mirror of
https://github.com/paradizelost/screeps.git
synced 2024-11-25 02:14:44 -06:00
changes
This commit is contained in:
parent
5c5b9003ad
commit
949f1d0e64
@ -1,7 +1,9 @@
|
||||
let Phase0 = {
|
||||
run: function(room) {
|
||||
require('assignsources').tick(room)
|
||||
creepcounts = _.countBy(Game.rooms[room].find(FIND_MY_CREEPS), c => c.memory.role)
|
||||
let creepcounts = _.countBy(Game.rooms[room].find(FIND_MY_CREEPS), c => c.memory.role)
|
||||
if(creepcounts===undefined){creepcounts['phase' + Game.rooms[room].memory.phase +'worker']=0}
|
||||
Game.rooms[room].memory.creepcounts=creepcounts
|
||||
let myspawns = Game.rooms[room].find(FIND_MY_SPAWNS)
|
||||
let sources = Game.rooms[room].find(FIND_SOURCES )
|
||||
if(myspawns.length<1){
|
||||
@ -24,8 +26,8 @@ let Phase0 = {
|
||||
} else {
|
||||
let workerrolename = 'phase' + Game.rooms[room].memory.phase +'worker'
|
||||
console.log(room)
|
||||
console.log(workerrolename + " : " + creepcounts[workerrolename])
|
||||
if(((creepcounts[workerrolename]< (sources.length * 1) || creepcounts[workerrolename]==undefined) && !myspawns[0].spawning && Game.rooms[room].energyAvailable == Game.rooms[room].energyCapacityAvailable) || (creepcounts[workerrolename] ==0 && Game.rooms[room].energyAvailable==300) ){
|
||||
console.log("room.phase0.js "+workerrolename + " : " + creepcounts[workerrolename])
|
||||
if(( creepcounts[workerrolename] == undefined ||(creepcounts[workerrolename]< (sources.length * 1) || creepcounts[workerrolename]==undefined) && !myspawns[0].spawning && Game.rooms[room].energyAvailable == Game.rooms[room].energyCapacityAvailable) || (creepcounts[workerrolename] ==0 && Game.rooms[room].energyAvailable==300) ){
|
||||
if(Game.rooms[room].energyAvailable == Game.rooms[room].energyCapacityAvailable){
|
||||
require('proc.spawning').spawnworker(room)
|
||||
}
|
||||
|
2
main.js
2
main.js
@ -25,7 +25,7 @@ module.exports.loop = function () {
|
||||
try{
|
||||
require('Room.Phase' + myroom.memory.phase).run(name)
|
||||
} catch(e){
|
||||
console.log(e)
|
||||
console.log(myroom.name + ": " + e)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -30,7 +30,7 @@ let mover={
|
||||
}
|
||||
if(creep.room.name != creep.memory.assignedroom){
|
||||
creep.moveTo(Game.rooms[creep.memory.assignedroom].controller)
|
||||
Game.notify(creep.name + " Not in assigned room")
|
||||
//Game.notify(creep.name + " Not in assigned room")
|
||||
} else {
|
||||
if(creep.memory.working){
|
||||
//let terminaltarget = creep.room.terminal
|
||||
|
Loading…
Reference in New Issue
Block a user