Added support for STRUCTURE_STORAGE

This commit is contained in:
paradizelost 2016-09-15 01:56:03 -05:00
parent d482d39d16
commit e8e8d8a138
6 changed files with 6 additions and 6 deletions

View File

@ -51,7 +51,7 @@ var roleBuilder = {
else { else {
var containers = creep.room.find(FIND_STRUCTURES, { var containers = creep.room.find(FIND_STRUCTURES, {
filter: (structure) => { filter: (structure) => {
return (structure.structureType == STRUCTURE_CONTAINER && structure.store[RESOURCE_ENERGY] > 0) ; return ((structure.structureType == STRUCTURE_CONTAINER|| structure.structureType == STRUCTURE_STORAGE) && structure.store[RESOURCE_ENERGY] > 0) ;
}}); }});
var allcontainers = creep.room.find(FIND_STRUCTURES, { var allcontainers = creep.room.find(FIND_STRUCTURES, {
filter: (structure) => { filter: (structure) => {

View File

@ -23,7 +23,7 @@ var roleHauler = {
}); });
var containertargets = creep.room.find(FIND_STRUCTURES, { var containertargets = creep.room.find(FIND_STRUCTURES, {
filter: (structure) => { filter: (structure) => {
return (structure.structureType == STRUCTURE_CONTAINER && structure.store[RESOURCE_ENERGY] < structure.storeCapacity) ; return ((structure.structureType == STRUCTURE_CONTAINER || structure.structureType == STRUCTURE_STORAGE) && _.sum(structure.store) < structure.storeCapacity) ;
} }
}); });

View File

@ -15,7 +15,7 @@
if(creep.carryCapacity > creep.carry.energy){ if(creep.carryCapacity > creep.carry.energy){
var container = creep.pos.findClosestByRange(FIND_STRUCTURES, { var container = creep.pos.findClosestByRange(FIND_STRUCTURES, {
filter: (structure) => { filter: (structure) => {
return (structure.structureType == STRUCTURE_CONTAINER && structure.store[RESOURCE_ENERGY] > 0) ; return ((structure.structureType == STRUCTURE_CONTAINER|| structure.structureType == STRUCTURE_STORAGE) && structure.store[RESOURCE_ENERGY] > 0) ;
}}); }});
if(creep.withdraw(container,RESOURCE_ENERGY) == ERR_NOT_IN_RANGE) { if(creep.withdraw(container,RESOURCE_ENERGY) == ERR_NOT_IN_RANGE) {
creep.say("MTSC"); creep.say("MTSC");

View File

@ -14,7 +14,7 @@ var roleRepairbot = {
if(creep.memory.repairing==false){ if(creep.memory.repairing==false){
var container = creep.pos.findClosestByRange(FIND_STRUCTURES, { var container = creep.pos.findClosestByRange(FIND_STRUCTURES, {
filter: (structure) => { filter: (structure) => {
return (structure.structureType == STRUCTURE_CONTAINER && structure.store[RESOURCE_ENERGY] > 0) ; return ((structure.structureType == STRUCTURE_CONTAINER|| structure.structureType == STRUCTURE_STORAGE) && structure.store[RESOURCE_ENERGY] > 0) ;
}}); }});
if(creep.withdraw(container,RESOURCE_ENERGY) == ERR_NOT_IN_RANGE) { if(creep.withdraw(container,RESOURCE_ENERGY) == ERR_NOT_IN_RANGE) {
creep.say("MTSC"); creep.say("MTSC");

View File

@ -5,7 +5,7 @@
if(creep.carryCapacity > creep.carry.energy){ if(creep.carryCapacity > creep.carry.energy){
var container = creep.pos.findClosestByRange(FIND_STRUCTURES, { var container = creep.pos.findClosestByRange(FIND_STRUCTURES, {
filter: (structure) => { filter: (structure) => {
return (structure.structureType == STRUCTURE_CONTAINER && structure.store[RESOURCE_ENERGY] > 1000) ; return ((structure.structureType == STRUCTURE_CONTAINER|| structure.structureType == STRUCTURE_STORAGE) && structure.store[RESOURCE_ENERGY] > 1000) ;
}}); }});
if(creep.withdraw(container,RESOURCE_ENERGY) == ERR_NOT_IN_RANGE) { if(creep.withdraw(container,RESOURCE_ENERGY) == ERR_NOT_IN_RANGE) {
creep.say("MTSC"); creep.say("MTSC");

View File

@ -34,7 +34,7 @@ var roleUpgrader = {
else { else {
var containers = creep.room.find(FIND_STRUCTURES, { var containers = creep.room.find(FIND_STRUCTURES, {
filter: (structure) => { filter: (structure) => {
return (structure.structureType == STRUCTURE_CONTAINER && structure.store[RESOURCE_ENERGY] > 0) ; return ((structure.structureType == STRUCTURE_CONTAINER|| structure.structureType == STRUCTURE_STORAGE) && structure.store[RESOURCE_ENERGY] > 0) ;
}}); }});
var allcontainers = creep.room.find(FIND_STRUCTURES, { var allcontainers = creep.room.find(FIND_STRUCTURES, {
filter: (structure) => { filter: (structure) => {