First working version of new system.

This commit is contained in:
DouweRavers
2022-04-30 14:23:44 +02:00
parent 3e962ed04a
commit 744b4a2478
9 changed files with 241 additions and 10 deletions

25
_creeps.js Normal file
View File

@@ -0,0 +1,25 @@
module.exports = {
// Gets called when recompiling and when Restart command is called.
start: function () {
for (const creep_name in Game.creeps) {
const creep = Game.creeps[creep_name];
creep.init();
}
},
// Gets called every tick.
update: function () {
for (const creep_name in Memory.creeps) {
const creep = Game.creeps[creep_name];
if (creep == undefined) delete Memory.creeps[creep_name];
switch (creep.memory.role) {
case ROLE_HARVESTER:
if (creep.memory.recharge) creep.harvestSource();
else creep.harvesterJobs();
break;
default:
break;
}
}
}
}