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
|
@@ -240,6 +240,33 @@ test('manifest refuses malformed bounds, layers, ids, unknown fields and house s
|
|
|
240
240
|
assert.equal(Manifest.readManifest(json({ house })).manifest, null);
|
|
241
241
|
}
|
|
242
242
|
});
|
|
243
|
+
test('action tiles route pick without stock, refuse locked/non-action/missing ids and share the op budget', () => {
|
|
244
|
+
const r = boot({ decor });
|
|
245
|
+
r.say('p1', { k: 'decor', op: 'pick', item: 'build' });
|
|
246
|
+
r.hub.decor.open('p1', { ...spec(), items: [item, { ...item, id: 'build', action: true, count: 0 },
|
|
247
|
+
{ ...item, id: 'locked', action: true, locked: { price: '120 ▲' } }] });
|
|
248
|
+
for (const id of ['chair', 'locked', 'missing']) r.say('p1', { k: 'decor', op: 'pick', item: id });
|
|
249
|
+
r.say('p2', { k: 'decor', op: 'pick', item: 'build' });
|
|
250
|
+
r.say('p1', { k: 'decor', op: 'pick', item: 'build', extra: true });
|
|
251
|
+
assert.deepEqual(r.ops, []);
|
|
252
|
+
r.say('p1', { k: 'decor', op: 'pick', item: 'build' });
|
|
253
|
+
assert.deepEqual(r.ops, [['p1', { op: 'pick', item: 'build' }]], 'zero stock still routes the action');
|
|
254
|
+
r.ops.length = 0;
|
|
255
|
+
r.tick(1000);
|
|
256
|
+
r.hub.decor.update('p1', { items: [{ ...item, id: 'build', action: true }] });
|
|
257
|
+
r.say('p1', { k: 'decor', op: 'place', item: 'build', x: 0, z: 0, rot: 0 });
|
|
258
|
+
assert.deepEqual(r.ops, [], 'actions cannot be placed even with stock');
|
|
259
|
+
for (let i = 0; i < 10; i++) r.say('p1', { k: 'decor', op: 'pick', item: 'build' });
|
|
260
|
+
assert.deepEqual(r.ops, Array.from({ length: 8 }, () => ['p1', { op: 'pick', item: 'build' }]));
|
|
261
|
+
r.say('p1', { k: 'decor', op: 'close' });
|
|
262
|
+
assert.equal(r.ops.length, 8, 'pick spends the ordinary budget');
|
|
263
|
+
r.tick(1000);
|
|
264
|
+
r.say('p1', { k: 'decor', op: 'pick', item: 'build' });
|
|
265
|
+
assert.equal(r.ops.length, 9);
|
|
266
|
+
for (const change of [{ action: false }, { action: 'true' }, { action: true, count: undefined }, { action: true, w: 0 }, { action: true, layer: 'missing' }]) {
|
|
267
|
+
assert.throws(() => r.hub.decor.open('p1', { ...spec(), items: [{ ...item, ...change }] }), TypeError);
|
|
268
|
+
}
|
|
269
|
+
});
|
|
243
270
|
test('exact catalogue limits are accepted; malformed rotated bounds and duplicate ids are refused', () => {
|
|
244
271
|
const h = { actors, place: { decor: { ...decor, grid: { ...decor.grid, w: 16, d: 16 } } }, spawned: new Map(Array.from({ length: 64 }, (_, i) => [`copy-${i}`, {}])) };
|
|
245
272
|
const max = {
|
|
@@ -55,7 +55,10 @@ console.log('device class layout, edges, invalid inputs, presence and round trip
|
|
|
55
55
|
|
|
56
56
|
// Run the actual hello method without loading the rendering engine.
|
|
57
57
|
const source = readFileSync(new URL('../code/systems/hub.js', import.meta.url), 'utf8');
|
|
58
|
-
|
|
58
|
+
// The method alone: from its signature to its own closing brace, whatever
|
|
59
|
+
// the class puts after it.
|
|
60
|
+
const helloAt = source.indexOf(' sendHello(scene,');
|
|
61
|
+
const method = source.slice(helloAt, source.indexOf('\n }\n', helloAt) + 4);
|
|
59
62
|
function hello(globals = {}, encoder = encode) {
|
|
60
63
|
const messages = [];
|
|
61
64
|
const context = { ...globals, encodeDeviceClass: encoder, Hub: { hub: {}, deck: {} },
|
|
@@ -0,0 +1,281 @@
|
|
|
1
|
+
// Disguise v1.196: real model build, controller seam, seats and cleanup.
|
|
2
|
+
import assert from 'node:assert/strict';
|
|
3
|
+
import fs from 'node:fs';
|
|
4
|
+
import { register } from 'node:module';
|
|
5
|
+
import { Group, PerspectiveCamera, Scene, SpriteMaterial } from 'three';
|
|
6
|
+
const root = new URL('../../', import.meta.url).href;
|
|
7
|
+
register(`data:text/javascript,${encodeURIComponent(`
|
|
8
|
+
export async function resolve(specifier, context, next) {
|
|
9
|
+
if (specifier === 'three') return { url: ${JSON.stringify(import.meta.resolve('three'))}, shortCircuit: true };
|
|
10
|
+
if (specifier === '@imports/castle.physics-2d/engine/art') return { url: 'data:text/javascript,export const renderArtFrame=()=>null;export const artReady=()=>false;export const artFrameCount=()=>0;', shortCircuit: true };
|
|
11
|
+
if (specifier.startsWith('@imports/')) {
|
|
12
|
+
const file = specifier.replace('@imports/castle.', '');
|
|
13
|
+
return { url: ${JSON.stringify(root)} + file + (file.endsWith('.js') ? '' : '.js'), shortCircuit: true };
|
|
14
|
+
}
|
|
15
|
+
try {return await next(specifier, context);} catch(e) {
|
|
16
|
+
if (specifier.startsWith('.') && !specifier.endsWith('.js')) return next(specifier + '.js', context);
|
|
17
|
+
throw e;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
`)}`);
|
|
21
|
+
const { makeInstances, drawInstances, removeInstances } = await import('@imports/castle.physics-3d/engine3d/optimize');
|
|
22
|
+
const { buildModelNode, parseModelCached } = await import('@imports/castle.physics-3d/engine3d/pxmodel');
|
|
23
|
+
const { makeDisguise } = await import('../code/client/disguiseDraw.js');
|
|
24
|
+
const { makeFarAvatars } = await import('../code/client/farAvatars.js');
|
|
25
|
+
const { canCacheStill } = await import('@imports/castle.physics-3d/engine3d/stillshadows');
|
|
26
|
+
const { disguiseMap, disguisedFor, disguiseBody } = await import('../code/client/disguise.js');
|
|
27
|
+
const { deck, hub, clear } = await import('../code/client/state.js');
|
|
28
|
+
const { applyPlayerVisibility, filterQualityScene, makeQualityVisit, qualityPlayers, resetQualityVisit } = await import('../code/client/quality.js');
|
|
29
|
+
const { makeWear, makeEarned, makeRole, makeHoldShow } = await import('../code/client/wear.js');
|
|
30
|
+
const { makeSay } = await import('../code/client/say.js');
|
|
31
|
+
const { makeIdle } = await import('../code/client/idle.js');
|
|
32
|
+
const { makeCompanion } = await import('../code/client/companion.js');
|
|
33
|
+
const { roleItems } = await import('../code/client/role.js');
|
|
34
|
+
const model = JSON.stringify({ format: 'pxmodel', parts: [{ id: 'box', kind: 'box', width: 1, height: 1, depth: 1, color: '#00ff00' }] });
|
|
35
|
+
function boot(viewer = 'me') {
|
|
36
|
+
clear();
|
|
37
|
+
const local = { id: 'local', components: { Player: {}, Transform: { x: 0, y: 0, z: 0 } } };
|
|
38
|
+
const other = { id: 'other', components: { Transform: { x: 1, y: 0, z: 1 } } };
|
|
39
|
+
const look = { id: 'look', components: { Model: { file: 'look.pxmodel', scale: 2, yOffset: 0.2 } } };
|
|
40
|
+
const actors = new Map([local, other, look].map(a => [a.id, a]));
|
|
41
|
+
const nodes = new Map();
|
|
42
|
+
for (const actor of [local, other]) {
|
|
43
|
+
const node = new Group(), rig = new Group(), hidden = new Group(), wearable = new Group();
|
|
44
|
+
rig.userData.modelParts = new Map(); node.userData.modelParts = rig.userData.modelParts;
|
|
45
|
+
hidden.visible = false; node.add(rig, hidden, wearable); nodes.set(actor.id, { node });
|
|
46
|
+
}
|
|
47
|
+
const material = new SpriteMaterial(), tags = new Map([['p', { sprite: { material } }]]);
|
|
48
|
+
const scene = { files: { 'look.pxmodel': model }, sprites: {},
|
|
49
|
+
getActor: id => actors.get(id), actorWith: () => local,
|
|
50
|
+
three: { nodes, scene: new Scene(), camera: new PerspectiveCamera() },
|
|
51
|
+
multiplayer: { net: { selfId: () => viewer }, avatars: { actors: new Map([['p', 'other']]), tags } },
|
|
52
|
+
};
|
|
53
|
+
return { scene, local, nodes, material, view: makeDisguise() };
|
|
54
|
+
}
|
|
55
|
+
const rows = to => [['p', 'look', to]];
|
|
56
|
+
{
|
|
57
|
+
// An unused visit keeps still-shadow caching and the exact callback it received.
|
|
58
|
+
const { scene, local, nodes, view } = boot(), root = scene.three.scene;
|
|
59
|
+
const original = root.onBeforeRender;
|
|
60
|
+
const renderer = { shadowMap: { render() {} }, capabilities: {}, renderBufferDirect() {} };
|
|
61
|
+
assert.equal(canCacheStill(renderer, root), true);
|
|
62
|
+
view.draw(scene, local); view.draw(scene, local);
|
|
63
|
+
assert.equal(root.onBeforeRender, original); assert.equal(canCacheStill(renderer, root), true);
|
|
64
|
+
hub.disguises = disguiseMap(rows(null)); view.draw(scene, local);
|
|
65
|
+
assert.notEqual(root.onBeforeRender, original); assert.equal(canCacheStill(renderer, root), false);
|
|
66
|
+
hub.disguises.clear(); view.draw(scene, local);
|
|
67
|
+
assert.equal(root.onBeforeRender, original); assert.equal(canCacheStill(renderer, root), true);
|
|
68
|
+
assert.equal(nodes.get('other').node.children[0].visible, true);
|
|
69
|
+
let calls = 0;
|
|
70
|
+
const previous = function () {assert.equal(this, root); calls++;};
|
|
71
|
+
root.onBeforeRender = previous;
|
|
72
|
+
hub.disguises = disguiseMap(rows(null)); view.draw(scene, local);
|
|
73
|
+
const render = root.onBeforeRender;
|
|
74
|
+
render.call(root); assert.equal(calls, 1);
|
|
75
|
+
hub.disguises.clear(); render.call(root);
|
|
76
|
+
assert.equal(calls, 2); assert.equal(root.onBeforeRender, previous, 'render-time clear restores the previous callback');
|
|
77
|
+
assert.equal(nodes.get('other').node.children[0].visible, true);
|
|
78
|
+
hub.disguises = disguiseMap(rows(null)); view.draw(scene, local); view.clear();
|
|
79
|
+
assert.equal(root.onBeforeRender, previous, 'lifecycle cleanup restores the previous callback');
|
|
80
|
+
}
|
|
81
|
+
{
|
|
82
|
+
// A disguise cleared under the Low cull's hook unhooks once on top again, so High
|
|
83
|
+
// gives the original back: neither hook outlives its owner in either order.
|
|
84
|
+
const { scene, local, view } = boot(), root = scene.three.scene, original = root.onBeforeRender;
|
|
85
|
+
let tier = 'high';
|
|
86
|
+
const q = makeQualityVisit({ current: () => tier }); q.warned = true;
|
|
87
|
+
const quality = deck.quality; deck.quality = { low: { players: 1 } };
|
|
88
|
+
scene.getActors = () => []; filterQualityScene(scene, { actors: [] }, q);
|
|
89
|
+
hub.disguises = disguiseMap(rows(null)); view.draw(scene, local);
|
|
90
|
+
tier = 'low'; qualityPlayers(scene, q, 0);
|
|
91
|
+
hub.disguises.clear(); view.draw(scene, local); root.onBeforeRender();
|
|
92
|
+
tier = 'high'; qualityPlayers(scene, q, 1); root.onBeforeRender();
|
|
93
|
+
assert.equal(root.onBeforeRender, original, 'a disguise cleared under Low leaves no hook');
|
|
94
|
+
tier = 'low'; qualityPlayers(scene, q, 2);
|
|
95
|
+
hub.disguises = disguiseMap(rows(null)); view.draw(scene, local);
|
|
96
|
+
tier = 'high'; qualityPlayers(scene, q, 3); root.onBeforeRender();
|
|
97
|
+
hub.disguises.clear(); view.draw(scene, local); root.onBeforeRender();
|
|
98
|
+
assert.equal(root.onBeforeRender, original, 'a Low hook released under a disguise leaves no hook');
|
|
99
|
+
deck.quality = quality;
|
|
100
|
+
}
|
|
101
|
+
{
|
|
102
|
+
// Far-avatar and disguise hides release independently, including under a Low cull.
|
|
103
|
+
for (const farFirst of [true, false]) {
|
|
104
|
+
const { scene, local, nodes, material, view } = boot();
|
|
105
|
+
const root = scene.three.scene, entry = nodes.get('other'), rig = entry.node.children[0];
|
|
106
|
+
const template = buildModelNode(parseModelCached(model), {}, {}, 'look.pxmodel', ['look.pxmodel'], { optimize: true });
|
|
107
|
+
entry.modelKey = 'avatar'; scene.three.models = new Map([['avatar', { template }]]);
|
|
108
|
+
for (const { node } of nodes.values()) {root.add(node);}
|
|
109
|
+
entry.node.position.x = 20;
|
|
110
|
+
const far = makeFarAvatars(), q = makeQualityVisit({ current: () => 'low' });
|
|
111
|
+
far.update(scene, ['other'], 'local', true, 0);
|
|
112
|
+
assert.equal(far.size, 1); assert.equal(rig.visible, false);
|
|
113
|
+
hub.disguises = disguiseMap(rows(null)); view.draw(scene, local);
|
|
114
|
+
q.culled.add('other'); applyPlayerVisibility(scene, q);
|
|
115
|
+
if (farFirst) {
|
|
116
|
+
entry.node.position.x = 2; far.update(scene, ['other'], 'local', true, 250);
|
|
117
|
+
assert.equal(far.size, 0); assert.equal(rig.visible, false, 'disguise retains its hide after the far owner releases');
|
|
118
|
+
view.draw(scene, local);
|
|
119
|
+
hub.disguises.clear(); view.draw(scene, local);
|
|
120
|
+
assert.equal(rig.visible, true, 'no owner still hides the rig');
|
|
121
|
+
} else {
|
|
122
|
+
hub.disguises.clear(); view.draw(scene, local);
|
|
123
|
+
assert.equal(rig.visible, false, 'the far owner retains its hide after disguise clears');
|
|
124
|
+
entry.node.position.x = 2; far.update(scene, ['other'], 'local', true, 250);
|
|
125
|
+
assert.equal(far.size, 0); assert.equal(rig.visible, true);
|
|
126
|
+
}
|
|
127
|
+
assert.equal(entry.node.visible, false); assert.equal(material.visible, false, 'quality remains hidden');
|
|
128
|
+
resetQualityVisit(q);
|
|
129
|
+
assert.equal(entry.node.visible, true); assert.equal(rig.visible, true); assert.equal(material.visible, true);
|
|
130
|
+
far.clear(); view.clear();
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
{
|
|
134
|
+
const { scene, local, nodes, material, view } = boot();
|
|
135
|
+
const node = nodes.get('other').node, [rig, hidden, wearable] = node.children;
|
|
136
|
+
view.draw(scene, local); assert.equal(node.children.length, 3);
|
|
137
|
+
hub.disguises = disguiseMap(rows(null)); view.draw(scene, local);
|
|
138
|
+
const group = node.children.find(c => c.name === 'hub:disguise');
|
|
139
|
+
assert.ok(group); assert.equal(group.visible, true); assert.equal(group.children[0].scale.x, 2); assert.equal(group.children[0].position.y, 0.2);
|
|
140
|
+
assert.equal(rig.visible, false); assert.equal(hidden.visible, false); assert.equal(wearable.visible, false);
|
|
141
|
+
assert.equal(material.visible, false); assert.equal(node.visible, true);
|
|
142
|
+
view.draw(scene, local); assert.equal(node.children.find(c => c.name === 'hub:disguise'), group);
|
|
143
|
+
hub.disguises.clear(); view.draw(scene, local);
|
|
144
|
+
assert.equal(group.parent, null); assert.equal(rig.visible, true); assert.equal(hidden.visible, false); assert.equal(wearable.visible, true); assert.equal(material.visible, true);
|
|
145
|
+
view.clear();
|
|
146
|
+
}
|
|
147
|
+
{
|
|
148
|
+
const { scene, local, nodes, material, view } = boot();
|
|
149
|
+
const node = nodes.get('other').node;
|
|
150
|
+
hub.disguises = disguiseMap(rows(['someone'])); view.draw(scene, local);
|
|
151
|
+
assert.equal(node.children.length, 3); assert.equal(material.visible, true);
|
|
152
|
+
hub.disguises = disguiseMap(rows(['me'])); view.draw(scene, local);
|
|
153
|
+
assert.equal(node.children.at(-1).name, 'hub:disguise'); assert.equal(material.visible, false);
|
|
154
|
+
hub.disguises = disguiseMap([['p', null, ['me']]]); view.draw(scene, local);
|
|
155
|
+
assert.equal(node.children.length, 3); assert.equal(node.children[0].visible, true); assert.equal(node.children[2].visible, true); assert.equal(material.visible, false);
|
|
156
|
+
assert.equal(disguisedFor('me', 'p'), true); assert.equal(disguiseBody('me', 'p'), false);
|
|
157
|
+
hub.disguises = disguiseMap(rows([])); view.draw(scene, local); assert.equal(material.visible, true);
|
|
158
|
+
view.clear();
|
|
159
|
+
}
|
|
160
|
+
{
|
|
161
|
+
const { scene, local, nodes, view } = boot('p');
|
|
162
|
+
const node = nodes.get('local').node, [rig, , wearable] = node.children;
|
|
163
|
+
for (const to of [null, [], ['p'], ['someone']]) {
|
|
164
|
+
hub.disguises = disguiseMap(rows(to)); view.draw(scene, local);
|
|
165
|
+
assert.ok(node.children.find(c => c.name === 'hub:disguise'));
|
|
166
|
+
assert.equal(rig.visible, false); assert.equal(wearable.visible, true);
|
|
167
|
+
assert.equal(disguisedFor('p', 'p'), false); assert.equal(disguiseBody('p', 'p'), false);
|
|
168
|
+
}
|
|
169
|
+
hub.disguises = disguiseMap([['p', null, null]]); view.draw(scene, local); assert.equal(rig.visible, true);
|
|
170
|
+
view.clear();
|
|
171
|
+
}
|
|
172
|
+
{
|
|
173
|
+
// Render-time replacement cannot flash, and the old clone is released.
|
|
174
|
+
const { scene, local, nodes, view } = boot();
|
|
175
|
+
hub.disguises = disguiseMap(rows(null)); view.draw(scene, local);
|
|
176
|
+
const old = nodes.get('other').node.children.at(-1), node = new Group(), rig = new Group();
|
|
177
|
+
node.add(rig); nodes.set('other', { node });
|
|
178
|
+
scene.three.scene.onBeforeRender();
|
|
179
|
+
assert.equal(old.parent, null); assert.equal(rig.visible, false); assert.equal(node.children.at(-1).name, 'hub:disguise');
|
|
180
|
+
view.clear(); assert.equal(rig.visible, true); assert.equal(node.children.length, 1);
|
|
181
|
+
}
|
|
182
|
+
{
|
|
183
|
+
// The two owners of a name material may hide/restore in either order.
|
|
184
|
+
for (const qualityFirst of [true, false]) {
|
|
185
|
+
const { scene, local, nodes, material, view } = boot();
|
|
186
|
+
const q = makeQualityVisit({ current: () => 'low' }); q.culled.add('other');
|
|
187
|
+
hub.disguises = disguiseMap(rows(null));
|
|
188
|
+
if (qualityFirst) {applyPlayerVisibility(scene, q); view.draw(scene, local);}
|
|
189
|
+
else {view.draw(scene, local); applyPlayerVisibility(scene, q);}
|
|
190
|
+
assert.equal(nodes.get('other').node.visible, false); assert.equal(material.visible, false);
|
|
191
|
+
scene.three.scene.onBeforeRender(); assert.equal(nodes.get('other').node.visible, false);
|
|
192
|
+
hub.disguises.clear(); view.draw(scene, local);
|
|
193
|
+
assert.equal(material.visible, false, 'clearing disguise keeps quality hidden');
|
|
194
|
+
resetQualityVisit(q); assert.equal(material.visible, true); assert.equal(nodes.get('other').node.visible, true);
|
|
195
|
+
hub.disguises = disguiseMap(rows(null)); view.draw(scene, local); q.culled.add('other'); applyPlayerVisibility(scene, q);
|
|
196
|
+
resetQualityVisit(q); assert.equal(material.visible, false, 'clearing quality keeps disguise hidden');
|
|
197
|
+
view.clear(); assert.equal(material.visible, true);
|
|
198
|
+
}
|
|
199
|
+
const { scene, local, material, view } = boot(); material.visible = false;
|
|
200
|
+
hub.disguises = disguiseMap(rows(null)); view.draw(scene, local); view.clear(); assert.equal(material.visible, false, 'pre-existing hide is preserved');
|
|
201
|
+
}
|
|
202
|
+
{
|
|
203
|
+
assert.equal(disguiseMap(Array(300).fill(['p', null, null])).size, 1);
|
|
204
|
+
assert.equal(disguiseMap(Array.from({ length: 300 }, (_, i) => [`p${i}`, null, null])).size, 256);
|
|
205
|
+
assert.equal(disguiseMap([null, [], [1, null, null], ['p', 1, null], ['p', null, [1]], ['p', null, Array(257).fill('v')], ['p', null, Array(1)]]).size, 0);
|
|
206
|
+
const to = ['b', 'a', 'b']; const map = disguiseMap([['p', null, to]]); to.push('c');
|
|
207
|
+
assert.deepEqual(map.get('p').to, ['a', 'b']);
|
|
208
|
+
// Run hookLayer's actual field parser, including absent-place cleanup.
|
|
209
|
+
const source = fs.readFileSync(new URL('../code/client/hookLayer.js', import.meta.url), 'utf8');
|
|
210
|
+
const a = source.indexOf(" if (Object.hasOwn(msg, 'hubDisguise'))");
|
|
211
|
+
const b = source.indexOf(' // v1.6:', a);
|
|
212
|
+
const receive = Function('msg', 'hub', 'disguiseMap', source.slice(a, b));
|
|
213
|
+
receive({ hubDisguise: rows(null) }, hub, disguiseMap); assert.equal(hub.disguises.get('p').look, 'look');
|
|
214
|
+
receive({}, hub, disguiseMap); assert.equal(hub.disguises.size, 1);
|
|
215
|
+
receive({ hubPlace: {} }, hub, disguiseMap); assert.equal(hub.disguises.size, 0);
|
|
216
|
+
receive({ hubDisguise: [] }, hub, disguiseMap); assert.equal(hub.disguises.size, 0);
|
|
217
|
+
}
|
|
218
|
+
{
|
|
219
|
+
const { scene, local } = boot();
|
|
220
|
+
const wear = makeWear(), earned = makeEarned(), role = makeRole(), flowers = makeHoldShow();
|
|
221
|
+
const items = new Map([['p', { kind: 'aura', color: '#00ff00', rarity: 1 }]]);
|
|
222
|
+
wear.frame(scene, local, items); assert.ok(scene.three.nodes.get('other').node.children.length > 3);
|
|
223
|
+
hub.disguises = disguiseMap(rows(null)); wear.frame(scene, local, items);
|
|
224
|
+
assert.equal(scene.three.nodes.get('other').node.children.length, 3);
|
|
225
|
+
const fit = () => null;
|
|
226
|
+
earned.frame(scene, local, new Map([['p', { class: 'held', shape: 'flower', color: '#00ff00' }]]), fit);
|
|
227
|
+
role.frame(scene, local, new Map([['p', { top: 'vest', tool: 'torch', color: '#00ff00' }]]), fit);
|
|
228
|
+
flowers.frame(scene, local, new Map([['p', { shape: 'flower', color: '#00ff00' }]]), fit);
|
|
229
|
+
assert.equal(earned.size, 0); assert.equal(role.size, 0); assert.equal(flowers.size, 0);
|
|
230
|
+
const project = () => ({ x: 1, y: 1 });
|
|
231
|
+
const roles = new Map([['p', { label: 'Role', color: '#00ff00' }]]);
|
|
232
|
+
assert.deepEqual(roleItems(scene, local, {}, {}, roles, project), []);
|
|
233
|
+
const source = fs.readFileSync(new URL('../code/systems/hub.js', import.meta.url), 'utf8');
|
|
234
|
+
const a = source.indexOf(' markItems(scene, local, cam, view) {'), b = source.indexOf(' measure(', a);
|
|
235
|
+
const marks = Function('Hub', 'disguiseTags', 'project', 'return ({' + source.slice(a, b) + '});');
|
|
236
|
+
const { disguiseTags } = await import('../code/client/disguise.js');
|
|
237
|
+
hub.marks = { p: { text: 'Mark' } };
|
|
238
|
+
assert.deepEqual(marks({ hub }, disguiseTags, project).markItems(scene, local, {}, {}), []);
|
|
239
|
+
hub.disguises = disguiseMap([['p', null, null]]); wear.frame(scene, local, items);
|
|
240
|
+
assert.ok(scene.three.nodes.get('other').node.children.length > 3, 'look-less keeps wearables');
|
|
241
|
+
assert.deepEqual(roleItems(scene, local, {}, {}, roles, project), []);
|
|
242
|
+
wear.clear(); earned.clear(); role.clear(); flowers.clear();
|
|
243
|
+
}
|
|
244
|
+
{
|
|
245
|
+
const { scene, local } = boot(), project = () => ({ x: 1, y: 1 });
|
|
246
|
+
const say = makeSay(), idle = makeIdle({}), companion = makeCompanion();
|
|
247
|
+
hub.saidEvents.push({ player: 'p', r: 0 }); say.frame(0, 'me', () => 'Player');
|
|
248
|
+
hub.lastT = 0; hub.lastAt = performance.now();
|
|
249
|
+
hub.emotes = { p: { id: 'wave', at: 0, until: 2000 } };
|
|
250
|
+
hub.glow = new Set(['p']); hub.avatars = new Map([['p', 0]]);
|
|
251
|
+
const bubbles = () => say.labels(scene, local, {}, {}, project, 'me');
|
|
252
|
+
const emotes = () => idle.labels(scene, local, {}, {}, project);
|
|
253
|
+
const drawCompanion = () => companion.frame(scene, local, hub, 0.016, 0, true);
|
|
254
|
+
assert.equal(bubbles().length, 1); assert.equal(emotes().length, 1);
|
|
255
|
+
drawCompanion(); assert.equal(scene.three.nodes.get('other').node.children.length, 4);
|
|
256
|
+
hub.disguises = disguiseMap(rows(null));
|
|
257
|
+
assert.equal(bubbles().length, 0); assert.equal(emotes().length, 0);
|
|
258
|
+
drawCompanion(); assert.equal(scene.three.nodes.get('other').node.children.length, 3);
|
|
259
|
+
hub.disguises = disguiseMap([['p', null, null]]);
|
|
260
|
+
assert.equal(bubbles().length, 1); assert.equal(emotes().length, 1);
|
|
261
|
+
drawCompanion(); assert.equal(scene.three.nodes.get('other').node.children.length, 4);
|
|
262
|
+
hub.disguises.clear(); companion.dispose(); idle.release(); say.clear();
|
|
263
|
+
}
|
|
264
|
+
{
|
|
265
|
+
const { scene, local, nodes, view } = boot();
|
|
266
|
+
const template = buildModelNode(parseModelCached(model), {}, {}, 'look.pxmodel');
|
|
267
|
+
const instances = makeInstances(template, scene.three.scene), rig = nodes.get('other').node.children[0];
|
|
268
|
+
scene.three.camera = null; scene.three.instances = new Map([['avatar', instances]]);
|
|
269
|
+
instances.rigs.add(rig); drawInstances(instances, null);
|
|
270
|
+
assert.ok(instances.parts.every(part => part.mesh.count > 0));
|
|
271
|
+
view.draw(scene, local);
|
|
272
|
+
hub.disguises = disguiseMap(rows(null)); view.draw(scene, local); scene.three.scene.onBeforeRender();
|
|
273
|
+
assert.ok(instances.parts.every(part => part.mesh.count === 0), 'shared original model is hidden before render');
|
|
274
|
+
hub.disguises.clear(); view.draw(scene, local);
|
|
275
|
+
assert.ok(instances.parts.every(part => part.mesh.count > 0), 'shared model restored');
|
|
276
|
+
hub.disguises = disguiseMap(rows(null)); view.draw(scene, local); view.clear();
|
|
277
|
+
assert.ok(instances.parts.every(part => part.mesh.count > 0), 'cleanup restores shared model');
|
|
278
|
+
removeInstances(instances);
|
|
279
|
+
}
|
|
280
|
+
clear(); assert.equal(hub.disguises.size, 0);
|
|
281
|
+
console.log('ok: disguise wire, viewer/self selection, clones, restoration, late render, quality and decorations');
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
// Disguise v1.196: real hub layer, fake transport/body, no Rapier needed.
|
|
2
|
+
import assert from 'node:assert/strict';
|
|
3
|
+
import { register } from 'node:module';
|
|
4
|
+
const sceneStub = 'export const readScene = () => globalThis.__hubTestActors ?? [];';
|
|
5
|
+
register(`data:text/javascript,${encodeURIComponent(`
|
|
6
|
+
export async function resolve(specifier, context, next) {
|
|
7
|
+
if (specifier === '@imports/castle.multiplayer-3d/code/server/sceneBodies.js') return { url: ${JSON.stringify('data:text/javascript,' + encodeURIComponent(sceneStub))}, shortCircuit: true };
|
|
8
|
+
if (specifier === '@imports/castle.multiplayer-3d/code/server/players.js') return { url: 'data:text/javascript,export function setPose(sim,id,msg){sim.reports.push([id,msg])}', shortCircuit: true };
|
|
9
|
+
if (specifier === '@imports/castle.multiplayer-3d/code/server/limits.js') return { url: 'data:text/javascript,export const readPoint=()=>null', shortCircuit: true };
|
|
10
|
+
return next(specifier, context);
|
|
11
|
+
}
|
|
12
|
+
`)}`);
|
|
13
|
+
const { layer } = await import('../code/server/hub.js');
|
|
14
|
+
const { hubPlayers } = await import('../code/server/players.js');
|
|
15
|
+
const spec = { look: 'car', seats: [[1, 0, 1], [-1, 0.3, 0]], horn: 'sounds/horn.wav' };
|
|
16
|
+
let clock = 1_800_000_000_000;
|
|
17
|
+
const realNow = Date.now;
|
|
18
|
+
Date.now = () => clock;
|
|
19
|
+
function boot({ retained = false, count = 3, arrived = true, grab = false, grabHook } = {}) {
|
|
20
|
+
globalThis.__hubTestActors = [
|
|
21
|
+
{ id: 'spawn', components: { Player: {}, Transform: { x: 0, y: 1, z: 0 } } },
|
|
22
|
+
{ id: 'car', components: { Model: { file: 'car.pxmodel' }, Transform: {} } },
|
|
23
|
+
{ id: 'bench', components: { HubSeat: {}, Transform: {}, Shape: { kind: 'box', height: 0.3 } } },
|
|
24
|
+
{ id: 'door', components: { HubDoor: { id: 'game', to: 'game' }, Transform: {} } },
|
|
25
|
+
...(grab ? [{ id: 'crate', components: { Transform: { x: 0, y: 1, z: 1 }, Shape: { kind: 'box' }, Body: { type: 'dynamic' } } }] : []),
|
|
26
|
+
];
|
|
27
|
+
const sent = [], broadcast = [], left = [];
|
|
28
|
+
const players = Array.from({ length: count }, (_, i) => ({ playerId: `p${i + 1}`, username: `user${i}`, userId: `${i + 1}` }));
|
|
29
|
+
const session = { sessionId: 'dev', players: [...players], send: (id, msg) => sent.push([id, msg]), broadcast: msg => broadcast.push(msg) };
|
|
30
|
+
const body = () => ({ at: { x: 0, y: 1, z: 0 }, facing: 0, body: { setTranslation() {} } });
|
|
31
|
+
const sim = { timeMs: 0, scenePath: retained ? 'scenes/game.scene' : 'scenes/main.scene', players: new Map(players.map(p => [p.playerId, body()])), objects: new Map(), bodies: new Map(), reports: [] };
|
|
32
|
+
let hub;
|
|
33
|
+
const opts = { title: 'Town', contract: 1, stuck: true, idle: { seats: true, sounds: ['sounds/horn.wav'] }, places: { game: { title: 'Game', scene: 'scenes/game.scene', result: {}, ...(retained ? { resume: { keep: true } } : {}) } } };
|
|
34
|
+
if (grab) {opts.grab = grab;}
|
|
35
|
+
if (retained) {session.place = 'game'; opts.places.game.idle = opts.idle;}
|
|
36
|
+
// resolvePlace reads session's authoritative place field.
|
|
37
|
+
const hooks = { ready(ctx) {hub = ctx;}, leave(ctx, id) {left.push(id);}, grab: grabHook };
|
|
38
|
+
const server = layer({ server: { maxPlayers: Math.max(8, count) }, hub: opts }, hooks, { game: hooks }, () => true);
|
|
39
|
+
server.sceneFor(session); server.ready(sim);
|
|
40
|
+
const say = (id, data) => server.message(session, { playerId: id }, data);
|
|
41
|
+
const tick = (ms = 50) => {sim.timeMs += ms; clock += ms; server.place(sim); server.step(sim, []);};
|
|
42
|
+
if (arrived) {players.forEach(p => say(p.playerId, { k: 'hub-hello', avatar: 0, party: 1 }));
|
|
43
|
+
tick(2000); tick(5000);}
|
|
44
|
+
for (const p of sim.players.values()) {p.at = { x: 0, y: 1, z: 0 };}
|
|
45
|
+
const drop = id => {session.players.splice(session.players.findIndex(p => p.playerId === id), 1); sim.players.delete(id);};
|
|
46
|
+
const back = id => {session.players.push(players.find(p => p.playerId === id)); sim.players.set(id, body()); say(id, { k: 'hub-hello', avatar: 0, party: 1, resume: true });};
|
|
47
|
+
return { hub, server, sim, session, sent, broadcast, say, tick, drop, back, left };
|
|
48
|
+
}
|
|
49
|
+
let n = 0;
|
|
50
|
+
function test(name, fn) {fn(); n++; console.log(`ok: ${name}`);}
|
|
51
|
+
try {
|
|
52
|
+
test('unused snapshot and delta remain byte-identical', () => {
|
|
53
|
+
const r = boot(), snapshot = JSON.stringify(r.server.join());
|
|
54
|
+
assert.equal(r.hub.disguised('p1'), null);
|
|
55
|
+
assert.equal(JSON.stringify(r.server.join()), snapshot);
|
|
56
|
+
assert.equal(Object.hasOwn(JSON.parse(snapshot), 'hubDisguise'), false);
|
|
57
|
+
r.server.delta(); const before = JSON.stringify(r.server.delta());
|
|
58
|
+
r.hub.disguised('p1'); assert.equal(JSON.stringify(r.server.delta()), before);
|
|
59
|
+
r.tick(); assert.equal(Object.hasOwn(r.server.delta() ?? {}, 'hubDisguise'), false);
|
|
60
|
+
});
|
|
61
|
+
test('set/read copies, sorting, latch, clear and empty field after first use', () => {
|
|
62
|
+
const r = boot(); r.server.delta();
|
|
63
|
+
const to = ['p3', 'p2', 'p3'];
|
|
64
|
+
assert.equal(r.hub.disguise('p2', { look: 'car', to }), true);
|
|
65
|
+
to.push('p1');
|
|
66
|
+
assert.equal(r.hub.disguise('p1', {}), true);
|
|
67
|
+
const copy = r.hub.disguised('p2'); copy.to.push('other'); copy.look = 'other';
|
|
68
|
+
assert.deepEqual(r.hub.disguised('p2'), { look: 'car', to: ['p2', 'p3'] });
|
|
69
|
+
assert.deepEqual(r.server.delta().hubDisguise, [['p1', null, null], ['p2', 'car', ['p2', 'p3']]]);
|
|
70
|
+
assert.equal(r.server.delta(), null);
|
|
71
|
+
r.tick(250); assert.equal(r.hub.disguise('p1', null), true); assert.equal(r.hub.disguise('p2', null), true);
|
|
72
|
+
assert.equal(r.hub.disguised('p1'), null);
|
|
73
|
+
assert.deepEqual(r.server.delta().hubDisguise, []);
|
|
74
|
+
assert.deepEqual(r.server.join().hubDisguise, []);
|
|
75
|
+
assert.equal(r.server.delta(), null);
|
|
76
|
+
const fresh = boot(); assert.equal(fresh.hub.disguise('p1', null), true);
|
|
77
|
+
assert.deepEqual(fresh.server.join().hubDisguise, []);
|
|
78
|
+
});
|
|
79
|
+
test('shape, look, to bounds, presence and held refusals warn once', () => {
|
|
80
|
+
const r = boot(), warnings = [], previous = console.warn;
|
|
81
|
+
console.warn = text => warnings.push(text);
|
|
82
|
+
try {
|
|
83
|
+
for (const value of [undefined, false, 'car', [], { other: 1 }, { look: null }, { look: 'bench' },
|
|
84
|
+
{ to: null }, { to: 'p2' }, { to: [1] }, { to: Array(1) }, { to: Array(257).fill('p2') }]) {
|
|
85
|
+
assert.equal(r.hub.disguise('p1', value), false);
|
|
86
|
+
}
|
|
87
|
+
const count = warnings.length;
|
|
88
|
+
r.hub.disguise('p1', { to: [1] }); assert.equal(warnings.length, count);
|
|
89
|
+
assert.equal(r.hub.disguise('unknown', {}), false);
|
|
90
|
+
assert.equal(r.hub.disguise('p1', { look: 'car' }), true); r.hub.hold('p1'); assert.equal(r.hub.disguise('p1', {}), false);
|
|
91
|
+
assert.equal(r.hub.disguise('p1', null), true); assert.equal(r.hub.disguised('p1'), null); r.hub.release('p1');
|
|
92
|
+
assert.equal(boot({ arrived: false }).hub.disguise('p1', {}), false);
|
|
93
|
+
assert.equal(r.hub.disguise('p1', { to: Array.from({ length: 256 }, (_, i) => `viewer${i}`) }), true);
|
|
94
|
+
assert.equal(r.hub.disguised('p1').to.length, 256);
|
|
95
|
+
} finally {console.warn = previous;}
|
|
96
|
+
});
|
|
97
|
+
test('drivers/riders refuse disguise; disguised walkers refuse drive and ride', () => {
|
|
98
|
+
const r = boot();
|
|
99
|
+
assert.equal(r.hub.drive('p1', spec), true); assert.equal(r.hub.ride('p2', 'p1', 1), true);
|
|
100
|
+
assert.equal(r.hub.disguise('p1', {}), false); assert.equal(r.hub.disguise('p2', { look: 'car' }), false);
|
|
101
|
+
assert.equal(r.hub.disguise('p3', { look: 'car' }), true);
|
|
102
|
+
assert.equal(r.hub.drive('p3', spec), false);
|
|
103
|
+
r.hub.ride('p2', null); assert.equal(r.hub.ride('p3', 'p1', 1), false);
|
|
104
|
+
r.hub.disguise('p3', null); assert.equal(r.hub.ride('p3', 'p1', 1), true);
|
|
105
|
+
});
|
|
106
|
+
test('grab and look disguise refuse each other, including a disguise inside the grab hook', () => {
|
|
107
|
+
const start = (grab, grabHook) => {
|
|
108
|
+
const r = boot({ grab, grabHook });
|
|
109
|
+
r.sim.objects.set('crate', { owner: 'p1', claimable: true, body: { translation: () => ({ x: 0, y: 1, z: 1 }) } });
|
|
110
|
+
return r;
|
|
111
|
+
};
|
|
112
|
+
for (const grab of [true, { keepHeld: true }]) {
|
|
113
|
+
const r = start(grab);
|
|
114
|
+
r.say('p1', { k: 'hub-grab', actor: 'crate', op: 'grab' });
|
|
115
|
+
assert.equal(r.hub.holding('p1'), 'crate');
|
|
116
|
+
assert.equal(r.hub.disguise('p1', { look: 'car' }), false);
|
|
117
|
+
assert.equal(r.hub.disguised('p1'), null);
|
|
118
|
+
assert.equal(r.hub.disguise('p1', {}), true, 'tag-only disguise may start during an existing grab');
|
|
119
|
+
assert.equal(r.hub.holding('p1'), 'crate');
|
|
120
|
+
r.say('p1', { k: 'hub-grab', actor: 'crate', op: 'throw' });
|
|
121
|
+
assert.equal(r.hub.holding('p1'), null, 'existing grabs may still be thrown');
|
|
122
|
+
{
|
|
123
|
+
const t = start(grab); assert.equal(t.hub.disguise('p1', {}), true);
|
|
124
|
+
t.say('p1', { k: 'hub-grab', actor: 'crate', op: 'grab' });
|
|
125
|
+
assert.equal(t.hub.holding('p1'), 'crate', 'a tag-only disguise may grab');
|
|
126
|
+
}
|
|
127
|
+
for (const spec of [{ look: 'car' }]) {
|
|
128
|
+
let asked = 0;
|
|
129
|
+
const s = start(grab, () => {asked++;});
|
|
130
|
+
assert.equal(s.hub.disguise('p1', spec), true);
|
|
131
|
+
s.say('p1', { k: 'hub-grab', actor: 'crate', op: 'grab' });
|
|
132
|
+
assert.equal(s.hub.holding('p1'), null); assert.equal(asked, 0);
|
|
133
|
+
assert.ok(s.sent.some(([id, msg]) => id === 'p1' && msg.k === 'hub-grab-deny' && msg.actor === 'crate'));
|
|
134
|
+
s.hub.disguise('p1', null); s.say('p1', { k: 'hub-grab', actor: 'crate', op: 'grab' });
|
|
135
|
+
assert.equal(s.hub.holding('p1'), 'crate'); assert.equal(asked, 1);
|
|
136
|
+
}
|
|
137
|
+
const s = start(grab, (ctx, id) => {assert.equal(ctx.disguise(id, { look: 'car' }), true);});
|
|
138
|
+
s.say('p1', { k: 'hub-grab', actor: 'crate', op: 'grab' });
|
|
139
|
+
assert.equal(s.hub.holding('p1'), null); assert.ok(s.hub.disguised('p1'));
|
|
140
|
+
assert.ok(s.sent.some(([, msg]) => msg.k === 'hub-grab-deny'));
|
|
141
|
+
if (grab.keepHeld) {assert.equal(s.sim.objects.get('crate').claimable, true, 'refused grab never pins the actor');}
|
|
142
|
+
}
|
|
143
|
+
});
|
|
144
|
+
test('250 ms latest-value coalescing is independent per player', () => {
|
|
145
|
+
const r = boot(); r.server.delta();
|
|
146
|
+
r.hub.disguise('p1', { look: 'car' }); assert.deepEqual(r.server.delta().hubDisguise, [['p1', 'car', null]]);
|
|
147
|
+
r.tick(100); r.hub.disguise('p1', { to: ['p2'] }); r.hub.disguise('p1', { to: ['p3'] });
|
|
148
|
+
assert.deepEqual(r.hub.disguised('p1'), { look: null, to: ['p3'] });
|
|
149
|
+
assert.equal(Object.hasOwn(r.server.delta() ?? {}, 'hubDisguise'), false);
|
|
150
|
+
r.hub.disguise('p2', {}); assert.deepEqual(r.server.delta().hubDisguise, [['p1', 'car', null], ['p2', null, null]]);
|
|
151
|
+
r.tick(149); assert.equal(Object.hasOwn(r.server.delta() ?? {}, 'hubDisguise'), false);
|
|
152
|
+
r.tick(1); assert.deepEqual(r.server.delta().hubDisguise, [['p1', null, ['p3']], ['p2', null, null]]);
|
|
153
|
+
r.hub.disguise('p1', null); assert.equal(Object.hasOwn(r.server.delta() ?? {}, 'hubDisguise'), false);
|
|
154
|
+
r.tick(250); assert.deepEqual(r.server.delta().hubDisguise, [['p2', null, null]]);
|
|
155
|
+
});
|
|
156
|
+
test('leave/forget, kit trip, end and changed account clear the visit disguise', () => {
|
|
157
|
+
let r = boot(); r.hub.disguise('p1', {}); r.server.delta(); r.drop('p1'); r.tick();
|
|
158
|
+
assert.equal(r.hub.disguised('p1'), null); assert.deepEqual(r.server.delta().hubDisguise, []);
|
|
159
|
+
r = boot(); r.hub.disguise('p1', {}); r.hub.go('game', ['p1']);
|
|
160
|
+
assert.equal(r.hub.disguised('p1'), null); assert.equal(r.hub.disguise('p1', {}), false);
|
|
161
|
+
r = boot(); r.hub.disguise('p1', {}); r.hub.end(['p1']); assert.equal(r.hub.disguised('p1'), null);
|
|
162
|
+
assert.equal(r.hub.disguise('p1', {}), false);
|
|
163
|
+
r = boot(); r.hub.disguise('p1', {}); r.server.join();
|
|
164
|
+
r.session.players.find(p => p.playerId === 'p1').userId = 'replacement'; r.tick();
|
|
165
|
+
assert.equal(r.hub.disguised('p1'), null); assert.deepEqual(r.server.join().hubDisguise, []);
|
|
166
|
+
});
|
|
167
|
+
test('retained resume keeps disguise; expiry clears it', () => {
|
|
168
|
+
const r = boot({ retained: true }); r.hub.disguise('p1', { look: 'car' });
|
|
169
|
+
r.drop('p1'); r.tick(); r.tick(30000);
|
|
170
|
+
assert.deepEqual(r.hub.disguised('p1'), { look: 'car', to: null });
|
|
171
|
+
r.back('p1'); r.tick(); assert.deepEqual(r.server.join().hubDisguise, [['p1', 'car', null]]); assert.deepEqual(r.left, []);
|
|
172
|
+
r.drop('p1'); r.tick(); r.tick(60000); assert.equal(r.hub.disguised('p1'), null); assert.deepEqual(r.left, ['p1']);
|
|
173
|
+
});
|
|
174
|
+
const r = boot(); r.hub.disguise('p1', {}); await r.server.shutdown(); assert.equal(r.hub.disguised('p1'), null);
|
|
175
|
+
} finally {Date.now = realNow;}
|
|
176
|
+
console.log(`ok: ${n} disguise server cases`);
|