// modules.select(type, group ...)
//
// select all super thrusters that are in both the 'forward' and
// 'lowpoweronly' user-defined groups
//
// 'forward' and 'lowpoweronly' are vecs of modules that have
// been tagged in the ship editor as such
function sleep(h) {}
var lp_forwards = modules.select(modules.types.SuperThruster, "forward", "lowpoweronly");
var sensors = modules.select(modules.types.ShipProximitySensor);
loop {
// yes, i think we need 'loop' - while True
// may confuse beginners
sleep(1); // 1 second
// if something is less than 15u away,
if (sensors.read() < 15) {
lp_forwards.activate();
} else {
lp_forwards.off(); // alias of Module.deactivate
}
}