castle-web-cli 0.4.239 → 0.4.241
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/dist/agent.js +5 -1
- package/dist/api.d.ts +20 -0
- package/dist/api.js +57 -0
- package/dist/bundle.d.ts +38 -1
- package/dist/bundle.js +309 -13
- package/dist/castle-host/host.js +163 -11
- package/dist/castleJson.d.ts +10 -0
- package/dist/castleJson.js +46 -2
- package/dist/check.js +5 -2
- package/dist/devSessionServer.js +4 -1
- package/dist/devSessionStorage.d.ts +1 -0
- package/dist/devSessionStorage.js +32 -7
- package/dist/importOrder.d.ts +2 -0
- package/dist/importOrder.js +29 -0
- package/dist/index.js +6 -3
- package/dist/init.js +24 -2
- package/dist/multiplayerDoc.d.ts +1 -1
- package/dist/multiplayerDoc.js +2 -0
- package/dist/platformDoc.js +3 -2
- package/dist/playPagePolicy.js +5 -1
- package/dist/resetLeaderboards.d.ts +8 -1
- package/dist/resetLeaderboards.js +43 -8
- package/dist/roomLogs.d.ts +1 -0
- package/dist/roomLogs.js +30 -6
- package/dist/save-deck.d.ts +32 -2
- package/dist/save-deck.js +240 -39
- package/kits/base/CLAUDE.md +1 -1
- package/kits/base/castle.json +1 -1
- package/kits/base/sdk/README.md +174 -6
- package/kits/base/sdk/analytics.d.ts +8 -0
- package/kits/base/sdk/analytics.js +92 -0
- package/kits/base/sdk/castle.d.ts +5 -1
- package/kits/base/sdk/castle.js +2 -0
- package/kits/base/sdk/commands.d.ts +48 -0
- package/kits/base/sdk/commands.js +1 -0
- package/kits/base/sdk/debugConsole.d.ts +17 -0
- package/kits/base/sdk/debugConsole.js +154 -0
- package/kits/base/sdk/experiments.js +24 -1
- package/kits/base/sdk/hostRetry.d.ts +7 -0
- package/kits/base/sdk/hostRetry.js +57 -0
- package/kits/base/sdk/hub.d.ts +20 -2
- package/kits/base/sdk/hub.js +99 -13
- package/kits/base/sdk/multiplayer.d.ts +2 -0
- package/kits/base/sdk/multiplayer.js +168 -26
- package/kits/base/sdk/reconnectBudget.d.ts +6 -0
- package/kits/base/sdk/reconnectBudget.js +41 -1
- package/kits/base/sdk/runtime.js +36 -19
- package/kits/base/sdk/server/hub.d.ts +19 -0
- package/kits/base/sdk/server/hub.js +12 -0
- package/kits/base/sdk/server/platformHandle.d.ts +1 -0
- package/kits/base/sdk/server/wrapper.d.ts +1 -1
- package/kits/base/sdk/server/wrapper.js +26 -1
- package/kits/base/sdk/transport.d.ts +2 -1
- package/kits/base/sdk/transport.js +35 -0
- package/kits/hub-game/CLAUDE.md +66 -19
- package/kits/hub-game/code/client/act.js +9 -6
- package/kits/hub-game/code/client/actCore.js +26 -6
- package/kits/hub-game/code/client/actGateLog.js +36 -0
- package/kits/hub-game/code/client/actionOverflow.js +29 -8
- package/kits/hub-game/code/client/actionRailSurface.js +186 -0
- package/kits/hub-game/code/client/actionRailTree.js +173 -0
- package/kits/hub-game/code/client/askSurface.js +85 -0
- package/kits/hub-game/code/client/askTree.js +51 -0
- package/kits/hub-game/code/client/attention.js +31 -6
- package/kits/hub-game/code/client/ballot.js +42 -5
- package/kits/hub-game/code/client/ballotSurface.js +115 -0
- package/kits/hub-game/code/client/ballotTree.js +180 -0
- package/kits/hub-game/code/client/catchingUp.js +19 -0
- package/kits/hub-game/code/client/celebrate.js +66 -0
- package/kits/hub-game/code/client/chrome.js +481 -57
- package/kits/hub-game/code/client/companion.js +93 -23
- package/kits/hub-game/code/client/companionDress.js +1 -1
- package/kits/hub-game/code/client/cornerSurface.js +106 -0
- package/kits/hub-game/code/client/cornerTree.js +83 -0
- package/kits/hub-game/code/client/decor.js +20 -11
- package/kits/hub-game/code/client/deviceStorage.js +121 -0
- package/kits/hub-game/code/client/disguise.js +23 -0
- package/kits/hub-game/code/client/disguiseDraw.js +87 -0
- package/kits/hub-game/code/client/dockSurface.js +206 -0
- package/kits/hub-game/code/client/dockTree.js +232 -0
- package/kits/hub-game/code/client/earned.js +29 -0
- package/kits/hub-game/code/client/emoteSurface.js +188 -0
- package/kits/hub-game/code/client/emoteTree.js +264 -0
- package/kits/hub-game/code/client/farAvatars.js +4 -3
- package/kits/hub-game/code/client/fpsTelemetry.js +3 -1
- package/kits/hub-game/code/client/grab.js +121 -50
- package/kits/hub-game/code/client/holdShow.js +19 -0
- package/kits/hub-game/code/client/hookLayer.js +96 -12
- package/kits/hub-game/code/client/hubControls.js +7 -1
- package/kits/hub-game/code/client/hudSurface.js +11 -3
- package/kits/hub-game/code/client/hudTree.js +7 -4
- package/kits/hub-game/code/client/idle.js +21 -3
- package/kits/hub-game/code/client/invites.js +24 -3
- package/kits/hub-game/code/client/keys.js +15 -0
- package/kits/hub-game/code/client/labelsNear.js +8 -1
- package/kits/hub-game/code/client/layoutCache.js +57 -8
- package/kits/hub-game/code/client/loadingCover.js +53 -4
- package/kits/hub-game/code/client/menuIcons.js +15 -0
- package/kits/hub-game/code/client/menuSurface.js +102 -0
- package/kits/hub-game/code/client/menuTree.js +135 -0
- package/kits/hub-game/code/client/modelLook.js +41 -0
- package/kits/hub-game/code/client/padCues.js +11 -7
- package/kits/hub-game/code/client/padReadability.js +3 -3
- package/kits/hub-game/code/client/pickerSurface.js +152 -0
- package/kits/hub-game/code/client/pickerTree.js +163 -0
- package/kits/hub-game/code/client/pushVisit.js +4 -2
- package/kits/hub-game/code/client/quality.js +188 -29
- package/kits/hub-game/code/client/qualityEntry.js +10 -1
- package/kits/hub-game/code/client/quickChatSurface.js +222 -0
- package/kits/hub-game/code/client/quickChatTree.js +201 -0
- package/kits/hub-game/code/client/rehello.js +75 -0
- package/kits/hub-game/code/client/renderVisibility.js +17 -0
- package/kits/hub-game/code/client/replay.js +118 -0
- package/kits/hub-game/code/client/role.js +3 -0
- package/kits/hub-game/code/client/safeLayout.js +441 -56
- package/kits/hub-game/code/client/safeStyle.js +13 -10
- package/kits/hub-game/code/client/say.js +2 -0
- package/kits/hub-game/code/client/soundSurface.js +77 -0
- package/kits/hub-game/code/client/soundTree.js +74 -0
- package/kits/hub-game/code/client/soundscape.js +12 -9
- package/kits/hub-game/code/client/soundscapeCues.js +1 -1
- package/kits/hub-game/code/client/state.js +67 -1
- package/kits/hub-game/code/client/stuckSurface.js +76 -0
- package/kits/hub-game/code/client/stuckTree.js +67 -0
- package/kits/hub-game/code/client/talk.js +42 -12
- package/kits/hub-game/code/client/talkTree.js +4 -2
- package/kits/hub-game/code/client/textAskSurface.js +147 -0
- package/kits/hub-game/code/client/textAskTree.js +67 -0
- package/kits/hub-game/code/client/tiers.js +252 -27
- package/kits/hub-game/code/client/together.js +4 -1
- package/kits/hub-game/code/client/uiDom.js +86 -8
- package/kits/hub-game/code/client/uiTree.js +33 -4
- package/kits/hub-game/code/client/vehicle.js +72 -51
- package/kits/hub-game/code/client/weakestTier.js +75 -31
- package/kits/hub-game/code/client/wear.js +159 -5
- package/kits/hub-game/code/client/worldLabels.js +205 -25
- package/kits/hub-game/code/companionSpec.js +4 -2
- package/kits/hub-game/code/server/act.js +3 -0
- package/kits/hub-game/code/server/actGate.js +83 -0
- package/kits/hub-game/code/server/actions.js +71 -15
- package/kits/hub-game/code/server/actors.js +20 -5
- package/kits/hub-game/code/server/analytics.js +35 -3
- package/kits/hub-game/code/server/ask.js +39 -3
- package/kits/hub-game/code/server/ballot.js +167 -4
- package/kits/hub-game/code/server/celebrate.js +64 -0
- package/kits/hub-game/code/server/companion.js +17 -2
- package/kits/hub-game/code/server/decor.js +11 -2
- package/kits/hub-game/code/server/disguise.js +63 -0
- package/kits/hub-game/code/server/earned.js +6 -2
- package/kits/hub-game/code/server/friendBests.js +13 -4
- package/kits/hub-game/code/server/friendsAmong.js +67 -8
- package/kits/hub-game/code/server/grab.js +12 -2
- package/kits/hub-game/code/server/heldOffers.js +142 -0
- package/kits/hub-game/code/server/holdShow.js +98 -0
- package/kits/hub-game/code/server/hub.js +991 -72
- package/kits/hub-game/code/server/idle.js +110 -9
- package/kits/hub-game/code/server/index.js +9 -0
- package/kits/hub-game/code/server/labels.js +13 -3
- package/kits/hub-game/code/server/manifest.js +94 -6
- package/kits/hub-game/code/server/menu.js +26 -3
- package/kits/hub-game/code/server/npcs.js +55 -9
- package/kits/hub-game/code/server/observe.js +67 -6
- package/kits/hub-game/code/server/players.js +14 -2
- package/kits/hub-game/code/server/replay.js +135 -0
- package/kits/hub-game/code/server/standing.js +7 -3
- package/kits/hub-game/code/server/storageLimit.js +4 -1
- package/kits/hub-game/code/server/townDay.js +74 -0
- package/kits/hub-game/code/server/vehicle.js +3 -0
- package/kits/hub-game/code/server/vis.js +26 -4
- package/kits/hub-game/code/server/wallet.js +677 -0
- package/kits/hub-game/code/server/wear.js +13 -3
- package/kits/hub-game/code/server/writerLease.js +191 -0
- package/kits/hub-game/code/shared/act.js +1 -1
- package/kits/hub-game/code/shared/expression.js +6 -0
- package/kits/hub-game/code/shared/replay.js +37 -0
- package/kits/hub-game/code/systems/hub.js +429 -55
- package/kits/hub-game/docs/analytics.md +16 -2
- package/kits/hub-game/docs/contract.md +956 -101
- package/kits/hub-game/docs/home-pieces.md +5 -6
- package/kits/hub-game/docs/observed-progress.md +49 -1
- package/kits/hub-game/docs/vehicle-preset.md +23 -0
- package/kits/hub-game/index.html +1 -0
- package/kits/hub-game/models/hats/baker-cap.pxmodel +3 -3
- package/kits/hub-game/models/hats/bat-clip.pxmodel +3 -3
- package/kits/hub-game/models/hats/beekeeper.pxmodel +3 -3
- package/kits/hub-game/models/hats/cap.pxmodel +3 -3
- package/kits/hub-game/models/hats/captain.pxmodel +3 -3
- package/kits/hub-game/models/hats/chef-toque.pxmodel +3 -3
- package/kits/hub-game/models/hats/crooked-top.pxmodel +3 -3
- package/kits/hub-game/models/hats/delivery-cap.pxmodel +3 -3
- package/kits/hub-game/models/hats/fire-helmet.pxmodel +3 -3
- package/kits/hub-game/models/hats/flower-crown.pxmodel +3 -3
- package/kits/hub-game/models/hats/foam-crown.pxmodel +3 -3
- package/kits/hub-game/models/hats/hard-hat.pxmodel +3 -3
- package/kits/hub-game/models/hats/lantern.pxmodel +3 -3
- package/kits/hub-game/models/hats/laurel.pxmodel +3 -3
- package/kits/hub-game/models/hats/lighthouse.pxmodel +3 -3
- package/kits/hub-game/models/hats/nurse-cap.pxmodel +3 -3
- package/kits/hub-game/models/hats/police-cap.pxmodel +3 -3
- package/kits/hub-game/models/hats/sailor.pxmodel +3 -3
- package/kits/hub-game/models/hats/souwester.pxmodel +3 -3
- package/kits/hub-game/models/hats/straw.pxmodel +3 -3
- package/kits/hub-game/models/hats/sunflower.pxmodel +3 -3
- package/kits/hub-game/models/hats/sweatband.pxmodel +3 -3
- package/kits/hub-game/models/hats/teacher-beret.pxmodel +3 -3
- package/kits/hub-game/models/hats/witch.pxmodel +3 -3
- package/kits/hub-game/models/hold-show/daisy.pxmodel +231 -0
- package/kits/hub-game/models/hold-show/moonflower.pxmodel +171 -0
- package/kits/hub-game/models/hold-show/rose.pxmodel +191 -0
- package/kits/hub-game/models/hold-show/square/daisy.pxmodel +233 -0
- package/kits/hub-game/models/hold-show/square/moonflower.pxmodel +173 -0
- package/kits/hub-game/models/hold-show/square/rose.pxmodel +193 -0
- package/kits/hub-game/models/hold-show/square/sunflower.pxmodel +313 -0
- package/kits/hub-game/models/hold-show/square/tulip.pxmodel +133 -0
- package/kits/hub-game/models/hold-show/sunflower.pxmodel +311 -0
- package/kits/hub-game/models/hold-show/tulip.pxmodel +131 -0
- package/kits/hub-game/package-lock.json +3 -3
- package/kits/hub-game/package.json +4 -3
- package/kits/hub-game/scripts/fixtures/engine-models-stub.mjs +1 -0
- package/kits/hub-game/scripts/fixtures/hud-surface.json +12 -12
- package/kits/hub-game/scripts/fixtures/talk-surface.json +8 -8
- package/kits/hub-game/scripts/gen-hats.mjs +1 -1
- package/kits/hub-game/scripts/gen-hold-show.mjs +27 -0
- package/kits/hub-game/scripts/pack.mjs +89 -23
- package/kits/hub-game/scripts/test-act-client.mjs +5 -0
- package/kits/hub-game/scripts/test-act-core.mjs +32 -0
- package/kits/hub-game/scripts/test-act-gate.mjs +186 -0
- package/kits/hub-game/scripts/test-action-rail-crowded-dom.mjs +7 -1
- package/kits/hub-game/scripts/test-action-rail-default-dom.mjs +102 -0
- package/kits/hub-game/scripts/test-action-rail-never-silent-dom.mjs +50 -0
- package/kits/hub-game/scripts/test-action-rail-surface.mjs +368 -0
- package/kits/hub-game/scripts/test-action-rail-town-jobs-dom.mjs +118 -0
- package/kits/hub-game/scripts/test-actions-client.mjs +5 -3
- package/kits/hub-game/scripts/test-actions.mjs +24 -0
- package/kits/hub-game/scripts/test-actors.mjs +19 -0
- package/kits/hub-game/scripts/test-again-corner-dom.mjs +59 -0
- package/kits/hub-game/scripts/test-analytics.mjs +79 -0
- package/kits/hub-game/scripts/test-arrival-pose-server.mjs +25 -8
- package/kits/hub-game/scripts/test-ask-client.mjs +9 -0
- package/kits/hub-game/scripts/test-ask-surface.mjs +188 -0
- package/kits/hub-game/scripts/test-attention.mjs +43 -1
- package/kits/hub-game/scripts/test-ballot-sheet-dom.mjs +71 -0
- package/kits/hub-game/scripts/test-ballot-surface.mjs +276 -0
- package/kits/hub-game/scripts/test-ballot.mjs +421 -4
- package/kits/hub-game/scripts/test-ban-join.mjs +1 -1
- package/kits/hub-game/scripts/test-celebrate-client.mjs +62 -0
- package/kits/hub-game/scripts/test-celebrate.mjs +116 -0
- package/kits/hub-game/scripts/test-chat.mjs +73 -0
- package/kits/hub-game/scripts/test-companion-client.mjs +203 -21
- package/kits/hub-game/scripts/test-companion.mjs +110 -3
- package/kits/hub-game/scripts/test-control-layout-dom.mjs +57 -10
- package/kits/hub-game/scripts/test-corner-surface.mjs +268 -0
- package/kits/hub-game/scripts/test-decor-client.mjs +59 -3
- package/kits/hub-game/scripts/test-decor.mjs +27 -0
- package/kits/hub-game/scripts/test-device-class.mjs +4 -1
- package/kits/hub-game/scripts/test-disguise-client.mjs +281 -0
- package/kits/hub-game/scripts/test-disguise.mjs +176 -0
- package/kits/hub-game/scripts/test-dock-surface.mjs +404 -0
- package/kits/hub-game/scripts/test-door-stay-client.mjs +602 -0
- package/kits/hub-game/scripts/test-door-stay.mjs +613 -0
- package/kits/hub-game/scripts/test-earned-client.mjs +119 -0
- package/kits/hub-game/scripts/test-emote-surface.mjs +616 -0
- package/kits/hub-game/scripts/test-fps-telemetry.mjs +39 -4
- package/kits/hub-game/scripts/test-friend-bests.mjs +38 -12
- package/kits/hub-game/scripts/test-ghost-click-dom.mjs +75 -0
- package/kits/hub-game/scripts/test-grab-client.mjs +29 -2
- package/kits/hub-game/scripts/test-grab-orbit.mjs +260 -11
- package/kits/hub-game/scripts/test-grab.mjs +10 -1
- package/kits/hub-game/scripts/test-hats.mjs +28 -0
- package/kits/hub-game/scripts/test-held-offers.mjs +394 -0
- package/kits/hub-game/scripts/test-high-only.mjs +3 -3
- package/kits/hub-game/scripts/test-hold-show-client.mjs +175 -0
- package/kits/hub-game/scripts/test-hold-show.mjs +355 -0
- package/kits/hub-game/scripts/test-hub-controls.mjs +3 -1
- package/kits/hub-game/scripts/test-hub-idle.mjs +348 -0
- package/kits/hub-game/scripts/test-hub-leaving.mjs +21 -0
- package/kits/hub-game/scripts/test-hub-ops.mjs +119 -0
- package/kits/hub-game/scripts/test-hub-trip.mjs +240 -4
- package/kits/hub-game/scripts/test-hud-clear.mjs +83 -0
- package/kits/hub-game/scripts/test-hud-rate.mjs +2 -1
- package/kits/hub-game/scripts/test-idle.mjs +160 -0
- package/kits/hub-game/scripts/test-invites-client.mjs +53 -0
- package/kits/hub-game/scripts/test-labels.mjs +11 -0
- package/kits/hub-game/scripts/test-landscape-layout.mjs +20 -0
- package/kits/hub-game/scripts/test-loading-cover.mjs +67 -1
- package/kits/hub-game/scripts/test-manifest.mjs +27 -0
- package/kits/hub-game/scripts/test-menu-client.mjs +54 -5
- package/kits/hub-game/scripts/test-menu-surface.mjs +236 -0
- package/kits/hub-game/scripts/test-npcs.mjs +128 -0
- package/kits/hub-game/scripts/test-observed.mjs +171 -3
- package/kits/hub-game/scripts/test-pack.mjs +166 -0
- package/kits/hub-game/scripts/test-pad-cues.mjs +39 -0
- package/kits/hub-game/scripts/test-picker-surface.mjs +321 -0
- package/kits/hub-game/scripts/test-placeat-server.mjs +648 -0
- package/kits/hub-game/scripts/test-placement-cache.mjs +1 -1
- package/kits/hub-game/scripts/test-pointer-clear-dom.mjs +82 -0
- package/kits/hub-game/scripts/test-progress-reset.mjs +184 -6
- package/kits/hub-game/scripts/test-push-visit.mjs +9 -0
- package/kits/hub-game/scripts/test-quality.mjs +312 -9
- package/kits/hub-game/scripts/test-quick-chat-surface.mjs +511 -0
- package/kits/hub-game/scripts/test-rehello.mjs +242 -3
- package/kits/hub-game/scripts/test-rejoin-yaw.mjs +138 -0
- package/kits/hub-game/scripts/test-relations-among.mjs +13 -7
- package/kits/hub-game/scripts/test-relations-refresh.mjs +90 -2
- package/kits/hub-game/scripts/test-replay-client.mjs +110 -0
- package/kits/hub-game/scripts/test-replay.mjs +178 -0
- package/kits/hub-game/scripts/test-resume-held.mjs +13 -0
- package/kits/hub-game/scripts/test-resume-pose-server.mjs +43 -5
- package/kits/hub-game/scripts/test-role-client.mjs +2 -1
- package/kits/hub-game/scripts/test-safe-act.mjs +233 -0
- package/kits/hub-game/scripts/test-safe-caption.mjs +364 -0
- package/kits/hub-game/scripts/test-safe-layout.mjs +79 -0
- package/kits/hub-game/scripts/test-safe-prompt.mjs +163 -0
- package/kits/hub-game/scripts/test-sound-surface.mjs +256 -0
- package/kits/hub-game/scripts/test-soundscape.mjs +85 -2
- package/kits/hub-game/scripts/test-standing.mjs +135 -2
- package/kits/hub-game/scripts/test-stuck-surface.mjs +174 -0
- package/kits/hub-game/scripts/test-stuck.mjs +36 -1
- package/kits/hub-game/scripts/test-talk-surface.mjs +23 -6
- package/kits/hub-game/scripts/test-talk-walk-dom.mjs +123 -0
- package/kits/hub-game/scripts/test-text-ask-surface.mjs +273 -0
- package/kits/hub-game/scripts/test-tiers.mjs +453 -3
- package/kits/hub-game/scripts/test-toast-no-row-dom.mjs +71 -0
- package/kits/hub-game/scripts/test-together.mjs +11 -0
- package/kits/hub-game/scripts/test-town-day.mjs +90 -0
- package/kits/hub-game/scripts/test-try-on.mjs +39 -0
- package/kits/hub-game/scripts/test-ui-dom-dom.mjs +49 -2
- package/kits/hub-game/scripts/test-ui-tree.mjs +28 -0
- package/kits/hub-game/scripts/test-vehicle-client.mjs +68 -1
- package/kits/hub-game/scripts/test-vis.mjs +145 -0
- package/kits/hub-game/scripts/test-wallet.mjs +650 -0
- package/kits/hub-game/scripts/test-weakest-tier.mjs +135 -1
- package/kits/hub-game/scripts/test-world-labels.mjs +340 -0
- package/kits/hub-game/scripts/test-writer-lease-server.mjs +234 -0
- package/kits/hub-game/scripts/test-writer-lease.mjs +281 -0
- package/kits/hub-game/scripts/writer-storage-fixture.mjs +37 -0
- package/kits/hub-game/tools/hubScene/export.mjs +6 -5
- package/kits/hub-game/tools/hubScene/hubdata.mjs +10 -0
- package/kits/hub-game/tools/hubScene/test/export-fixture.mjs +36 -2
- package/kits/hub-game/tools/hubScene/validate-manifest.mjs +10 -2
- package/kits/multiplayer-3d/castle.json +5 -5
- package/kits/multiplayer-3d/code/client/resumeGate.js +66 -2
- package/kits/multiplayer-3d/code/server/ownership.js +25 -6
- package/kits/multiplayer-3d/code/server/world.js +19 -4
- package/kits/multiplayer-3d/code/systems/multiplayer.js +108 -18
- package/kits/multiplayer-3d/package-lock.json +1 -1
- package/kits/multiplayer-3d/package.json +2 -1
- package/kits/multiplayer-3d/scripts/test-ground-half.mjs +56 -0
- package/kits/multiplayer-3d/scripts/test-join-watchdog.mjs +54 -3
- package/kits/multiplayer-3d/scripts/test-owned-moves.mjs +190 -0
- package/kits/multiplayer-3d/scripts/test-resume-gate.mjs +417 -5
- package/kits/multiplayer-3d/scripts/test-resync-reconnect.mjs +68 -0
- package/kits/physics-2d/castle.json +2 -2
- package/kits/physics-2d/engine/scene.js +10 -2
- package/kits/physics-3d/CLAUDE.md +14 -0
- package/kits/physics-3d/behaviors/Player.jsx +39 -3
- package/kits/physics-3d/castle.json +3 -3
- package/kits/physics-3d/docs/engine-model-cache.md +109 -0
- package/kits/physics-3d/docs/engine-player.md +76 -0
- package/kits/physics-3d/docs/engine-skip-work.md +16 -0
- package/kits/physics-3d/docs/pxmodel-format.md +5 -1
- package/kits/physics-3d/engine3d/gait.js +16 -8
- package/kits/physics-3d/engine3d/groundsize.js +23 -0
- package/kits/physics-3d/engine3d/kithooks.js +50 -0
- package/kits/physics-3d/engine3d/look.js +110 -17
- package/kits/physics-3d/engine3d/lookbake.js +19 -1
- package/kits/physics-3d/engine3d/materialpresets.js +3 -2
- package/kits/physics-3d/engine3d/modelcache.js +280 -0
- package/kits/physics-3d/engine3d/modelcachedigest.js +37 -0
- package/kits/physics-3d/engine3d/modelcachegate.js +69 -0
- package/kits/physics-3d/engine3d/modelrefs.js +13 -0
- package/kits/physics-3d/engine3d/optimize.js +20 -9
- package/kits/physics-3d/engine3d/playerRun.js +26 -1
- package/kits/physics-3d/engine3d/pxmodel.js +7 -3
- package/kits/physics-3d/engine3d/templatecache.js +722 -0
- package/kits/physics-3d/engine3d/world3d.js +211 -17
- package/kits/physics-3d/package-lock.json +1 -1
- package/kits/physics-3d/package.json +2 -1
- package/kits/physics-3d/play/behaviors/Player.js +43 -3
- package/kits/physics-3d/scripts/render.mjs +56 -8
- package/kits/physics-3d/scripts/template-cache-fixtures.mjs +37 -0
- package/kits/physics-3d/scripts/template-cache-v1-bytes.json +49 -0
- package/kits/physics-3d/scripts/test-coaxial-escape.mjs +176 -0
- package/kits/physics-3d/scripts/test-gait.mjs +53 -9
- package/kits/physics-3d/scripts/test-ground-half.mjs +120 -0
- package/kits/physics-3d/scripts/test-model-cache.mjs +600 -0
- package/kits/physics-3d/scripts/test-orbit-shadow-fade.mjs +1 -0
- package/kits/physics-3d/scripts/test-sleeping-models.mjs +384 -0
- package/kits/physics-3d/scripts/test-template-cache-minified.mjs +106 -0
- package/kits/physics-3d/scripts/test-template-cache.mjs +519 -0
- package/kits/physics-3d/scripts/test-wall-slide.mjs +272 -0
- package/kits/physics-3d/systems/physics3d.js +59 -2
- package/kits/real-time/castle.json +2 -2
- package/kits/real-time/code/client/connection.js +3 -0
- package/package.json +2 -2
- package/vendor/three/examples/jsm/libs/fflate.module.js +2672 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// The default world view: goals already become pointers, other actor labels
|
|
2
2
|
// use the existing three-slot distance/hysteresis rule in games as well.
|
|
3
|
-
import { makeLayoutCache } from './layoutCache.js';
|
|
3
|
+
import { makeLayoutCache, surfacePrint } from './layoutCache.js';
|
|
4
4
|
import { near } from './labelsNear.js';
|
|
5
5
|
import { clearBox } from './padOccupancy.js';
|
|
6
6
|
import { overlaps, reservedCorners } from './safeLayout.js';
|
|
@@ -27,7 +27,15 @@ export function relevantLabels(state, items, view, now) {
|
|
|
27
27
|
// Pointers keep their words before ordinary labels. Labels retain their world
|
|
28
28
|
// anchor: when there is no clear air there, they collapse instead of becoming
|
|
29
29
|
// a second row of HUD. Speech/emotes/marks participate in clearance too.
|
|
30
|
-
|
|
30
|
+
// A plate or a sign (`clamp`) whose anchor is on screen slides onto it rather
|
|
31
|
+
// than being dropped at the edge, and one over the player's own avatar (one
|
|
32
|
+
// of `around`) steps just above or beside it; a control still drops it.
|
|
33
|
+
// An NPC's line (`edge`) is pinned to the screen edge by its caller, so a
|
|
34
|
+
// sub-pixel past the margin, or under a tighter world bound, it slides on.
|
|
35
|
+
// Over its own Talk prompt, a reserved corner or any card or control it
|
|
36
|
+
// steps to the nearest clear slot (`edgeSlot`) instead of being hidden; it
|
|
37
|
+
// never steps around the avatar, which it is already drawn over.
|
|
38
|
+
export function worldPlacement(pointers, labels, controls, view, around = []) {
|
|
31
39
|
const insets = view.insets ?? { top: 0, right: 0, bottom: 0, left: 0 };
|
|
32
40
|
const world = view.world;
|
|
33
41
|
const bounds = {
|
|
@@ -50,15 +58,73 @@ export function worldPlacement(pointers, labels, controls, view) {
|
|
|
50
58
|
if (placed) {taken.push(placed);}
|
|
51
59
|
return placed;
|
|
52
60
|
});
|
|
61
|
+
const inside = (box) => box.left >= bounds.left && box.right <= bounds.right && box.top >= bounds.top && box.bottom <= bounds.bottom;
|
|
62
|
+
const clear = (box, ignore) => !taken.some((other) => other !== ignore && overlaps(box, other));
|
|
53
63
|
const labelBoxes = labels.map((box) => {
|
|
54
|
-
|
|
55
|
-
if (!
|
|
56
|
-
|
|
57
|
-
|
|
64
|
+
let placed = inside(box) && clear(box, box.ignoreObstacle) ? box : null;
|
|
65
|
+
if (!placed && box.clamp) {
|
|
66
|
+
const at = clampTo(box, bounds);
|
|
67
|
+
const w = box.right - box.left, h = box.bottom - box.top;
|
|
68
|
+
const moves = at ? [at, ...around.filter((o) => overlaps(at, o)).flatMap((o) => [
|
|
69
|
+
{ left: at.left, right: at.right, top: o.top - 8 - h, bottom: o.top - 8 },
|
|
70
|
+
{ left: o.left - 8 - w, right: o.left - 8, top: at.top, bottom: at.bottom },
|
|
71
|
+
{ left: o.right + 8, right: o.right + 8 + w, top: at.top, bottom: at.bottom },
|
|
72
|
+
])] : [];
|
|
73
|
+
placed = moves.filter((move) => inside(move) && clear(move, box.ignoreObstacle))
|
|
74
|
+
.sort((a, b) => Math.hypot(a.left - box.left, a.top - box.top) - Math.hypot(b.left - box.left, b.top - box.top))[0] ?? null;
|
|
75
|
+
} else if (!placed && box.edge) {
|
|
76
|
+
placed = edgeSlot(box, bounds, taken, inside, clear);
|
|
77
|
+
}
|
|
78
|
+
if (placed) {taken.push(placed);}
|
|
79
|
+
return placed;
|
|
58
80
|
});
|
|
59
81
|
return { pointers: pointerBoxes, labels: labelBoxes };
|
|
60
82
|
}
|
|
61
83
|
|
|
84
|
+
// Where an NPC's line goes when its slid box is covered: the nearest clear
|
|
85
|
+
// slot higher up (above its own Talk prompt, beside a reserved corner as
|
|
86
|
+
// well if need be), then the nearest clear slot beside or below, then the same search
|
|
87
|
+
// for its first line alone (`box.line` tall; the result carries `line: true`
|
|
88
|
+
// and the chrome clips the rest). Slots stand 8 px off what they step around
|
|
89
|
+
// and stay within a label's width, and twice its height, of where it was
|
|
90
|
+
// slid to. Null when the anchor is off `bounds` or nothing is clear.
|
|
91
|
+
function edgeSlot(box, bounds, taken, inside, clear) {
|
|
92
|
+
const at = clampTo(box, bounds);
|
|
93
|
+
if (!at) {return null;}
|
|
94
|
+
if (inside(at) && clear(at, box.ignoreObstacle)) {return at;}
|
|
95
|
+
const w = at.right - at.left, h = at.bottom - at.top;
|
|
96
|
+
const reach = { left: at.left - w - 8, right: at.right + w + 8, top: at.top - 2 * h - 16, bottom: at.bottom + 2 * h + 16 };
|
|
97
|
+
const near = taken.filter((other) => other !== box.ignoreObstacle && overlaps(other, reach));
|
|
98
|
+
const lefts = [...new Set([at.left, bounds.left, bounds.right - w, ...near.flatMap((other) => [other.left - 8 - w, other.right + 8])])]
|
|
99
|
+
.filter((left) => Math.abs(left - at.left) <= w + 8);
|
|
100
|
+
const slot = (height) => {
|
|
101
|
+
const tops = [...new Set([at.top, at.bottom - height, bounds.top, bounds.bottom - height,
|
|
102
|
+
...near.flatMap((other) => [other.top - 8 - height, other.bottom + 8])])]
|
|
103
|
+
.filter((top) => top >= reach.top && top + height <= reach.bottom);
|
|
104
|
+
const rank = (move) => [move.bottom < at.bottom - 0.5 ? 0 : 1, Math.hypot(move.left - at.left, move.bottom - at.bottom)];
|
|
105
|
+
return tops.flatMap((top) => lefts.map((left) => ({ left, right: left + w, top, bottom: top + height })))
|
|
106
|
+
.filter((move) => inside(move) && clear(move, box.ignoreObstacle))
|
|
107
|
+
.map((move) => ({ move, key: rank(move) }))
|
|
108
|
+
.sort((a, b) => a.key[0] - b.key[0] || a.key[1] - b.key[1])[0]?.move ?? null;
|
|
109
|
+
};
|
|
110
|
+
const whole = slot(h);
|
|
111
|
+
if (whole || !(box.line > 0 && box.line < h - 0.5)) {return whole;}
|
|
112
|
+
const first = slot(box.line);
|
|
113
|
+
return first && { ...first, line: true };
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
// A label slid inside `bounds`, or null when its anchor (the middle of its
|
|
117
|
+
// bottom edge) is off them or it is wider or taller than they are.
|
|
118
|
+
function clampTo(box, bounds) {
|
|
119
|
+
const w = box.right - box.left, h = box.bottom - box.top;
|
|
120
|
+
const x = (box.left + box.right) / 2;
|
|
121
|
+
if (x < bounds.left || x > bounds.right || box.bottom < bounds.top || box.bottom > bounds.bottom
|
|
122
|
+
|| w > bounds.right - bounds.left || h > bounds.bottom - bounds.top) {return null;}
|
|
123
|
+
const left = Math.min(Math.max(box.left, bounds.left), bounds.right - w);
|
|
124
|
+
const top = Math.min(Math.max(box.top, bounds.top), bounds.bottom - h);
|
|
125
|
+
return { left, right: left + w, top, bottom: top + h };
|
|
126
|
+
}
|
|
127
|
+
|
|
62
128
|
// Try whole-width vertical bands first; the DOM pass can reflow on failure.
|
|
63
129
|
export function captionBand(box, controls, view) {
|
|
64
130
|
const height = box.bottom - box.top;
|
|
@@ -117,28 +183,91 @@ function captionSlot(box, controls, view) {
|
|
|
117
183
|
return null;
|
|
118
184
|
}
|
|
119
185
|
|
|
120
|
-
|
|
186
|
+
const reflowKeys = ['width', 'maxWidth', 'left', 'right', 'boxSizing', 'whiteSpace', 'maxHeight', 'overflowY', 'pointerEvents'];
|
|
187
|
+
|
|
188
|
+
// Everything outside a caption's own text and inline style that can resize
|
|
189
|
+
// it unseen under its reflow: the attributes of it and every ancestor, the
|
|
190
|
+
// style sheets and their rule counts, loaded fonts and the pixel ratio.
|
|
191
|
+
const sheetIds = new WeakMap();
|
|
192
|
+
let sheets = 0;
|
|
193
|
+
function surroundings(node, geometry) {
|
|
194
|
+
const parts = [geometry.fontEpoch?.(), globalThis.devicePixelRatio];
|
|
195
|
+
for (let at = node; at; at = at.parentElement ?? at.parent) {
|
|
196
|
+
parts.push('/', at.className);
|
|
197
|
+
for (const name of at.getAttributeNames?.() ?? []) {
|
|
198
|
+
if (at !== node || name !== 'style') {parts.push(name, at.getAttribute(name));}
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
const doc = globalThis.document;
|
|
202
|
+
for (const sheet of [...(doc?.styleSheets ?? []), ...(doc?.adoptedStyleSheets ?? [])]) {
|
|
203
|
+
if (!sheetIds.has(sheet)) {sheetIds.set(sheet, sheets += 1);}
|
|
204
|
+
let rules = null;
|
|
205
|
+
try {rules = sheet.cssRules?.length;} catch {/* A cross-origin sheet's rules are unreadable. */}
|
|
206
|
+
parts.push(sheetIds.get(sheet), rules, sheet.disabled, sheet.media?.mediaText);
|
|
207
|
+
}
|
|
208
|
+
return parts.join('\u0001');
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
// `held(node)` is the box a control held before safe layout moved or hid it
|
|
212
|
+
// (an act prompt): labels and pointers make way for that box, as before.
|
|
213
|
+
export function makeWorldLayout(entries, view, obstacles = () => [], geometry = makeLayoutCache(), held = () => null) {
|
|
121
214
|
const hidden = new Set();
|
|
122
215
|
const shifted = new Map();
|
|
123
216
|
const reflowed = new Map();
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
217
|
+
// A caption's last reflow and everything it was fitted to. While none of
|
|
218
|
+
// it changes, the reflowed styles stay written and the natural sample
|
|
219
|
+
// stands in for the restored caption's box.
|
|
220
|
+
const kept = new Map();
|
|
221
|
+
// Captions held with their natural sample, as if restored at frame start.
|
|
222
|
+
const restoredEarly = new Set();
|
|
223
|
+
// `early`: the plain reset would have restored this caption already, so
|
|
224
|
+
// a style another writer set since then is theirs to keep.
|
|
225
|
+
function restore(node, early = false) {
|
|
226
|
+
const styles = reflowed.get(node), written = kept.get(node)?.written;
|
|
227
|
+
if (!styles) {return;}
|
|
228
|
+
Object.assign(node.style, early ? Object.fromEntries(Object.entries(styles).filter(([key]) => node.style[key] === written[key])) : styles);
|
|
229
|
+
// The snapshot may contain the narrower caption from the last flush.
|
|
230
|
+
geometry.invalidate(node);
|
|
231
|
+
reflowed.delete(node); kept.delete(node); restoredEarly.delete(node);
|
|
131
232
|
}
|
|
132
|
-
|
|
233
|
+
const hold = (node) => {
|
|
234
|
+
const record = kept.get(node);
|
|
235
|
+
if (geometry.hold?.(node, record?.natural, () => restore(node, true), () => surroundings(node, geometry) === record.surroundings) !== true) {return false;}
|
|
236
|
+
restoredEarly.add(node);
|
|
237
|
+
return true;
|
|
238
|
+
};
|
|
239
|
+
// At a frame's start the caption must still be drawn where it was fitted
|
|
240
|
+
// in the same viewport, with nothing inline changed since (layout moves
|
|
241
|
+
// in 1/64px units).
|
|
242
|
+
const drawnAsKept = (node) => {
|
|
243
|
+
const record = kept.get(node);
|
|
244
|
+
if (!record || !geometry.active?.() || surfacePrint(node) !== record.print || JSON.stringify(view()) !== record.viewport) {return false;}
|
|
245
|
+
const box = geometry.rect(node);
|
|
246
|
+
return ['left', 'right', 'top', 'bottom'].every((side) => Math.abs(box[side] - record.box[side]) < 0.005);
|
|
247
|
+
};
|
|
248
|
+
// NPC lines drawn as their first line alone: node -> its own clip-path.
|
|
249
|
+
const clipped = new Map();
|
|
250
|
+
function unplace() {
|
|
133
251
|
for (const node of hidden) {node.style.visibility = '';}
|
|
134
252
|
for (const [node, value] of shifted) {node.style.translate = value;}
|
|
135
|
-
|
|
136
|
-
hidden.clear(); shifted.clear();
|
|
253
|
+
for (const [node, value] of clipped) {node.style.clipPath = value;}
|
|
254
|
+
hidden.clear(); shifted.clear(); clipped.clear();
|
|
255
|
+
}
|
|
256
|
+
// `keep` is the frame-start reset: an unchanged reflow waits for the flush.
|
|
257
|
+
function begin(keep = false) {
|
|
258
|
+
unplace();
|
|
259
|
+
for (const node of [...reflowed.keys()]) {
|
|
260
|
+
if (!keep || !drawnAsKept(node) || !hold(node)) {restore(node);}
|
|
261
|
+
}
|
|
137
262
|
}
|
|
138
263
|
function flush() {
|
|
139
264
|
// Width restoration changes wrapping, so only those captions need a fresh
|
|
140
|
-
// DOM read. Ordinary surfaces keep using the frame-start snapshot.
|
|
141
|
-
|
|
265
|
+
// DOM read. Ordinary surfaces keep using the frame-start snapshot. A
|
|
266
|
+
// reflow held unchanged since then keeps its styles until compared below;
|
|
267
|
+
// one held only since the last flush stands for a restore made here.
|
|
268
|
+
for (const node of [...reflowed.keys()]) {
|
|
269
|
+
if (!geometry.held?.(node) || (!restoredEarly.has(node) && !hold(node))) {restore(node);}
|
|
270
|
+
}
|
|
142
271
|
const surfaces = entries();
|
|
143
272
|
const styleHides = (style) => style?.display === 'none' || style?.visibility === 'hidden' || style?.opacity === '0';
|
|
144
273
|
// Surfaces share their layers, so each ancestor's style is read once per
|
|
@@ -178,11 +307,13 @@ export function makeWorldLayout(entries, view, obstacles = () => [], geometry =
|
|
|
178
307
|
const measured = surfaces.map((entry) => ({ ...entry, box: visible(entry) })).filter((entry) => entry.box);
|
|
179
308
|
// Restore the previous pass after reading its unshifted boxes, before the
|
|
180
309
|
// caption pass records this flush's shifts, hides and reflowed styles.
|
|
181
|
-
|
|
310
|
+
unplace();
|
|
182
311
|
// Text bands yield to navigation, but never escape the viewport while
|
|
183
312
|
// doing so. Dense lanes reflow into a narrower gap before world labels.
|
|
184
313
|
const viewport = view();
|
|
185
314
|
const captions = ['hud-prompt', 'engine-look'].flatMap((id) => measured.filter((entry) => entry.id === id));
|
|
315
|
+
const menu = measured.some((entry) => entry.id === 'menu' || entry.node.dataset?.hub === 'action-sheet');
|
|
316
|
+
const fitted = new Set();
|
|
186
317
|
for (const caption of captions) {
|
|
187
318
|
// A caption safe layout already placed keeps that place and is cleared
|
|
188
319
|
// where it is drawn. One laid out wholly off-screen (a parked engine
|
|
@@ -196,9 +327,26 @@ export function makeWorldLayout(entries, view, obstacles = () => [], geometry =
|
|
|
196
327
|
.map(({ x, y, w, h }) => ({ left: x, right: x + w, top: y, bottom: y + h })));
|
|
197
328
|
let box = caption.box;
|
|
198
329
|
let placed = captionBand(box, controls, viewport);
|
|
330
|
+
const record = kept.get(caption.node);
|
|
331
|
+
let natural = null, around = null;
|
|
332
|
+
// The width search reads only the DOM and these inputs, so an
|
|
333
|
+
// unchanged caption would find the same width and slot again.
|
|
334
|
+
if (!placed && reflowed.has(caption.node) && record?.menu === menu
|
|
335
|
+
&& record.viewport === JSON.stringify(viewport) && record.controls === JSON.stringify(controls)) {
|
|
336
|
+
({ box, placed } = record);
|
|
337
|
+
fitted.add(caption.node);
|
|
338
|
+
} else if (reflowed.has(caption.node)) {
|
|
339
|
+
// Otherwise a held caption is restored and measured afresh.
|
|
340
|
+
restore(caption.node, restoredEarly.has(caption.node));
|
|
341
|
+
box = caption.box = geometry.rect(caption.node);
|
|
342
|
+
placed = captionBand(box, controls, viewport);
|
|
343
|
+
}
|
|
199
344
|
if (!placed) {
|
|
345
|
+
natural = geometry.fresh?.(caption.node);
|
|
346
|
+
around = natural && surroundings(caption.node, geometry);
|
|
200
347
|
const style = caption.node.style;
|
|
201
|
-
reflowed.set(caption.node, Object.fromEntries(
|
|
348
|
+
reflowed.set(caption.node, Object.fromEntries(reflowKeys.map((key) => [key, style[key]])));
|
|
349
|
+
fitted.add(caption.node);
|
|
202
350
|
for (const width of captionWidths(controls, viewport)) {
|
|
203
351
|
Object.assign(style, { width: `${width}px`, maxWidth: `${width}px`, left: `${(viewport.w - width) / 2}px`, right: 'auto', boxSizing: 'border-box', whiteSpace: 'normal' });
|
|
204
352
|
box = geometry.rect(caption.node);
|
|
@@ -210,7 +358,6 @@ export function makeWorldLayout(entries, view, obstacles = () => [], geometry =
|
|
|
210
358
|
// A menu owns its reading surface until it closes. Outside a menu,
|
|
211
359
|
// make a one-line scrollable caption in a measured gap, preserving
|
|
212
360
|
// access to the full words even when the complete paragraph won't fit.
|
|
213
|
-
const menu = measured.some((entry) => entry.id === 'menu' || entry.node.dataset?.hub === 'action-sheet');
|
|
214
361
|
if (!menu) {
|
|
215
362
|
for (const width of captionWidths(controls, viewport)) {
|
|
216
363
|
Object.assign(caption.node.style, { width: `${width}px`, maxWidth: `${width}px`, left: `${(viewport.w - width) / 2}px`, right: 'auto', maxHeight: '21px', overflowY: 'auto', pointerEvents: 'auto' });
|
|
@@ -224,21 +371,54 @@ export function makeWorldLayout(entries, view, obstacles = () => [], geometry =
|
|
|
224
371
|
continue;
|
|
225
372
|
}
|
|
226
373
|
}
|
|
374
|
+
const sample = natural && geometry.sample(caption.node);
|
|
375
|
+
if (sample) {
|
|
376
|
+
kept.set(caption.node, { natural, sample, box, placed, menu, print: surfacePrint(caption.node), surroundings: around,
|
|
377
|
+
written: Object.fromEntries(reflowKeys.map((key) => [key, caption.node.style[key]])),
|
|
378
|
+
viewport: JSON.stringify(viewport), controls: JSON.stringify(controls) });
|
|
379
|
+
}
|
|
227
380
|
if (placed.left !== box.left || placed.top !== box.top) {
|
|
228
381
|
shifted.set(caption.node, caption.node.style.translate);
|
|
229
382
|
caption.node.style.translate = `${placed.left - box.left}px ${placed.top - box.top}px`;
|
|
230
383
|
}
|
|
384
|
+
// Later reads this frame see the reflowed sample, as after a search.
|
|
385
|
+
if (fitted.has(caption.node) && kept.has(caption.node)) {
|
|
386
|
+
geometry.hold(caption.node, kept.get(caption.node).sample);
|
|
387
|
+
restoredEarly.delete(caption.node);
|
|
388
|
+
}
|
|
231
389
|
caption.box = { left: placed.left, right: placed.right, top: placed.top, bottom: placed.top + box.bottom - box.top };
|
|
232
390
|
}
|
|
391
|
+
for (const node of [...reflowed.keys()]) {
|
|
392
|
+
if (!fitted.has(node)) {restore(node, restoredEarly.has(node));}
|
|
393
|
+
}
|
|
233
394
|
const pointers = measured.filter((entry) => entry.kind === 'pointer' && entry.id !== 'stuck')
|
|
234
395
|
.sort((a, b) => Number(b.id?.startsWith('pointer:goal:') === true) - Number(a.id?.startsWith('pointer:goal:') === true));
|
|
235
396
|
const labels = measured.filter((entry) => entry.kind === 'label');
|
|
236
|
-
const controls = measured.filter((entry) => (entry.kind !== 'pointer' || entry.id === 'stuck') && entry.kind !== 'label').map((entry) => entry.box)
|
|
237
|
-
|
|
238
|
-
|
|
397
|
+
const controls = measured.filter((entry) => (entry.kind !== 'pointer' || entry.id === 'stuck') && entry.kind !== 'label' && !held(entry.node)).map((entry) => entry.box)
|
|
398
|
+
.concat(surfaces.map((entry) => held(entry.node)).filter(Boolean));
|
|
399
|
+
const around = obstacles();
|
|
400
|
+
// An NPC line's one-line form: the slot is its line box and both
|
|
401
|
+
// paddings; what stays drawn ends at its first line's foot (`firstLine`),
|
|
402
|
+
// since the second line starts there and its glyphs would show through
|
|
403
|
+
// the bottom padding.
|
|
404
|
+
const firstLine = new Map();
|
|
405
|
+
const lineOf = (node) => {
|
|
406
|
+
const style = globalThis.getComputedStyle?.(node) ?? node.style;
|
|
407
|
+
const line = Number.parseFloat(style?.lineHeight);
|
|
408
|
+
if (!Number.isFinite(line)) {return null;}
|
|
409
|
+
const top = Number.parseFloat(style.paddingTop) || 0;
|
|
410
|
+
firstLine.set(node, top + line);
|
|
411
|
+
return top + line + (Number.parseFloat(style.paddingBottom) || 0);
|
|
412
|
+
};
|
|
413
|
+
const placements = worldPlacement(pointers.map((entry) => entry.box), labels.map(({ node, box, ignoreObstacle, clamp, edge }) => ignoreObstacle || clamp || edge
|
|
414
|
+
? { left: box.left, right: box.right, top: box.top, bottom: box.bottom, ignoreObstacle, clamp, edge, ...(edge ? { line: lineOf(node) } : {}) } : box), [...controls, ...around], view(), around);
|
|
239
415
|
for (const [items, boxes] of [[pointers, placements.pointers], [labels, placements.labels]]) {
|
|
240
416
|
items.forEach(({ node, box }, index) => {
|
|
241
417
|
const placed = boxes[index];
|
|
418
|
+
if (placed?.line) {
|
|
419
|
+
clipped.set(node, node.style.clipPath);
|
|
420
|
+
node.style.clipPath = `inset(0 0 ${Number((box.bottom - box.top - firstLine.get(node)).toFixed(3))}px 0 round 12px)`;
|
|
421
|
+
}
|
|
242
422
|
if (!placed) {node.style.visibility = 'hidden'; hidden.add(node);}
|
|
243
423
|
else if (placed.left !== box.left || placed.top !== box.top) {
|
|
244
424
|
shifted.set(node, node.style.translate);
|
|
@@ -28,7 +28,7 @@ export function check(spec) {
|
|
|
28
28
|
return null;
|
|
29
29
|
}
|
|
30
30
|
need(object(spec), 'spec must be a plain object or null');
|
|
31
|
-
need(Reflect.ownKeys(spec).every((key) => ['look', 'say', 'at', 'dress', 'pose'].includes(key)), 'spec has an unknown key');
|
|
31
|
+
need(Reflect.ownKeys(spec).every((key) => ['look', 'say', 'at', 'dress', 'pose', 'shown'].includes(key)), 'spec has an unknown key');
|
|
32
32
|
need(Object.hasOwn(spec, 'look'), 'look must be an own property');
|
|
33
33
|
const look = spec.look;
|
|
34
34
|
const hasSay = Object.hasOwn(spec, 'say'), hasAt = Object.hasOwn(spec, 'at');
|
|
@@ -41,5 +41,7 @@ export function check(spec) {
|
|
|
41
41
|
const dress = hasDress ? checkDress(spec.dress) : undefined;
|
|
42
42
|
const hasPose = Object.hasOwn(spec, 'pose'), pose = hasPose ? spec.pose : undefined;
|
|
43
43
|
need(!hasPose || (look === 'bird' && pose === 'show'), 'pose must be show and requires bird');
|
|
44
|
-
|
|
44
|
+
const hasShown = Object.hasOwn(spec, 'shown'), shown = hasShown ? spec.shown : undefined;
|
|
45
|
+
need(!hasShown || (look === 'bird' && shown === true), 'shown must be true and requires bird');
|
|
46
|
+
return { look, ...(hasSay ? { say } : {}), ...(hasAt ? { at } : {}), ...(dress ? { dress } : {}), ...(hasPose ? { pose } : {}), ...(hasShown ? { shown } : {}) };
|
|
45
47
|
}
|
|
@@ -118,7 +118,10 @@ export function message(h, player, data, placeAt) {
|
|
|
118
118
|
else if (item.op === 'grab' || item.op === 'throw') {Grab.message(h, id, { actor: item.actor, op: item.op });}
|
|
119
119
|
else if (item.op === 'talk') {h.npcs.message(player, { k: 'hub-npc-open', npc: item.actor });}
|
|
120
120
|
else {
|
|
121
|
+
// v1.169: an end this press makes is the player's own door (`hub.end`).
|
|
122
|
+
h.acting = { playerId: id, id: item.id };
|
|
121
123
|
try {h.hooks.message?.(h.ctx, player, { k: 'hub-act', id: item.id, n: data.n });}
|
|
122
124
|
catch {console.warn('[hub] Act message hook failed');}
|
|
125
|
+
finally {h.acting = null;}
|
|
123
126
|
}
|
|
124
127
|
}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
// Act-gate log (v1.203, `hub.actGateLog`): a client in an opted-in place
|
|
2
|
+
// reports when its Act/Jump pair is hidden or shown again and why
|
|
3
|
+
// (`client/actGateLog.js`), and the server prints one stdout line per
|
|
4
|
+
// accepted change, so a hidden pair in production can be read from the logs.
|
|
5
|
+
//
|
|
6
|
+
// Advisory only: the report changes no game state. Reasons are a fixed list
|
|
7
|
+
// of short tokens, never text from the client. Lines are capped per player
|
|
8
|
+
// per minute, then per player for the life of this server.
|
|
9
|
+
|
|
10
|
+
export const GATE_REASONS = new Set(['hold', 'card', 'menu', 'ask', 'action', 'talk', 'trip', 'end', 'decor', 'nobody']);
|
|
11
|
+
export const MAX_REASONS = 8;
|
|
12
|
+
export const PER_MINUTE = 20;
|
|
13
|
+
export const PER_SERVER = 400;
|
|
14
|
+
const MINUTE_MS = 60000;
|
|
15
|
+
const KEYS = new Set(['k', 'show', 'reasons']);
|
|
16
|
+
|
|
17
|
+
// Reasons as the client gave them, cleaned: known tokens only, each once, at
|
|
18
|
+
// most MAX_REASONS. Null for a report that is not a report.
|
|
19
|
+
export function readReport(data) {
|
|
20
|
+
if (!data || typeof data !== 'object' || typeof data.show !== 'boolean' || !Array.isArray(data.reasons) ||
|
|
21
|
+
Object.keys(data).some(key => !KEYS.has(key))) {return null;}
|
|
22
|
+
const reasons = [];
|
|
23
|
+
for (const reason of data.reasons.slice(0, 32)) {
|
|
24
|
+
if (typeof reason === 'string' && reason.length <= 12 && GATE_REASONS.has(reason) && !reasons.includes(reason)) {reasons.push(reason);}
|
|
25
|
+
if (reasons.length === MAX_REASONS) {break;}
|
|
26
|
+
}
|
|
27
|
+
return { show: data.show, reasons: data.show ? [] : reasons };
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const label = show => show === null ? '-' : show ? 'shown' : 'hidden';
|
|
31
|
+
|
|
32
|
+
// One line against `key`'s budget; past PER_SERVER, one muted line and then
|
|
33
|
+
// nothing more from that key.
|
|
34
|
+
function emit(budget, key, line, now, log) {
|
|
35
|
+
if (budget.muted) {return;}
|
|
36
|
+
if (budget.lines >= PER_SERVER) {
|
|
37
|
+
budget.muted = true;
|
|
38
|
+
log(`[hub] act-gate ${key} muted after ${PER_SERVER} lines t=${now}`);
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
budget.lines++;
|
|
42
|
+
log(line);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
// `who` is the account id, or null for a guest (printed 'guest', budgeted by
|
|
46
|
+
// player id). An account's per-server budget holds across rejoins; the last
|
|
47
|
+
// state is a visit's, dropped by `forget`.
|
|
48
|
+
export function message(h, player, data, who, now = Date.now(), log = console.log) {
|
|
49
|
+
const report = readReport(data);
|
|
50
|
+
const playerId = player?.playerId;
|
|
51
|
+
if (!report || !h.session?.players.some(p => p.playerId === playerId)) {return;}
|
|
52
|
+
h.actGate ??= { players: new Map(), budgets: new Map() };
|
|
53
|
+
const last = h.actGate.players.get(playerId) ?? { show: null, reasons: [] };
|
|
54
|
+
if (last.show === report.show && last.reasons.join(',') === report.reasons.join(',')) {return;}
|
|
55
|
+
h.actGate.players.set(playerId, report);
|
|
56
|
+
const key = who ?? 'guest';
|
|
57
|
+
const budgetKey = who ?? `guest:${playerId}`;
|
|
58
|
+
let budget = h.actGate.budgets.get(budgetKey);
|
|
59
|
+
if (!budget) {
|
|
60
|
+
budget = { windowAt: now, count: 0, suppressed: 0, lines: 0, muted: false, flushedAt: null };
|
|
61
|
+
h.actGate.budgets.set(budgetKey, budget);
|
|
62
|
+
}
|
|
63
|
+
if (now - budget.windowAt >= MINUTE_MS) {
|
|
64
|
+
// One summary a window: none if a leave already printed this one's.
|
|
65
|
+
if (budget.suppressed > 0 && budget.flushedAt !== budget.windowAt) {emit(budget, key, `[hub] act-gate ${key} suppressed=${budget.suppressed} t=${now}`, now, log);}
|
|
66
|
+
budget.windowAt = now; budget.count = 0; budget.suppressed = 0;
|
|
67
|
+
}
|
|
68
|
+
if (budget.count >= PER_MINUTE) {budget.suppressed++; return;}
|
|
69
|
+
budget.count++;
|
|
70
|
+
emit(budget, key, `[hub] act-gate ${key} ${label(last.show)}->${label(report.show)} reasons=${report.reasons.join(',') || '-'} t=${now}`, now, log);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
// A visit's end also prints the count its minute held back, once a minute:
|
|
74
|
+
// leaving and rejoining does not buy more lines.
|
|
75
|
+
export function forget(h, playerId, who, now = Date.now(), log = console.log) {
|
|
76
|
+
if (!h.actGate?.players.delete(playerId)) {return;}
|
|
77
|
+
const key = who ?? 'guest';
|
|
78
|
+
const budget = h.actGate.budgets.get(who ?? `guest:${playerId}`);
|
|
79
|
+
if (!budget?.suppressed || budget.flushedAt === budget.windowAt) {return;}
|
|
80
|
+
budget.flushedAt = budget.windowAt;
|
|
81
|
+
emit(budget, key, `[hub] act-gate ${key} suppressed=${budget.suppressed} t=${now}`, now, log);
|
|
82
|
+
budget.suppressed = 0;
|
|
83
|
+
}
|
|
@@ -1,32 +1,38 @@
|
|
|
1
1
|
// Action chips (contract v1.74): private offers; the place's hook alone
|
|
2
2
|
// decides what a press does. No state exists in a place without `actions`.
|
|
3
3
|
import { REFUSED_TEXT as DIRECTIONS } from '../privateText.js';
|
|
4
|
+
import { warnOnce } from './actors.js';
|
|
5
|
+
import * as Held from './heldOffers.js';
|
|
4
6
|
|
|
5
7
|
const ID = /^[a-z][a-z0-9_-]{0,23}$/;
|
|
6
8
|
const SEND_EVERY_MS = 250;
|
|
7
9
|
const object = (value) => value !== null && typeof value === 'object' && [Object.prototype, null].includes(Object.getPrototypeOf(value));
|
|
8
10
|
const id = (value) => typeof value === 'string' && ID.exec(value)?.[0] === value;
|
|
9
11
|
|
|
10
|
-
function need(condition, message) {
|
|
12
|
+
function need(condition, message, at = '') {
|
|
11
13
|
if (!condition) {
|
|
12
|
-
throw new TypeError(`hub.actions: ${message}`);
|
|
14
|
+
throw Object.assign(new TypeError(`hub.actions: ${message}`), { rule: message, at });
|
|
13
15
|
}
|
|
14
16
|
}
|
|
17
|
+
// Where in the list a rule failed, for the log: an item's id as it was read
|
|
18
|
+
// (never read again: a getter runs once), or its place when it has none yet.
|
|
19
|
+
const shown = (value) => typeof value === 'string' ? JSON.stringify(value.slice(0, 32)) : typeof value;
|
|
15
20
|
function check(items) {
|
|
16
21
|
if (items === null) {
|
|
17
22
|
return null;
|
|
18
23
|
}
|
|
19
24
|
need(Array.isArray(items) && items.length <= 3, 'items must be null or an array of 0..3 items');
|
|
20
|
-
const out = Array.from(items, (item) => {
|
|
21
|
-
need(object(item), 'item must be a plain object');
|
|
22
|
-
need(Reflect.ownKeys(item).every((key) => ['id', 'label'].includes(key)), 'item has an unknown key');
|
|
23
|
-
need(Object.hasOwn(item, 'id') && Object.hasOwn(item, 'label'), 'id and label must be own properties');
|
|
25
|
+
const out = Array.from(items, (item, i) => {
|
|
26
|
+
need(object(item), 'item must be a plain object', `item ${i}`);
|
|
27
|
+
need(Reflect.ownKeys(item).every((key) => ['id', 'label'].includes(key)), 'item has an unknown key', `item ${i}`);
|
|
28
|
+
need(Object.hasOwn(item, 'id') && Object.hasOwn(item, 'label'), 'id and label must be own properties', `item ${i}`);
|
|
24
29
|
const itemId = item.id, label = item.label;
|
|
25
|
-
need(id(itemId), 'id must be a short id');
|
|
26
|
-
need(typeof label === 'string' && label.length <= 32 && label.trim().length > 0 && Array.from(label).length <= 16 && !DIRECTIONS.test(label), 'label must be 1..16 characters (code points), no control, direction or zero-width characters');
|
|
30
|
+
need(id(itemId), 'id must be a short id', `id ${shown(itemId)}`);
|
|
31
|
+
need(typeof label === 'string' && label.length <= 32 && label.trim().length > 0 && Array.from(label).length <= 16 && !DIRECTIONS.test(label), 'label must be 1..16 characters (code points), no control, direction or zero-width characters', `id ${shown(itemId)}`);
|
|
27
32
|
return { id: itemId, label };
|
|
28
33
|
});
|
|
29
|
-
|
|
34
|
+
const repeated = out.find((item, i) => out.findIndex((other) => other.id === item.id) !== i);
|
|
35
|
+
need(!repeated, 'ids must be unique', `id ${shown(repeated?.id)}`);
|
|
30
36
|
return out.length ? out : null;
|
|
31
37
|
}
|
|
32
38
|
function present(h, playerId) {
|
|
@@ -57,22 +63,38 @@ function version(h) {
|
|
|
57
63
|
return h.actionsSeq;
|
|
58
64
|
}
|
|
59
65
|
|
|
66
|
+
// A refused list still throws, as it always did; the place's log also says
|
|
67
|
+
// once which rule refused it and at what, as a deck that catches the throw
|
|
68
|
+
// would otherwise refuse every player's list with no word.
|
|
60
69
|
export function set(h, playerId, items) {
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
70
|
+
let checked;
|
|
71
|
+
try {
|
|
72
|
+
need(h.place.actions === true, 'this place does not declare actions');
|
|
73
|
+
need(typeof playerId === 'string', 'playerId must be a string');
|
|
74
|
+
checked = check(items);
|
|
75
|
+
} catch (error) {
|
|
76
|
+
if (error?.rule) {
|
|
77
|
+
warnOnce(h, `actions:refused:${error.rule}`, `hub.actions refused a list: ${error.rule}${error.at ? ` (${error.at})` : ''}`);
|
|
78
|
+
}
|
|
79
|
+
throw error;
|
|
80
|
+
}
|
|
81
|
+
// v1.180: a held visit away takes the call, recorded unsent.
|
|
82
|
+
const held = Held.on(h) ? Held.take(h, playerId) : null;
|
|
83
|
+
if (held === 'block' || (!held?.away && !arrived(h, playerId))) {
|
|
65
84
|
return false;
|
|
66
85
|
}
|
|
86
|
+
if (held && Held.gate(h, playerId, h.actionsMe?.get(playerId)) === 'drop') {
|
|
87
|
+
h.actionsMe.delete(playerId);
|
|
88
|
+
}
|
|
67
89
|
const state = current(h, playerId), json = JSON.stringify(checked);
|
|
68
|
-
if (state.json === json) {
|
|
90
|
+
if (state.json === json && state.hold === held?.hold) {
|
|
69
91
|
return true;
|
|
70
92
|
}
|
|
71
93
|
// Record every changed list; the tick sends only the latest, at most 4/s.
|
|
72
94
|
// Back to the list the player was last sent, with nothing sent since: that
|
|
73
95
|
// offer and its version stand (the client never heard of the ones between).
|
|
74
96
|
const n = json === state.sentJson ? state.sentN : version(h);
|
|
75
|
-
(h.actionsMe ??= new Map()).set(playerId, { ...state, items: checked, json, n });
|
|
97
|
+
(h.actionsMe ??= new Map()).set(playerId, { ...state, items: checked, json, n, ...(held ? { hold: held.hold } : {}) });
|
|
76
98
|
return true;
|
|
77
99
|
}
|
|
78
100
|
|
|
@@ -95,6 +117,16 @@ export function message(h, playerId, data) {
|
|
|
95
117
|
return;
|
|
96
118
|
}
|
|
97
119
|
const actionId = data.id, n = data.n, state = current(h, playerId);
|
|
120
|
+
// v1.180: a held offer is pressed only by its own account, back on the
|
|
121
|
+
// visit's body and replayed to by a fresh hello.
|
|
122
|
+
const held = Held.on(h) ? Held.gate(h, playerId, h.actionsMe?.get(playerId)) : null;
|
|
123
|
+
if (held === 'drop' || held === 'block') {
|
|
124
|
+
h.actionsMe?.delete(playerId);
|
|
125
|
+
return;
|
|
126
|
+
}
|
|
127
|
+
if (held === 'away') {
|
|
128
|
+
return;
|
|
129
|
+
}
|
|
98
130
|
// The offer in force is the one this player was sent: a list recorded and
|
|
99
131
|
// not yet sent cannot be pressed, however its version was guessed.
|
|
100
132
|
if (!id(actionId) || !Number.isSafeInteger(n) || n !== state.n || n !== state.sentN || !state.items?.some((item) => item.id === actionId)) {
|
|
@@ -106,14 +138,29 @@ export function message(h, playerId, data) {
|
|
|
106
138
|
console.warn(`[hub] action hook failed: ${error?.message ?? error}`);
|
|
107
139
|
}
|
|
108
140
|
};
|
|
141
|
+
// v1.169: an end the hook makes before it returns is the player's own door.
|
|
142
|
+
h.acting = { playerId, id: actionId };
|
|
109
143
|
try {
|
|
110
144
|
Promise.resolve(h.hooks.action?.(h.ctx, playerId, actionId)).catch(failed);
|
|
111
145
|
} catch (error) {
|
|
112
146
|
failed(error);
|
|
147
|
+
} finally {
|
|
148
|
+
h.acting = null;
|
|
113
149
|
}
|
|
114
150
|
}
|
|
115
151
|
|
|
116
152
|
export function joinedAfresh(h, playerId) {
|
|
153
|
+
if (Held.on(h)) {
|
|
154
|
+
const held = Held.gate(h, playerId, h.actionsMe?.get(playerId));
|
|
155
|
+
if (held === 'drop' || held === 'block') {
|
|
156
|
+
h.actionsMe?.delete(playerId);
|
|
157
|
+
} else if (held === 'away') {
|
|
158
|
+
return;
|
|
159
|
+
} else if (held === 'here' && h.actionsMe?.has(playerId)) {
|
|
160
|
+
// v1.180: a replay is a new offer; presses on the old version are refused.
|
|
161
|
+
h.actionsMe.get(playerId).n = version(h);
|
|
162
|
+
}
|
|
163
|
+
}
|
|
117
164
|
const state = current(h, playerId);
|
|
118
165
|
(h.actionsMe ??= new Map()).set(playerId, state);
|
|
119
166
|
send(h, playerId, state);
|
|
@@ -124,6 +171,15 @@ export function forget(h, playerId) {
|
|
|
124
171
|
}
|
|
125
172
|
export function prune(h) {
|
|
126
173
|
for (const playerId of new Set([...(h.actionsMe?.keys() ?? []), ...(h.actionsBudget?.keys() ?? [])])) {
|
|
174
|
+
const held = Held.on(h) ? Held.gate(h, playerId, h.actionsMe?.get(playerId)) : null;
|
|
175
|
+
if (held === 'drop' || held === 'block') {
|
|
176
|
+
forget(h, playerId);
|
|
177
|
+
continue;
|
|
178
|
+
}
|
|
179
|
+
if (held === 'away') {
|
|
180
|
+
h.actionsBudget?.delete(playerId);
|
|
181
|
+
continue;
|
|
182
|
+
}
|
|
127
183
|
if (!present(h, playerId)) {
|
|
128
184
|
forget(h, playerId);
|
|
129
185
|
continue;
|
|
@@ -311,13 +311,16 @@ export function marksOf(h) {
|
|
|
311
311
|
// dynamic Body (its ownership is the multiplayer kit's), nor a player, door or
|
|
312
312
|
// NPC. Bounded: MAX_SPAWNED copies alive (a deck's hub.spawnCap, v1.161), SPAWN_RATE spawns a second with
|
|
313
313
|
// bursts of SPAWN_BURST, so the snapshot and every client's actor count stay
|
|
314
|
-
// small.
|
|
314
|
+
// small. v1.162: `{ carer: playerId }` names the player a copy goes with (a
|
|
315
|
+
// pet beside its owner), kept for the copy's life, the carer leaving included
|
|
316
|
+
// (the place despawns it). A carer that is not a string or not a player in
|
|
317
|
+
// this place now is ignored and the copy is spawned without one.
|
|
315
318
|
export const MAX_SPAWNED = 96;
|
|
316
319
|
export const SPAWN_RATE = 10;
|
|
317
320
|
export const SPAWN_BURST = 40;
|
|
318
321
|
const NOT_TEMPLATES = ['Player', 'HubDoor', 'HubNpc', 'HubPad', 'Pickup'];
|
|
319
322
|
|
|
320
|
-
export function spawn(h, fromId, at, engine) {
|
|
323
|
+
export function spawn(h, fromId, at, engine, options) {
|
|
321
324
|
const template = typeof fromId === 'string' ? h.actors.find((a) => a.id === fromId) : null;
|
|
322
325
|
const c = template?.components;
|
|
323
326
|
if (!c || !c.Transform || !c.Shape || NOT_TEMPLATES.some((name) => c[name]) || c.Body?.type === 'dynamic') {
|
|
@@ -365,7 +368,8 @@ export function spawn(h, fromId, at, engine) {
|
|
|
365
368
|
} while (h.actors.some((a) => a.id === id) || h.spawned.has(id));
|
|
366
369
|
const components = { ...c, Transform: { ...t, x: point.x, y: point.y, z: point.z, rotationY: point.rotationY } };
|
|
367
370
|
const actor = { id, components };
|
|
368
|
-
|
|
371
|
+
const carer = options?.carer;
|
|
372
|
+
h.spawned.set(id, { from: fromId, at: point, actor, ...(typeof carer === 'string' && h.players.has(carer) ? { carer } : {}) });
|
|
369
373
|
// The copy's body, as the world builds a scene actor's: solid or a sensor,
|
|
370
374
|
// fixed or kinematic; a kinematic one's pose reaches every client.
|
|
371
375
|
if (h.sim && engine?.createBody) {
|
|
@@ -440,10 +444,21 @@ export function templatesOf(h) {
|
|
|
440
444
|
return out;
|
|
441
445
|
}
|
|
442
446
|
|
|
447
|
+
// v1.197: the decor templates of live copies, in a deck with no quality block
|
|
448
|
+
// of its own, sorted. Empty where there are none (and in every deck with one).
|
|
449
|
+
export function doorDecorOf(h) {
|
|
450
|
+
if (!h.doorDecor) {return [];}
|
|
451
|
+
const out = new Set();
|
|
452
|
+
for (const { from } of h.spawned.values()) {
|
|
453
|
+
if (h.doorDecor.has(from)) {out.add(from);}
|
|
454
|
+
}
|
|
455
|
+
return [...out].sort();
|
|
456
|
+
}
|
|
457
|
+
|
|
443
458
|
export function spawnedOf(h) {
|
|
444
459
|
const out = Object.create(null);
|
|
445
|
-
for (const [id, { from, at }] of h.spawned) {
|
|
446
|
-
out[id] = { from, ...at };
|
|
460
|
+
for (const [id, { from, at, carer }] of h.spawned) {
|
|
461
|
+
out[id] = carer === undefined ? { from, ...at } : { from, ...at, carer };
|
|
447
462
|
}
|
|
448
463
|
return out;
|
|
449
464
|
}
|