somehow fixed reload bug by making things actively worse

This commit is contained in:
Bertie690 2025-08-01 20:42:25 -04:00
parent 1819712201
commit 152f54ee7a

View File

@ -89,6 +89,11 @@ interface InProgressStub {
onError(error: any): void; onError(error: any): void;
} }
interface onHoldStub {
name: string;
call(): void;
}
export class PhaseInterceptor { export class PhaseInterceptor {
public scene: BattleScene; public scene: BattleScene;
// @ts-expect-error: initialized in `initPhases` // @ts-expect-error: initialized in `initPhases`
@ -98,7 +103,7 @@ export class PhaseInterceptor {
* TODO: This should not be an array; * TODO: This should not be an array;
* Our linear phase system means only 1 phase is ever started at once (if any) * Our linear phase system means only 1 phase is ever started at once (if any)
*/ */
private onHold: PhaseClass[]; private onHold: onHoldStub[];
private interval: NodeJS.Timeout; private interval: NodeJS.Timeout;
private promptInterval: NodeJS.Timeout; private promptInterval: NodeJS.Timeout;
private intervalRun: NodeJS.Timeout; private intervalRun: NodeJS.Timeout;
@ -279,7 +284,7 @@ export class PhaseInterceptor {
}, },
onError: error => reject(error), onError: error => reject(error),
}; };
this.phases[currentPhase.name].start.call(this.scene.phaseManager.getCurrentPhase()); currentPhase.call();
} }
}); });
}); });
@ -325,7 +330,13 @@ export class PhaseInterceptor {
*/ */
startPhase(phase: PhaseClass) { startPhase(phase: PhaseClass) {
this.log.push(phase.name as PhaseString); this.log.push(phase.name as PhaseString);
this.onHold.push(phase); const instance = this.scene.phaseManager.getCurrentPhase();
this.onHold.push({
name: phase.name,
call: () => {
this.phases[phase.name].start.apply(instance);
},
});
} }
/** /**