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