module.exports = { setup: function () { StructureSpawn.prototype = _Spawn.prototype; } } class _Spawn extends StructureSpawn { begin(){ if (!this.memory.creepCounter) this.memory.creepCounter = 0; this.memory.init = true; } tick(){ if(!this.memory.init) this.begin(); if(this.room.memory.jobs.length){ const job = this.room.memory.jobs[0]; const body = [WORK, CARRY, MOVE]; const response = this.createCreep(body, "harvester", job); if(response == OK) this.room.memory.jobs.splice(0, 1); } } createHarvester() { this.createCreep(body, "harvester", Role.HARVESTER); } createCreep(body, name, job) { const response = this.spawnCreep(body, name + ": " + this.memory.creepCounter, { memory: { job: job } }); if (response == OK) this.memory.creepCounter++; return response; } }