extern void object::ServiceTower1() { object tower; // info. about tower object station; // info. about station // 1) goes toward the defense tower tower = radar(DefenseTower); // looks for tower goto(tower.position); // goes there while ( true ) // always repeats: { // 2) waits until power cell is empty while ( tower.energyCell.energyLevel > 0.2 ) { wait(2); } grab(); // grabs the power cell // 3) goes toward power station to recharge station = radar(PowerStation); goto(station.position); // goes there while ( load.energyLevel < 1 ) { wait(1); // waits until recharged } // 4) goes back to defense tower goto(tower.position); // goes toward tower drop(); // drops the power cell } }