castle-web-cli 0.4.239 → 0.4.240
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/platformDoc.js +2 -1
- package/dist/playPagePolicy.js +5 -1
- package/dist/resetLeaderboards.d.ts +8 -1
- package/dist/resetLeaderboards.js +43 -8
- 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 +473 -53
- 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/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 +851 -45
- 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 +8 -1
- package/kits/hub-game/code/server/replay.js +135 -0
- 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 +427 -54
- package/kits/hub-game/docs/analytics.md +16 -2
- package/kits/hub-game/docs/contract.md +942 -99
- 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 +420 -3
- 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-picker-surface.mjs +321 -0
- package/kits/hub-game/scripts/test-placeat-server.mjs +395 -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 +237 -0
- 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-stuck-surface.mjs +174 -0
- package/kits/hub-game/scripts/test-stuck.mjs +31 -0
- 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 +49 -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 +67 -11
- 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 +191 -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-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 +51 -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
|
@@ -37,8 +37,10 @@ const RISE_M = 2;
|
|
|
37
37
|
// Objects wider than this (metres from centre to edge) are not offered.
|
|
38
38
|
const MAX_EXTENT = 2;
|
|
39
39
|
// How fast a held object follows its hold point: a pickup eases in rather
|
|
40
|
-
// than jumping
|
|
41
|
-
// how far an owned object may move between reports
|
|
40
|
+
// than jumping. The speed alone does not keep the ease-in inside the server's
|
|
41
|
+
// limit on how far an owned object may move between reports (reports bunched
|
|
42
|
+
// by the network get no time at all), so the ease-in is also bounded by what
|
|
43
|
+
// the server has acknowledged, as the aimed throw's swing is (`ease`).
|
|
42
44
|
const CARRY_SPEED = 20;
|
|
43
45
|
// A throw's upward part, as a share of its speed.
|
|
44
46
|
const THROW_UP = 0.25;
|
|
@@ -93,18 +95,19 @@ export const KEEP_TELL_MS = 1000;
|
|
|
93
95
|
// never lost. The server judges a throw from the pose it last heard.
|
|
94
96
|
export const AIM_WAIT_MS = 150;
|
|
95
97
|
export const AIM_GIVE_UP_MS = 2000;
|
|
96
|
-
// How far (metres, in a straight line) the swing
|
|
97
|
-
// from anywhere the server's body for it
|
|
98
|
-
// owned-object report against where its
|
|
99
|
-
// arrives: no farther than MAX_OBJECT_SPEED
|
|
100
|
-
// since the last report, plus MOVE_SLACK
|
|
101
|
-
// the object away and ends the hold.
|
|
102
|
-
// two physics steps get no time at
|
|
103
|
-
// only
|
|
104
|
-
//
|
|
105
|
-
//
|
|
106
|
-
//
|
|
107
|
-
//
|
|
98
|
+
// How far (metres, in a straight line) the swing, and the pickup's ease-in
|
|
99
|
+
// (`ease`), may put the held object from anywhere the server's body for it
|
|
100
|
+
// may be. multiplayer-3d checks each owned-object report against where its
|
|
101
|
+
// kinematic body is when the report arrives: no farther than MAX_OBJECT_SPEED
|
|
102
|
+
// (40 m/s) times the server time since the last report, plus MOVE_SLACK
|
|
103
|
+
// (0.6 m); a report past that takes the object away and ends the hold.
|
|
104
|
+
// Reports bunched by the network between two physics steps get no time at
|
|
105
|
+
// all, only the 0.6 m, and the body moves only at a step, to the newest
|
|
106
|
+
// report applied before it. So the swing and the ease-in never count on
|
|
107
|
+
// time, and put the object within this of every position this client has
|
|
108
|
+
// reported since the one the body is sure to have reached (see `reach`):
|
|
109
|
+
// wherever among them the body is, the next report is inside the bound. The
|
|
110
|
+
// report carries exactly where the swing or the ease-in put the object (the
|
|
108
111
|
// client's physics runs before this system, the report after it); the rest
|
|
109
112
|
// of the 0.6 m is margin.
|
|
110
113
|
export const AIM_SLACK_M = 0.5;
|
|
@@ -117,9 +120,12 @@ const AIM_FACE_RAD = 1 * DEG;
|
|
|
117
120
|
// height, and how far it hovers.
|
|
118
121
|
const PLAYER = { radius: 0.35, height: 1.4, hover: 0.15 };
|
|
119
122
|
|
|
120
|
-
|
|
123
|
+
// `refuse` (v1.204) is true, having said why, when a press must wait on the
|
|
124
|
+
// server's progress read.
|
|
125
|
+
export function makeGrab(chrome, refuse = () => false) {
|
|
121
126
|
const t = {
|
|
122
127
|
chrome,
|
|
128
|
+
refuse,
|
|
123
129
|
held: null,
|
|
124
130
|
net: null,
|
|
125
131
|
pressed: false,
|
|
@@ -153,6 +159,8 @@ export function makeGrab(chrome) {
|
|
|
153
159
|
return {
|
|
154
160
|
frame: (scene, mp, local, idle, pauseCarry = false) => frame(t, scene, mp, local, idle, pauseCarry),
|
|
155
161
|
holding: () => t.held?.id ?? null,
|
|
162
|
+
// For tests: how many reports of the hold are kept (`listen`).
|
|
163
|
+
trailLength: () => t.held?.sent?.trail.length ?? 0,
|
|
156
164
|
perform(id, scene, mp, local, op, onThrow) {
|
|
157
165
|
const body = scene.physics3d?.bodyOf(id), actor = scene.getActor(id);
|
|
158
166
|
if (!body || !actor || !mp.own?.mine?.has(id)) {return false;}
|
|
@@ -164,8 +172,8 @@ export function makeGrab(chrome) {
|
|
|
164
172
|
else {throwHeld(t, scene, body, local, config, { send() {} }, performance.now());}
|
|
165
173
|
} else if (op === 'grab' && !t.held) {
|
|
166
174
|
const at = body.translation(), size = sizeOf(actor.components.Shape);
|
|
167
|
-
t.held = { id, ...size, at: { ...at } };
|
|
168
|
-
|
|
175
|
+
t.held = { id, ...size, at: { ...at }, ease: { last: performance.now() + AIM_GIVE_UP_MS } };
|
|
176
|
+
ease(t, scene, mp, body, local, config, 0, performance.now());
|
|
169
177
|
}
|
|
170
178
|
return true;
|
|
171
179
|
},
|
|
@@ -178,8 +186,11 @@ function frame(t, scene, mp, local, idle, pauseCarry) {
|
|
|
178
186
|
const dt = Math.min(0.1, Math.max(0, (now - (t.lastAt || now)) / 1000));
|
|
179
187
|
t.lastAt = now;
|
|
180
188
|
// A press counts in the frame it lands in, and only for what is offered then.
|
|
181
|
-
const pressed = t.pressed;
|
|
189
|
+
const pressed = t.pressed && !t.refuse();
|
|
182
190
|
t.pressed = false;
|
|
191
|
+
// v1.204: nothing is grabbed while the server reads progress, a press
|
|
192
|
+
// queued before it included.
|
|
193
|
+
if (hub.catching != null) {t.waiting = null;}
|
|
183
194
|
const events = hub.grabEvents.splice(0);
|
|
184
195
|
const net = mp.net ?? null;
|
|
185
196
|
if (net !== t.net) {
|
|
@@ -216,11 +227,10 @@ function frame(t, scene, mp, local, idle, pauseCarry) {
|
|
|
216
227
|
t.held = null;
|
|
217
228
|
} else {
|
|
218
229
|
if (paused) {delete t.held.aim; delete t.held.actThrow;}
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
}
|
|
230
|
+
// What this client has told the server of the hold, for the pickup's
|
|
231
|
+
// ease-in and a throw's swing to keep inside (`reach`); it changes
|
|
232
|
+
// nothing here.
|
|
233
|
+
listen(t.held, mp);
|
|
224
234
|
if (t.held.aim) {
|
|
225
235
|
aimFrame(t, scene, mp, body, local, config, net, now, dt);
|
|
226
236
|
} else if (can && pressed && scene.cameraControl === 'orbit') {
|
|
@@ -228,7 +238,7 @@ function frame(t, scene, mp, local, idle, pauseCarry) {
|
|
|
228
238
|
} else if (can && pressed) {
|
|
229
239
|
throwHeld(t, scene, body, local, config, net, now);
|
|
230
240
|
} else {
|
|
231
|
-
|
|
241
|
+
ease(t, scene, mp, body, local, config, dt, now);
|
|
232
242
|
if (config.keepHeld === true) {
|
|
233
243
|
// v1.25: the server keeps a held object this client's only while it
|
|
234
244
|
// hears the hold goes on.
|
|
@@ -239,7 +249,7 @@ function frame(t, scene, mp, local, idle, pauseCarry) {
|
|
|
239
249
|
}
|
|
240
250
|
}
|
|
241
251
|
}
|
|
242
|
-
if (t.held
|
|
252
|
+
if (t.held) {
|
|
243
253
|
// Where the body is now is what the multiplayer kit's report, after
|
|
244
254
|
// this system, packs if one goes out this frame (`listen`).
|
|
245
255
|
put(t.held, body);
|
|
@@ -270,9 +280,10 @@ function frame(t, scene, mp, local, idle, pauseCarry) {
|
|
|
270
280
|
extent: target.extent,
|
|
271
281
|
half: target.half,
|
|
272
282
|
at: { x: at.x, y: at.y, z: at.z },
|
|
283
|
+
ease: { last: now + AIM_GIVE_UP_MS },
|
|
273
284
|
};
|
|
274
285
|
net.send({ k: 'hub-grab', actor: target.id, op: 'grab' });
|
|
275
|
-
|
|
286
|
+
ease(t, scene, mp, phys.bodyOf(target.id), local, config, dt, now);
|
|
276
287
|
t.chrome.grabPrompt?.('Throw');
|
|
277
288
|
return;
|
|
278
289
|
}
|
|
@@ -322,9 +333,10 @@ function steadyFrame(t, scene, mp, local, config, net, active, pressed, now, dt)
|
|
|
322
333
|
extent: ready.extent,
|
|
323
334
|
half: ready.half,
|
|
324
335
|
at: { x: at.x, y: at.y, z: at.z },
|
|
336
|
+
ease: { last: now + AIM_GIVE_UP_MS },
|
|
325
337
|
};
|
|
326
338
|
net.send({ k: 'hub-grab', actor: ready.id, op: 'grab' });
|
|
327
|
-
|
|
339
|
+
ease(t, scene, mp, body, local, config, dt, now);
|
|
328
340
|
t.chrome.grabPrompt?.('Throw');
|
|
329
341
|
}
|
|
330
342
|
|
|
@@ -469,6 +481,50 @@ function carry(
|
|
|
469
481
|
return k === 1;
|
|
470
482
|
}
|
|
471
483
|
|
|
484
|
+
// A held object's carry while the pickup eases in: from where it lay to its
|
|
485
|
+
// hold point, which may be metres at the carry speed, it goes only as fast as
|
|
486
|
+
// the server hears it, as the aimed throw's swing does (AIM_SLACK_M, below):
|
|
487
|
+
// never more than AIM_SLACK_M, in a straight line, from any position this
|
|
488
|
+
// client has reported since the one the server's body is sure to have reached
|
|
489
|
+
// (`reach`), at rest where it is put, and not at all while no such report is
|
|
490
|
+
// known (the frame of the grab itself among them). The ease-in is over, for
|
|
491
|
+
// the rest of the hold, once the object first gets to the hold point, or
|
|
492
|
+
// AIM_GIVE_UP_MS after the grab (a player who walks off faster than the bound
|
|
493
|
+
// lets it follow is never left with the object stuck behind them); from then
|
|
494
|
+
// on, and throughout with a multiplayer kit without acknowledgements or
|
|
495
|
+
// report numbers, it is the plain carry at the carry speed.
|
|
496
|
+
function ease(t, scene, mp, body, local, config, dt, now) {
|
|
497
|
+
const held = t.held;
|
|
498
|
+
const places = held.ease && now < held.ease.last ? reach(held, mp) : null;
|
|
499
|
+
if (places === null) {
|
|
500
|
+
if (carry(t, scene, body, local, config, dt)) {
|
|
501
|
+
delete held.ease;
|
|
502
|
+
}
|
|
503
|
+
return;
|
|
504
|
+
}
|
|
505
|
+
const to = holdPoint(local, config, held);
|
|
506
|
+
const full = CARRY_SPEED * dt;
|
|
507
|
+
let most = 0;
|
|
508
|
+
if (places !== false) {
|
|
509
|
+
const from = held.at;
|
|
510
|
+
const d = Math.hypot(to.x - from.x, to.y - from.y, to.z - from.z);
|
|
511
|
+
// Where `carry` puts it going at most m.
|
|
512
|
+
most = farthest(places, full, (m) => {
|
|
513
|
+
const k = d > m && d > 0 ? m / d : 1;
|
|
514
|
+
return {
|
|
515
|
+
x: from.x + (to.x - from.x) * k,
|
|
516
|
+
y: from.y + (to.y - from.y) * k,
|
|
517
|
+
z: from.z + (to.z - from.z) * k,
|
|
518
|
+
};
|
|
519
|
+
});
|
|
520
|
+
}
|
|
521
|
+
if (carry(t, scene, body, local, config, dt, to, most)) {
|
|
522
|
+
delete held.ease;
|
|
523
|
+
}
|
|
524
|
+
// Reported at rest where it is put, as the swing is.
|
|
525
|
+
body.setLinvel({ x: 0, y: 0, z: 0 }, true);
|
|
526
|
+
}
|
|
527
|
+
|
|
472
528
|
// Let go along the player's facing at `throwSpeed`, a little upward (or
|
|
473
529
|
// along `f`, radians, for an aimed throw).
|
|
474
530
|
function throwHeld(
|
|
@@ -610,23 +666,7 @@ function swing(t, scene, mp, body, local, config, dt) {
|
|
|
610
666
|
if (places === false) {
|
|
611
667
|
most = 0;
|
|
612
668
|
} else if (places !== null) {
|
|
613
|
-
|
|
614
|
-
places.every((q) => Math.hypot(p.x - q.x, p.y - q.y, p.z - q.z) <= AIM_SLACK_M);
|
|
615
|
-
if (!fits(step(full).next)) {
|
|
616
|
-
// The farthest that fits, to well under a millimetre; none, when even a
|
|
617
|
-
// little way does not (the object stays where it was last reported).
|
|
618
|
-
let lo = 0;
|
|
619
|
-
let hi = full;
|
|
620
|
-
for (let i = 0; i < 24; i += 1) {
|
|
621
|
-
const mid = (lo + hi) / 2;
|
|
622
|
-
if (fits(step(mid).next)) {
|
|
623
|
-
lo = mid;
|
|
624
|
-
} else {
|
|
625
|
-
hi = mid;
|
|
626
|
-
}
|
|
627
|
-
}
|
|
628
|
-
most = lo;
|
|
629
|
-
}
|
|
669
|
+
most = farthest(places, full, (m) => step(m).next);
|
|
630
670
|
}
|
|
631
671
|
const { a, to } = step(most);
|
|
632
672
|
aim.a = a;
|
|
@@ -639,11 +679,36 @@ function swing(t, scene, mp, body, local, config, dt) {
|
|
|
639
679
|
return reached && aim.a === aim.f;
|
|
640
680
|
}
|
|
641
681
|
|
|
682
|
+
// How far, up to `full` metres, a held object may go this frame and stay
|
|
683
|
+
// within AIM_SLACK_M of every one of `places`, where `next(most)` is where
|
|
684
|
+
// going at most `most` puts it: the whole way when that fits, else the
|
|
685
|
+
// farthest that fits, to well under a millimetre; none, when even a little
|
|
686
|
+
// way does not (the object stays where it was last reported). The pickup's
|
|
687
|
+
// ease-in and the throw's swing alike.
|
|
688
|
+
function farthest(places, full, next) {
|
|
689
|
+
const fits = (p) =>
|
|
690
|
+
places.every((q) => Math.hypot(p.x - q.x, p.y - q.y, p.z - q.z) <= AIM_SLACK_M);
|
|
691
|
+
if (fits(next(full))) {
|
|
692
|
+
return full;
|
|
693
|
+
}
|
|
694
|
+
let lo = 0;
|
|
695
|
+
let hi = full;
|
|
696
|
+
for (let i = 0; i < 24; i += 1) {
|
|
697
|
+
const mid = (lo + hi) / 2;
|
|
698
|
+
if (fits(next(mid))) {
|
|
699
|
+
lo = mid;
|
|
700
|
+
} else {
|
|
701
|
+
hi = mid;
|
|
702
|
+
}
|
|
703
|
+
}
|
|
704
|
+
return lo;
|
|
705
|
+
}
|
|
706
|
+
|
|
642
707
|
// What this client has told the server about a held object, kept frame by
|
|
643
|
-
// frame
|
|
644
|
-
//
|
|
645
|
-
//
|
|
646
|
-
//
|
|
708
|
+
// frame while it is held: `trail`, `[report number, position]` for each
|
|
709
|
+
// movement report since the hold began (ease-in, carry and swing alike),
|
|
710
|
+
// known from report number `from` on; and `sure`, the newest report the
|
|
711
|
+
// server's body is sure to have reached (`reach`). The position is the one
|
|
647
712
|
// the report carried: the body where this system left it the frame the report
|
|
648
713
|
// went out (`put`), which the multiplayer kit reads straight after, before the
|
|
649
714
|
// next frame's physics moves it on at its velocity. Never the body read back a
|
|
@@ -690,6 +755,12 @@ function listen(held, mp) {
|
|
|
690
755
|
) {
|
|
691
756
|
sent.sure = Math.max(sent.sure, ack[1]);
|
|
692
757
|
}
|
|
758
|
+
// Reports before the one the body is sure to have reached are behind it for
|
|
759
|
+
// good: dropped here, every frame, so a long hold keeps only the few in
|
|
760
|
+
// flight, whether or not anything reads them (`reach`).
|
|
761
|
+
while (sent.trail.length > 0 && sent.trail[0][0] < sent.sure) {
|
|
762
|
+
sent.trail.shift();
|
|
763
|
+
}
|
|
693
764
|
}
|
|
694
765
|
|
|
695
766
|
// The body of a held object where this system leaves it this frame: the
|
|
@@ -704,8 +775,8 @@ function put(held, body) {
|
|
|
704
775
|
// Every place the server's body for a held object may be when the next
|
|
705
776
|
// report reaches it: the reported positions from the newest one it is sure to
|
|
706
777
|
// have reached on. null when the multiplayer kit gives no acknowledgements
|
|
707
|
-
// or report numbers (the swing
|
|
708
|
-
// such report is known yet.
|
|
778
|
+
// or report numbers (the swing and the ease-in are unbounded, as before
|
|
779
|
+
// them); false when no such report is known yet.
|
|
709
780
|
//
|
|
710
781
|
// An acknowledgement alone is not a body moved. multiplayer-3d applies a
|
|
711
782
|
// report as it arrives (its kinematic target, stamped with the simulation
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
// Pure catalogue, shared with the server. Flowers never occupy Earned.
|
|
2
|
+
export const HOLD_SHOW_SHAPES = Object.freeze(['daisy', 'tulip', 'sunflower', 'rose', 'moonflower']);
|
|
3
|
+
export const holdShowFile = (shape, square = false) => `models/hold-show/${square ? 'square/' : ''}${shape}.pxmodel`;
|
|
4
|
+
export function holdShowLook(item, fit = null) {
|
|
5
|
+
if (!HOLD_SHOW_SHAPES.includes(item?.shape) || typeof item?.color !== 'string' || item.color.length !== 7 || !/^#[0-9a-f]{6}$/i.test(item.color)) { return null; }
|
|
6
|
+
const [x, y, z] = fit?.hand ?? [-0.33, 0.34, 0.01];
|
|
7
|
+
return { shape: item.shape, file: holdShowFile(item.shape, fit?.square === true), color: item.color.toLowerCase(),
|
|
8
|
+
position: [x, Math.round((y - 0.7) * 1000) / 1000, z], yaw: 0, tilt: 0, scale: [1.2, 1.2, 1.2] };
|
|
9
|
+
}
|
|
10
|
+
export function holdShowMap(wire) {
|
|
11
|
+
return new Map(Object.entries(wire ?? {}).filter(([, v]) => Array.isArray(v) && v.length === 2 && holdShowLook({ shape: v[0], color: v[1] }))
|
|
12
|
+
.map(([id, [shape, color]]) => [id, { shape, color }]));
|
|
13
|
+
}
|
|
14
|
+
export function holdShowVisible(shows, roles, self, grabbing) {
|
|
15
|
+
return new Map([...shows].filter(([id]) => !roles.get(id)?.tool && !(id === self && grabbing)));
|
|
16
|
+
}
|
|
17
|
+
export function holdShowEarned(earned, shows) {
|
|
18
|
+
return shows.size ? new Map([...earned].filter(([id, item]) => item?.class !== 'held' || !shows.has(id))) : earned;
|
|
19
|
+
}
|
|
@@ -5,18 +5,20 @@
|
|
|
5
5
|
// draws it.
|
|
6
6
|
|
|
7
7
|
import * as castleSdk from 'castle-web-sdk';
|
|
8
|
+
import * as Celebrate from './celebrate.js';
|
|
8
9
|
import * as Avatars from '@imports/castle.multiplayer-3d/code/client/avatars.js';
|
|
9
10
|
import * as Avatar from './avatar.js';
|
|
10
11
|
import * as AvatarCap from './avatarCap.js';
|
|
11
12
|
import { mergeDictionary } from './interestCap.js';
|
|
12
13
|
import * as Cabinets from './cabinets.js';
|
|
13
14
|
import { firstJoinFor } from './firstJoin.js';
|
|
14
|
-
import { deck, earnedNow, hub, localArrival, mergeHidden, receiveParty, rolesNow, wearingNow } from './state.js';
|
|
15
|
+
import { deck, earnedNow, hub, holdShowsNow, idleNow, localArrival, mergeHidden, receiveParty, replayCleanup, rolesNow, wearingNow } from './state.js';
|
|
15
16
|
import { clearShot, receiveShot } from './shot.js';
|
|
16
17
|
import * as Ballot from './ballot.js';
|
|
18
|
+
import { holdShowMap } from './holdShow.js';
|
|
17
19
|
import * as Rehello from './rehello.js';
|
|
18
20
|
import { guestName } from './signIn.js';
|
|
19
|
-
import { sanitise, ownStamp } from './companion.js';
|
|
21
|
+
import { sanitise, ownStamp, chirpMap } from './companion.js';
|
|
20
22
|
import { buildStamp } from './build.js';
|
|
21
23
|
import { unpackFrame } from './frameBatch.js';
|
|
22
24
|
import { setFpsTelemetry } from './fpsTelemetry.js';
|
|
@@ -25,6 +27,7 @@ import { readQuality } from '../shared/quality.js';
|
|
|
25
27
|
import { noteQualityInteraction } from './quality.js';
|
|
26
28
|
import { parseCar, vehicleOf } from '../shared/car.js';
|
|
27
29
|
import { pinRiders } from './riders.js';
|
|
30
|
+
import { disguiseMap } from './disguise.js';
|
|
28
31
|
import { readDanceIdle } from '../shared/danceIdle.js';
|
|
29
32
|
|
|
30
33
|
// Root-anchored: the deck's own castle.json once this kit is imported.
|
|
@@ -111,6 +114,15 @@ let drawnStyle = null;
|
|
|
111
114
|
// Everyone's avatars with this player's own over them. A player whose avatar
|
|
112
115
|
// changed is dropped and respawns in the new one.
|
|
113
116
|
// A `hubAv2` block (v1.51) as a map, or an empty one for anything else.
|
|
117
|
+
// The camera turns to look along a facing the place chose (a jump, v1.190's
|
|
118
|
+
// turnCamera hold). Under the engine's orbit camera key the facing is asked for.
|
|
119
|
+
function turnTo(scene, facing) {
|
|
120
|
+
(scene.persistent ??= {}).camAngle = Math.PI - facing;
|
|
121
|
+
if (scene.cameraControl === 'orbit') {
|
|
122
|
+
scene.faceRequest = facing;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
|
|
114
126
|
function realAvatars(block) {
|
|
115
127
|
return new Map(Object.entries(block && typeof block === 'object' ? block : {}));
|
|
116
128
|
}
|
|
@@ -189,6 +201,11 @@ function stuckAnswer(msg) {
|
|
|
189
201
|
return { spot: msg.spot === true, to: typeof msg.to === 'string' && msg.to ? msg.to.slice(0, 40) : null };
|
|
190
202
|
}
|
|
191
203
|
|
|
204
|
+
// A `hub-idle` block: a plain object, or none.
|
|
205
|
+
function idleMap(value) {
|
|
206
|
+
return value && typeof value === 'object' && !Array.isArray(value) ? value : {};
|
|
207
|
+
}
|
|
208
|
+
|
|
192
209
|
function wearMap(value) {
|
|
193
210
|
return new Map(Object.entries(value && typeof value === 'object' ? value : {}));
|
|
194
211
|
}
|
|
@@ -279,11 +296,18 @@ const hooks = {
|
|
|
279
296
|
case 'hub-invite':
|
|
280
297
|
if (hub.place?.invite === true) {hub.commands.push({ k: 'hub-invite', ...(msg.share === true ? { share: true } : {}) });}
|
|
281
298
|
break;
|
|
299
|
+
case 'hub-stayed':
|
|
300
|
+
// v1.169: the place's answer to a numbered hub-stay.
|
|
301
|
+
if (Number.isSafeInteger(msg.end)) {hub.commands.push(msg);}
|
|
302
|
+
break;
|
|
282
303
|
case 'hub-go':
|
|
283
304
|
case 'hub-end':
|
|
284
305
|
case 'hub-result':
|
|
285
306
|
if (msg.k !== 'hub-result') {
|
|
307
|
+
Celebrate.clear();
|
|
286
308
|
clearShot();
|
|
309
|
+
// v1.169: whether it overlapped an absence is known only now.
|
|
310
|
+
Rehello.noteArrival(msg, scene.multiplayer);
|
|
287
311
|
}
|
|
288
312
|
hub.commands.push(msg);
|
|
289
313
|
break;
|
|
@@ -296,18 +320,21 @@ const hooks = {
|
|
|
296
320
|
case 'hub-hud':
|
|
297
321
|
hub.hudMe = msg.hud ?? null;
|
|
298
322
|
break;
|
|
323
|
+
case 'hub-progress':
|
|
324
|
+
// v1.204: kept from the first `true` until a `false`.
|
|
325
|
+
hub.catching = msg.catching === true ? (hub.catching ?? performance.now()) : null;
|
|
326
|
+
break;
|
|
299
327
|
case 'hub-arrived':
|
|
300
328
|
hub.arrivedFacing = typeof msg.facing === 'number' ? msg.facing : 0;
|
|
301
329
|
break;
|
|
330
|
+
case 'hub-hold-face':
|
|
331
|
+
// v1.190: a hold with turnCamera, and its release, turn this player's
|
|
332
|
+
// avatar to the held facing exactly as a jump does.
|
|
333
|
+
if (Number.isFinite(msg.facing)) {turnTo(scene, msg.facing);}
|
|
334
|
+
break;
|
|
302
335
|
case 'hub-jumped':
|
|
303
336
|
// A jump to a door: the camera turns to look at it.
|
|
304
|
-
if (typeof msg.facing === 'number') {
|
|
305
|
-
(scene.persistent ??= {}).camAngle = Math.PI - msg.facing;
|
|
306
|
-
// Under the engine's orbit camera key the facing is asked for.
|
|
307
|
-
if (scene.cameraControl === 'orbit') {
|
|
308
|
-
scene.faceRequest = msg.facing;
|
|
309
|
-
}
|
|
310
|
-
}
|
|
337
|
+
if (typeof msg.facing === 'number') {turnTo(scene, msg.facing);}
|
|
311
338
|
// Beside a player: the hub system says whom (a start next to a friend).
|
|
312
339
|
if (typeof msg.to === 'string') {
|
|
313
340
|
hub.jumpedTo = msg.to;
|
|
@@ -361,10 +388,25 @@ const hooks = {
|
|
|
361
388
|
hub.avatarColorsMe = realAvatars(msg.hubAvC);
|
|
362
389
|
setAvatars(netSystem?.scene ?? scene, netSystem?.system ?? null);
|
|
363
390
|
break;
|
|
391
|
+
case 'hub-idle':
|
|
392
|
+
// v1.183: seats, emotes and holds of players in a hidden pair this
|
|
393
|
+
// player may see, whole each time, laid over the shared fields.
|
|
394
|
+
hub.seatedMe = idleMap(msg.hubSeated);
|
|
395
|
+
hub.emotesMe = idleMap(msg.hubEmotes);
|
|
396
|
+
hub.heldMe = new Set(Array.isArray(msg.held) ? msg.held.filter((id) => typeof id === 'string') : []);
|
|
397
|
+
idleNow();
|
|
398
|
+
break;
|
|
364
399
|
case 'hub-wear':
|
|
365
400
|
hub.wearMe = wearMap(msg.hubWear);
|
|
366
401
|
setWearing();
|
|
367
402
|
break;
|
|
403
|
+
case 'hub-replay':
|
|
404
|
+
replayCleanup.receive(scene, msg.slot, msg.replay);
|
|
405
|
+
break;
|
|
406
|
+
case 'hub-hold-show':
|
|
407
|
+
hub.holdShowMe = holdShowMap(msg.hubHoldShow);
|
|
408
|
+
hub.holdShows = holdShowsNow();
|
|
409
|
+
break;
|
|
368
410
|
case 'hub-role':
|
|
369
411
|
hub.roleMe = wearMap(msg.hubRole);
|
|
370
412
|
hub.roles = rolesNow();
|
|
@@ -389,6 +431,7 @@ const hooks = {
|
|
|
389
431
|
case 'hub-vis':
|
|
390
432
|
hub.hiddenMe = new Set(Array.isArray(msg.hide) ? msg.hide : []);
|
|
391
433
|
hub.shownMe = new Set(Array.isArray(msg.show) ? msg.show : []);
|
|
434
|
+
hub.solidMe = new Set(Array.isArray(msg.solid) ? msg.solid : []);
|
|
392
435
|
mergeHidden();
|
|
393
436
|
break;
|
|
394
437
|
case 'hub-npc':
|
|
@@ -413,6 +456,11 @@ const hooks = {
|
|
|
413
456
|
hub.soundEvents.push(msg);
|
|
414
457
|
}
|
|
415
458
|
break;
|
|
459
|
+
case 'celebrate':
|
|
460
|
+
if (!Celebrate.receive(scene, msg)) {break;}
|
|
461
|
+
// Its chime is the token cue, under the cue message's own gates.
|
|
462
|
+
msg = { k: 'hub-cue', cue: 'token' };
|
|
463
|
+
// falls through
|
|
416
464
|
case 'hub-cue':
|
|
417
465
|
// Independent of audio mute/gesture gates; private transport only.
|
|
418
466
|
if (hub.place?.companion === true && hub.companion?.c && ownStamp(msg)) {
|
|
@@ -449,6 +497,17 @@ const hooks = {
|
|
|
449
497
|
)) {
|
|
450
498
|
hub.arrivalPlaced = true;
|
|
451
499
|
}
|
|
500
|
+
// v1.165 fix: this client's own clamped row carries the server's facing,
|
|
501
|
+
// which multiplayer does not apply to the local player; a driver's car
|
|
502
|
+
// takes it when the clamp is a placement (vehicle.js `placedHeading`).
|
|
503
|
+
for (const row of msg.ps ?? []) {
|
|
504
|
+
if (row?.[0] === system?.net?.selfId?.() && Boolean(row[5]) && Number.isFinite(row[4])) {
|
|
505
|
+
hub.selfClamp = { x: row[1], y: row[2], z: row[3], facing: row[4], at: performance.now() };
|
|
506
|
+
}
|
|
507
|
+
}
|
|
508
|
+
// v1.163: every admission's WORLD starts with no ghosts, hello or not;
|
|
509
|
+
// the server holds none for a connection it has not sent them on.
|
|
510
|
+
if (msg.k === 'w' && msg.again !== 1) {replayCleanup.clear();}
|
|
452
511
|
if (msg.hubPlace) {
|
|
453
512
|
setFpsTelemetry(system?.net, msg.hubPlace.fpsTelemetry);
|
|
454
513
|
setLoadTelemetry(system?.net, msg.hubPlace.loadTelemetry);
|
|
@@ -478,6 +537,7 @@ const hooks = {
|
|
|
478
537
|
if (hub.place.companion !== true) {
|
|
479
538
|
delete hub.companion;
|
|
480
539
|
delete hub.glow;
|
|
540
|
+
delete hub.chirp;
|
|
481
541
|
}
|
|
482
542
|
if (hub.place.ask !== true && Object.hasOwn(hub, 'ask')) {
|
|
483
543
|
hub.askClose?.();
|
|
@@ -551,6 +611,11 @@ const hooks = {
|
|
|
551
611
|
} else if (msg.hubPlace) {
|
|
552
612
|
delete hub.glow;
|
|
553
613
|
}
|
|
614
|
+
if (Array.isArray(msg.hubChirp)) {
|
|
615
|
+
hub.chirp = chirpMap(msg.hubChirp);
|
|
616
|
+
} else if (msg.hubPlace) {
|
|
617
|
+
delete hub.chirp;
|
|
618
|
+
}
|
|
554
619
|
}
|
|
555
620
|
if (msg.hubWear) {
|
|
556
621
|
hub.wearAll = wearMap(msg.hubWear);
|
|
@@ -573,6 +638,13 @@ const hooks = {
|
|
|
573
638
|
hub.tryAll = new Map();
|
|
574
639
|
setWearing();
|
|
575
640
|
}
|
|
641
|
+
if (msg.hubHoldShow && typeof msg.hubHoldShow === 'object') {
|
|
642
|
+
hub.holdShowAll = holdShowMap(msg.hubHoldShow);
|
|
643
|
+
hub.holdShows = holdShowsNow();
|
|
644
|
+
} else if (msg.hubPlace && hub.holdShowAll.size > 0) {
|
|
645
|
+
hub.holdShowAll.clear();
|
|
646
|
+
hub.holdShows = holdShowsNow();
|
|
647
|
+
}
|
|
576
648
|
// v1.157: snapshots clear only the shared block, as hubTry does.
|
|
577
649
|
if (msg.hubRole && typeof msg.hubRole === 'object') {
|
|
578
650
|
hub.roleAll = wearMap(msg.hubRole);
|
|
@@ -606,11 +678,15 @@ const hooks = {
|
|
|
606
678
|
if (msg.spawnTemplates) {
|
|
607
679
|
hub.spawnTemplates = msg.spawnTemplates;
|
|
608
680
|
}
|
|
681
|
+
if (Array.isArray(msg.hubDecorTpl)) {
|
|
682
|
+
hub.decorTemplates = new Set(msg.hubDecorTpl.filter((id) => typeof id === 'string'));
|
|
683
|
+
}
|
|
609
684
|
if (msg.spawned) {
|
|
610
685
|
hub.spawned = msg.spawned;
|
|
611
686
|
}
|
|
612
687
|
if (msg.held) {
|
|
613
|
-
hub.
|
|
688
|
+
hub.heldAll = new Set(msg.held);
|
|
689
|
+
idleNow();
|
|
614
690
|
}
|
|
615
691
|
if (msg.labels) {
|
|
616
692
|
hub.labels = msg.labels;
|
|
@@ -629,16 +705,20 @@ const hooks = {
|
|
|
629
705
|
}));
|
|
630
706
|
}
|
|
631
707
|
else if (msg.hubPlace) {hub.cars = {};}
|
|
708
|
+
if (Object.hasOwn(msg, 'hubDisguise')) {hub.disguises = disguiseMap(msg.hubDisguise);}
|
|
709
|
+
else if (msg.hubPlace) {hub.disguises.clear();}
|
|
632
710
|
// v1.6: only a place that turns idle play on sends these.
|
|
633
711
|
if (msg.hubEmotes && typeof msg.hubEmotes === 'object') {
|
|
634
|
-
hub.
|
|
712
|
+
hub.emotesAll = msg.hubEmotes;
|
|
713
|
+
idleNow();
|
|
635
714
|
}
|
|
636
715
|
// v1.47: only a place where an NPC has emoted sends this.
|
|
637
716
|
if (msg.hubNpcEmotes && typeof msg.hubNpcEmotes === 'object') {
|
|
638
717
|
hub.npcEmotes = msg.hubNpcEmotes;
|
|
639
718
|
}
|
|
640
719
|
if (msg.hubSeated && typeof msg.hubSeated === 'object') {
|
|
641
|
-
hub.
|
|
720
|
+
hub.seatedAll = msg.hubSeated;
|
|
721
|
+
idleNow();
|
|
642
722
|
}
|
|
643
723
|
if (msg.hubSounds && typeof msg.hubSounds === 'object') {
|
|
644
724
|
hub.sounds = msg.hubSounds;
|
|
@@ -665,9 +745,13 @@ const hooks = {
|
|
|
665
745
|
},
|
|
666
746
|
|
|
667
747
|
reset() {
|
|
748
|
+
Celebrate.clear();
|
|
749
|
+
replayCleanup.clear();
|
|
668
750
|
clearShot();
|
|
669
751
|
},
|
|
670
752
|
dispose() {
|
|
753
|
+
Celebrate.clear();
|
|
754
|
+
replayCleanup.clear();
|
|
671
755
|
clearShot();
|
|
672
756
|
},
|
|
673
757
|
};
|
|
@@ -34,6 +34,11 @@ export function personAction(net, person, action, { together, say, jump, jumpTo,
|
|
|
34
34
|
// player's own House, as the pad would have.
|
|
35
35
|
jump(net, { k: 'hub-house-visit', door: person.door, owner: person.owner });
|
|
36
36
|
say(`Going to ${person.username ?? 'your friend'}'s House`);
|
|
37
|
+
} else if (action === 'door' && person.door && person.playerId && doors.find((d) => d.id === person.door)?.solo === true) {
|
|
38
|
+
// Someone here at a door that takes one player cannot be gone to: its
|
|
39
|
+
// pad would send this player into a game of their own (`together.rows`
|
|
40
|
+
// offers no Go there; this is the backstop for a host's own rows).
|
|
41
|
+
return false;
|
|
37
42
|
} else if (action === 'door' && person.door) {
|
|
38
43
|
jump(net, { k: 'hub-door-jump', door: person.door });
|
|
39
44
|
// A friend inside the game is said to be; someone standing at the door
|
|
@@ -101,7 +106,8 @@ export function backControl({ away, idle, pendingEnd, hostTrail, place, ticket,
|
|
|
101
106
|
|
|
102
107
|
// What a user's Back (the kit's control or the host's) does: it first closes
|
|
103
108
|
// the action overflow, then the place menu; in a game it quits the door
|
|
104
|
-
// (`hub-door-quit`) and goes back; anywhere else it
|
|
109
|
+
// (`hub-door-quit`) and goes back; anywhere else it ends the visit
|
|
110
|
+
// (`hub-back`, v1.173) and goes back.
|
|
105
111
|
// Returns 'overflow' | 'menu' | 'quit' | 'back'.
|
|
106
112
|
export function backPress({ overflowOpen, menuOpen, inGame }) {
|
|
107
113
|
if (overflowOpen) {
|
|
@@ -34,7 +34,7 @@ export function hudInputs(hub, simNow) {
|
|
|
34
34
|
export function makeHudSurface({ landscape = false, safeInsets = false, onBack = () => {}, promptBlocked = () => false, draw = null } = {}) {
|
|
35
35
|
const state = {
|
|
36
36
|
view: { landscape: Boolean(landscape), safeInsets },
|
|
37
|
-
back: { show: false, label: 'Town' },
|
|
37
|
+
back: { show: false, label: 'Town', low: false },
|
|
38
38
|
hud: { show: false, title: '', big: '', clock: null, prompt: '', promptShown: false },
|
|
39
39
|
toast: { text: '', wrap: false },
|
|
40
40
|
actPair: null,
|
|
@@ -55,7 +55,7 @@ export function makeHudSurface({ landscape = false, safeInsets = false, onBack =
|
|
|
55
55
|
function render() {
|
|
56
56
|
const { view, back: b, hud: d, toast: t, actPair: p } = state;
|
|
57
57
|
const big = d.clock ? `clock:${d.clock.gen}` : d.big;
|
|
58
|
-
const next = [view.landscape, b.show, b.label, d.show, d.title, big, d.prompt, d.promptShown, t.text, t.wrap, p ? `${p.show}${p.enabled}` : ''].join('\u0001');
|
|
58
|
+
const next = [view.landscape, b.show, b.label, b.low, d.show, d.title, big, d.prompt, d.promptShown, t.text, t.wrap, p ? `${p.show}${p.enabled}` : ''].join('\u0001');
|
|
59
59
|
if (next === key) {return;}
|
|
60
60
|
key = next;
|
|
61
61
|
const tree = buildHud(state);
|
|
@@ -101,9 +101,17 @@ export function makeHudSurface({ landscape = false, safeInsets = false, onBack =
|
|
|
101
101
|
state.view.landscape = Boolean(on);
|
|
102
102
|
render();
|
|
103
103
|
},
|
|
104
|
-
|
|
104
|
+
// Whether Back stands low (v1.186), re-read as the stage turns.
|
|
105
|
+
setBackLow(low) {
|
|
106
|
+
state.back.low = Boolean(low);
|
|
107
|
+
render();
|
|
108
|
+
},
|
|
109
|
+
// `low` (v1.186): the control stands at the bottom centre, out of the
|
|
110
|
+
// reserved Back corner.
|
|
111
|
+
showBack(show, label = 'Back', low = false) {
|
|
105
112
|
state.back.show = Boolean(show);
|
|
106
113
|
state.back.label = label;
|
|
114
|
+
state.back.low = Boolean(low);
|
|
107
115
|
render();
|
|
108
116
|
},
|
|
109
117
|
// Said every frame: the root is rebuilt only when its words change, so a
|
|
@@ -26,6 +26,9 @@ const edge = (safeInsets, px) => (safeInsets ? [px, 0] : px);
|
|
|
26
26
|
export function buildActPair(pair, safeInsets = false) {
|
|
27
27
|
const show = Boolean(pair?.show);
|
|
28
28
|
const enabled = Boolean(pair?.enabled);
|
|
29
|
+
// v1.204: catching up, Act stays pressable (a press is refused with a
|
|
30
|
+
// line) but dimmed, and says why on two short lines.
|
|
31
|
+
const catching = Boolean(pair?.catching);
|
|
29
32
|
const on = pair?.on ?? {};
|
|
30
33
|
const button = { h: 48, w: 64, minH: 44, pad: 8, radius: 22, border: { w: 2, c: 'rgba(255,255,255,.55)' }, bg: 'rgba(20,16,12,.88)', color: '#fff', font: 'ui', size: 14, weight: 700, lh: 'normal', box: 'border', wrap: 'none', gone: !show };
|
|
31
34
|
return h('stack', {
|
|
@@ -34,11 +37,11 @@ export function buildActPair(pair, safeInsets = false) {
|
|
|
34
37
|
style: { w: 134, h: 48, hit: 'none', gone: !show },
|
|
35
38
|
},
|
|
36
39
|
h('button', {
|
|
37
|
-
key: 'act', data: { hubAct: 'act' }, disabled: !enabled,
|
|
40
|
+
key: 'act', data: { hubAct: 'act' }, disabled: !enabled && !catching,
|
|
38
41
|
at: { anchor: 'topLeft', top: 0, left: 70 },
|
|
39
|
-
style: { ...button, opacity: enabled ? 1 : 0.5 },
|
|
42
|
+
style: catching ? { ...button, opacity: 0.5, pad: 4, size: 11, lh: 1.1, wrap: 'word' } : { ...button, opacity: enabled ? 1 : 0.5 },
|
|
40
43
|
on: { press: on.press, release: on.release, cancel: on.cancel },
|
|
41
|
-
}, 'Act'),
|
|
44
|
+
}, catching ? 'Catching up' : 'Act'),
|
|
42
45
|
h('button', {
|
|
43
46
|
key: 'jump', data: { hubAct: 'jump' }, fire: 'down', keepFocus: true,
|
|
44
47
|
at: { anchor: 'topLeft', top: 0, left: 0 },
|
|
@@ -61,7 +64,7 @@ export function buildHud(state) {
|
|
|
61
64
|
return h('stack', { key: 'hud', style: { font: 'ui', size: 15, weight: 600, lh: 1.3, color: '#fff' } },
|
|
62
65
|
h('button', {
|
|
63
66
|
key: 'back', fire: 'down',
|
|
64
|
-
at: { anchor: 'topLeft', top: [12, 0], left: edge(safeInsets, landscape ? 76 : 12) },
|
|
67
|
+
at: back.low ? { anchor: 'bottom', bottom: [12, 6] } : { anchor: 'topLeft', top: [12, 0], left: edge(safeInsets, landscape ? 76 : 12) },
|
|
65
68
|
style: { pad: [9, 16, 9, 12], radius: 22, border: { w: 1, c: 'line35' }, bg: 'chip', color: '#fff', gone: !back.show },
|
|
66
69
|
on: { tap: state.on?.back },
|
|
67
70
|
}, `‹ ${back.label ?? 'Back'}`),
|