1 Star 0 Fork 0

Leviaton/Screeps

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
role.upgrader.js 1.04 KB
一键复制 编辑 原始数据 按行查看 历史
Lev 提交于 2020-02-17 12:50 . first commit
var B = require('behaviors');
module.exports = {
run: function(creep){
const pos1 = new RoomPosition(22,32,'W42N28');
const pos2 = new RoomPosition(23,31,'W42N28');
let obj_list = pos2.lookFor("creep");
if(creep.pos.isEqualTo(pos1) && obj_list.length == 0) creep.move(TOP_RIGHT);
const room = creep.room.name;
const pos = new RoomPosition(Memory.rooms[room].Upgrade.x, Memory.rooms[room].Upgrade.y, room);
const closepoint = new RoomPosition(Memory.rooms[room].closepoint.x, Memory.rooms[room].closepoint.y, room);
if(creep.store.getUsedCapacity() == 0) {
if(creep.pos.isNearTo(pos)) B.GetResource(creep, pos, 'energy');
else creep.moveTo(pos,{visualizePathStyle: {stroke: '#ffffff'},reuse:200});
if(creep.pos.isEqualTo(pos)) creep.moveTo(closepoint);
}else{
if(creep.upgradeController(creep.room.controller) == ERR_NOT_IN_RANGE)
creep.moveTo(closepoint,{visualizePathStyle: {stroke: '#ffff00'},reuse:200});
}
}
};
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
JavaScript
1
https://gitee.com/Chorolop/Screeps.git
git@gitee.com:Chorolop/Screeps.git
Chorolop
Screeps
Screeps
master

搜索帮助