Skip to content

Commit

Permalink
优化代码
Browse files Browse the repository at this point in the history
  • Loading branch information
JesseTzh committed Aug 7, 2020
1 parent 078aff3 commit bb09d6f
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Role_Mover.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,8 @@ module.exports = ({
logger.debug(creep.name + "找不到可以提取能量的建筑,切换为自由工作");
freeJob(creep);
} else {
if (creep.withdraw(source, RESOURCE_ENERGY) === ERR_NOT_IN_RANGE) {
const result = creep.withdraw(source, RESOURCE_ENERGY);
if (result === ERR_NOT_IN_RANGE) {
creep.moveTo(source);
}
}
Expand Down

0 comments on commit bb09d6f

Please sign in to comment.