From dd36461c351720de9a804d032c603e8f5a474f4b Mon Sep 17 00:00:00 2001 From: Vitor Hideyoshi Date: Sat, 12 Jul 2025 01:18:14 -0300 Subject: [PATCH] Better Path Caching --- src/roleHandlers/harvesterHandler.ts | 6 +++--- src/types/gameConfig.ts | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/roleHandlers/harvesterHandler.ts b/src/roleHandlers/harvesterHandler.ts index e6343e9..ca96c17 100644 --- a/src/roleHandlers/harvesterHandler.ts +++ b/src/roleHandlers/harvesterHandler.ts @@ -1,6 +1,6 @@ import { getSourceById, getSpawnById } from "utils/funcs/get_by_id"; import { RoleHandler } from "./roleHandler.interface"; -import { forEachMatrixSpot, getNextEmptySpot, getPositionWithDelta, setSpotStatus, SourceSpotStatus } from "types/source"; +import { getNextEmptySpot, getPositionWithDelta, setSpotStatus, SourceSpotStatus } from "types/source"; @@ -79,7 +79,7 @@ class HarvesterHandler extends RoleHandler { const sourceSpotPosition = getPositionWithDelta( source.pos, creep.memory.destination.sourceSpot ) - creep.moveTo(sourceSpotPosition, { reusePath: 0, visualizePathStyle: { stroke: '#ffffff', lineStyle: 'dashed', strokeWidth: 0.1 } }); + creep.moveTo(sourceSpotPosition, { reusePath: 10, visualizePathStyle: { stroke: '#ffffff', lineStyle: 'dashed', strokeWidth: 0.1 } }); } } @@ -111,7 +111,7 @@ class HarvesterHandler extends RoleHandler { } if (creep.transfer(spawn, RESOURCE_ENERGY) === ERR_NOT_IN_RANGE) { - creep.moveTo(spawn, { reusePath: 0, visualizePathStyle: { stroke: '#ffffff', lineStyle: 'dashed', strokeWidth: 0.1 } }); + creep.moveTo(spawn, { reusePath: 10, visualizePathStyle: { stroke: '#ffffff', lineStyle: 'dashed', strokeWidth: 0.1 } }); } } diff --git a/src/types/gameConfig.ts b/src/types/gameConfig.ts index d36ebef..b8c4878 100644 --- a/src/types/gameConfig.ts +++ b/src/types/gameConfig.ts @@ -22,9 +22,9 @@ export type GameConfig = { * @type {GameConfig} */ export const DEFAULT_GAME_CONFIG: GameConfig = { - maxCreeps: 5, + maxCreeps: 15, minCreepsPerRole: { - harvester: 5, + harvester: 15, upgrader: 0, builder: 0 }