// locates a WingedShooter with less than 'full' (0.9) // energy and resupplies it with a cell that's at least at // 'minevel' (0.8). // precond: hands empty or carrying power cell extern void object::ReloadWingedShooter() { // level at which we decide to reload power cells float minLevel = 0.8; // full is defined in pickNonFullWS, below point home = position; object ws = pickNonFullWS(); if (ws == null) { message("Nobody to resupply"); return; } if (load==null) grabPowerCell(); if (load.category!=PowerCell) { message("I cannot resupply the WS because I am carrrying something already"); // (and it's not a power cell) return; } if (load.energyLevel=full and null!=ws) { m=distance(position,ws.position)+0.1; ws = null; } else if (null!=ws) { message("picked a WS with energy ("+l+")"); } } while (l>=full and count<100); if (null==ws) { message("There is no WS under "+full+" around"); } return ws; }