A town simulation in pale isometric line art, implemented with Ritmo ECS and PixiJs 3D
Hold a shared town still until it is first drawn
Claude74a7ff2419f1
diff --git a/src/main.ts b/src/main.tsindex 449893a..84a71fe 100644--- a/src/main.ts+++ b/src/main.ts@@ -134,6 +134,8 @@ const start = async () => {if (saved._tag === "Failure") ui.toast(describe(saved.failure))}+ /** A shared town has just loaded and not yet been drawn. */+ let settling = falseconst loop = FixedLoop.start({source: FixedLoop.source((onTick) => stage.subscribe(onTick)),stepSeconds: STEP_SECONDS,@@ -147,7 +149,10 @@ const start = async () => {const text = arrivingarriving = nullarrive(text)+ settling = true}+ // The town's numbers are still the old town's until the next frame draws the new one: wait for them.+ if (settling) return Result.success(undefined)if (ui.edits.some((edit) => edit.type === "newTown")) {resetPresentation()stage.resetCamera()@@ -165,6 +170,7 @@ const start = async () => {clock.elapsed += elapsedSecondsconst shown = runtime.tick(present)if (!shown.ok) throw new Error(`The town view stopped: ${JSON.stringify(shown.error)}`)+ settling = falsesyncPage()autosave()},