From 3b4cd13dad798d20273cf61500219721558ddacb Mon Sep 17 00:00:00 2001 From: Tyrel Souza Date: Tue, 28 Jun 2016 21:52:40 -0400 Subject: [PATCH] make builder build, not transfer --- main.js | 6 +++--- role.builder.js | 14 +++++++------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/main.js b/main.js index 15bab9e..7d0e275 100644 --- a/main.js +++ b/main.js @@ -5,17 +5,17 @@ var roleBuilder = require('role.builder'); var creepRolePriority = ['harvester', 'builder', 'upgrader']; var creepsConfig = { harvester: { - bodyParts: [WORK, CARRY, MOVE], + bodyParts: [WORK, CARRY, MOVE, MOVE], minimumCreeps: 2, role: roleHarvester }, builder: { - bodyParts: [WORK, CARRY, MOVE], + bodyParts: [WORK, CARRY, MOVE, MOVE], minimumCreeps: 2, role: roleBuilder }, upgrader: { - bodyParts: [WORK, CARRY, MOVE], + bodyParts: [WORK, CARRY, MOVE, MOVE], minimumCreeps: 2, role: roleUpgrader } diff --git a/role.builder.js b/role.builder.js index b783e1e..077a096 100644 --- a/role.builder.js +++ b/role.builder.js @@ -10,16 +10,14 @@ var roleBuilder = { creep.memory.building = true; } if (creep.memory.building){ - console.log("\tis building"); + console.log("\t is building"); var targets = creep.room.find(FIND_CONSTRUCTION_SITES); - let transerErrorCode = creep.transfer(targets[0], RESOURCE_ENERGY); - if(transerErrorCode == ERR_NOT_IN_RANGE) { + var transferErrorCode = creep.build(targets[0]); + if(transferErrorCode == ERR_NOT_IN_RANGE) { + console.log("\t moving to", targets[0]); creep.moveTo(targets[0]); - } else if (transerErrorCode == ERR_INVALID_TARGET){ - console.log("\tError, invalid Target"); } - } else { console.log("\t","isFindingSources"); var sources = creep.room.find(FIND_SOURCES); @@ -27,6 +25,8 @@ var roleBuilder = { creep.moveTo(sources[0]); } } + + } -} +}; module.exports = roleBuilder;