代码拉取完成,页面将自动刷新
module.exports = {
run: function(creep){
if(creep.store[RESOURCE_ENERGY] < creep.store.getCapacity() || 1) {
creep.say('欧拉!');
var tar = creep.pos.findClosestByPath(FIND_SOURCES);
if(!tar){ creep.say('Confused :('); return -1; }
if(creep.room.name == 'W35N28'){
creep.say('dd');
if(creep.pos.isEqualTo(Game.flags['Source1R1'])) creep.harvest(tar);
else creep.moveTo(Game.flags['Source1R1'],{visualizePathStyle: {stroke: '#ffaa00'}});
}else{
creep.say('dd');
if(creep.pos.isEqualTo(Game.flags['Source1R2'])) creep.harvest(tar);
else creep.moveTo(Game.flags['Source1R2'],{visualizePathStyle: {stroke: '#ffaa00'}});
}
if(creep.pos.isEqualTo(Game.flags['Source1R1'])) creep.drop(RESOURCE_ENERGY);
if(creep.pos.isEqualTo(Game.flags['Source1R2'])) creep.drop(RESOURCE_ENERGY);
}else{
//creep.drop(RESOURCE_ENERGY);
//return;
var targets = creep.pos.findClosestByPath(FIND_STRUCTURES, {
filter: (structure) => {
return (
structure.structureType == STRUCTURE_EXTENSION ||
structure.structureType == STRUCTURE_SPAWN ||
structure.structureType == STRUCTURE_TOWER) && structure.store[RESOURCE_ENERGY] < structure.energyCapacity;
}
});
if(creep.room.energyAvailable >= 1000) targets = creep.pos.findClosestByPath(FIND_STRUCTURES, {
filter: (structure) => {
return (structure.structureType == STRUCTURE_TOWER) && structure.store[RESOURCE_ENERGY] < structure.energyCapacity;
}
});
if(targets) {
if(creep.transfer(targets, RESOURCE_ENERGY) == ERR_NOT_IN_RANGE) {
creep.moveTo(targets, {visualizePathStyle: {stroke: '#ffffff'}});
}
}else console.log("CRY!");
}
}
};
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。