diff --git a/main.js b/main.js index 7c6d0c1..4196b1c 100644 --- a/main.js +++ b/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); } } \ No newline at end of file