Improved performance of walking.

Switches to manual walking when close to target.
This commit is contained in:
DouweRavers
2022-05-01 00:52:48 +02:00
parent 744b4a2478
commit 4e3ad07fff
5 changed files with 48 additions and 52 deletions

View File

@@ -1,3 +1,5 @@
const { round } = require("lodash");
module.exports = {
// Gets called when recompiling and when Restart command is called.
start: function () {
@@ -11,7 +13,10 @@ module.exports = {
update: function () {
for (const creep_name in Memory.creeps) {
const creep = Game.creeps[creep_name];
if (creep == undefined) delete Memory.creeps[creep_name];
if (creep == undefined) {
delete Memory.creeps[creep_name];
return;
}
switch (creep.memory.role) {
case ROLE_HARVESTER:
if (creep.memory.recharge) creep.harvestSource();