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N3QC OET27TXMNRKBX3HWDSLQWCWAJOWNY5NU4XDKLO5N7Z3EE23CSWOAC 6REHBZAOJN4CVZY4HFXVNEUMWGQUXFTXMLQPXEH7RTH5FBL2TXIAC HUH4SI4HXIP72KQSJP2I4ELHX5KUQZM7FFGKZZGJ33DF7E3JHMYQC WBDAIDQZ3J7ON5DWIDA2L4OJEEZCUP2RLEWJSNR4AC3SDBHDBXIQC 6OD22ZHHEANTKREVSWHHAWEDVUFWTZHUKJD35ICBPWYERYPABGDQC N2M7CWXHD722QWM6IIIEOD66YMR3SSZEJZLDCGEIPXRCVNF6YBSQC FXYPURO7GWFOWZMZ4HP7SMLAXSZMQAON6D6LTGSKPYST52RJYXIAC TQ57VE45BHV7MOZ6GKTYZEAMAOTXLPQ3ROCWJ2FUCITQWOYVMUIAC DFFMZSJOCLTBA3IGRYS2ZIJNO2MC3VLBBU42QL5DFY2SMCNFXPIAC ZOZN5WVJLRMAP7GHGAFBL62VTMICVFCQ3EPL652MK6UPRTB2MT4AC 3EAR4KTTJ26IRF5QUGEDRMJVBR4X3VWSQ6OBIJCLDH3A4ZZ4O3ZAC WO2ALETBVNH7N3NXJ6JKWCQ2YIZN6LBO7WEXPHAT3EQQJEUCJITQC DHO4JCJIELKX4R42XXAMAHVQTTE6OWULLP2QF4BXO3UWC5UTMSMAC QUT2VGNOS2XSDLSYCSMILCKF343M56MRPRSUWN4GXWPGCK6APK2QC PEQNQJYNX7QOEM67QH2UF7VZ43AXHUBO76DN77L43MEFRHVDBO5QC CZPLX4O4R7K3TF3NSAL5PT7NO3CUOLDY3OR332GBIYYNKMZTW24AC TQAGEMW7FKIQCPQOJN44XVUZJQFQYNGSYRVIYSXFYF36HU7YDMZQC WPMKCTWMATYM6IPD5KXMO3OEFUM3J2FYL2FMBPMJNXN4ADTHI56AC 3UFL673QX2JG7KHTAM7DFH4BBYVHDNMXBS2RW45G3JBNFZFLSRRQC export function PixiComponent(props: {onFocusedNodeChange: (selection: PointNodeRef) => void;}) {
export function PixiComponent(props: { originalSetGameState: Function }) {const [gameState, gameStateUpdaters, fireBatchedSetGameState] = useContext(UseGameStateContext);
<button onClick={() => {}}>draw circle</button>
<button onClick={() => {gameStateUpdaters.update((old) => {let newGameState = new GameStateFactory({}).create(old.worldGen.seed);old.playerSave = newGameState.playerSave;old.playerUI = newGameState.playerUI;old.worldGen = newGameState.worldGen;return old});}}>Reset game state</button><button onClick={() => {application.pause();application.destroy();setApplication(new BaseApplication({originalWindowWidth: window.innerWidth,originalWindowHeight: window.innerHeight,}, {}, true));let newGameState = new GameStateFactory({}).create(+new Date());props.originalSetGameState((old: GameState) => {old.playerSave = newGameState.playerSave;old.playerUI = newGameState.playerUI;old.worldGen = newGameState.worldGen;return old});}}>Get a fresh seed, reset, and rerender</button>
public create(): GameState {assertOnlyCalledOnce("GameStateFactory.create");
const zLevel = new ZLevelGenFactory({}).create({ seed: mySeed, z: 0, startingChunks: 0 });const origin = new Vector2(0, 0);const firstId = zLevel.chunks.get(origin)?.pointNodes.get(origin)?.id!const pointNodeRef: PointNodeRef = new PointNodeRef({z: 0,chunkCoord: origin,pointNodeId: firstId,pointNodeCoord: origin});
constructor(args: Partial<Config> = {}, props: Partial<BaseApplicationProps> = {}) {assertOnlyCalledOnce("Base application constructor"); // annoying with react hot reload, disable for now
constructor(args: Partial<Config> = {}, props: Partial<BaseApplicationProps> = {}, isSecondTime = false) {// verify that we are not loading this twice when we expect to load it only once -- bad for performance!!if (!isSecondTime) {assertOnlyCalledOnce("Base application constructor"); // annoying with react hot reload, disable for now}}
this.container = new Pixi.Container();this.container.sortableChildren = true;
const setState: UpdaterFn<State> = ((valueOrCallback) => {if (typeof valueOrCallback === "function") {this.state = valueOrCallback(this.state);} else {this.state = valueOrCallback;}})let [batchedSetState, fireBatch] = batchify(setState);this.stateUpdaters = updaterGenerator2<State>(this.state, batchedSetState);this.fireStateUpdaters = fireBatch;
const childProps = {delta: 0,args: {pointNodeTexture: this.state.pointNodeTexture.get(),z: 0,},updaters: props.updaters,position: props.appSize.multiply(0.5),zLevelGen: props.gameState.worldGen.zLevels[0],selectedPointNode: props.gameState.playerUI.selectedPointNode,allocatedPointNodeSubset: props.gameState.playerSave.allocatedPointNodeSet,};if (!this.zLevel) {this.zLevel = new ZLevelComponent(childProps);this.actionStage.addChild(this.zLevel.container);} else {this.zLevel.update(childProps);}
if (props.gameState.worldGen.zLevels[0]) {const childProps = {delta: 0,args: {pointNodeTexture: this.state.pointNodeTexture.get(),z: 0,},updaters: props.updaters,position: props.appSize.multiply(0.5),zLevelGen: props.gameState.worldGen.zLevels[0],selectedPointNode: props.gameState.playerUI.selectedPointNode,allocatedPointNodeSubset: props.gameState.playerSave.allocatedPointNodeSet,};if (!this.zLevel) {this.zLevel = new ZLevelComponent(childProps);this.actionStage.addChild(this.zLevel.container);} else {this.zLevel.update(childProps);}
const childProps = {delta: 0,args: {pointNodeTexture: this.state.pointNodeTexture.get(),z: 0,},updaters: props.updaters,position: props.appSize.multiply(0.5),zLevelGen: props.gameState.worldGen.zLevels[0],selectedPointNode: props.gameState.playerUI.selectedPointNode,allocatedPointNodeSubset: props.gameState.playerSave.allocatedPointNodeSet,};if (!this.zLevel) {this.zLevel = new ZLevelComponent(childProps);this.actionStage.addChild(this.zLevel.container);} else {this.zLevel.update(childProps);
const { updaters } = this.staleProps;assertOnlyCalledOnce("root application did mount");updaters.worldGen.zLevels.update((prev, prevGameState) => {assertOnlyCalledOnce("root application callback");if (!prev[0]) {return { 0: new ZLevelGenFactory({}).create({ seed: prevGameState.worldGen.seed, z: 0 }) };}return prev;})
childComponent.update(childProps);
if (childComponent) {childComponent.update(childProps);} else {childComponent = new PointNodeComponent(childProps);this.children.put(pointNodeRef, childComponent);this.container.addChild(childComponent.container);}
this.children.get(chunkRef).update(childProps);
let childComponent = this.children.get(chunkRef);if (childComponent) {childComponent.update(childProps);} else {childComponent = new ChunkComponent(childProps);this.children.put(chunkRef, childComponent);this.container.addChild(childComponent.container);}
}didUpdate(prevProps: Props, props: Props) {}didMount() {const { args, updaters } = this.staleProps;// if we mounted but our data is not generated, please generate ourselvesupdaters.worldGen.zLevels.update((prev, prevGameState) => {if (!prev[args.z]) {return { [args.z]: new ZLevelGenFactory({}).create({ seed: prevGameState.worldGen.seed, z: args.z }) };}return prev;})// updaters.playerSave.allocatedPointNodeSet.update((prev, prevGameState) => {// if (prev.size() === 0) {// let startNode = prevGameState.worldGen.zLevels[0].chunks.get(new Vector2(0, 0))?.pointNodes.get(new Vector2(0, 0));// if (startNode) {// prev.put(new PointNodeRef({// z: 0,// chunkCoord: new Vector2(0, 0),// pointNodeCoord: new Vector2(0, 0),// pointNodeId: startNode?.id// }))// return prev.clone();// }// }// return prev;// })