Adds a shared fixed-position debugging dock (Controls/State/Log tabs) gated to dynamic superusers, mounted per minigame. Multiplayer games gain synced server-authoritative admin commands with [dev-admin] audit logging: poker (force fold, force street, per-viewer reveal-all, clock control, stack adjust, force expire), blackjack (bankroll adjust, next-card injection, dealer override, force expire), bomperator (pure applyAdminCommand: crates, pickups, eliminate, freeze, sudden death, timer, end round; mirrored over the arena REST path), and CFF Versus (reveal fleets, force shot outcome, skip turn). Solo games get client-side tuning via persisted dev settings: flappy physics sliders plus pause and invincibility, EOD layout reveal and seeded boards, radio transcript view and timer freeze, aim trainer seed and difficulty overrides plus hitbox overlay, OPORD answer reveal and study window, call-for-fire target reveal, seeded grids, and free corrections. Includes 26 new integration specs (command purity, gating, audit lines) and a poker e2e smoke for the dock. Plan: Minigame Developer Console.
82 lines
2.9 KiB
TypeScript
82 lines
2.9 KiB
TypeScript
"use client";
|
|
|
|
import { useCallback, useEffect, useState } from "react";
|
|
import type {
|
|
CallForFireDifficulty,
|
|
CallForFireStats,
|
|
} from "@/app/(frontend)/minigames/call-for-fire/actions";
|
|
import { useRealtimePresence } from "@/hooks/useRealtimePresence";
|
|
import { useSidebar } from "@/components/ui/sidebar";
|
|
import { AllTimeLeaderboard } from "@/components/frontend/minigames/AllTimeLeaderboard";
|
|
import { PeriodStandingsCard } from "@/components/frontend/minigames/PeriodStandingsCard";
|
|
import { CallForFireDevControls } from "@/components/frontend/minigames/dev/CallForFireDevControls";
|
|
import { MinigameDevDock } from "@/components/frontend/minigames/dev/MinigameDevDock";
|
|
import { CallForFireLeaderboard } from "./CallForFireLeaderboard";
|
|
import { FireMissionBoard, type CallForFireDevSnapshot } from "./FireMissionBoard";
|
|
|
|
export function CallForFireArena({
|
|
initialStats,
|
|
currentUserId,
|
|
isSuperuser = false,
|
|
}: {
|
|
initialStats: CallForFireStats;
|
|
currentUserId: number | string;
|
|
isSuperuser?: boolean;
|
|
}) {
|
|
const [refreshKey, setRefreshKey] = useState(0);
|
|
const [playing, setPlaying] = useState(false);
|
|
const [selectedDifficulty, setSelectedDifficulty] = useState<CallForFireDifficulty>("patrol");
|
|
const [missionSnapshot, setMissionSnapshot] = useState<CallForFireDevSnapshot | null>(null);
|
|
const { isMobile, setOpenMobile } = useSidebar();
|
|
const activeTeams = useRealtimePresence("callForFire", playing, true);
|
|
const onPhaseChange = useCallback((phase: "ready" | "playing" | "over") => {
|
|
setPlaying(phase === "playing");
|
|
}, []);
|
|
|
|
useEffect(() => {
|
|
if (playing && isMobile) setOpenMobile(false);
|
|
}, [isMobile, playing, setOpenMobile]);
|
|
|
|
return (
|
|
<div className="flex flex-col items-center gap-6">
|
|
<FireMissionBoard
|
|
initialStats={initialStats}
|
|
onGameRecorded={() => setRefreshKey((key) => key + 1)}
|
|
onPhaseChange={onPhaseChange}
|
|
onDifficultyChange={setSelectedDifficulty}
|
|
isSuperuser={isSuperuser}
|
|
onDevSnapshotChange={setMissionSnapshot}
|
|
/>
|
|
<PeriodStandingsCard
|
|
gameKey="callForFire"
|
|
icon="Target"
|
|
refreshKey={refreshKey}
|
|
currentUserId={currentUserId}
|
|
presence={{ participants: activeTeams, noun: "team" }}
|
|
className="max-w-[520px]"
|
|
/>
|
|
<AllTimeLeaderboard>
|
|
<CallForFireLeaderboard
|
|
refreshKey={refreshKey}
|
|
currentUserId={currentUserId}
|
|
activeTeams={activeTeams}
|
|
difficulty={selectedDifficulty}
|
|
onDifficultyChange={setSelectedDifficulty}
|
|
/>
|
|
</AllTimeLeaderboard>
|
|
<MinigameDevDock
|
|
isSuperuser={isSuperuser}
|
|
gameKey="call-for-fire"
|
|
gameLabel="Call for Fire"
|
|
snapshot={
|
|
missionSnapshot ?? {
|
|
phase: "ready",
|
|
difficulty: selectedDifficulty,
|
|
}
|
|
}
|
|
>
|
|
<CallForFireDevControls />
|
|
</MinigameDevDock>
|
|
</div>
|
|
);
|
|
}
|