Fixes Spot Holding Bug
This commit is contained in:
@@ -24,11 +24,7 @@ class HarvesterHandler extends RoleHandler {
|
||||
}
|
||||
|
||||
private static validateCreepMemory(creep: Creep, state: GameState) {
|
||||
if (!creep.memory.destination) {
|
||||
return; // No destination set, nothing to validate
|
||||
}
|
||||
|
||||
if (creep.memory.destination.type === "source" && !!creep.memory.previousDestination && creep.memory.previousDestination.type === "source") {
|
||||
if (!!creep.memory.previousDestination && creep.memory.previousDestination.type === "source") {
|
||||
setSpotStatus(
|
||||
state.sourcesStates[creep.memory.previousDestination.id].spots,
|
||||
creep.memory.previousDestination.sourceSpot,
|
||||
@@ -37,6 +33,10 @@ class HarvesterHandler extends RoleHandler {
|
||||
delete creep.memory.previousDestination;
|
||||
}
|
||||
|
||||
if (!creep.memory.destination) {
|
||||
return; // No destination set, nothing to validate
|
||||
}
|
||||
|
||||
if (creep.memory.destination.type === "source" && !creep.store.getFreeCapacity(RESOURCE_ENERGY)) {
|
||||
creep.memory.previousDestination = creep.memory.destination;
|
||||
creep.memory.destination = {
|
||||
|
||||
@@ -24,11 +24,7 @@ class UpgraderHandler extends RoleHandler {
|
||||
}
|
||||
|
||||
private static validateCreepMemory(creep: Creep, state: GameState) {
|
||||
if (!creep.memory.destination) {
|
||||
return; // No destination set, nothing to validate
|
||||
}
|
||||
|
||||
if (creep.memory.destination.type === "source" && !!creep.memory.previousDestination && creep.memory.previousDestination.type === "source") {
|
||||
if (!!creep.memory.previousDestination && creep.memory.previousDestination.type === "source") {
|
||||
setSpotStatus(
|
||||
state.sourcesStates[creep.memory.previousDestination.id].spots,
|
||||
creep.memory.previousDestination.sourceSpot,
|
||||
@@ -37,6 +33,10 @@ class UpgraderHandler extends RoleHandler {
|
||||
delete creep.memory.previousDestination;
|
||||
}
|
||||
|
||||
if (!creep.memory.destination) {
|
||||
return; // No destination set, nothing to validate
|
||||
}
|
||||
|
||||
if (creep.memory.destination.type === "source" && !creep.store.getFreeCapacity(RESOURCE_ENERGY)) {
|
||||
creep.memory.previousDestination = creep.memory.destination;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user