feat(repair): filter debug sub-state options by current mission
Pylon-only mission steps (approaching/arrived/npc-return/narrator-outro) no longer appear in the GameStateDebugPanel sub-state dropdown for the ebike or farm missions, which use the shorter locked/waiting/inspected/fragmented/scanning/repairing/reassembling/done flow.
This commit is contained in:
@@ -5,8 +5,8 @@ import {
|
|||||||
MAIN_GAME_STATES,
|
MAIN_GAME_STATES,
|
||||||
} from "@/data/game/gameStateConfig";
|
} from "@/data/game/gameStateConfig";
|
||||||
import {
|
import {
|
||||||
|
getMissionStepsFor,
|
||||||
isMissionStep,
|
isMissionStep,
|
||||||
MISSION_STEPS,
|
|
||||||
} from "@/data/gameplay/repairMissionState";
|
} from "@/data/gameplay/repairMissionState";
|
||||||
import { useGameStore } from "@/managers/stores/useGameStore";
|
import { useGameStore } from "@/managers/stores/useGameStore";
|
||||||
import type { MainGameState } from "@/types/game";
|
import type { MainGameState } from "@/types/game";
|
||||||
@@ -53,7 +53,9 @@ export function GameStateDebugPanel(): React.JSX.Element {
|
|||||||
? GAME_STEPS
|
? GAME_STEPS
|
||||||
: mainState === "outro"
|
: mainState === "outro"
|
||||||
? ["waiting", "started"]
|
? ["waiting", "started"]
|
||||||
: MISSION_STEPS;
|
: mainState === "ebike" || mainState === "pylon" || mainState === "farm"
|
||||||
|
? getMissionStepsFor(mainState)
|
||||||
|
: [];
|
||||||
|
|
||||||
function setSubState(nextSubState: string): void {
|
function setSubState(nextSubState: string): void {
|
||||||
if (mainState === "intro") {
|
if (mainState === "intro") {
|
||||||
|
|||||||
@@ -24,6 +24,20 @@ export const MISSION_STEPS = [
|
|||||||
] as const satisfies readonly MissionStep[];
|
] as const satisfies readonly MissionStep[];
|
||||||
const MISSION_STEP_VALUES: ReadonlySet<string> = new Set(MISSION_STEPS);
|
const MISSION_STEP_VALUES: ReadonlySet<string> = new Set(MISSION_STEPS);
|
||||||
|
|
||||||
|
const PYLON_ONLY_MISSION_STEPS = new Set<MissionStep>([
|
||||||
|
"approaching",
|
||||||
|
"arrived",
|
||||||
|
"npc-return",
|
||||||
|
"narrator-outro",
|
||||||
|
]);
|
||||||
|
|
||||||
|
export function getMissionStepsFor(
|
||||||
|
mission: RepairMissionId,
|
||||||
|
): readonly MissionStep[] {
|
||||||
|
if (mission === "pylon") return MISSION_STEPS;
|
||||||
|
return MISSION_STEPS.filter((step) => !PYLON_ONLY_MISSION_STEPS.has(step));
|
||||||
|
}
|
||||||
|
|
||||||
export function isRepairMissionId(value: string): value is RepairMissionId {
|
export function isRepairMissionId(value: string): value is RepairMissionId {
|
||||||
return REPAIR_MISSION_ID_VALUES.has(value);
|
return REPAIR_MISSION_ID_VALUES.has(value);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user