SHOW:
|
|
- or go back to the newest paste.
1 | module.exports = { | |
2 | run: function(creep) { | |
3 | if(creep.store.getFreeCapacity() > 0 && creep.memory[delivering]) { | |
4 | creep.memory[delivering] = false; | |
5 | } | |
6 | else { | |
7 | if(creep.store.getFreeCapacity() = 0 && !creep.memory[delivering]) { | |
8 | creep.memory[delivering] = true; | |
9 | } | |
10 | } | |
11 | ||
12 | if(creep.memory[delivering]) { | |
13 | if(creep.transfer(creep.room.controller) == ERR_NOT_IN_RANGE) { | |
14 | creep.moveTo(creep.room.controller); | |
15 | } | |
16 | } else { | |
17 | var sources = creep.room.find(FIND_SOURCES); | |
18 | if(creep.harvest(sources[0]) == ERR_NOT_IN_RANGE) { | |
19 | creep.moveTo(sources[0]); | |
20 | } | |
21 | } | |
22 | }, | |
23 | ||
24 | spawnInfo: { | |
25 | count: 1, | |
26 | label: 'Upgrader', | |
27 | body: [WORK, CARRY, MOVE, MOVE], | |
28 | startMemory: {delivering: false} | |
29 | } | |
30 | } |