old source files of 2018-2020.
This commit is contained in:
16
job_miner.js
Normal file
16
job_miner.js
Normal file
@@ -0,0 +1,16 @@
|
||||
|
||||
/* ########################################
|
||||
# Mine energy and drop it in container #
|
||||
########################################*/
|
||||
|
||||
module.exports = {
|
||||
do: function(creep){
|
||||
var container = Game.getObjectById(creep.memory.container_id);
|
||||
if(container != null && creep.pos.isEqualTo(container.pos)){
|
||||
if(creep.memory.source_id == undefined) creep.memory.source_id = creep.pos.findClosestByPath(FIND_SOURCES).id;
|
||||
creep.harvest(Game.getObjectById(creep.memory.source_id));
|
||||
} else {
|
||||
creep.moveTo(Game.getObjectById(creep.memory.container_id));
|
||||
}
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user