Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if(creep.harvest(Game.getObjectById(creep.memory.targetId)) != OK){
- if(!creep.memory.path){ /** if no path registered to source **/
- getSourceId.run(creep); /** search an availlable source and lock creep on it **/
- creep.memory.path = pathFind.run(creep); /** calculate Path to target or exit **/
- }
- var Path = creep.memory.path;
- if(creep.pos == Path[Path.length-1]){ /** if creep is at end of path ( on exit or stuck by something) **/
- creep.memory.path = pathFind.run(creep); /** recalculate path **/
- }
- creep.moveByPath(Path); follow path
- /** var Path = pathFind.run(creep); calculate path each tick
- if(Path[0] != undefined){ if Path exist
- creep.move(Path[0].direction); move
- }
- else{
- getSourceId.run(creep); find source
- }
- **/
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement