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

@@ -15,16 +15,8 @@ class _Room extends Room {
//#region Checks
// Is the level changed?
isNewLevel() {
if (this.memory.level == undefined) this.memory.level = -1;
const value = this.controller.my && this.controller.level != this.memory.level;
if (value) this.memory.level = this.controller.level;
return value;
}
// Is the max amount of construction sites achieved?
isConstructionQueueFull() { return this.find(FIND_CONSTRUCTION_SITES).length > 90; }
canConstruct() { return this.find(FIND_CONSTRUCTION_SITES).length < 90; }
//#endregion
//#region Construcion
@@ -62,7 +54,6 @@ class _Room extends Room {
});
// Build a road for every permutation of the targets.
// TODO: When performance to high make this loop recoverable.
for (let i = 0; i < target_array.length; i++) {
const begin = target_array[i];
for (let j = 0; j < target_array.length; j++) {