22 lines
551 B
JavaScript
22 lines
551 B
JavaScript
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;
|
|
}
|
|
}
|