代码拉取完成,页面将自动刷新
module.exports = {
run: function(creep){
if(creep.memory.arrive == 0 && creep.pos.isEqualTo(Game.flags['OutBuild']))
creep.memory.arrive = 1;
if(creep.memory.arrive == 0){
creep.moveTo(Game.flags['OutBuild']);
return;
}
if(creep.store[RESOURCE_ENERGY] < creep.store.getCapacity()) {
var tar = creep.pos.findClosestByPath(FIND_SOURCES);
if(!tar){ creep.say('Where the fuck Source is??'); return -1; }
if(creep.pos.isEqualTo(Game.flags['Source1R2']) == 0 && Game.flags['Source1R2'].pos.lookFor(LOOK_CREEPS).length == 0){
creep.moveTo(Game.flags['Source1R2'],{visualizePathStyle: {stroke: '#ffaa00'}});
return ;
}else if(0 && creep.pos.isEqualTo(Game.flags['Source2R2']) == 0 && Game.flags['Source2R2'].pos.lookFor(LOOK_CREEPS).length == 0){
creep.moveTo(Game.flags['Source2R2'],{visualizePathStyle: {stroke: '#ffaa00'}});
return ;
}
var target = creep.pos.findClosestByRange(FIND_SOURCES);
if(creep.pos.isEqualTo(Game.flags['Source2R2'])) target = Game.getObjectById('5bbcab1c9099fc012e632d94');
creep.harvest(target);
creep.drop(RESOURCE_ENERGY);
}else{
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!");
}
}
};
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。