代码拉取完成,页面将自动刷新
module.exports = {
run: function(creep){
if(false){
if(creep.store.getFreeCapacity() == 0){
for(var resource in creep.store){
if(creep.pos.isNearTo(creep.room.storage)) creep.transfer(creep.room.storage,resource);
else creep.moveTo(creep.room.storage);
}
}else{
for(var resource in creep.room.terminal.store){
var amount = creep.room.terminal.store[resource];
if(amount > creep.store.getFreeCapacity()) amount = creep.store.getFreeCapacity();
if(creep.pos.isNearTo(creep.room.terminal)) creep.say(creep.withdraw(creep.room.terminal ,resource ,amount));
else creep.moveTo(creep.room.terminal);
}
}
return;
}
if(!creep.pos.isEqualTo(22,27)){
creep.moveTo(22,27);
return;
}
if(creep.room.terminal.store.getFreeCapacity() >= 0 && creep.room.storage.store[RESOURCE_ENERGY] > 200000){
if(creep.store.getUsedCapacity() == 0){
var amount = creep.room.terminal.store.getFreeCapacity();
if(amount > creep.store.getFreeCapacity()) amount = creep.store.getFreeCapacity();
if(creep.pos.isNearTo(creep.room.storage)) creep.withdraw(creep.room.storage,RESOURCE_ENERGY,amount);
else creep.moveTo(creep.room.storage);
}else{
if(creep.pos.isNearTo(creep.room.terminal)) creep.transfer(creep.room.terminal,RESOURCE_ENERGY);
else creep.moveTo(creep.room.terminal);
}
}else{
return;
if(creep.store.getFreeCapacity() == 0){
if(creep.pos.isNearTo(creep.room.storage)) creep.transfer(creep.room.storage,RESOURCE_ENERGY);
else creep.moveTo(creep.room.storage);
}else{
var amount = creep.room.terminal.store[RESOURCE_ENERGY]-100000;
if(amount > creep.store.getFreeCapacity()) amount = creep.store.getFreeCapacity();
if(creep.pos.isNearTo(creep.room.terminal)) creep.say(creep.withdraw(creep.room.terminal,RESOURCE_ENERGY,amount));
else creep.moveTo(creep.room.terminal);
}
}
}
};
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。