spoint 0.1.636 → 0.1.638
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/sdk/WorkerEntry.js +16 -5
package/package.json
CHANGED
package/src/sdk/WorkerEntry.js
CHANGED
|
@@ -190,14 +190,25 @@ export async function init({ worldDef, apps = [], migrationSnapshot = null, loca
|
|
|
190
190
|
ctx.onClientConnect = createConnectionHandlers(ctx).onClientConnect
|
|
191
191
|
|
|
192
192
|
stageLoader.loadFromDefinition('main', worldDef)
|
|
193
|
+
// server-scale-worldpersistence-async-trimesh-race-and-in-flight-flush-frequency: wait (bounded) for
|
|
194
|
+
// every autoTrimesh/addTrimeshCollider build the spawn loops above just kicked off (including
|
|
195
|
+
// custom._interior placed-models like env-sillos's trimesh floor, apps/placed-model/index.js) to
|
|
196
|
+
// settle before anything else can run against these entities. src/sdk/ServerAPI.js's loadWorld()
|
|
197
|
+
// already does this for the real multiplayer server; singleplayer's in-Worker path had NO equivalent
|
|
198
|
+
// wait, and unlike a human joining a remote server (real network latency covers the gap), a local
|
|
199
|
+
// client can connect fast enough to spawn its player capsule before env-sillos's floor trimesh body
|
|
200
|
+
// exists -- live-witnessed: player fell straight through, position Y drifting from spawn (2.27) to
|
|
201
|
+
// -100 and still falling (onGround:false) by tick 38, X/Z correctly at the declared spawn point.
|
|
202
|
+
try { await appRuntime.waitForPendingTrimeshBuilds?.() } catch (e) { console.error('[world-persistence] waitForPendingTrimeshBuilds error:', e.message) }
|
|
193
203
|
// Restore-on-boot: must run after BOTH the world-def spawn (stageLoader.loadFromDefinition, immediately
|
|
194
204
|
// above) AND the placed-model replay loop (the `for (const p of placed)` block above, already run before
|
|
195
205
|
// this point in this file) have finished creating every entity -- see WorldPersistence.js's own header
|
|
196
|
-
// comment for the full ordering rationale
|
|
197
|
-
//
|
|
198
|
-
//
|
|
199
|
-
//
|
|
200
|
-
//
|
|
206
|
+
// comment for the full ordering rationale. The async-autoTrimesh-body race this comment used to accept
|
|
207
|
+
// as an open gap here is now closed above (waitForPendingTrimeshBuilds), matching ServerAPI.js's own
|
|
208
|
+
// ordering exactly. A missing/version-mismatched/world-mismatched snapshot (including a genuinely fresh
|
|
209
|
+
// IndexedDB with nothing saved yet -- every first-ever singleplayer session) is a clean no-op, matching
|
|
210
|
+
// server.js's ServerAPI.js loadWorld() call site exactly: this never throws into init(), a broken/absent
|
|
211
|
+
// snapshot degrades to "world boots exactly as it always did today", never a boot failure.
|
|
201
212
|
try { await restoreWorldSnapshot(ctx) } catch (e) { console.error('[world-persistence] restore error:', e.message) }
|
|
202
213
|
|
|
203
214
|
// Host migration (client/HostMigration.js): the newly-elected host boots this SAME WorkerEntry.init()
|