Permalink
Cannot retrieve contributors at this time
821 lines (755 sloc)
19 KB
| public object object::SafeGoto(point target) | |
| { | |
| errmode(0); | |
| int counter = 0; | |
| while(goto(target) != 0) { | |
| if(counter == 0) { | |
| message("Unable to goto()", DisplayWarning); | |
| } | |
| if(counter < 10) { | |
| move(-0.5); | |
| } | |
| counter++; | |
| } | |
| errmode(1); | |
| } | |
| public object object::GoTo(int cat) | |
| { | |
| object item = radar(cat); | |
| SafeGoto(item.position); | |
| return item; | |
| } | |
| public object object::SafeGrab(int cat) | |
| { | |
| errmode(0); | |
| do { | |
| if(grab() != 0) Get(cat); | |
| if(this.load.category != cat) { | |
| SafeDrop(); | |
| Get(cat); | |
| } | |
| } while(this.load == null); | |
| errmode(1); | |
| } | |
| public void object::SafeDrop() | |
| { | |
| errmode(0); | |
| if(drop() != 0) { | |
| do { | |
| SafeGoto(space()); | |
| } while(drop() != 0); | |
| } | |
| errmode(1); | |
| } | |
| public object object::SafeGrabCell() | |
| { | |
| /*do { | |
| grab(); | |
| if(this.load.category != PowerCell && this.load.category != NuclearCell) { | |
| drop(); | |
| } | |
| } while(this.load == null);*/ | |
| grab(); | |
| } | |
| public object object::Get(int cat) | |
| { | |
| object item = GoTo(cat); | |
| SafeGrab(cat); | |
| return item; | |
| } | |
| public object object::Deposit(int cat) | |
| { | |
| object item = GoTo(cat); | |
| drop(); | |
| return item; | |
| } | |
| public void object::MyGoto(point pos, float dist) | |
| { | |
| while(distance(this.position, pos) > dist) { | |
| turn(direction(pos)); | |
| jet(0); | |
| /*point checkPos; | |
| checkPos.x = this.position.x + cos(this.orientation); | |
| checkPos.y = this.position.y + sin(this.orientation);*/ | |
| point checkPos = this.position; | |
| if(this.position.z < topo(checkPos) + 30) jet(0.5); | |
| if(this.position.z > topo(checkPos) + 40) jet(-0.5); | |
| if(this.temperature > 0.75 && radar(AlienAnt, 0, 380, 0, 45) == null) { | |
| motor(0,0); | |
| jet(-1); | |
| while(this.temperature > 0) wait(0.01); | |
| jet(1); | |
| motor(1,1); | |
| } | |
| motor(1,1); | |
| if(distance(this.position, pos) < (Max(this.position.z, pos.z) - Min(this.position.z, pos.z)) * 1.5) jet(-1); | |
| wait(0.25); | |
| } | |
| motor(0,0); | |
| jet(-1); | |
| while(this.position.z > topo(this.position)) wait(0.01); | |
| SafeGoto(pos); | |
| } | |
| public object object::GetTitanium() | |
| { | |
| GetTitanium(true, true); | |
| } | |
| public object object::GetTitanium(bool getReady, bool getPrepared) | |
| { | |
| object item; | |
| if(getReady) { | |
| item = radar(Titanium); | |
| if(item != null) return item; | |
| if(!getPrepared) { | |
| Database db(); | |
| db.switchCamera(db.titaniumCollector); | |
| do { | |
| item = radar(Titanium); | |
| if(item == null) continue; | |
| object conv = search(Converter, item.position); | |
| if(distance(item.position, conv.position) < 5) item = null; | |
| } while(item == null); | |
| db.switchCamera(db.builder); | |
| return item; | |
| } | |
| } | |
| if(getPrepared) { | |
| if(radar(Converter) == null) { | |
| message("Unable to get Titanium!", DisplayError); | |
| return null; | |
| } | |
| item = radar(TitaniumOre); | |
| SafeGoto(item.position); | |
| SafeGrab(TitaniumOre); | |
| item = radar(Converter); | |
| SafeGoto(item.position); | |
| SafeDrop(); | |
| move(-2.5); | |
| while((item = radar(Titanium, 0, 90, 2, 5)) == null); | |
| return item; | |
| } | |
| return null; | |
| } | |
| public object object::GetCell(bool getReady, bool getPrepared) | |
| { | |
| object item; | |
| if(getReady) { | |
| item = radar(PowerCell); | |
| if(item != null) return item; | |
| if(!getPrepared) { | |
| do { | |
| wait(5); | |
| item = radar(PowerCell); | |
| } while(item == null); | |
| return item; | |
| } | |
| } | |
| if(getPrepared) { | |
| if(radar(PowerPlant) == null) { | |
| message("Unable to get PowerCell!", DisplayError); | |
| return null; | |
| } | |
| item = GetTitanium(true, false); | |
| SafeGoto(item.position); | |
| SafeGrab(Titanium); | |
| item = radar(PowerPlant); | |
| SafeGoto(item.position); | |
| drop(); | |
| while(item.energyCell == null || item.energyCell.category != PowerCell); | |
| return item; | |
| } | |
| return null; | |
| } | |
| public object object::Build(int cat) | |
| { | |
| return Build(cat, flatspace(GetHome(), 8)); | |
| } | |
| public object object::Build(int cat, point pos) | |
| { | |
| object item = GetTitanium(true, false); | |
| SafeGoto(item.position); | |
| SafeGrab(Titanium); | |
| SafeGoto(pos); | |
| drop(); | |
| build(cat); | |
| item = radar(cat); | |
| BatteryCheck(); | |
| return item; | |
| } | |
| public object object::Factory(object obj, int cat, string prog, bool nuclear) | |
| { | |
| object item = GetTitanium(true, false); | |
| SafeGoto(item.position); | |
| SafeGrab(Titanium); | |
| turn(direction(obj.position)); //I Hate Goto Bugs! | |
| move(distance(this.position, obj.position)/2); //I Really Hate Goto Bugs! | |
| SafeGoto(obj.position); | |
| drop(); | |
| move(-5); | |
| point waitpoint = this.position; | |
| obj.factory(cat, progfunc(prog)); | |
| if(!nuclear) { | |
| item = GetCell(true, true); | |
| SafeGoto(item.position); | |
| grab(); | |
| if(this.load.energyLevel < 1 && radar(PowerStation) != null) { | |
| item = radar(PowerStation); | |
| SafeGoto(item.position); | |
| while(this.load.energyLevel < 1); | |
| } | |
| } else { | |
| if(radar(NuclearCell) == null) { | |
| Database db(); | |
| db.switchCamera(db.uraniumCollector); | |
| while((item = radar(NuclearCell)) == null) wait(1); | |
| db.switchCamera(db.builder); | |
| } | |
| SafeGoto(item.position); | |
| SafeGrab(NuclearCell); | |
| } | |
| SafeGoto(waitpoint); | |
| turn(direction(obj.position)); | |
| while((item = radar(cat, 0, 90, 3, 10)) == null); | |
| wait(1); | |
| Deposit(cat); | |
| move(-10); | |
| wait(2); | |
| BatteryCheck(); | |
| return item; | |
| } | |
| public point object::flatspace(point nearThis, float rmin) | |
| { | |
| point pos; | |
| float r = 1; | |
| float a = 1; | |
| do { | |
| if(++a == 360) { | |
| a = 0; | |
| r ++; | |
| } | |
| pos.x = nearThis.x + cos(a) * r; | |
| pos.y = nearThis.y + sin(a) * r; | |
| pos = space(pos, rmin, 50, rmin); | |
| } while(flatground(pos, rmin) < rmin); | |
| return pos; | |
| } | |
| public bool object::BatteryCheck() | |
| { | |
| if(this.energyCell != null) { | |
| if(this.energyCell.energyLevel <= 0.3) { | |
| bool result = Recharge(); | |
| if(!result) { | |
| while(this.energyCell == null || this.energyCell.energyLevel <= 0.3) wait(1); | |
| } | |
| return true; | |
| } | |
| } | |
| return false; | |
| } | |
| public object object::GetBattery() | |
| { | |
| object maxEnergyCell = null; | |
| object usedBatteries[]; | |
| float maxEnergy = -1; | |
| int j=0; | |
| for(int i=0;i<500;i++) { | |
| object item = retobject(i); | |
| if(item != null) { | |
| if(item.energyCell != null) { | |
| usedBatteries[j] = item.energyCell; | |
| j++; | |
| } | |
| if(item.load != null) { | |
| if(item.load.category == PowerCell || | |
| item.load.category == NuclearCell) { | |
| usedBatteries[j] = item.load; | |
| j++; | |
| } | |
| } | |
| } | |
| } | |
| for(int i=0;i<500;i++) { | |
| object item = retobject(i); | |
| if(item != null) { | |
| bool used = false; | |
| for(int j=0;j<sizeof(usedBatteries);j++) { | |
| if(item == usedBatteries[j]) { | |
| used = true; | |
| break; | |
| } | |
| } | |
| if(used) continue; | |
| if(item.category == NuclearCell && item.energyLevel*100>maxEnergy) { | |
| maxEnergy = item.energyLevel*100; | |
| maxEnergyCell = item; | |
| } | |
| if(item.category == PowerCell && item.energyLevel>maxEnergy) { | |
| maxEnergy = item.energyLevel; | |
| maxEnergyCell = item; | |
| } | |
| } | |
| } | |
| return maxEnergyCell; | |
| } | |
| public bool object::Recharge() | |
| { | |
| if(this.energyCell.category == PowerCell) { | |
| if(radar(PowerStation) != null) { | |
| object item = radar(PowerStation); | |
| SafeGoto(item.position); | |
| while(this.energyCell.energyLevel < 1) wait(0.01); | |
| return true; | |
| } | |
| if(radar(PowerCaptor) != null) { | |
| object item = radar(PowerCaptor); | |
| SafeGoto(item.position); | |
| while(this.energyCell.energyLevel < 1) wait(0.01); | |
| return true; | |
| } | |
| } | |
| if(!(this.category == WheeledGrabber || | |
| this.category == TrackedGrabber || | |
| this.category == WingedGrabber || | |
| this.category == LeggedGrabber || | |
| this.category == Subber)) { | |
| message("Unable to recharge", DisplayError); | |
| return false; | |
| } | |
| if(this.category != Subber) { | |
| object battery = GetBattery(); | |
| if(battery != null && battery.energyLevel > this.energyCell.energyLevel && ((battery.category == PowerCell && battery.energyLevel > 0.3) || (battery.category == NuclearCell && battery.energyLevel > 0.05))) { | |
| SafeGoto(battery.position); | |
| SafeGrabCell(); | |
| drop(Behind); | |
| grab(EnergyCell); | |
| drop(InFront); | |
| grab(Behind); | |
| drop(EnergyCell); | |
| return true; | |
| } | |
| if(radar(NuclearPlant) != null) { | |
| object plant = radar(NuclearPlant); | |
| if(plant.energyCell != null) { | |
| if(plant.energyCell.category == NuclearCell) { | |
| SafeGoto(plant.position); | |
| grab(); | |
| drop(Behind); | |
| grab(EnergyCell); | |
| drop(InFront); | |
| grab(Behind); | |
| drop(EnergyCell); | |
| grab(InFront); | |
| SafeGoto(space()); | |
| drop(InFront); | |
| return true; | |
| } else if(plant.energyCell.category == UraniumOre) { | |
| SafeGoto(plant.position); | |
| move(-3); | |
| while(plant.energyCell.category != NuclearCell) wait(0.01); | |
| move(3); | |
| grab(InFront); | |
| drop(Behind); | |
| grab(EnergyCell); | |
| drop(InFront); | |
| grab(Behind); | |
| drop(EnergyCell); | |
| grab(InFront); | |
| SafeGoto(space()); | |
| drop(InFront); | |
| return true; | |
| } else { | |
| if(radar(UraniumOre) != null) { | |
| SafeGoto(plant.position); | |
| grab(InFront); | |
| SafeGoto(space()); | |
| drop(InFront); | |
| } | |
| } | |
| } | |
| if(radar(UraniumOre) != null) { | |
| object item = radar(UraniumOre); | |
| SafeGoto(item.position); | |
| SafeGrab(UraniumOre); | |
| SafeGoto(plant.position); | |
| drop(InFront); | |
| move(-3); | |
| while(plant.energyCell.category != NuclearCell) wait(0.01); | |
| move(3); | |
| grab(InFront); | |
| drop(Behind); | |
| grab(EnergyCell); | |
| drop(InFront); | |
| grab(Behind); | |
| drop(EnergyCell); | |
| grab(InFront); | |
| SafeGoto(space()); | |
| drop(InFront); | |
| return true; | |
| } | |
| } | |
| if(radar(PowerPlant) != null) { | |
| object plant = radar(PowerPlant); | |
| if(plant.energyCell != null) { | |
| if(plant.energyCell.category == PowerCell) { | |
| SafeGoto(plant.position); | |
| grab(InFront); | |
| drop(Behind); | |
| grab(EnergyCell); | |
| drop(InFront); | |
| grab(Behind); | |
| drop(EnergyCell); | |
| grab(InFront); | |
| SafeGoto(space()); | |
| drop(InFront); | |
| return true; | |
| } else if(plant.energyCell.category == Titanium) { | |
| SafeGoto(plant.position); | |
| while(plant.energyCell.category != PowerCell) wait(0.01); | |
| grab(InFront); | |
| drop(Behind); | |
| grab(EnergyCell); | |
| drop(InFront); | |
| grab(Behind); | |
| drop(EnergyCell); | |
| grab(InFront); | |
| SafeGoto(space()); | |
| drop(InFront); | |
| return true; | |
| } else { | |
| if(radar(Titanium) != null) { | |
| SafeGoto(plant.position); | |
| grab(); | |
| SafeGoto(space()); | |
| drop(InFront); | |
| } | |
| } | |
| } | |
| if(radar(Titanium) != null) { | |
| object item = radar(Titanium); | |
| SafeGoto(item.position); | |
| SafeGrab(Titanium); | |
| SafeGoto(plant.position); | |
| drop(InFront); | |
| while(plant.energyCell.category != PowerCell) wait(0.01); | |
| grab(InFront); | |
| drop(Behind); | |
| grab(EnergyCell); | |
| drop(InFront); | |
| grab(Behind); | |
| drop(EnergyCell); | |
| grab(InFront); | |
| SafeGoto(space()); | |
| drop(InFront); | |
| return true; | |
| } | |
| } | |
| } | |
| message("Unable to charge", DisplayError); | |
| return false; | |
| } | |
| public bool object::Service() | |
| { | |
| object item = radar(RepairCenter); | |
| if(item == null) return false; | |
| SafeGoto(item.position); | |
| while(this.shieldLevel < 1) wait(0.01); | |
| return true; | |
| } | |
| public bool object::ServiceCheck() | |
| { | |
| if(this.shieldLevel < 0.25) return Service(); | |
| return false; | |
| } | |
| public float object::CalculateAim(point target) | |
| { | |
| float H = target.z - this.position.z; | |
| float L = distance2d(target, this.position); | |
| return atan(H/L); | |
| } | |
| public bool object::AimAt(point target) | |
| { | |
| float alfa = CalculateAim(target); | |
| float minAngle = -10; | |
| float maxAngle = 20; | |
| if(this.category == PhazerShooter) { | |
| minAngle = -20; | |
| maxAngle = 45; | |
| } | |
| if(alfa > minAngle && alfa < maxAngle) { | |
| aim(alfa); | |
| return true; | |
| } | |
| return false; | |
| } | |
| public bool object::FireAt(point target) | |
| { | |
| if(AimAt(target)) { | |
| fire(0.2); | |
| return true; | |
| } | |
| return false; | |
| } | |
| public float Min(float a, float b) | |
| { | |
| if(b < a) return b; | |
| return a; | |
| } | |
| public float Max(float a, float b) | |
| { | |
| if(b > a) return b; | |
| return a; | |
| } | |
| public point object::GetHome() | |
| { | |
| object item = radar(SpaceShip); | |
| return item.position; | |
| } | |
| public void object::NewBot() | |
| { | |
| while(this.energyCell == null); | |
| wait(3); | |
| message(this.category+" started!"); | |
| } | |
| public class Database { | |
| //Buildings | |
| public static object botFactory = null; | |
| public static object converter = null; | |
| public static object radarStation = null; | |
| public static object repairCenter = null; | |
| public static object powerStation = null; | |
| public static object powerPlant = null; | |
| public static object nuclearPlant = null; | |
| //Robots | |
| public static object builder = null; | |
| public static object titaniumCollector = null; | |
| public static object sniffer = null; | |
| public static object killers[]; | |
| public static object uraniumCollector = null; | |
| public static object thumper = null; | |
| public static object shielder = null; | |
| //Camera | |
| public static object focusedObject = null; | |
| public void switchCamera(object item) | |
| { | |
| UraniumAntKillerCommunication uranant_comm(); | |
| if(!uranant_comm.started || uranant_comm.back) { | |
| camerafocus(item); | |
| } | |
| focusedObject = item; | |
| } | |
| } | |
| extern void object::BuildSuperBase() | |
| { | |
| setresearchenable(-1); | |
| setresearchdone(-1); | |
| setbuild(-1); | |
| while(ismovie() != 0) wait(1); | |
| Database db(); | |
| db.builder = this; | |
| db.focusedObject = this; | |
| playmusic("Hv2.ogg", 1); | |
| db.botFactory = Build(BotFactory); | |
| db.converter = Build(Converter); | |
| db.titaniumCollector = Factory(db.botFactory, LeggedGrabber, "TitaniumCollector", false); | |
| db.sniffer = Factory(db.botFactory, LeggedSniffer, "SnifferProgram", false); | |
| SnifferCommunication sniff_comm(); | |
| sniff_comm.searchHere = GetHome(); | |
| sniff_comm.requiredSpace = 8; | |
| sniff_comm.requiredDistance = 40; | |
| sniff_comm.searchFor = PowerSpot; | |
| db.radarStation = Build(RadarStation); | |
| db.repairCenter = Build(RepairCenter); | |
| camerafocus(db.sniffer); | |
| while(sniff_comm.searchFor != 0) wait(1); | |
| camerafocus(this); | |
| point energySpot = sniff_comm.foundPos; | |
| db.powerStation = Build(PowerStation, energySpot); | |
| camerafocus(db.sniffer); | |
| sniff_comm.searchHere = energySpot; | |
| sniff_comm.requiredSpace = 5; | |
| sniff_comm.requiredDistance = 13; | |
| sniff_comm.searchFor = PowerSpot; | |
| while(sniff_comm.searchFor != 0) wait(1); | |
| camerafocus(this); | |
| db.powerPlant = Build(PowerPlant, sniff_comm.foundPos); | |
| db.killers[0] = Factory(db.botFactory, WingedOrgaShooter, "KillUraniumAnts", false); | |
| playmusic("Constructive.ogg", 0); | |
| camerafocus(db.killers[0]); | |
| db.nuclearPlant = Build(NuclearPlant); | |
| db.uraniumCollector = Factory(db.botFactory, WingedGrabber, "UraniumCollector", false); | |
| UraniumAntKillerCommunication uranant_comm(); | |
| while(!uranant_comm.done) wait(1); | |
| while(!uranant_comm.back) wait(1); | |
| camerafocus(this); | |
| playmusic("Hv2.ogg", 1); | |
| object item; | |
| do { | |
| item = radar(NuclearCell); | |
| } while(item == null); | |
| SafeGoto(item.position); | |
| SafeGrab(NuclearCell); | |
| SafeGoto(db.killers[0].position); | |
| drop(); | |
| db.thumper = Factory(db.botFactory, Thumper, "MoveAway", true); | |
| db.shielder = Factory(db.botFactory, Shielder, "MoveAway", true); | |
| for(int i=1; i<3; i++) db.killers[i] = Factory(db.botFactory, WingedOrgaShooter, "MoveAway", true); | |
| playmusic("Humanitarian.ogg", 1); | |
| while(true) wait(1); // blink the lights :) | |
| } | |
| public void object::MoveAway() | |
| { | |
| NewBot(); | |
| SafeGoto(space()); | |
| } | |
| public void object::TitaniumCollector() | |
| { | |
| NewBot(); | |
| while(radar(TitaniumOre) != null) { | |
| object item = GetTitanium(false, true); | |
| SafeGoto(item.position); | |
| SafeGrab(Titanium); | |
| SafeGoto(space(GetHome(), 4, 50, 4)); | |
| SafeDrop(); | |
| ServiceCheck(); | |
| BatteryCheck(); | |
| } | |
| } | |
| public class SnifferCommunication | |
| { | |
| public static int searchFor = 0; | |
| public static point searchHere; | |
| public static float requiredSpace; | |
| public static float requiredDistance; | |
| public static point foundPos; | |
| public static point[] usedMarkers; | |
| public static int usedMarkersCount = 0; | |
| } | |
| public void object::SnifferProgram() | |
| { | |
| MoveAway(); | |
| SnifferCommunication comm(); | |
| while(true) { | |
| while(comm.searchFor == 0) wait(1); | |
| point home = comm.searchHere; | |
| float dr = comm.requiredSpace; | |
| float minDist = comm.requiredDistance; | |
| float r = minDist; | |
| float a = 1; | |
| object spot; | |
| point lastPos, pos; | |
| while(r<60) { | |
| if(++a == 360) { | |
| a = 0; | |
| r += dr; | |
| } | |
| pos.x = home.x + cos(a) * r; | |
| pos.y = home.y + sin(a) * r; | |
| //TODO: After some time shows only shadows, after some more crashes the game | |
| //produce(pos, 0, WayPoint); | |
| if(flatground(pos, dr) < dr) continue; | |
| if(distance(lastPos, pos) < dr) continue; | |
| if(distance(pos, home) < minDist) continue; | |
| bool doSniff = true; | |
| for(int i=0; i<comm.usedMarkersCount; i++) { | |
| if(distance(pos, comm.usedMarkers[i]) < minDist) { | |
| doSniff = false; | |
| break; | |
| } | |
| } | |
| if(!doSniff) continue; | |
| lastPos = pos; | |
| errmode(0); | |
| if(goto(pos) == 0) sniff(); | |
| errmode(1); | |
| spot = radar(comm.searchFor); | |
| if(spot != null) { | |
| bool found = true; | |
| for(int i=0; i<comm.usedMarkersCount; i++) { | |
| if(comm.usedMarkers[i] == spot.position) { | |
| found = false; | |
| break; | |
| } | |
| } | |
| if(found) break; | |
| } | |
| BatteryCheck(); | |
| } | |
| if(spot == null) { | |
| comm.foundPos.x = 0; | |
| comm.foundPos.y = 0; | |
| comm.foundPos.z = 0; | |
| } else { | |
| comm.foundPos = spot.position; | |
| comm.usedMarkers[comm.usedMarkersCount++] = spot.position; | |
| } | |
| comm.searchFor = 0; | |
| SafeGoto(space(GetHome())); | |
| BatteryCheck(); | |
| } | |
| } | |
| public object object::FindAntNear(object pos, float maxDist) | |
| { | |
| object item = search(AlienAnt, pos.position); | |
| if(distance(pos.position, item.position) > maxDist) return null; | |
| return item; | |
| } | |
| public class UraniumAntKillerCommunication | |
| { | |
| public static bool started = false; | |
| public static bool done = false; | |
| public static bool back = false; | |
| } | |
| public void object::KillUraniumAnts() | |
| { | |
| NewBot(); | |
| aim(0); | |
| move(-5); | |
| UraniumAntKillerCommunication comm(); | |
| comm.started = true; | |
| object item; | |
| while((item = FindAntNear(radar(UraniumOre), 75)) != null) { | |
| turn(direction(item.position)); | |
| jet(0); | |
| if(this.position.z < topo(this.position) + 30) jet(0.5); | |
| if(this.position.z > topo(this.position) + 40) jet(-0.5); | |
| motor(1,1); | |
| if(distance(this.position, item.position) < 100) jet(-1); | |
| if(distance(this.position, item.position) < 40) { | |
| FireAt(item.position); | |
| } | |
| ServiceCheck(); | |
| BatteryCheck(); | |
| wait(0.1); | |
| } | |
| comm.done = true; | |
| MyGoto(space(GetHome()), 5); | |
| comm.back = true; | |
| Database db(); | |
| db.switchCamera(db.focusedObject); | |
| while(this.energyCell == null || this.energyCell.category != NuclearCell) wait(1); | |
| Service(); | |
| while(true) wait(1); //TODO: Idz razem z innymi shooterami | |
| } | |
| public void object::UraniumCollector() | |
| { | |
| MoveAway(); | |
| UraniumAntKillerCommunication uranant_comm(); | |
| while(!uranant_comm.done) wait(1); | |
| while(radar(UraniumOre) != null) { | |
| object item = radar(UraniumOre); | |
| MyGoto(item.position, 5); | |
| SafeGrab(UraniumOre); | |
| item = radar(NuclearPlant); | |
| MyGoto(item.position, 12); | |
| drop(); | |
| move(-5); | |
| while(item.energyCell.category != NuclearCell) wait(1); | |
| SafeGoto(item.position); | |
| grab(); | |
| SafeGoto(space(GetHome(), 4, 50, 4)); | |
| SafeDrop(); | |
| Service(); | |
| if(this.energyCell.category == PowerCell) Recharge(); | |
| else BatteryCheck(); | |
| } | |
| } |