diff --git a/Empire.js b/Empire.js index a408a34..b593bd2 100644 --- a/Empire.js +++ b/Empire.js @@ -82,6 +82,31 @@ module.exports = { }, sellEnergy: function(roomname){ let myorders = Game.market.getAllOrders(order=>order.resourceType == RESOURCE_ENERGY && order.type == ORDER_SELL) - + }, + computeSourceAccess: function(){ + for(let myroom of _.filter(Game.rooms, 'controller.my')) { + let name = myroom.name + let minablepositions = 0 + let srcs = Game.rooms[name].find(FIND_SOURCES); + for(let i = 0;i o[LOOK_TERRAIN] !== 'wall'); - return walkable.length; - }; - + let x = this.pos.x; + let y = this.pos.y; + let walkable = this.room.lookForAtArea( + LOOK_TERRAIN, + y - 1, // top + x - 1, // left + y + 1, // bottom + x + 1, // right + true // asArray + ).filter(o => o[LOOK_TERRAIN] !== 'wall'); + return walkable.length; } } module.exports = initroom \ No newline at end of file diff --git a/main.js b/main.js index a079ac2..ed4d0d9 100644 --- a/main.js +++ b/main.js @@ -63,7 +63,7 @@ module.exports.loop = function () { require('role.' + creep.memory.role).run(creep) //creep.say("TRYING") } catch (e) { - console.log("creep error") + console.log("creep error " + Game.creeps[name]) console.log(e) } }