Created
July 26, 2021 17:12
-
-
Save curzonj/4319b7bb81b92567557a91abedab160b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports.loop = function () { | |
console.log("Hello World") | |
var spawner = Object.values(Game.spawns)[0]; | |
if (spawner.store[RESOURCE_ENERGY] >= 300) { | |
console.log(spawner.spawnCreep([WORK,CARRY,MOVE], Game.time)); | |
} | |
Object.values(Game.creeps).forEach(c => { | |
if (c.store[RESOURCE_ENERGY] > 10) { | |
if (c.upgradeController(c.room.controller) == ERR_NOT_IN_RANGE) { | |
c.moveTo(c.room.controller); | |
} | |
} else { | |
var src = c.pos.findClosestByRange(FIND_SOURCES_ACTIVE) | |
if (c.harvest(src) == ERR_NOT_IN_RANGE) { | |
c.moveTo(src); | |
} | |
} | |
}) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment