You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
17 lines
647 B
17 lines
647 B
import { prototypes, utils, constants } from '/game'; |
|
|
|
export function loop() { |
|
var creep = utils.getObjectsByPrototype(prototypes.Creep).find(i => i.my); |
|
var source = utils.getObjectsByPrototype(prototypes.Source)[0]; |
|
var spawn = utils.getObjectsByPrototype(prototypes.StructureSpawn).find(i => i.my); |
|
|
|
if(creep.store.getFreeCapacity(constants.RESOURCE_ENERGY)) { |
|
if(creep.harvest(source) == constants.ERR_NOT_IN_RANGE) { |
|
creep.moveTo(source); |
|
} |
|
} else { |
|
if(creep.transfer(spawn, constants.RESOURCE_ENERGY) == constants.ERR_NOT_IN_RANGE) { |
|
creep.moveTo(spawn); |
|
} |
|
} |
|
} |