1
0
Fork 0

feat(sounds): integrate sound effects for game actions in Minesweeper

This commit is contained in:
Jason Fraley 2026-08-28 18:33:15 -04:00
parent b9999fceff
commit 3faa01353d
2 changed files with 9 additions and 6 deletions

View file

@ -20,6 +20,7 @@ import { PROFILE_UPDATE_EVENT } from "@/hooks/useGameTick";
import { useSessionExpired } from "@/hooks/useSessionExpired";
import { LoginLink } from "@/components/frontend/auth/LoginLink";
import { cn } from "@/lib/utils";
import { playClear, playExplosion, playFlag, playReveal, playXp } from "./sounds";
type Phase = "ready" | "playing" | "over";
type GameMode = EodDifficulty | "custom";

View file

@ -24,6 +24,8 @@
import { spawnSync } from "child_process";
import { existsSync, mkdirSync, readFileSync } from "fs";
import { dirname, join } from "path";
import { getPayload } from "payload";
import config from "@payload-config";
interface CliOpts {
catalog?: string[];
@ -43,8 +45,9 @@ function parseCli(argv: string[]): CliOpts {
if (a === "--approve") { opts.approve = true; continue; }
if (a === "--dry-run") { opts["dry-run"] = true; continue; }
if (a.startsWith("--") && i + 1 < argv.length && !argv[i + 1].startsWith("--")) {
const key = a.slice(2) as keyof CliOpts;
(opts[key] ??= []).push(argv[++i]);
const key = a.slice(2) as Exclude<keyof CliOpts, "approve" | "dry-run">;
const value = argv[++i];
(opts[key] ??= []).push(value);
}
}
return opts;
@ -135,7 +138,7 @@ function planImport(
const ref = iconRef || pictureRef;
const paaPath = ref ? resolvePaaPath(ref, lookups.paaRoot) : "";
const pngPath = paaPath
? convertPaaToPng(lookups.hemtt, paaPath, join(lookups.outDir))
? (convertPaaToPng(lookups.hemtt, paaPath, join(lookups.outDir)) ?? "")
: "";
const screenshotPath = lookups.screenshots
? (["png", "webp", "jpg"].map((e) => join(lookups.screenshots, clazz + "." + e)).find(existsSync) ?? "")
@ -151,7 +154,7 @@ async function resolveFuelConfig(payload: { find: (args: any) => Promise<{ docs:
}
async function writeEntry(
payload: { create: (args: { collection: string; data: any }) => Promise<any>; update: (args: { collection: string; id: number; data: any }) => Promise<any> },
payload: any,
plan: ImportPlan,
opts: { outDir: string },
fuelId: number,
@ -229,8 +232,7 @@ async function main() {
if (dryRun) { console.log(`\nDry run: ${plans.length} would import, 0 applied.`); return; }
const { getPayload } = await import("@payload-config");
const payload = await getPayload({ config: (await import("@payload-config")).default });
const payload = await getPayload({ config });
const fuel = await resolveFuelConfig(payload);
let ok = 0, err = 0;
for (const plan of plans) {