Basic setup new system.

This commit is contained in:
Douwe Ravers
2023-08-24 01:48:31 +02:00
parent ae3812aa83
commit ccd0557339
12 changed files with 147 additions and 242 deletions

21
ClassSpawn.js Normal file
View File

@@ -0,0 +1,21 @@
module.exports = {
setup: function () { StructureSpawn.prototype = _Spawn.prototype; }
}
class _Spawn extends StructureSpawn {
createHarvester() {
var body = [WORK, CARRY, MOVE];
this.createCreep(body, "harvester", Role.HARVESTER);
}
createCreep(body, name, role) {
if (this.memory.creepCounter == undefined) this.memory.creepCounter = 0;
const response = this.spawnCreep(body, name + ": " + this.memory.creepCounter, {
memory: { job: { role: role } }
});
if (response == OK) this.memory.creepCounter++;
return response;
}
}