Better Path Caching

This commit is contained in:
2025-07-12 01:18:14 -03:00
parent c38ebe3721
commit dd36461c35
2 changed files with 5 additions and 5 deletions

View File

@@ -1,6 +1,6 @@
import { getSourceById, getSpawnById } from "utils/funcs/get_by_id"; import { getSourceById, getSpawnById } from "utils/funcs/get_by_id";
import { RoleHandler } from "./roleHandler.interface"; 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( const sourceSpotPosition = getPositionWithDelta(
source.pos, creep.memory.destination.sourceSpot 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) { 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 } });
} }
} }

View File

@@ -22,9 +22,9 @@ export type GameConfig = {
* @type {GameConfig} * @type {GameConfig}
*/ */
export const DEFAULT_GAME_CONFIG: GameConfig = { export const DEFAULT_GAME_CONFIG: GameConfig = {
maxCreeps: 5, maxCreeps: 15,
minCreepsPerRole: { minCreepsPerRole: {
harvester: 5, harvester: 15,
upgrader: 0, upgrader: 0,
builder: 0 builder: 0
} }