javascript - Strange survival mode only error -
if(creep === game.creeps["worker0"]) { var sources = creep.pos.findclosest(game.sources); creep.moveto(24,29); creep.harvest(sources); creep.transferenergy(game.creeps["transport0"]); } if(creep === game.creeps["worker1"]) { var sources = creep.pos.findclosest(game.sources); creep.moveto(25,29); creep.harvest(sources); creep.transferenergy(game.creeps["transport0"]); } i below error:
typeerror: cannot read property 'foreach' of undefined @ roomposition.findclosest (/opt/engine/dist/game/rooms.js:843:23) @ module.exports (harvester:7:30) @ main:24:11 it weird because works fine in simulation mode not in survival.
the screeps api has been changed yesterday: changelog.
you have use findclosest(find_sources) instead of findclosest(game.sources).
Comments
Post a Comment