From bb8a891513b0615a596b15e96e4e0595db75f989 Mon Sep 17 00:00:00 2001 From: soulrap <135220351+soulrap@users.noreply.github.com> Date: Fri, 28 Aug 2026 20:35:21 +0300 Subject: [PATCH] map the book event game type onto the frontend's vocabulary math-sdk names its game types basegame / freegame - `Config.freegame_type` in src/config/config.py - while this game's config names them basegame / freeSpins: `GameType` is `keyof typeof config.paddingReels`, and those keys are `basegame` and `freeSpins`. The reveal handler assigned `bookEvent.gameType` straight through, so during a feature round `stateGame.gameType` sat at 'freegame'. Background.svelte shows the base scene when it is 'basegame' and the feature scene when it is 'freeSpins', so neither branch matched: both FadeContainers stayed hidden and the entire feature played on a black screen. freeSpinTrigger does set 'freeSpins', but the next reveal overwrote it, and freeSpinEnd sets 'basegame' - which is why the scene reappears the moment the round ends, and why this reads as "the background comes back at the end". Measured against the published books for 0_0_scatter: 4060 reveal events in books_bonus carry gameType 'freegame', 400 in books_base carry 'basegame'. Co-Authored-By: Claude Opus 5 --- apps/scatter/src/game/bookEventHandlerMap.ts | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/apps/scatter/src/game/bookEventHandlerMap.ts b/apps/scatter/src/game/bookEventHandlerMap.ts index 7c4e048bd..011d87ab3 100644 --- a/apps/scatter/src/game/bookEventHandlerMap.ts +++ b/apps/scatter/src/game/bookEventHandlerMap.ts @@ -8,7 +8,17 @@ import { playBookEvent } from './utils'; import { winLevelMap, type WinLevel, type WinLevelData } from './winLevelMap'; import { stateGame, stateGameDerived } from './stateGame.svelte'; import type { BookEvent, BookEventOfType, BookEventContext } from './typesBookEvent'; -import type { Position } from './types'; +import type { GameType, Position } from './types'; + +/** + * math-sdk names its game types basegame / freegame (Config.freegame_type), while this + * game's config - and therefore GameType - names them basegame / freeSpins. Passing the + * book event's value through raw leaves gameType at 'freegame', which matches neither + * branch in Background.svelte, so both backgrounds stay hidden and the screen goes black + * for the whole feature. freeSpinTrigger sets the right value; the next reveal overwrote it. + */ +const toGameType = (raw: string): GameType => + raw === 'freegame' ? 'freeSpins' : (raw as GameType); const winLevelSoundsPlay = ({ winLevelData }: { winLevelData: WinLevelData }) => { if (winLevelData?.alias === 'max') eventEmitter.broadcastAsync({ type: 'uiHide' }); @@ -51,7 +61,7 @@ export const bookEventHandlerMap: BookEventHandlerMap