changed git root
This commit is contained in:
@@ -1,37 +0,0 @@
|
||||
module.exports = {
|
||||
setup: function () { StructureSpawn.prototype = _Spawn.prototype; }
|
||||
}
|
||||
|
||||
|
||||
class _Spawn extends StructureSpawn {
|
||||
init() {
|
||||
}
|
||||
|
||||
requireNewCreep(role) {
|
||||
const roleCount = this.room.find(FIND_MY_CREEPS, {
|
||||
filter: (c) => { return c.memory.role == role; }
|
||||
}).length;
|
||||
|
||||
switch (role) {
|
||||
case ROLE_HARVESTER:
|
||||
return roleCount < 10;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
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: { role: role }
|
||||
});
|
||||
if (response == OK) this.memory.creepCounter++;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user