It runs off of keybinds. For example, the distance sensor will see an enemy, and as a response, press an assigned key, e.g. "F". Then you set a gun to the F keybind, and when an enemy gets in front of it, it fires.
This is the Mothership I: it holds a drone bay full of these little guys. Once undocked, they spin in a circle with their laser beams, and their missile turrets annihilate everything. The lasers are good for keeping enemies at a distance, as well as drilling to the core in quick time.
This was my first successful droneboat build, so I'm a little proud of it