This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
PathFinder.use(true); | |
for (var i in Game.creeps) { | |
var creep = Game.creeps[i], source = undefined; | |
if (!creep.room) { | |
continue; | |
} | |
if (creep.memory.sourceId) { | |
source = Game.getObjectById(creep.memory.sourceId); | |
} | |
if(!source) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var flee = require('flee'); | |
function checkPath(pos1, pos2) { | |
var path = pos1.findPathTo(pos2); | |
if (!path.length) { | |
return false; | |
} | |
return path[path.length - 1].x == pos2.x && path[path.length - 1].y == pos2.y; | |
} | |
function costCallbackIgnoreRamparts(roomName, cm) { | |
var ramparts = Game.rooms[roomName].find(FIND_STRUCTURES, {filter: i => i.structureType == STRUCTURE_RAMPART || i.structureType == STRUCTURE_WALL}); |