From a2ea1a4d1f8050140a2d596c4c8c263939a34d0f Mon Sep 17 00:00:00 2001 From: Tyrel Souza Date: Tue, 28 Jun 2016 17:17:03 -0400 Subject: [PATCH] redo some naming --- main.js | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) 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