15 lines
404 B
JavaScript
15 lines
404 B
JavaScript
//只收集,不运输
|
|
module.exports = {
|
|
run(creep) {
|
|
let sources = creep.room.find(FIND_SOURCES);
|
|
let Re_code=creep.harvest(sources[0]);
|
|
if ( Re_code== ERR_NOT_IN_RANGE) {
|
|
creep.moveTo(sources[0]);
|
|
}else{
|
|
if(OK==Re_code){
|
|
creep.harvest(sources[0]);
|
|
creep.drop(RESOURCE_ENERGY);
|
|
}
|
|
}
|
|
}
|
|
} |