mirror of
https://github.com/paradizelost/screeps.git
synced 2024-11-25 02:14:44 -06:00
Added support for STRUCTURE_STORAGE
This commit is contained in:
parent
d482d39d16
commit
e8e8d8a138
@ -51,7 +51,7 @@ var roleBuilder = {
|
||||
else {
|
||||
var containers = creep.room.find(FIND_STRUCTURES, {
|
||||
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, {
|
||||
filter: (structure) => {
|
||||
|
@ -23,7 +23,7 @@ var roleHauler = {
|
||||
});
|
||||
var containertargets = creep.room.find(FIND_STRUCTURES, {
|
||||
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) ;
|
||||
}
|
||||
|
||||
});
|
||||
|
@ -15,7 +15,7 @@
|
||||
if(creep.carryCapacity > creep.carry.energy){
|
||||
var container = creep.pos.findClosestByRange(FIND_STRUCTURES, {
|
||||
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) {
|
||||
creep.say("MTSC");
|
||||
|
@ -14,7 +14,7 @@ var roleRepairbot = {
|
||||
if(creep.memory.repairing==false){
|
||||
var container = creep.pos.findClosestByRange(FIND_STRUCTURES, {
|
||||
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) {
|
||||
creep.say("MTSC");
|
||||
|
@ -5,7 +5,7 @@
|
||||
if(creep.carryCapacity > creep.carry.energy){
|
||||
var container = creep.pos.findClosestByRange(FIND_STRUCTURES, {
|
||||
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) {
|
||||
creep.say("MTSC");
|
||||
|
@ -34,7 +34,7 @@ var roleUpgrader = {
|
||||
else {
|
||||
var containers = creep.room.find(FIND_STRUCTURES, {
|
||||
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, {
|
||||
filter: (structure) => {
|
||||
|
Loading…
Reference in New Issue
Block a user