This commit is contained in:
dan 2020-11-17 11:47:15 -06:00
parent e1130cfe10
commit c03125c5c0
4 changed files with 7 additions and 14 deletions

View File

@ -44,15 +44,10 @@ let Phase1 = {
require('proc.spawning').spawnmover(room) require('proc.spawning').spawnmover(room)
} }
if((Game.rooms[room].find(FIND_MY_STRUCTURES, {filter: {structureType: STRUCTURE_EXTRACTOR}}).length > 0)&&(creepcounts["miner"] < 1 || creepcounts["miner"]==undefined)&&(Game.rooms[room].energyAvailable >= Game.rooms[room].energyCapacityAvailable)){ if((Game.rooms[room].find(FIND_MY_STRUCTURES, {filter: {structureType: STRUCTURE_EXTRACTOR}}).length > 0)&&(creepcounts["miner"] < 1 || creepcounts["miner"]==undefined)&&(Game.rooms[room].energyAvailable >= Game.rooms[room].energyCapacityAvailable)){
<<<<<<< HEAD
if(Game.rooms[room].find(FIND_MINERALS)[0].ticksToRegeneration < 1000){ if(Game.rooms[room].find(FIND_MINERALS)[0].ticksToRegeneration < 1000){
console.log("Spawning Miner in " + room) console.log("Spawning Miner in " + room)
require('proc.spawning').spawnminer(room) require('proc.spawning').spawnminer(room)
} else { if(Game.flags.debug && Game.flags.debug.room == Game.rooms[room]){console.log("Not spawning miner in " + room + ", waiting for regen")}} } else { if(Game.flags.debug && Game.flags.debug.room == Game.rooms[room]){console.log("Not spawning miner in " + room + ", waiting for regen")}}
=======
console.log("Spawning Miner in " + room)
require('proc.spawning').spawnminer(room)
>>>>>>> 1ff4251f0330951b8788d86218fc0b5a1906d5f4
} }
//require('proc.market').sellEnergy(room) //require('proc.market').sellEnergy(room)
} }

View File

@ -68,15 +68,17 @@ module.exports.loop = function () {
console.log(e) console.log(e)
} }
} }
//console.log('done running creeps')
} }
let flags = Game.flags let flags = Game.flags
for(let flag in flags){ for(let flag in flags){
//console.log('running flags')
require('flag.' + flag ).run() require('flag.' + flag ).run()
} }
for(let name in Memory.rooms) { for(let name in Memory.rooms) {
// console.log('cleaning up old rooms')
let myroom = Game.rooms[name] let myroom = Game.rooms[name]
if(!Game.rooms[name]){delete Memory.rooms[name]} if(!Game.rooms[name]){delete Memory.rooms[name]}
} }
console.log("----End loop for "+ Game.time +'----') console.log("----End loop for "+ Game.time +'----')
} }

View File

@ -16,7 +16,6 @@ let roleMiner = {
if(creep.harvest(mysource) == ERR_NOT_IN_RANGE) { if(creep.harvest(mysource) == ERR_NOT_IN_RANGE) {
creep.travelTo(mysource); creep.travelTo(mysource);
} }
<<<<<<< HEAD
} else if ((creep.ticksToLive < 300 || creep.ticksToLive <= creep.memory.renewto) && (Game.rooms[creep.room.name].find(FIND_MY_SPAWNS, {filter: (r) =>{return ( r.store[RESOURCE_ENERGY]>1)}})) ) { } else if ((creep.ticksToLive < 300 || creep.ticksToLive <= creep.memory.renewto) && (Game.rooms[creep.room.name].find(FIND_MY_SPAWNS, {filter: (r) =>{return ( r.store[RESOURCE_ENERGY]>1)}})) ) {
if(creep.memory.renewto == undefined){ if(creep.memory.renewto == undefined){
creep.memory.renewto = 1200 creep.memory.renewto = 1200
@ -33,9 +32,6 @@ let roleMiner = {
creep.moveTo(spawn); creep.moveTo(spawn);
} }
} else { } else {
=======
} else {
>>>>>>> 1ff4251f0330951b8788d86218fc0b5a1906d5f4
let storagetargets = creep.pos.findClosestByRange(FIND_STRUCTURES, {filter: (s) => {return ((s.structureType == STRUCTURE_STORAGE || s.structureType == STRUCTURE_CONTAINER || s.structureType == STRUCTURE_TERMINAL || s.structureType == STRUCTURE_FACTORY ) && _.sum(s.store) < s.storeCapacity) ;}}); let storagetargets = creep.pos.findClosestByRange(FIND_STRUCTURES, {filter: (s) => {return ((s.structureType == STRUCTURE_STORAGE || s.structureType == STRUCTURE_CONTAINER || s.structureType == STRUCTURE_TERMINAL || s.structureType == STRUCTURE_FACTORY ) && _.sum(s.store) < s.storeCapacity) ;}});
if(storagetargets){ if(storagetargets){
if(this.transferAll(creep,storagetargets) == ERR_NOT_IN_RANGE) { if(this.transferAll(creep,storagetargets) == ERR_NOT_IN_RANGE) {

View File

@ -1,8 +1,8 @@
let rolewarrior = { let rolewarrior = {
run: function(creep) { run: function(creep) {
var hostile = creep.pos.findClosestByRange(FIND_HOSTILE_CREEPS); var hostile = creep.pos.findClosestByRange(FIND_HOSTILE_CREEPS);
var hostilebuilding = creep.pos.findClosestByRange(FIND_HOSTILE_SPAWNS ); var hostilebuilding = creep.pos.findClosestByRange(FIND_HOSTILE_SPAWNS );
if(hostile!=undefined) { if(hostile!=undefined) {
creep.say('Sorry') creep.say('Sorry')
creep.travelTo(hostile,{ignoreCreeps:true}); creep.travelTo(hostile,{ignoreCreeps:true});
creep.attack(hostile); creep.attack(hostile);