Basic setup new system.
This commit is contained in:
21
ClassSpawn.js
Normal file
21
ClassSpawn.js
Normal 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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user