6REHBZAOJN4CVZY4HFXVNEUMWGQUXFTXMLQPXEH7RTH5FBL2TXIAC DFFMZSJOCLTBA3IGRYS2ZIJNO2MC3VLBBU42QL5DFY2SMCNFXPIAC L5PRY4LCFODVMMTEJ5IKB7PX3BV2BDXDKCI4RW3QGOMTNOAWOKKAC DHO4JCJIELKX4R42XXAMAHVQTTE6OWULLP2QF4BXO3UWC5UTMSMAC OPUQ6NVYM2BN4H2FENH6EBGVU25XQBY2GRRZANPZEBEACZMDOGEAC B4JS4Z3VVAD5RJJ272S7GJM5BUNIHHMGNK2VSKVGZFPOVFP2YO4QC HXHNGFB2VCXB6YXDND35HJI22GBJC3QTSUR2TK3M3LXGJHVNXVHAC DPJCZOPIKAKQIS4YRXETBSJA5ZTL2KQESSJE2TEZFLRQARXUVFXQC OET27TXMNRKBX3HWDSLQWCWAJOWNY5NU4XDKLO5N7Z3EE23CSWOAC A75BWKGRLUDH3KF4M2HJYLNC6BSV5MAJFV2RJSF757F46HLRLCKQC 6EXHALB3E5HP3IQVC47M4RVZE2JERJHX37GOOHPYIVAFBWSWUX7QC Z3E7XJOW6NSBDYRDKSGTOAEJSPATAUX4JUFCL4DIL3372GL4K52QC AAKN4XJLZ2GARZMUFYX3CJZKYHTRRZDYNTFRLMY7VPAY7K6W4N3QC WO2ALETBVNH7N3NXJ6JKWCQ2YIZN6LBO7WEXPHAT3EQQJEUCJITQC 3EAR4KTTJ26IRF5QUGEDRMJVBR4X3VWSQ6OBIJCLDH3A4ZZ4O3ZAC import { ZLevel } from "./ZLevel";import { RenderedZLevel } from "./RenderedZLevel";import { HashMap } from "../lib/util/data_structures/hash";import { GameState, PointNodeRef } from "../data/GameState";import { generatePointNodeTexture } from "./textures/PointNodeTexture";import { Reticle } from "./Reticle";import { ZLevelGenFactory } from "../dataFactory/WorldGenStateFactory";import { assertOnlyCalledOnce, DeepReadonly, Lazy } from "../lib/util/misc";import { PixiComponentState } from "../components/PixiComponent";import { render } from "@testing-library/react";
import { GameState, WindowState } from "../data/GameState";import { assertOnlyCalledOnce, DeepReadonly, updaterGenerator, UpdaterGeneratorType } from "../lib/util/misc";import { GameStateFactory } from "../dataFactory/GameStateFactory";
this.state.appSize = BaseApplication.appSizeFromWindowSize(props.windowSize);
this.state.appSize = BaseApplication.appSizeFromWindowSize(new Vector2(props.pixiComponentState.innerWidth, props.pixiComponentState.innerHeight));}// shim, called from react, possibly many times , possibly at any time, including during the baseGameLoop belowrerender(props: {gameStateUpdaters: UpdaterGeneratorType<GameState>,pixiComponentState: DeepReadonly<WindowState>,// needed to avoid double-updatesprevGameState: DeepReadonly<GameState>,gameState: DeepReadonly<GameState>,}) {this.globalEventQueue.push(() => {this.props.pixiComponentState = props.pixiComponentState;this.updaters.gameState = props.gameStateUpdaters; // optional})
// now: read the value of this.gameStatelet startGameState = this.gameState// generates a new object by shallow copyinglet setStartGameState = (arg: GameState | ((old: GameState) => GameState)) => {if (typeof arg === 'function') {startGameState = { ...arg(startGameState) };} else {startGameState = { ...arg }}}
// apply changes to gameState - this should be synchronous, or at least lockedlet updater = updaterGenerator<GameState>(startGameState, setStartGameState);for (let eventAction of this.globalEventQueue) {eventAction(updater); // includes actions sent down from react}// pass the new game state back upthis.gameState = startGameState;// note that react will view this as a state change and trigger this.rerender immediately, so we need to block thatthis.updaters.gameState.update((old: GameState): GameState => {this.blockedReactUpdate = { old, new: this.gameState };return this.gameState;});