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
|
@@ -0,0 +1,394 @@
|
|
|
1
|
+
// v1.180 `heldOffers: true`: hub.actions, hub.ask and hub.menu offers kept for
|
|
2
|
+
// a retained player while away, replayed with fresh versions on their resume
|
|
3
|
+
// hello, and only ever for the same signed-in account on the same visit body.
|
|
4
|
+
import assert from 'node:assert/strict';
|
|
5
|
+
import { register } from 'node:module';
|
|
6
|
+
|
|
7
|
+
register(`data:text/javascript,${encodeURIComponent(`
|
|
8
|
+
export async function resolve(specifier, context, next) {
|
|
9
|
+
if (specifier === '@imports/castle.multiplayer-3d/code/server/sceneBodies.js') {
|
|
10
|
+
return { url: 'data:text/javascript,export const readScene = () => globalThis.__hubHeldOffersActors;', shortCircuit: true };
|
|
11
|
+
}
|
|
12
|
+
if (context.parentURL?.includes('/kits/base/sdk/') && specifier.startsWith('.') && !specifier.endsWith('.js')) {
|
|
13
|
+
return next(specifier + '.js', context);
|
|
14
|
+
}
|
|
15
|
+
return next(specifier, context);
|
|
16
|
+
}
|
|
17
|
+
`)}`);
|
|
18
|
+
|
|
19
|
+
const { layer } = await import('../code/server/hub.js');
|
|
20
|
+
const Manifest = await import('../code/server/manifest.js');
|
|
21
|
+
const actors = [
|
|
22
|
+
{ id: 'player', components: { Player: {}, Transform: { x: 0, y: 1, z: 0 } } },
|
|
23
|
+
{ id: 'floor', components: { Transform: { x: 0, y: 0, z: 0 } } },
|
|
24
|
+
];
|
|
25
|
+
const members = [
|
|
26
|
+
{ playerId: 'p1', userId: '101', username: 'Ada', isAnonymous: false },
|
|
27
|
+
{ playerId: 'p2', userId: '102', username: 'Bo', isAnonymous: false },
|
|
28
|
+
];
|
|
29
|
+
const body = () => ({ at: { x: 0, y: 1, z: 0 }, facing: 0, body: { setTranslation() {} } });
|
|
30
|
+
const keep = { result: { score: { unit: 'points', better: 'higher' } }, resume: { keep: true } };
|
|
31
|
+
const channels = { actions: true, ask: true, menu: true };
|
|
32
|
+
const held = { ...keep, ...channels, heldOffers: true };
|
|
33
|
+
|
|
34
|
+
function boot(keys = held) {
|
|
35
|
+
globalThis.__hubHeldOffersActors = actors;
|
|
36
|
+
const sent = [], ops = [];
|
|
37
|
+
let hub;
|
|
38
|
+
const hooks = {
|
|
39
|
+
ready(ctx) { hub = ctx; },
|
|
40
|
+
action(ctx, id, actionId) { ops.push(['action', id, actionId]); },
|
|
41
|
+
answer(ctx, id, promptId, text) { ops.push(['answer', id, promptId, text]); },
|
|
42
|
+
menu(ctx, id, itemId) { ops.push(['menu', id, itemId]); },
|
|
43
|
+
};
|
|
44
|
+
const server = layer({ deckId: 'held-offers-test', server: { maxPlayers: 8 }, hub: { contract: 1, title: 'Held offers', ...keys } }, hooks, {}, () => true);
|
|
45
|
+
const session = {
|
|
46
|
+
sessionId: 'test', players: structuredClone(members),
|
|
47
|
+
send(id, message) { sent.push([id, structuredClone(message)]); },
|
|
48
|
+
broadcast(message) { sent.push(['all', structuredClone(message)]); },
|
|
49
|
+
};
|
|
50
|
+
const world = { timeMs: 0, scenePath: 'scenes/main.scene', players: new Map(members.map(({ playerId }) => [playerId, body()])), objects: new Map(), bodies: new Map() };
|
|
51
|
+
server.sceneFor(session);
|
|
52
|
+
server.ready(world);
|
|
53
|
+
const say = (id, message) => server.message(session, { playerId: id }, message);
|
|
54
|
+
const hello = (id, more = {}) => say(id, { k: 'hub-hello', avatar: 0, party: 2, ...more });
|
|
55
|
+
const tick = (ms = 50) => { world.timeMs += ms; server.place(world); server.step(world, []); };
|
|
56
|
+
hello('p1'); hello('p2'); tick(2000); tick(50);
|
|
57
|
+
const row = (id) => session.players.find((p) => p.playerId === id);
|
|
58
|
+
// The roster row and the body go; the next tick observes the absence.
|
|
59
|
+
const drop = (id = 'p1') => {
|
|
60
|
+
const was = { row: row(id), body: world.players.get(id) };
|
|
61
|
+
session.players = session.players.filter((p) => p.playerId !== id);
|
|
62
|
+
world.players.delete(id);
|
|
63
|
+
tick();
|
|
64
|
+
return was;
|
|
65
|
+
};
|
|
66
|
+
// A connection on the id again: a roster row (any account) and maybe a body.
|
|
67
|
+
const back = (id, member, withBody = body()) => {
|
|
68
|
+
session.players.push(structuredClone(member));
|
|
69
|
+
if (withBody) { world.players.set(id, withBody); }
|
|
70
|
+
};
|
|
71
|
+
const last = (k, id = 'p1') => sent.findLast(([to, msg]) => to === id && msg.k === k)?.[1];
|
|
72
|
+
const count = (k, id = 'p1') => sent.filter(([to, msg]) => to === id && msg.k === k).length;
|
|
73
|
+
return { server, session, world, sent, ops, say, hello, tick, drop, back, last, count, row, hub: () => hub };
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
const chips = [{ id: 'start', label: 'Start' }];
|
|
77
|
+
const prompt = { id: 'name', title: 'Name', max: 8 };
|
|
78
|
+
const sheet = { title: 'Shop', sections: [{ title: 'Hats', items: [{ id: 'cap', label: 'Cap' }] }] };
|
|
79
|
+
const offerAll = (r) => {
|
|
80
|
+
r.hub().actions('p1', chips);
|
|
81
|
+
r.hub().ask('p1', prompt);
|
|
82
|
+
r.hub().menu('p1', sheet);
|
|
83
|
+
r.tick(250);
|
|
84
|
+
return { a: r.last('hub-actions'), q: r.last('hub-ask'), m: r.last('hub-menu') };
|
|
85
|
+
};
|
|
86
|
+
const pressAll = (r, { a, q, m }, id = 'p1') => {
|
|
87
|
+
r.say(id, { k: 'hub-action', id: 'start', n: a.n });
|
|
88
|
+
r.say(id, { k: 'hub-answer', id: 'name', n: q.n, text: 'Ada' });
|
|
89
|
+
r.say(id, { k: 'hub-menu-pick', id: 'cap', n: m.n });
|
|
90
|
+
};
|
|
91
|
+
const ada = members[0];
|
|
92
|
+
|
|
93
|
+
let passed = 0;
|
|
94
|
+
const failures = [];
|
|
95
|
+
async function test(name, fn) {
|
|
96
|
+
try { await fn(); passed += 1; console.log(`ok: ${name}`); } catch (error) { failures.push(name); console.error(`not ok: ${name}\n${error.stack}`); }
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
await test('manifest: true or absent; only in a place with a resume mode; server-only', () => {
|
|
100
|
+
const read = (keys) => Manifest.readManifest({ server: { maxPlayers: 8 }, hub: { contract: 1, title: 'T', ...keys } });
|
|
101
|
+
const has = (r) => r.errors.some((e) => e.includes('.heldOffers'));
|
|
102
|
+
for (const value of [false, null, 0, 1, '', 'true', [], {}]) {
|
|
103
|
+
assert(has(read({ ...keep, heldOffers: value })), `refuses ${JSON.stringify(value)}`);
|
|
104
|
+
}
|
|
105
|
+
for (const ok of [keep, { resumePose: true }, { houseResume: true }, {}]) {
|
|
106
|
+
const r = read({ ...ok, heldOffers: true });
|
|
107
|
+
assert(!has(r), JSON.stringify(ok));
|
|
108
|
+
assert.equal(r.manifest.places.main.heldOffers, true);
|
|
109
|
+
assert(!Object.hasOwn(Manifest.publicPlace('main', r.manifest.places.main), 'heldOffers'));
|
|
110
|
+
}
|
|
111
|
+
// No resume mode: a result place without keep, and pose-only reconnect.
|
|
112
|
+
assert(read({ result: keep.result, heldOffers: true }).errors.some((e) => e.includes('.heldOffers requires a resume mode')));
|
|
113
|
+
assert(read({ result: keep.result, resume: true, heldOffers: true }).errors.some((e) => e.includes('.heldOffers requires a resume mode')));
|
|
114
|
+
assert(read({ resumeArrivalPose: true, heldOffers: true }).errors.some((e) => e.includes('.heldOffers requires a resume mode')));
|
|
115
|
+
const named = read({ places: { porch: { title: 'Porch', scene: 'scenes/main.scene', heldOffers: 'yes' } } });
|
|
116
|
+
assert(named.errors.some((e) => e.includes('porch') && e.includes('.heldOffers must be true or absent')));
|
|
117
|
+
assert(!Object.hasOwn(read({ ...keep }).manifest.places.main, 'heldOffers'));
|
|
118
|
+
});
|
|
119
|
+
|
|
120
|
+
await test('offers are kept across a short drop and replayed on the resume hello with fresh versions', () => {
|
|
121
|
+
const r = boot();
|
|
122
|
+
const old = offerAll(r);
|
|
123
|
+
const before = { a: r.count('hub-actions'), q: r.count('hub-ask'), m: r.count('hub-menu') };
|
|
124
|
+
r.drop();
|
|
125
|
+
r.tick(250); r.tick(250);
|
|
126
|
+
assert.deepEqual({ a: r.count('hub-actions'), q: r.count('hub-ask'), m: r.count('hub-menu') }, before, 'nothing is sent while away');
|
|
127
|
+
r.back('p1', ada);
|
|
128
|
+
r.hello('p1', { resume: true });
|
|
129
|
+
const now = { a: r.last('hub-actions'), q: r.last('hub-ask'), m: r.last('hub-menu') };
|
|
130
|
+
assert.deepEqual(now.a.items, chips);
|
|
131
|
+
assert.equal(now.q.id, 'name');
|
|
132
|
+
assert.deepEqual(now.m.spec.sections, sheet.sections);
|
|
133
|
+
assert(now.a.n > old.a.n && now.q.n > old.q.n && now.m.n > old.m.n, 'every replay has a fresh version');
|
|
134
|
+
// Presses on the old versions are refused; the fresh ones are the owner's.
|
|
135
|
+
pressAll(r, old);
|
|
136
|
+
assert.deepEqual(r.ops, []);
|
|
137
|
+
r.tick(2000);
|
|
138
|
+
pressAll(r, now);
|
|
139
|
+
assert.deepEqual(r.ops.map(([k]) => k), ['action', 'answer', 'menu']);
|
|
140
|
+
});
|
|
141
|
+
|
|
142
|
+
await test('the synthetic resume hello of a silent return replays too (resumePose town)', () => {
|
|
143
|
+
const r = boot({ resumePose: true, ...channels, heldOffers: true });
|
|
144
|
+
const old = offerAll(r);
|
|
145
|
+
r.drop();
|
|
146
|
+
r.back('p1', ada);
|
|
147
|
+
r.tick();
|
|
148
|
+
const a = r.last('hub-actions');
|
|
149
|
+
assert.deepEqual(a.items, chips);
|
|
150
|
+
assert(a.n > old.a.n);
|
|
151
|
+
});
|
|
152
|
+
|
|
153
|
+
await test('calls made while away are recorded, not sent, and the latest is delivered at resume', () => {
|
|
154
|
+
const r = boot();
|
|
155
|
+
offerAll(r);
|
|
156
|
+
r.drop();
|
|
157
|
+
const sentBefore = r.sent.length;
|
|
158
|
+
assert.equal(r.hub().actions('p1', [{ id: 'one', label: 'One' }]), true);
|
|
159
|
+
assert.equal(r.hub().actions('p1', [{ id: 'two', label: 'Two' }]), true);
|
|
160
|
+
assert.equal(r.hub().ask('p1', { id: 'later', title: 'Later', max: 4 }), true);
|
|
161
|
+
assert.equal(r.hub().menu('p1', null), true);
|
|
162
|
+
r.tick(250); r.tick(250);
|
|
163
|
+
assert.equal(r.sent.filter(([to]) => to === 'p1').length, r.sent.slice(0, sentBefore).filter(([to]) => to === 'p1').length, 'nothing to p1 while away');
|
|
164
|
+
r.back('p1', ada);
|
|
165
|
+
r.hello('p1', { resume: true });
|
|
166
|
+
assert.deepEqual(r.last('hub-actions').items, [{ id: 'two', label: 'Two' }]);
|
|
167
|
+
assert.equal(r.last('hub-ask').id, 'later');
|
|
168
|
+
assert.equal(r.last('hub-menu').spec, null, 'the menu close made while away is delivered');
|
|
169
|
+
r.tick(2000);
|
|
170
|
+
r.say('p1', { k: 'hub-action', id: 'one', n: r.last('hub-actions').n });
|
|
171
|
+
r.say('p1', { k: 'hub-action', id: 'two', n: r.last('hub-actions').n });
|
|
172
|
+
assert.deepEqual(r.ops, [['action', 'p1', 'two']]);
|
|
173
|
+
});
|
|
174
|
+
|
|
175
|
+
await test('a player with no offer yet still has calls made while away delivered at resume', () => {
|
|
176
|
+
const r = boot();
|
|
177
|
+
r.drop();
|
|
178
|
+
assert.equal(r.hub().actions('p1', chips), true);
|
|
179
|
+
r.back('p1', ada);
|
|
180
|
+
r.hello('p1', { resume: true });
|
|
181
|
+
assert.deepEqual(r.last('hub-actions').items, chips);
|
|
182
|
+
});
|
|
183
|
+
|
|
184
|
+
await test('v1.149: another account on the same id with an again:true hello gets nothing and the hold ends', () => {
|
|
185
|
+
const r = boot();
|
|
186
|
+
const old = offerAll(r);
|
|
187
|
+
r.drop();
|
|
188
|
+
const mallory = { ...ada, userId: '999', username: 'Mal' };
|
|
189
|
+
r.back('p1', mallory);
|
|
190
|
+
r.hello('p1', { again: true, avatar: 2 });
|
|
191
|
+
pressAll(r, old);
|
|
192
|
+
r.tick(250);
|
|
193
|
+
const after = r.sent.length;
|
|
194
|
+
pressAll(r, old);
|
|
195
|
+
r.tick(250); r.tick(250);
|
|
196
|
+
assert.deepEqual(r.ops, [], 'no press, answer or pick reaches a hook');
|
|
197
|
+
assert(!r.sent.slice(after).some(([to, msg]) => to === 'p1' && ((msg.k === 'hub-actions' && msg.items) || (msg.k === 'hub-ask' && msg.id) || (msg.k === 'hub-menu' && msg.spec))), 'nothing of Ada is sent to Mal');
|
|
198
|
+
// Ada coming back later finds nothing replayed: the hold ended.
|
|
199
|
+
r.session.players = r.session.players.filter((p) => p.playerId !== 'p1');
|
|
200
|
+
r.world.players.delete('p1');
|
|
201
|
+
r.tick();
|
|
202
|
+
r.back('p1', ada);
|
|
203
|
+
r.hello('p1', { resume: true });
|
|
204
|
+
r.tick(250);
|
|
205
|
+
assert.equal(r.last('hub-actions').items, null);
|
|
206
|
+
assert.equal(r.last('hub-ask').id, null);
|
|
207
|
+
assert.equal(r.count('hub-menu'), 1, 'no menu replayed');
|
|
208
|
+
});
|
|
209
|
+
|
|
210
|
+
await test('another account that said hello on the id and left before any tick still ends the hold', () => {
|
|
211
|
+
const r = boot();
|
|
212
|
+
offerAll(r);
|
|
213
|
+
r.drop();
|
|
214
|
+
r.back('p1', { ...ada, userId: '999', username: 'Mal' });
|
|
215
|
+
r.hello('p1', { again: true });
|
|
216
|
+
r.session.players = r.session.players.filter((p) => p.playerId !== 'p1');
|
|
217
|
+
r.world.players.delete('p1');
|
|
218
|
+
r.tick();
|
|
219
|
+
r.back('p1', ada);
|
|
220
|
+
r.hello('p1', { resume: true });
|
|
221
|
+
assert.equal(r.last('hub-actions').items, null);
|
|
222
|
+
assert.equal(r.last('hub-ask').id, null);
|
|
223
|
+
assert.equal(r.count('hub-menu'), 1);
|
|
224
|
+
});
|
|
225
|
+
|
|
226
|
+
await test('another account with a fresh hello on the id is replayed nothing, before any tick', () => {
|
|
227
|
+
const r = boot();
|
|
228
|
+
offerAll(r);
|
|
229
|
+
r.drop();
|
|
230
|
+
const mark = r.sent.length;
|
|
231
|
+
r.back('p1', { ...ada, userId: '999', username: 'Mal' });
|
|
232
|
+
r.hello('p1', { resume: true });
|
|
233
|
+
const toMal = r.sent.slice(mark).filter(([to]) => to === 'p1').map(([, msg]) => msg);
|
|
234
|
+
assert.deepEqual(toMal.find((msg) => msg.k === 'hub-actions'), { k: 'hub-actions', items: null, n: 0 });
|
|
235
|
+
assert.deepEqual(toMal.find((msg) => msg.k === 'hub-ask'), { k: 'hub-ask', id: null, n: 0 });
|
|
236
|
+
assert(!toMal.some((msg) => msg.k === 'hub-menu'));
|
|
237
|
+
});
|
|
238
|
+
|
|
239
|
+
await test('an offer made under an ended hold is never pressable under the next account\'s hold', () => {
|
|
240
|
+
const r = boot();
|
|
241
|
+
const old = offerAll(r);
|
|
242
|
+
r.drop();
|
|
243
|
+
r.back('p1', { ...ada, userId: '999', username: 'Mal' });
|
|
244
|
+
r.hello('p1', { again: true });
|
|
245
|
+
// Blocked until Mal's own fresh hello; then the place offers him his own.
|
|
246
|
+
assert.equal(r.hub().ask('p1', { id: 'mal', title: 'Mal', max: 4 }), false);
|
|
247
|
+
r.hello('p1');
|
|
248
|
+
assert.equal(r.hub().ask('p1', { id: 'mal', title: 'Mal', max: 4 }), true);
|
|
249
|
+
r.tick(250); r.tick(2000);
|
|
250
|
+
pressAll(r, old);
|
|
251
|
+
assert.deepEqual(r.ops, []);
|
|
252
|
+
});
|
|
253
|
+
|
|
254
|
+
// Sol review round 1 repros.
|
|
255
|
+
await test('review P1: another account on an id whose body real-time kept is blocked on every channel until its own fresh hello', () => {
|
|
256
|
+
const r = boot();
|
|
257
|
+
r.hub().actions('p1', chips);
|
|
258
|
+
r.tick(250);
|
|
259
|
+
const old = r.last('hub-actions');
|
|
260
|
+
// Ada's row goes; real-time keeps her body. Mal takes the id before any hello.
|
|
261
|
+
r.session.players = r.session.players.filter((p) => p.playerId !== 'p1');
|
|
262
|
+
r.tick();
|
|
263
|
+
r.back('p1', { ...ada, userId: '999', username: 'Mal' }, null);
|
|
264
|
+
const mark = r.sent.length;
|
|
265
|
+
assert.equal(r.hub().actions('p1', chips), false);
|
|
266
|
+
assert.equal(r.hub().ask('p1', prompt), false, 'an unused channel records nothing either');
|
|
267
|
+
assert.equal(r.hub().menu('p1', sheet), false);
|
|
268
|
+
r.tick(250); r.tick(2000);
|
|
269
|
+
for (let n = 0; n <= old.n + 8; n += 1) {
|
|
270
|
+
r.say('p1', { k: 'hub-action', id: 'start', n });
|
|
271
|
+
r.say('p1', { k: 'hub-answer', id: 'name', n, text: 'x' });
|
|
272
|
+
r.say('p1', { k: 'hub-menu-pick', id: 'cap', n });
|
|
273
|
+
}
|
|
274
|
+
r.tick(250);
|
|
275
|
+
assert.deepEqual(r.ops, [], 'no hook runs');
|
|
276
|
+
assert(!r.sent.slice(mark).some(([to, msg]) => to === 'p1' && ['hub-actions', 'hub-ask', 'hub-menu'].includes(msg.k)), 'nothing is sent');
|
|
277
|
+
// An again:true hello rebuilds no ownership: still blocked.
|
|
278
|
+
r.hello('p1', { again: true, avatar: 3 });
|
|
279
|
+
assert.equal(r.hub().ask('p1', prompt), false);
|
|
280
|
+
// Mal's own fresh hello lifts the block for Mal's own offers.
|
|
281
|
+
r.hello('p1');
|
|
282
|
+
assert.equal(r.hub().ask('p1', prompt), true);
|
|
283
|
+
r.tick(250);
|
|
284
|
+
r.say('p1', { k: 'hub-answer', id: 'name', n: r.last('hub-ask').n, text: 'Mal' });
|
|
285
|
+
assert.deepEqual(r.ops, [['answer', 'p1', 'name', 'Mal']]);
|
|
286
|
+
});
|
|
287
|
+
|
|
288
|
+
await test('review P2: a call before resume preparation keeps every held offer', () => {
|
|
289
|
+
const r = boot();
|
|
290
|
+
offerAll(r);
|
|
291
|
+
r.drop();
|
|
292
|
+
r.back('p1', ada);
|
|
293
|
+
assert.equal(r.hub().actions('p1', [{ id: 'two', label: 'Two' }]), true, 'recorded, waiting for prepareResume');
|
|
294
|
+
r.hello('p1', { resume: true });
|
|
295
|
+
assert.deepEqual(r.last('hub-actions').items, [{ id: 'two', label: 'Two' }]);
|
|
296
|
+
assert.equal(r.last('hub-ask').id, 'name', 'the held ask is replayed');
|
|
297
|
+
assert.equal(r.count('hub-menu'), 2, 'the held menu is replayed');
|
|
298
|
+
assert.deepEqual(r.last('hub-menu').spec.sections, sheet.sections);
|
|
299
|
+
});
|
|
300
|
+
|
|
301
|
+
await test('review P3: a replacement body with no away tick refuses old versions until a fresh hello replays', () => {
|
|
302
|
+
const r = boot();
|
|
303
|
+
const old = offerAll(r);
|
|
304
|
+
r.world.players.set('p1', body());
|
|
305
|
+
r.hello('p1', { again: true, avatar: 1 });
|
|
306
|
+
pressAll(r, old);
|
|
307
|
+
r.tick(); r.tick(250);
|
|
308
|
+
pressAll(r, old);
|
|
309
|
+
assert.deepEqual(r.ops, [], 'no pre-change version reaches a hook');
|
|
310
|
+
r.hello('p1', { resume: true });
|
|
311
|
+
const now = { a: r.last('hub-actions'), q: r.last('hub-ask'), m: r.last('hub-menu') };
|
|
312
|
+
assert(now.a.n > old.a.n && now.q.n > old.q.n && now.m.n > old.m.n);
|
|
313
|
+
r.tick(2000);
|
|
314
|
+
pressAll(r, old);
|
|
315
|
+
assert.deepEqual(r.ops, []);
|
|
316
|
+
pressAll(r, now);
|
|
317
|
+
assert.deepEqual(r.ops.map(([k]) => k), ['action', 'answer', 'menu']);
|
|
318
|
+
});
|
|
319
|
+
|
|
320
|
+
await test('v1.151: another account rostered on the id without a body ends the hold', () => {
|
|
321
|
+
const r = boot();
|
|
322
|
+
offerAll(r);
|
|
323
|
+
r.drop();
|
|
324
|
+
r.back('p1', { ...ada, userId: '999' }, null);
|
|
325
|
+
// A call for the id now is not Ada's to hold.
|
|
326
|
+
assert.equal(r.hub().actions('p1', [{ id: 'leak', label: 'Leak' }]), false);
|
|
327
|
+
r.tick();
|
|
328
|
+
r.session.players = r.session.players.filter((p) => p.playerId !== 'p1');
|
|
329
|
+
r.tick();
|
|
330
|
+
r.back('p1', ada);
|
|
331
|
+
r.hello('p1', { resume: true });
|
|
332
|
+
r.tick(250);
|
|
333
|
+
assert.equal(r.last('hub-actions').items, null, 'Ada is not replayed an offer once the hold ended');
|
|
334
|
+
assert.equal(r.last('hub-ask').id, null);
|
|
335
|
+
assert.equal(r.count('hub-menu'), 1);
|
|
336
|
+
});
|
|
337
|
+
|
|
338
|
+
await test('an anonymous identity on the id ends the hold, even with the same digits', () => {
|
|
339
|
+
const r = boot();
|
|
340
|
+
offerAll(r);
|
|
341
|
+
r.drop();
|
|
342
|
+
r.back('p1', { ...ada, isAnonymous: true }, null);
|
|
343
|
+
r.tick();
|
|
344
|
+
r.session.players = r.session.players.filter((p) => p.playerId !== 'p1');
|
|
345
|
+
r.tick();
|
|
346
|
+
r.back('p1', ada);
|
|
347
|
+
r.hello('p1', { resume: true });
|
|
348
|
+
assert.equal(r.last('hub-actions').items, null);
|
|
349
|
+
assert.equal(r.last('hub-ask').id, null);
|
|
350
|
+
});
|
|
351
|
+
|
|
352
|
+
await test('no packet before a hello is admitted for a held offer', () => {
|
|
353
|
+
for (const sameBody of [true, false]) {
|
|
354
|
+
const r = boot();
|
|
355
|
+
const old = offerAll(r);
|
|
356
|
+
const was = r.drop();
|
|
357
|
+
r.tick(2000);
|
|
358
|
+
r.back('p1', ada, sameBody ? was.body : body());
|
|
359
|
+
pressAll(r, old);
|
|
360
|
+
assert.deepEqual(r.ops, [], `refused before any hello (${sameBody ? 'same' : 'new'} body)`);
|
|
361
|
+
r.hello('p1', { resume: true });
|
|
362
|
+
pressAll(r, old);
|
|
363
|
+
assert.deepEqual(r.ops, [], 'the old versions stay refused after the replay');
|
|
364
|
+
}
|
|
365
|
+
});
|
|
366
|
+
|
|
367
|
+
await test('absent: offers are pruned while disconnected and calls while away return false', () => {
|
|
368
|
+
const r = boot({ ...keep, ...channels });
|
|
369
|
+
const old = offerAll(r);
|
|
370
|
+
r.drop();
|
|
371
|
+
assert.equal(r.hub().actions('p1', chips), false);
|
|
372
|
+
assert.equal(r.hub().ask('p1', prompt), false);
|
|
373
|
+
assert.equal(r.hub().menu('p1', sheet), false);
|
|
374
|
+
r.back('p1', ada);
|
|
375
|
+
r.hello('p1', { resume: true });
|
|
376
|
+
assert.deepEqual(r.last('hub-actions'), { k: 'hub-actions', items: null, n: 0 });
|
|
377
|
+
assert.deepEqual(r.last('hub-ask'), { k: 'hub-ask', id: null, n: 0 });
|
|
378
|
+
assert.equal(r.count('hub-menu'), 1);
|
|
379
|
+
r.tick(2000);
|
|
380
|
+
pressAll(r, old);
|
|
381
|
+
assert.deepEqual(r.ops, []);
|
|
382
|
+
// And a present player's replay keeps today's version.
|
|
383
|
+
r.hub().actions('p1', chips);
|
|
384
|
+
r.tick(250);
|
|
385
|
+
const n = r.last('hub-actions').n;
|
|
386
|
+
r.hello('p1');
|
|
387
|
+
assert.equal(r.last('hub-actions').n, n);
|
|
388
|
+
});
|
|
389
|
+
|
|
390
|
+
console.log(`${passed} held-offers tests passed`);
|
|
391
|
+
if (failures.length) {
|
|
392
|
+
console.error(`${failures.length} failed: ${failures.join('; ')}`);
|
|
393
|
+
process.exit(1);
|
|
394
|
+
}
|
|
@@ -5,7 +5,7 @@ import * as THREE from 'three';
|
|
|
5
5
|
import { readManifest } from '../code/server/manifest.js';
|
|
6
6
|
import { deck, hub } from '../code/client/state.js';
|
|
7
7
|
import { HIGH, makeTiers, cellInert } from '../code/client/tiers.js';
|
|
8
|
-
import { filterQualityScene, lowQuality, makeQualityVisit, qualityFor, restoreDecor } from '../code/client/quality.js';
|
|
8
|
+
import { filterQualityScene, lowQuality, makeQualityVisit, qualityFor, lowerLate, restoreDecor } from '../code/client/quality.js';
|
|
9
9
|
import { readQuality } from '../code/shared/quality.js';
|
|
10
10
|
const stubs = {
|
|
11
11
|
'castle-web-sdk': `export const isEdit = () => globalThis.__highOnlyEditor === true; export const resolveDeckFile = (name) => String(name).replace(/^\\.\\//, '');
|
|
@@ -151,8 +151,8 @@ const q = qualityFor(runtime);
|
|
|
151
151
|
// Exercise the real system's restoration gate with only highOnly enabled.
|
|
152
152
|
const source = fs.readFileSync(new URL('../code/systems/hub.js', import.meta.url), 'utf8');
|
|
153
153
|
const method = source.slice(source.indexOf(' deviceTier(scene, mp, now) {'), source.indexOf('\n interestFrame(scene, now) {'));
|
|
154
|
-
const deviceTier = new Function('Hub', 'qualityFor', 'restoreDecor', 'qualityPlayers', 'fpsTelemetryFor',
|
|
155
|
-
`return ({${method}}).deviceTier;`)({ deck, hub }, qualityFor, restoreDecor, () => assert.fail('quality caps enabled'), () => null);
|
|
154
|
+
const deviceTier = new Function('Hub', 'qualityFor', 'restoreDecor', 'qualityPlayers', 'fpsTelemetryFor', 'lowerLate',
|
|
155
|
+
`return ({${method}}).deviceTier;`)({ deck, hub }, qualityFor, restoreDecor, () => assert.fail('quality caps enabled'), () => null, lowerLate);
|
|
156
156
|
globalThis.__hub = {};
|
|
157
157
|
const system = { tiers: q.tiers, pendingEnd: null };
|
|
158
158
|
q.tiers.set('high');
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
// Hold-show v1.182: state, fitted flowers and held-item precedence.
|
|
2
|
+
import assert from 'node:assert/strict';
|
|
3
|
+
import fs from 'node:fs';
|
|
4
|
+
import { register } from 'node:module';
|
|
5
|
+
|
|
6
|
+
const hooks = `
|
|
7
|
+
import { readFile } from 'node:fs/promises';
|
|
8
|
+
import { existsSync } from 'node:fs';
|
|
9
|
+
import { fileURLToPath } from 'node:url';
|
|
10
|
+
const SDK = ${JSON.stringify(new URL('./fixtures/sdk-stub.mjs', import.meta.url).href)};
|
|
11
|
+
const KITS = ${JSON.stringify(new URL('../../', import.meta.url).href)};
|
|
12
|
+
export async function resolve(specifier, context, next) {
|
|
13
|
+
if (specifier === '@imports/castle.multiplayer-3d/code/client/avatars.js') return { url: 'data:text/javascript,export function dropMissing() {}', shortCircuit: true };
|
|
14
|
+
if (specifier === 'castle-web-sdk') {
|
|
15
|
+
return { url: SDK, shortCircuit: true };
|
|
16
|
+
}
|
|
17
|
+
for (const kit of ['physics-2d', 'physics-3d']) {
|
|
18
|
+
if (specifier.startsWith('@imports/castle.' + kit + '/')) {
|
|
19
|
+
specifier = KITS + kit + '/' + specifier.slice(('@imports/castle.' + kit + '/').length);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
const parent = context.parentURL ?? '';
|
|
23
|
+
if ((specifier.startsWith('.') || specifier.startsWith('file:')) && parent.includes('/kits/') && !/\\.(m?js|jsx|json)$/.test(specifier)) {
|
|
24
|
+
const base = new URL(specifier, parent).href;
|
|
25
|
+
for (const ext of ['.js', '.jsx']) if (existsSync(fileURLToPath(base + ext))) return next(base + ext, context);
|
|
26
|
+
}
|
|
27
|
+
return next(specifier, context);
|
|
28
|
+
}
|
|
29
|
+
export async function load(url, context, next) {
|
|
30
|
+
if (url.endsWith('/code/client/hookLayer.js')) return { format: 'module', source: (await readFile(fileURLToPath(url), 'utf8')).replaceAll('import.meta.glob(', '(() => ({}))('), shortCircuit: true };
|
|
31
|
+
return next(url, context);
|
|
32
|
+
}`;
|
|
33
|
+
register(`data:text/javascript,${encodeURIComponent(hooks)}`);
|
|
34
|
+
|
|
35
|
+
const THREE = await import('three');
|
|
36
|
+
const Avatar = await import('../code/client/avatar.js');
|
|
37
|
+
const Role = await import('../code/client/role.js');
|
|
38
|
+
const HoldShow = await import('../code/client/holdShow.js');
|
|
39
|
+
const State = await import('../code/client/state.js');
|
|
40
|
+
const hooksLayer = (await import('../code/client/hookLayer.js')).default;
|
|
41
|
+
const { makeWear, makeEarned, makeRole, makeHoldShow } = await import('../code/client/wear.js');
|
|
42
|
+
const { buildModelNode, parseModel, visibleBounds } = await import('../../physics-3d/engine3d/pxmodel.js');
|
|
43
|
+
const police = { id: 'police', label: 'Police', color: '#22335a', hat: 'police-cap', top: 'vest', tool: 'torch' };
|
|
44
|
+
let n = 0;
|
|
45
|
+
function test(name, fn) { fn(); n += 1; console.log(`ok: ${name}`); }
|
|
46
|
+
const read = (file) => fs.readFileSync(new URL(`../${file}`, import.meta.url), 'utf8');
|
|
47
|
+
|
|
48
|
+
function sceneOf() {
|
|
49
|
+
const local = { id: 'me-body', components: { Transform: { x: 0, y: 1, z: 0 } } };
|
|
50
|
+
const other = { id: 'body-p2', components: { Transform: { x: 2, y: 1, z: 0 } } };
|
|
51
|
+
const nodes = new Map([local, other].map(({ id }) => [id, { node: new THREE.Group() }]));
|
|
52
|
+
const files = {};
|
|
53
|
+
for (const [kind, ids] of [['top', Role.ROLE_TOPS], ['tool', Role.ROLE_TOOLS]]) {
|
|
54
|
+
for (const id of ids) {
|
|
55
|
+
for (const square of kind === 'top' ? [false, true] : [false]) {
|
|
56
|
+
const file = Role.roleFile(kind, id, square); files[`imports/castle.hub-game/${file}`] = read(file);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
for (const shape of HoldShow.HOLD_SHOW_SHAPES) for (const square of [false, true]) {
|
|
61
|
+
const file = HoldShow.holdShowFile(shape, square); files[`imports/castle.hub-game/${file}`] = read(file);
|
|
62
|
+
}
|
|
63
|
+
for (const file of ['models/hats/cap.pxmodel', 'models/hats/police-cap.pxmodel', 'models/earned/belt-plain.pxmodel', 'models/earned/sash-plain.pxmodel', 'models/earned/held-lantern.pxmodel', 'models/earned/pin-round.pxmodel']) {
|
|
64
|
+
files[`imports/castle.hub-game/${file}`] = read(file);
|
|
65
|
+
}
|
|
66
|
+
return { local, files, three: { nodes }, multiplayer: { net: { selfId: () => 'me' }, avatars: { actors: new Map([['p2', other.id]]) } }, getActor: (id) => id === local.id ? local : id === other.id ? other : null };
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
const flower = { shape: 'daisy', color: '#ffbbdd' };
|
|
70
|
+
test('tuple wire, private maps, empty snapshots, absent snapshot and travel cleanup', () => {
|
|
71
|
+
State.clear();
|
|
72
|
+
hooksLayer.state({}, { hubHoldShow: { me: ['daisy', '#ffbbdd'], p2: ['rose', '#ee3344'] } });
|
|
73
|
+
assert.deepEqual(State.hub.holdShows.get('me'), flower);
|
|
74
|
+
hooksLayer.message({}, { k: 'hub-hold-show', hubHoldShow: { p2: ['tulip', '#ffffff'] } });
|
|
75
|
+
assert.equal(State.hub.holdShows.get('p2').shape, 'tulip');
|
|
76
|
+
hooksLayer.state({}, { hubPlace: {} });
|
|
77
|
+
assert.equal(State.hub.holdShows.size, 1);
|
|
78
|
+
hooksLayer.message({}, { k: 'hub-hold-show', hubHoldShow: {} });
|
|
79
|
+
assert.equal(State.hub.holdShows.size, 0);
|
|
80
|
+
hooksLayer.state({}, { hubHoldShow: { me: ['daisy', '#ffbbdd'] } });
|
|
81
|
+
hooksLayer.state({}, { hubHoldShow: {} }); assert.equal(State.hub.holdShows.size, 0);
|
|
82
|
+
hooksLayer.state({}, { hubHoldShow: { me: ['daisy', '#ffbbdd'], bad: ['unknown', '#ffffff'] } });
|
|
83
|
+
assert.equal(State.hub.holdShows.size, 1);
|
|
84
|
+
State.clear(); assert.equal(State.hub.holdShows.size + State.hub.holdShowAll.size + State.hub.holdShowMe.size, 0);
|
|
85
|
+
});
|
|
86
|
+
test('all flower models build and tint, fitting the right-hand grip at 1.2x on every avatar style', () => {
|
|
87
|
+
for (const shape of HoldShow.HOLD_SHOW_SHAPES) for (const square of [false, true]) {
|
|
88
|
+
const file = HoldShow.holdShowFile(shape, square), text = read(file), model = parseModel(text);
|
|
89
|
+
assert.ok(model.parts.some((p) => p.color === '#3aa0d8'));
|
|
90
|
+
const tinted = JSON.parse(text.split('"#3aa0d8"').join('"#abcdef"'));
|
|
91
|
+
assert.ok(tinted.parts.some((p) => p.color === '#abcdef'));
|
|
92
|
+
assert.ok(tinted.parts.some((p) => p.color === '#43834d'), 'stem stays green');
|
|
93
|
+
const node = buildModelNode(model, null, { [file]: text }, file, [file], { optimize: true });
|
|
94
|
+
assert.ok(visibleBounds(node).max.y > 0.25);
|
|
95
|
+
}
|
|
96
|
+
for (const style of Avatar.STYLES) for (let i = 0; i < Avatar.AVATARS; i++) {
|
|
97
|
+
const fit = Avatar.earnedFit(i, style);
|
|
98
|
+
for (const shape of HoldShow.HOLD_SHOW_SHAPES) {
|
|
99
|
+
const look = HoldShow.holdShowLook({ shape, color: '#ABCDEF' }, fit);
|
|
100
|
+
assert.deepEqual(look.position, [fit.hand[0], Math.round((fit.hand[1] - 0.7) * 1000) / 1000, fit.hand[2]]);
|
|
101
|
+
assert.deepEqual(look.scale, [1.2, 1.2, 1.2]); assert.equal(look.color, '#abcdef');
|
|
102
|
+
assert.equal(look.file.includes('/square/'), fit.square === true);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
});
|
|
106
|
+
test('flowers attach to both avatar nodes, refit, replace, hide with body and dispose on clear', () => {
|
|
107
|
+
const scene = sceneOf(), renderer = makeHoldShow(), shows = new Map([['me', flower], ['p2', flower]]);
|
|
108
|
+
const fit = Avatar.earnedFit(1, 'toon');
|
|
109
|
+
const mine = scene.three.nodes.get('me-body').node, theirs = scene.three.nodes.get('body-p2').node;
|
|
110
|
+
renderer.frame(scene, scene.local, shows, () => fit);
|
|
111
|
+
assert.equal(mine.children[0].name, 'hold-show:daisy'); assert.equal(theirs.children[0].name, 'hold-show:daisy');
|
|
112
|
+
assert.deepEqual(mine.children[0].children[0].position.toArray(), HoldShow.holdShowLook(flower, fit).position);
|
|
113
|
+
assert.deepEqual(mine.children[0].children[0].children[0].scale.toArray(), [1.2, 1.2, 1.2]);
|
|
114
|
+
assert.ok(mine.children[0].userData.hatKey.includes('"#ffbbdd"'));
|
|
115
|
+
const first = mine.children[0]; renderer.frame(scene, scene.local, shows, () => fit); assert.equal(mine.children[0], first);
|
|
116
|
+
renderer.frame(scene, scene.local, shows, () => Avatar.earnedFit(1, 'blocky'));
|
|
117
|
+
assert.ok(mine.children[0].userData.hatKey.includes('/square/daisy.pxmodel'));
|
|
118
|
+
mine.visible = false; assert.equal(mine.children[0].parent.visible, false);
|
|
119
|
+
const replacement = new THREE.Group(); scene.three.nodes.set('me-body', { node: replacement });
|
|
120
|
+
renderer.frame(scene, scene.local, shows, () => fit); assert.equal(replacement.children.length, 1);
|
|
121
|
+
let freed = 0; replacement.traverse((o) => o.geometry?.addEventListener('dispose', () => freed++));
|
|
122
|
+
shows.clear(); renderer.frame(scene, scene.local, shows); assert.equal(replacement.children.length + theirs.children.length, 0); assert.ok(freed > 0);
|
|
123
|
+
renderer.clear(); renderer.forget();
|
|
124
|
+
});
|
|
125
|
+
test('live system hides earned held only, yields to role tool and grab, restores after each clears; every tier', () => {
|
|
126
|
+
const source = read('code/systems/hub.js');
|
|
127
|
+
const method = source.slice(source.indexOf(' applyWear(scene, local) {') + 2, source.indexOf(" // The place's tuning", source.indexOf(' applyWear(scene, local) {')));
|
|
128
|
+
const Hub = { hub: State.hub };
|
|
129
|
+
const deps = { Hub, Avatar: { ...Avatar, style: () => 'toon', current: () => 1 }, AvatarCap: { shown: () => 2 },
|
|
130
|
+
roleWearing: Role.roleWearing, roleEarned: Role.roleEarned, holdShowVisible: HoldShow.holdShowVisible, holdShowEarned: HoldShow.holdShowEarned };
|
|
131
|
+
const apply = new Function(...Object.keys(deps), `return ({${method}}).applyWear`)(...Object.values(deps));
|
|
132
|
+
for (const tier of ['high', 'low', 'weakest']) {
|
|
133
|
+
State.clear(); const scene = sceneOf(); let grabbing = null;
|
|
134
|
+
const draw = { wear: makeWear(), earned: makeEarned(), roles: makeRole(), holdShows: makeHoldShow(), grab: { holding: () => grabbing } };
|
|
135
|
+
const node = scene.three.nodes.get('me-body').node;
|
|
136
|
+
const has = (name) => node.children.some((c) => c.name === name);
|
|
137
|
+
State.hub.tier = tier;
|
|
138
|
+
State.hub.earned.set('me', { class: 'held', shape: 'held-lantern', color: '#abcdef' });
|
|
139
|
+
apply.call(draw, scene, scene.local); assert.ok(has('earned:held-lantern'));
|
|
140
|
+
State.hub.holdShows.set('me', flower); apply.call(draw, scene, scene.local);
|
|
141
|
+
assert.ok(has('hold-show:daisy')); assert.equal(has('earned:held-lantern'), false);
|
|
142
|
+
State.hub.roles.set('me', police); apply.call(draw, scene, scene.local);
|
|
143
|
+
assert.equal(has('hold-show:daisy'), false); assert.ok(has('role:tool-torch'));
|
|
144
|
+
State.hub.roles.clear(); apply.call(draw, scene, scene.local); assert.ok(has('hold-show:daisy'));
|
|
145
|
+
grabbing = 'ball'; apply.call(draw, scene, scene.local); assert.equal(has('hold-show:daisy'), false);
|
|
146
|
+
assert.equal(has('earned:held-lantern'), false);
|
|
147
|
+
grabbing = null; apply.call(draw, scene, scene.local); assert.ok(has('hold-show:daisy'));
|
|
148
|
+
State.hub.earned.set('me', { class: 'pin', shape: 'pin-round', color: '#abcdef' });
|
|
149
|
+
apply.call(draw, scene, scene.local); assert.ok(has('earned:pin-round')); assert.ok(has('hold-show:daisy'));
|
|
150
|
+
State.hub.earned.set('me', { class: 'held', shape: 'held-lantern', color: '#abcdef' });
|
|
151
|
+
State.hub.holdShows.clear(); apply.call(draw, scene, scene.local);
|
|
152
|
+
assert.ok(has('earned:held-lantern')); assert.equal(has('hold-show:daisy'), false);
|
|
153
|
+
draw.wear.clear(); draw.earned.clear(); draw.roles.clear(); draw.holdShows.clear();
|
|
154
|
+
}
|
|
155
|
+
State.clear();
|
|
156
|
+
});
|
|
157
|
+
test('v1.190 hub-hold-face turns the camera (follow) or asks the facing (orbit), as hub-jumped does', () => {
|
|
158
|
+
const follow = { persistent: { camAngle: 0 } };
|
|
159
|
+
hooksLayer.message(follow, { k: 'hub-hold-face', facing: 1 });
|
|
160
|
+
assert.equal(follow.persistent.camAngle, Math.PI - 1);
|
|
161
|
+
assert.equal(follow.faceRequest, undefined);
|
|
162
|
+
const orbit = { cameraControl: 'orbit', persistent: { camAngle: 0 } };
|
|
163
|
+
hooksLayer.message(orbit, { k: 'hub-hold-face', facing: -2 });
|
|
164
|
+
assert.equal(orbit.persistent.camAngle, Math.PI + 2);
|
|
165
|
+
assert.equal(orbit.faceRequest, -2);
|
|
166
|
+
const bad = { persistent: { camAngle: 0.5 } };
|
|
167
|
+
hooksLayer.message(bad, { k: 'hub-hold-face', facing: 'x' });
|
|
168
|
+
hooksLayer.message(bad, { k: 'hub-hold-face', facing: NaN });
|
|
169
|
+
assert.equal(bad.persistent.camAngle, 0.5, 'a facing that is not a finite number is ignored');
|
|
170
|
+
const jumped = { cameraControl: 'orbit' };
|
|
171
|
+
hooksLayer.message(jumped, { k: 'hub-jumped', facing: 0.25 });
|
|
172
|
+
assert.equal(jumped.persistent.camAngle, Math.PI - 0.25, 'hub-jumped is unchanged');
|
|
173
|
+
assert.equal(jumped.faceRequest, 0.25);
|
|
174
|
+
});
|
|
175
|
+
console.log(`test-hold-show-client: ${n} passed`);
|