redo some naming
This commit is contained in:
parent
9882dc75e1
commit
a2ea1a4d1f
15
main.js
15
main.js
@ -6,19 +6,20 @@ var creepsConfig = {
|
||||
harvester: {
|
||||
bodyParts: [WORK, CARRY, MOVE],
|
||||
minimumCreeps: 4,
|
||||
run: roleHarvester.run
|
||||
role: roleHarvester
|
||||
},
|
||||
builder:{
|
||||
builder: {
|
||||
bodyParts: [WORK, CARRY, MOVE],
|
||||
minimumCreeps: 2,
|
||||
run: roleBuilder.run
|
||||
role: roleBuilder
|
||||
},
|
||||
upgrader: {
|
||||
bodyParts: [WORK, CARRY, MOVE],
|
||||
minimumCreeps: 2,
|
||||
run: roleUpgrader.run
|
||||
role: roleUpgrader
|
||||
}
|
||||
}
|
||||
|
||||
module.exports.loop = function(){
|
||||
// Cleanup Creeps
|
||||
for (var name in Memory.creeps){
|
||||
@ -32,7 +33,9 @@ module.exports.loop = function(){
|
||||
for (var roleName in creepsConfig){
|
||||
var creepsOfKind = _.filter(Game.creeps, (creep) => creep.memory.role == roleName);
|
||||
if (creepsOfKind.length < creepsConfig[roleName].minimumCreeps){
|
||||
var newName = Game.spawns.Spawn1.createCreep(creepsConfig[roleName].bodyParts, undefined, {role: roleName});
|
||||
var newName = Game.spawns.Spawn1.createCreep(creepsConfig[roleName].bodyParts,
|
||||
undefined,
|
||||
{role: roleName});
|
||||
console.log("Spawning new ", roleName, ": ", newName);
|
||||
}
|
||||
};
|
||||
@ -41,6 +44,6 @@ module.exports.loop = function(){
|
||||
for (var name in Game.creeps){
|
||||
var creep = Game.creeps[name];
|
||||
var role = creep.memory.role;
|
||||
creepsConfig[role].run(creep);
|
||||
creepsConfig[role].role.run(creep);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user