【发布时间】:2015-01-19 12:49:50
【问题描述】:
下面的代码打印出“rampart”,但cree只是静止不动并没有修复。它使用文档中提到的 sn-p。根据文档,可以修复结构,而城墙是一种结构。怎么了?
module.exports = function(creep) {
var target = creep.pos.findNearest(Game.MY_STRUCTURES, {
filter: function(object) {
return object.hits < object.hitsMax;
}
});
if(target) {
console.log("_________" + target.structureType);
creep.moveTo(target);
creep.repair(target);
}
}
【问题讨论】:
标签: javascript screeps