castle-web-cli 0.4.232 → 0.4.234
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-failures.d.ts +8 -0
- package/dist/agent-failures.js +19 -2
- package/dist/agent-prompts.d.ts +1 -1
- package/dist/agent-prompts.js +10 -3
- package/dist/agent.d.ts +64 -3
- package/dist/agent.js +170 -81
- package/dist/api.d.ts +11 -0
- package/dist/api.js +43 -0
- package/dist/bundle.d.ts +64 -0
- package/dist/bundle.js +558 -2
- package/dist/castle-host/host.d.ts +18 -2
- package/dist/castle-host/host.js +844 -39
- package/dist/castleJson.d.ts +23 -2
- package/dist/castleJson.js +46 -2
- package/dist/check.d.ts +3 -1
- package/dist/check.js +20 -3
- package/dist/chunkLoader.d.ts +3 -0
- package/dist/chunkLoader.js +111 -0
- package/dist/devParty.d.ts +26 -0
- package/dist/devParty.js +231 -0
- package/dist/devSaveStorage.js +4 -0
- package/dist/devSessionStorage.js +50 -2
- package/dist/devSocial.d.ts +24 -0
- package/dist/devSocial.js +70 -0
- package/dist/ide.d.ts +2 -0
- package/dist/ide.js +119 -15
- package/dist/importPinMismatch.d.ts +22 -0
- package/dist/importPinMismatch.js +77 -0
- package/dist/importRegression.js +3 -15
- package/dist/imports.d.ts +10 -3
- package/dist/imports.js +88 -20
- package/dist/index.js +11 -4
- package/dist/init.js +1 -1
- package/dist/platformDoc.js +22 -0
- package/dist/routerFences.d.ts +5 -0
- package/dist/routerFences.js +12 -2
- package/dist/save-deck.d.ts +25 -1
- package/dist/save-deck.js +178 -9
- package/dist/serve.js +32 -11
- package/dist/shell/assets/{index-D2tWM896.js → index-DulbYIJm.js} +97 -97
- package/dist/shell/assets/index-MVLfNYd9.css +1 -0
- package/dist/shell/index.html +2 -2
- package/dist/taskSteer.d.ts +13 -0
- package/dist/taskSteer.js +22 -2
- package/dist/vitePlugins.d.ts +2 -1
- package/dist/vitePlugins.js +13 -0
- package/kits/base/castle.json +1 -1
- package/kits/base/package-lock.json +1 -1
- package/kits/base/sdk/README.md +339 -5
- package/kits/base/sdk/avatar.d.ts +6 -2
- package/kits/base/sdk/avatar.js +12 -4
- package/kits/base/sdk/castle.d.ts +7 -3
- package/kits/base/sdk/castle.js +2 -0
- package/kits/base/sdk/commands.d.ts +176 -1
- package/kits/base/sdk/commands.js +3 -0
- package/kits/base/sdk/display.d.ts +3 -0
- package/kits/base/sdk/display.js +9 -3
- package/kits/base/sdk/hub.d.ts +37 -6
- package/kits/base/sdk/hub.js +63 -4
- package/kits/base/sdk/multiplayer.d.ts +7 -1
- package/kits/base/sdk/multiplayer.js +148 -32
- package/kits/base/sdk/multiplayerProtocol.d.ts +2 -0
- package/kits/base/sdk/party.d.ts +23 -0
- package/kits/base/sdk/party.js +91 -0
- package/kits/base/sdk/reconnectBudget.d.ts +23 -0
- package/kits/base/sdk/reconnectBudget.js +96 -0
- package/kits/base/sdk/save.d.ts +38 -1
- package/kits/base/sdk/save.js +81 -7
- package/kits/base/sdk/server/hub.d.ts +117 -0
- package/kits/base/sdk/server/hub.js +119 -2
- package/kits/base/sdk/server/platformHandle.d.ts +43 -1
- package/kits/base/sdk/server/storage.d.ts +17 -0
- package/kits/base/sdk/server/storage.js +65 -3
- package/kits/base/sdk/server/wrapper.d.ts +43 -6
- package/kits/base/sdk/server/wrapper.js +93 -9
- package/kits/base/sdk/social.d.ts +9 -0
- package/kits/base/sdk/social.js +5 -0
- package/kits/hub-game/CLAUDE.md +451 -13
- package/kits/hub-game/README.md +63 -0
- package/kits/hub-game/blueprints/avatar-10.scene +28 -0
- package/kits/hub-game/blueprints/avatar-11.scene +28 -0
- package/kits/hub-game/blueprints/avatar-12.scene +28 -0
- package/kits/hub-game/blueprints/avatar-13.scene +28 -0
- package/kits/hub-game/blueprints/avatar-14.scene +28 -0
- package/kits/hub-game/blueprints/avatar-15.scene +28 -0
- package/kits/hub-game/blueprints/avatar-4.scene +28 -0
- package/kits/hub-game/blueprints/avatar-5.scene +28 -0
- package/kits/hub-game/blueprints/avatar-6.scene +28 -0
- package/kits/hub-game/blueprints/avatar-7.scene +28 -0
- package/kits/hub-game/blueprints/avatar-8.scene +28 -0
- package/kits/hub-game/blueprints/avatar-9.scene +28 -0
- package/kits/hub-game/castle.json +5 -5
- package/kits/hub-game/code/client/act.js +312 -0
- package/kits/hub-game/code/client/actionLayout.js +147 -0
- package/kits/hub-game/code/client/actionOverflow.js +556 -0
- package/kits/hub-game/code/client/actorBudget.js +47 -0
- package/kits/hub-game/code/client/arrivalCamera.js +50 -0
- package/kits/hub-game/code/client/askSlot.js +117 -0
- package/kits/hub-game/code/client/attention.js +11 -2
- package/kits/hub-game/code/client/avatar.js +311 -35
- package/kits/hub-game/code/client/avatarCap.js +228 -0
- package/kits/hub-game/code/client/avatarColors.js +70 -0
- package/kits/hub-game/code/client/avatarFaces.js +21 -0
- package/kits/hub-game/code/client/avatarShare.js +253 -0
- package/kits/hub-game/code/client/backVisibility.js +13 -0
- package/kits/hub-game/code/client/ballot.js +472 -0
- package/kits/hub-game/code/client/build.js +38 -0
- package/kits/hub-game/code/client/chat.js +41 -5
- package/kits/hub-game/code/client/chatModeration.js +5 -0
- package/kits/hub-game/code/client/chrome.js +2144 -160
- package/kits/hub-game/code/client/companion.js +716 -0
- package/kits/hub-game/code/client/companionDress.js +99 -0
- package/kits/hub-game/code/client/crowdNames.js +241 -0
- package/kits/hub-game/code/client/decor.js +515 -0
- package/kits/hub-game/code/client/defaultEnvironment.js +194 -0
- package/kits/hub-game/code/client/doorErrors.js +39 -0
- package/kits/hub-game/code/client/earned.js +131 -0
- package/kits/hub-game/code/client/emoteBubble.js +75 -0
- package/kits/hub-game/code/client/fall.js +18 -0
- package/kits/hub-game/code/client/farAvatars.js +233 -0
- package/kits/hub-game/code/client/firstJoin.js +9 -2
- package/kits/hub-game/code/client/fpsTelemetry.js +50 -0
- package/kits/hub-game/code/client/frameBatch.js +5 -0
- package/kits/hub-game/code/client/grab.js +368 -29
- package/kits/hub-game/code/client/hookLayer.js +385 -20
- package/kits/hub-game/code/client/hudCopy.js +51 -0
- package/kits/hub-game/code/client/hudRate.js +20 -0
- package/kits/hub-game/code/client/idle.js +177 -24
- package/kits/hub-game/code/client/interestCap.js +81 -0
- package/kits/hub-game/code/client/invites.js +231 -0
- package/kits/hub-game/code/client/joinError.js +9 -0
- package/kits/hub-game/code/client/keys.js +36 -0
- package/kits/hub-game/code/client/labelsNear.js +234 -0
- package/kits/hub-game/code/client/landscapeLayout.js +17 -0
- package/kits/hub-game/code/client/layoutCache.js +264 -0
- package/kits/hub-game/code/client/loadTelemetry.js +20 -0
- package/kits/hub-game/code/client/loadingCover.js +148 -0
- package/kits/hub-game/code/client/loadingEntry.js +8 -0
- package/kits/hub-game/code/client/menuIcons.js +34 -0
- package/kits/hub-game/code/client/menuRows.js +43 -0
- package/kits/hub-game/code/client/modelReady.js +7 -0
- package/kits/hub-game/code/client/pack.js +6 -2
- package/kits/hub-game/code/client/packFormat.js +3 -3
- package/kits/hub-game/code/client/padCueArrival.js +23 -0
- package/kits/hub-game/code/client/padCues.js +112 -0
- package/kits/hub-game/code/client/padOccupancy.js +88 -0
- package/kits/hub-game/code/client/padReadability.js +26 -0
- package/kits/hub-game/code/client/padRings.js +69 -0
- package/kits/hub-game/code/client/pushVisit.js +14 -0
- package/kits/hub-game/code/client/quality.js +205 -0
- package/kits/hub-game/code/client/qualityEntry.js +55 -0
- package/kits/hub-game/code/client/rehello.js +167 -0
- package/kits/hub-game/code/client/safeLayout.js +338 -0
- package/kits/hub-game/code/client/safeStyle.js +42 -0
- package/kits/hub-game/code/client/say.js +12 -3
- package/kits/hub-game/code/client/shot.js +146 -0
- package/kits/hub-game/code/client/shotFit.js +56 -0
- package/kits/hub-game/code/client/signIn.js +28 -0
- package/kits/hub-game/code/client/sound.js +63 -8
- package/kits/hub-game/code/client/soundscape.js +1151 -0
- package/kits/hub-game/code/client/soundscapeActions.js +99 -0
- package/kits/hub-game/code/client/soundscapeAmbience.js +453 -0
- package/kits/hub-game/code/client/soundscapeBaked.js +143 -0
- package/kits/hub-game/code/client/soundscapeBusker.js +217 -0
- package/kits/hub-game/code/client/soundscapeCourt.js +200 -0
- package/kits/hub-game/code/client/soundscapeCrowd.js +331 -0
- package/kits/hub-game/code/client/soundscapeCues.js +362 -0
- package/kits/hub-game/code/client/soundscapeMap.js +181 -0
- package/kits/hub-game/code/client/soundscapeMarket.js +176 -0
- package/kits/hub-game/code/client/soundscapeMusic.js +126 -0
- package/kits/hub-game/code/client/soundscapeMusicEngine.js +460 -0
- package/kits/hub-game/code/client/soundscapeSimlish.js +737 -0
- package/kits/hub-game/code/client/soundscapeSongs.js +127 -0
- package/kits/hub-game/code/client/soundscapeSongsRound3.js +63 -0
- package/kits/hub-game/code/client/soundscapeSynthesis.js +168 -0
- package/kits/hub-game/code/client/soundscapeUi.js +211 -0
- package/kits/hub-game/code/client/soundscapeVoice.js +1209 -0
- package/kits/hub-game/code/client/soundscapeWaves.js +206 -0
- package/kits/hub-game/code/client/spin.js +101 -0
- package/kits/hub-game/code/client/state.js +162 -1
- package/kits/hub-game/code/client/stuck.js +259 -0
- package/kits/hub-game/code/client/talk.js +714 -59
- package/kits/hub-game/code/client/tiers.js +543 -52
- package/kits/hub-game/code/client/toastBand.js +37 -0
- package/kits/hub-game/code/client/together.js +39 -2
- package/kits/hub-game/code/client/visibility.js +43 -0
- package/kits/hub-game/code/client/weakestLookBake.js +92 -0
- package/kits/hub-game/code/client/weakestTier.js +295 -0
- package/kits/hub-game/code/client/wear.js +461 -170
- package/kits/hub-game/code/client/worldLabels.js +241 -0
- package/kits/hub-game/code/client/yours.js +200 -0
- package/kits/hub-game/code/companionSpec.js +45 -0
- package/kits/hub-game/code/npcDisplayText.js +55 -0
- package/kits/hub-game/code/privateText.js +7 -0
- package/kits/hub-game/code/server/act.js +124 -0
- package/kits/hub-game/code/server/actions.js +138 -0
- package/kits/hub-game/code/server/actors.js +11 -2
- package/kits/hub-game/code/server/analytics.js +83 -0
- package/kits/hub-game/code/server/anonymousEntry.js +49 -0
- package/kits/hub-game/code/server/arrivalPose.js +36 -0
- package/kits/hub-game/code/server/ask.js +155 -0
- package/kits/hub-game/code/server/ballot.js +539 -0
- package/kits/hub-game/code/server/cells.js +100 -0
- package/kits/hub-game/code/server/companion.js +107 -0
- package/kits/hub-game/code/server/cues.js +70 -0
- package/kits/hub-game/code/server/decor.js +269 -0
- package/kits/hub-game/code/server/doorAnalytics.js +52 -0
- package/kits/hub-game/code/server/earned.js +478 -0
- package/kits/hub-game/code/server/frameBatch.js +183 -0
- package/kits/hub-game/code/server/friendBests.js +166 -0
- package/kits/hub-game/code/server/friendsAmong.js +272 -0
- package/kits/hub-game/code/server/history.js +7 -0
- package/kits/hub-game/code/server/hub.js +2510 -95
- package/kits/hub-game/code/server/idle.js +60 -12
- package/kits/hub-game/code/server/index.js +28 -6
- package/kits/hub-game/code/server/invites.js +19 -0
- package/kits/hub-game/code/server/labels.js +36 -2
- package/kits/hub-game/code/server/loadAbandon.js +106 -0
- package/kits/hub-game/code/server/manifest.js +586 -7
- package/kits/hub-game/code/server/menu.js +161 -0
- package/kits/hub-game/code/server/npcs.js +1025 -113
- package/kits/hub-game/code/server/observe.js +408 -0
- package/kits/hub-game/code/server/padOccupancy.js +85 -0
- package/kits/hub-game/code/server/party.js +2 -2
- package/kits/hub-game/code/server/players.js +30 -0
- package/kits/hub-game/code/server/resumePose.js +152 -0
- package/kits/hub-game/code/server/say.js +1 -1
- package/kits/hub-game/code/server/shot.js +110 -0
- package/kits/hub-game/code/server/standing.js +123 -0
- package/kits/hub-game/code/server/storageLimit.js +187 -0
- package/kits/hub-game/code/server/vis.js +175 -0
- package/kits/hub-game/code/server/wear.js +12 -0
- package/kits/hub-game/code/server/yours.js +59 -0
- package/kits/hub-game/code/shared/act.js +35 -0
- package/kits/hub-game/code/shared/cues.js +9 -0
- package/kits/hub-game/code/shared/danceIdle.js +28 -0
- package/kits/hub-game/code/shared/decor.js +41 -0
- package/kits/hub-game/code/shared/loadStages.js +12 -0
- package/kits/hub-game/code/shared/quality.js +74 -0
- package/kits/hub-game/code/shared/say.js +2 -0
- package/kits/hub-game/code/shared/shot.js +53 -0
- package/kits/hub-game/code/shared/spin.js +57 -0
- package/kits/hub-game/code/systems/hub.js +1753 -202
- package/kits/hub-game/docs/analytics.md +279 -0
- package/kits/hub-game/docs/content-pack.md +1 -1
- package/kits/hub-game/docs/contract.md +3475 -77
- package/kits/hub-game/docs/home-pieces.md +71 -0
- package/kits/hub-game/docs/observed-progress.md +252 -0
- package/kits/hub-game/main.jsx +2 -0
- package/kits/hub-game/models/avatar-10.pxmodel +28 -0
- package/kits/hub-game/models/avatar-11.pxmodel +28 -0
- package/kits/hub-game/models/avatar-12.pxmodel +27 -0
- package/kits/hub-game/models/avatar-13.pxmodel +24 -0
- package/kits/hub-game/models/avatar-14.pxmodel +29 -0
- package/kits/hub-game/models/avatar-15.pxmodel +24 -0
- package/kits/hub-game/models/avatar-4.pxmodel +29 -0
- package/kits/hub-game/models/avatar-5.pxmodel +27 -0
- package/kits/hub-game/models/avatar-6.pxmodel +26 -0
- package/kits/hub-game/models/avatar-7.pxmodel +25 -0
- package/kits/hub-game/models/avatar-8.pxmodel +24 -0
- package/kits/hub-game/models/avatar-9.pxmodel +30 -0
- package/kits/hub-game/models/earned/badge-round.pxmodel +100 -0
- package/kits/hub-game/models/earned/badge-shield.pxmodel +117 -0
- package/kits/hub-game/models/earned/badge-star.pxmodel +87 -0
- package/kits/hub-game/models/earned/belt-plain.pxmodel +72 -0
- package/kits/hub-game/models/earned/held-ball.pxmodel +43 -0
- package/kits/hub-game/models/earned/held-lantern.pxmodel +85 -0
- package/kits/hub-game/models/earned/held-net.pxmodel +57 -0
- package/kits/hub-game/models/earned/held-trophy.pxmodel +109 -0
- package/kits/hub-game/models/earned/pin-round.pxmodel +62 -0
- package/kits/hub-game/models/earned/sash-plain.pxmodel +66 -0
- package/kits/hub-game/models/earned/square/belt-plain.pxmodel +104 -0
- package/kits/hub-game/models/earned/square/sash-plain.pxmodel +98 -0
- package/kits/hub-game/models/hats/bat-clip.pxmodel +206 -0
- package/kits/hub-game/models/hats/beekeeper.pxmodel +149 -0
- package/kits/hub-game/models/hats/cap.pxmodel +162 -0
- package/kits/hub-game/models/hats/captain.pxmodel +178 -0
- package/kits/hub-game/models/hats/crooked-top.pxmodel +172 -0
- package/kits/hub-game/models/hats/flower-crown.pxmodel +451 -0
- package/kits/hub-game/models/hats/foam-crown.pxmodel +179 -0
- package/kits/hub-game/models/hats/lantern.pxmodel +230 -0
- package/kits/hub-game/models/hats/laurel.pxmodel +533 -0
- package/kits/hub-game/models/hats/lighthouse.pxmodel +96 -0
- package/kits/hub-game/models/hats/sailor.pxmodel +141 -0
- package/kits/hub-game/models/hats/souwester.pxmodel +131 -0
- package/kits/hub-game/models/hats/straw.pxmodel +139 -0
- package/kits/hub-game/models/hats/sunflower.pxmodel +406 -0
- package/kits/hub-game/models/hats/sweatband.pxmodel +112 -0
- package/kits/hub-game/models/hats/witch.pxmodel +147 -0
- package/kits/hub-game/package-lock.json +10 -1
- package/kits/hub-game/package.json +6 -2
- package/kits/hub-game/play/player.js +142 -0
- package/kits/hub-game/play/registry.js +47 -0
- package/kits/hub-game/play.jsx +37 -0
- package/kits/hub-game/scripts/check.mjs +117 -16
- package/kits/hub-game/scripts/companion-follower-wire.json +1 -0
- package/kits/hub-game/scripts/fixtures/decor-keyless-draw.json +132 -0
- package/kits/hub-game/scripts/fixtures/decor-keyless.json +293 -0
- package/kits/hub-game/scripts/fixtures/engine-models-stub.mjs +26 -0
- package/kits/hub-game/scripts/fixtures/fake-dom.mjs +123 -0
- package/kits/hub-game/scripts/fixtures/interest-legacy.json +385 -0
- package/kits/hub-game/scripts/fixtures/npc-notes-v1.77.jsonl +4 -0
- package/kits/hub-game/scripts/fixtures/vis-shared-wire.json +1 -0
- package/kits/hub-game/scripts/gen-avatars.mjs +933 -16
- package/kits/hub-game/scripts/gen-earned.mjs +285 -0
- package/kits/hub-game/scripts/gen-hats.mjs +827 -0
- package/kits/hub-game/scripts/grab.before-orbit.mjs +400 -0
- package/kits/hub-game/scripts/pose-storage-fixture.mjs +46 -0
- package/kits/hub-game/scripts/soundscape-wave-analysis.mjs +125 -0
- package/kits/hub-game/scripts/test-act-client.mjs +186 -0
- package/kits/hub-game/scripts/test-act.mjs +171 -0
- package/kits/hub-game/scripts/test-action-layout.mjs +80 -0
- package/kits/hub-game/scripts/test-action-observers.mjs +46 -0
- package/kits/hub-game/scripts/test-actions-client.mjs +853 -0
- package/kits/hub-game/scripts/test-actions.mjs +298 -0
- package/kits/hub-game/scripts/test-actor-budget.mjs +44 -0
- package/kits/hub-game/scripts/test-actors.mjs +38 -23
- package/kits/hub-game/scripts/test-analytics.mjs +76 -0
- package/kits/hub-game/scripts/test-anonymous-entry.mjs +28 -0
- package/kits/hub-game/scripts/test-arrival-pose-server.mjs +196 -0
- package/kits/hub-game/scripts/test-arrival-pose.mjs +24 -0
- package/kits/hub-game/scripts/test-ask-client.mjs +358 -0
- package/kits/hub-game/scripts/test-ask-slot.mjs +85 -0
- package/kits/hub-game/scripts/test-ask.mjs +269 -0
- package/kits/hub-game/scripts/test-attention.mjs +10 -1
- package/kits/hub-game/scripts/test-avatar-cap.mjs +379 -0
- package/kits/hub-game/scripts/test-avatar-colors.mjs +72 -0
- package/kits/hub-game/scripts/test-avatar-models.mjs +181 -0
- package/kits/hub-game/scripts/test-avatar-share.mjs +318 -0
- package/kits/hub-game/scripts/test-avatar-wire.mjs +792 -0
- package/kits/hub-game/scripts/test-avatar.mjs +584 -7
- package/kits/hub-game/scripts/test-back-visibility.mjs +82 -0
- package/kits/hub-game/scripts/test-ballot.mjs +1008 -0
- package/kits/hub-game/scripts/test-ban-join.mjs +121 -13
- package/kits/hub-game/scripts/test-build.mjs +49 -0
- package/kits/hub-game/scripts/test-cells.mjs +71 -0
- package/kits/hub-game/scripts/test-chat.mjs +863 -0
- package/kits/hub-game/scripts/test-classic.mjs +2 -0
- package/kits/hub-game/scripts/test-companion-chat.mjs +216 -0
- package/kits/hub-game/scripts/test-companion-client.mjs +1167 -0
- package/kits/hub-game/scripts/test-companion.mjs +259 -0
- package/kits/hub-game/scripts/test-control-layout-dom.mjs +120 -0
- package/kits/hub-game/scripts/test-crowd-names.mjs +205 -0
- package/kits/hub-game/scripts/test-decor-client.mjs +344 -0
- package/kits/hub-game/scripts/test-decor.mjs +464 -0
- package/kits/hub-game/scripts/test-default-environment-root.mjs +95 -0
- package/kits/hub-game/scripts/test-default-environment.mjs +267 -0
- package/kits/hub-game/scripts/test-door-analytics.mjs +58 -0
- package/kits/hub-game/scripts/test-door-jump.mjs +100 -0
- package/kits/hub-game/scripts/test-earned-client.mjs +459 -0
- package/kits/hub-game/scripts/test-earned.mjs +1224 -0
- package/kits/hub-game/scripts/test-emote-bubble.mjs +110 -0
- package/kits/hub-game/scripts/test-far-avatars.mjs +340 -0
- package/kits/hub-game/scripts/test-fps-telemetry.mjs +112 -0
- package/kits/hub-game/scripts/test-frame-batch.mjs +252 -0
- package/kits/hub-game/scripts/test-fresh-friends.mjs +118 -0
- package/kits/hub-game/scripts/test-friend-bests.mjs +435 -0
- package/kits/hub-game/scripts/test-grab-orbit.mjs +961 -0
- package/kits/hub-game/scripts/test-grab.mjs +7 -0
- package/kits/hub-game/scripts/test-hats.mjs +422 -168
- package/kits/hub-game/scripts/test-high-only.mjs +170 -0
- package/kits/hub-game/scripts/test-hub-leaving.mjs +203 -0
- package/kits/hub-game/scripts/test-hub-ops.mjs +758 -2
- package/kits/hub-game/scripts/test-hub-trip.mjs +1594 -12
- package/kits/hub-game/scripts/test-hud-clear.mjs +484 -57
- package/kits/hub-game/scripts/test-hud-defects-dom.mjs +100 -0
- package/kits/hub-game/scripts/test-hud-rate.mjs +224 -0
- package/kits/hub-game/scripts/test-hud-safe-visibility-dom.mjs +83 -0
- package/kits/hub-game/scripts/test-idle.mjs +427 -1
- package/kits/hub-game/scripts/test-interest-cap.mjs +36 -0
- package/kits/hub-game/scripts/test-interest-cells.mjs +513 -0
- package/kits/hub-game/scripts/test-interest-client.mjs +118 -0
- package/kits/hub-game/scripts/test-interest.mjs +15 -0
- package/kits/hub-game/scripts/test-invites-client.mjs +430 -0
- package/kits/hub-game/scripts/test-invites.mjs +109 -0
- package/kits/hub-game/scripts/test-keys.mjs +46 -1
- package/kits/hub-game/scripts/test-labels.mjs +664 -0
- package/kits/hub-game/scripts/test-landscape-layout.mjs +194 -0
- package/kits/hub-game/scripts/test-list-scroll-dom.mjs +49 -0
- package/kits/hub-game/scripts/test-load-abandon.mjs +246 -0
- package/kits/hub-game/scripts/test-loading-cover.mjs +162 -0
- package/kits/hub-game/scripts/test-manifest.mjs +472 -0
- package/kits/hub-game/scripts/test-menu-client.mjs +585 -0
- package/kits/hub-game/scripts/test-menu.mjs +319 -0
- package/kits/hub-game/scripts/test-npcs.mjs +2528 -13
- package/kits/hub-game/scripts/test-object-entry.mjs +76 -0
- package/kits/hub-game/scripts/test-observed.mjs +745 -0
- package/kits/hub-game/scripts/test-pack.mjs +7 -0
- package/kits/hub-game/scripts/test-pad-cues.mjs +304 -0
- package/kits/hub-game/scripts/test-pad-occupancy.mjs +177 -0
- package/kits/hub-game/scripts/test-picker.mjs +541 -0
- package/kits/hub-game/scripts/test-placement-cache.mjs +690 -0
- package/kits/hub-game/scripts/test-progress-reset.mjs +559 -0
- package/kits/hub-game/scripts/test-push-visit.mjs +26 -0
- package/kits/hub-game/scripts/test-quality.mjs +385 -0
- package/kits/hub-game/scripts/test-rehello.mjs +1733 -0
- package/kits/hub-game/scripts/test-relations-among.mjs +222 -0
- package/kits/hub-game/scripts/test-relations-refresh.mjs +188 -0
- package/kits/hub-game/scripts/test-resume-action-order.mjs +598 -0
- package/kits/hub-game/scripts/test-resume-held.mjs +239 -0
- package/kits/hub-game/scripts/test-resume-pose.mjs +142 -0
- package/kits/hub-game/scripts/test-safe-events-dom.mjs +116 -0
- package/kits/hub-game/scripts/test-safe-layout.mjs +330 -0
- package/kits/hub-game/scripts/test-say.mjs +1 -1
- package/kits/hub-game/scripts/test-shot.mjs +901 -0
- package/kits/hub-game/scripts/test-signin-client.mjs +45 -0
- package/kits/hub-game/scripts/test-soundscape.mjs +5437 -0
- package/kits/hub-game/scripts/test-spin.mjs +314 -0
- package/kits/hub-game/scripts/test-standing.mjs +449 -0
- package/kits/hub-game/scripts/test-storage-limit.mjs +333 -0
- package/kits/hub-game/scripts/test-stuck.mjs +1904 -0
- package/kits/hub-game/scripts/test-talk-overlay-dom.mjs +130 -0
- package/kits/hub-game/scripts/test-tier-cells.mjs +706 -0
- package/kits/hub-game/scripts/test-tiers-render.mjs +412 -0
- package/kits/hub-game/scripts/test-tiers.mjs +476 -2
- package/kits/hub-game/scripts/test-toast-band.mjs +61 -0
- package/kits/hub-game/scripts/test-try-on.mjs +22 -22
- package/kits/hub-game/scripts/test-vis.mjs +770 -0
- package/kits/hub-game/scripts/test-visibility.mjs +134 -0
- package/kits/hub-game/scripts/test-weakest-tier.mjs +924 -0
- package/kits/hub-game/scripts/test-world-labels.mjs +367 -0
- package/kits/hub-game/scripts/test-yours-chrome.mjs +210 -0
- package/kits/hub-game/scripts/test-yours.mjs +403 -0
- package/kits/multiplayer-3d/CLAUDE.md +50 -0
- package/kits/multiplayer-3d/castle.json +5 -5
- package/kits/multiplayer-3d/code/client/avatars.js +7 -0
- package/kits/multiplayer-3d/code/client/gait.js +65 -0
- package/kits/multiplayer-3d/code/client/joinFailure.js +27 -0
- package/kits/multiplayer-3d/code/client/nameTags.js +59 -4
- package/kits/multiplayer-3d/code/client/resumeGate.js +139 -0
- package/kits/multiplayer-3d/code/options.js +5 -0
- package/kits/multiplayer-3d/code/server/ownership.js +10 -2
- package/kits/multiplayer-3d/code/server/sceneBodies.js +12 -0
- package/kits/multiplayer-3d/code/server/world.js +7 -0
- package/kits/multiplayer-3d/code/systems/multiplayer.js +443 -34
- package/kits/multiplayer-3d/package-lock.json +8 -1
- package/kits/multiplayer-3d/package.json +3 -1
- package/kits/multiplayer-3d/scripts/fixtures/README.md +11 -0
- package/kits/multiplayer-3d/scripts/fixtures/ownership-legacy.json +2 -0
- package/kits/multiplayer-3d/scripts/ownership-harness.mjs +102 -0
- package/kits/multiplayer-3d/scripts/ownership-loader.mjs +46 -0
- package/kits/multiplayer-3d/scripts/ownership-worker.mjs +15 -0
- package/kits/multiplayer-3d/scripts/record-ownership-session.mjs +98 -0
- package/kits/multiplayer-3d/scripts/test-eligible-claims.mjs +167 -0
- package/kits/multiplayer-3d/scripts/test-join-watchdog.mjs +436 -0
- package/kits/multiplayer-3d/scripts/test-own-name-tag.mjs +247 -0
- package/kits/multiplayer-3d/scripts/test-resume-gate.mjs +624 -0
- package/kits/physics-2d/CLAUDE.md +19 -1
- package/kits/physics-2d/castle.json +2 -2
- package/kits/physics-2d/engine/frozenActors.js +233 -0
- package/kits/physics-2d/engine/scene.js +337 -3
- package/kits/physics-2d/engine/skyKey.js +129 -0
- package/kits/physics-2d/engine/stillClock.js +106 -0
- package/kits/physics-2d/engine/updateBudget.js +21 -0
- package/kits/physics-2d/eslint.config.js +1 -1
- package/kits/physics-2d/play/behaviors/AnalogStick.js +198 -0
- package/kits/physics-2d/play/behaviors/Camera.js +40 -0
- package/kits/physics-2d/play/behaviors/Collider.js +122 -0
- package/kits/physics-2d/play/behaviors/Draggable.js +115 -0
- package/kits/physics-2d/play/behaviors/Goal.js +46 -0
- package/kits/physics-2d/play/behaviors/Joints.js +126 -0
- package/kits/physics-2d/play/behaviors/Layout.js +71 -0
- package/kits/physics-2d/play/behaviors/RigidBody.js +57 -0
- package/kits/physics-2d/play/behaviors/Slingshot.js +142 -0
- package/kits/physics-2d/play/behaviors/SoundPlayer.js +263 -0
- package/kits/physics-2d/play/behaviors/Sprite.js +406 -0
- package/kits/physics-2d/play/behaviors/Style.js +209 -0
- package/kits/physics-2d/play/behaviors/Text.js +85 -0
- package/kits/physics-2d/play/behaviors/Video.js +93 -0
- package/kits/physics-2d/scripts/test-skip-unchanged.mjs +326 -1
- package/kits/physics-3d/CLAUDE.md +42 -529
- package/kits/physics-3d/behaviors/Body.jsx +3 -0
- package/kits/physics-3d/behaviors/Model.jsx +3 -0
- package/kits/physics-3d/behaviors/Player.jsx +661 -87
- package/kits/physics-3d/behaviors/Shape.jsx +3 -0
- package/kits/physics-3d/behaviors/Solid.jsx +3 -0
- package/kits/physics-3d/behaviors/Transform.jsx +3 -0
- package/kits/physics-3d/castle.json +3 -3
- package/kits/physics-3d/docs/engine-camera.md +542 -0
- package/kits/physics-3d/docs/engine-frame-cap.md +136 -0
- package/kits/physics-3d/docs/engine-load.md +149 -0
- package/kits/physics-3d/docs/engine-look.md +114 -0
- package/kits/physics-3d/docs/engine-shadows.md +372 -0
- package/kits/physics-3d/docs/engine-skip-work.md +187 -0
- package/kits/physics-3d/docs/engine-sky.md +198 -0
- package/kits/physics-3d/docs/engine-static-actors.md +226 -0
- package/kits/physics-3d/docs/engine-view.md +37 -0
- package/kits/physics-3d/docs/pxmodel-format.md +9 -1
- package/kits/physics-3d/engine3d/PlayOnly3D.jsx +5 -1
- package/kits/physics-3d/engine3d/Scene3DPlayer.jsx +19 -277
- package/kits/physics-3d/engine3d/actornode.js +87 -0
- package/kits/physics-3d/engine3d/animationBudget.js +23 -0
- package/kits/physics-3d/engine3d/branches.js +3 -13
- package/kits/physics-3d/engine3d/cage.js +2 -7
- package/kits/physics-3d/engine3d/cageops.js +2 -17
- package/kits/physics-3d/engine3d/dataBehaviors.js +12 -0
- package/kits/physics-3d/engine3d/editorWorld.js +6 -0
- package/kits/physics-3d/engine3d/emptynodes.js +232 -0
- package/kits/physics-3d/engine3d/framecap.js +99 -0
- package/kits/physics-3d/engine3d/frozenphysics.js +140 -0
- package/kits/physics-3d/engine3d/frozenstatics.js +273 -0
- package/kits/physics-3d/engine3d/gait.js +126 -0
- package/kits/physics-3d/engine3d/initialModelFiles.js +18 -0
- package/kits/physics-3d/engine3d/kithooks.js +47 -0
- package/kits/physics-3d/engine3d/look.js +514 -48
- package/kits/physics-3d/engine3d/lookbake.js +208 -0
- package/kits/physics-3d/engine3d/materialpresets.js +2 -0
- package/kits/physics-3d/engine3d/modelFiles.js +3 -17
- package/kits/physics-3d/engine3d/modelMath.js +49 -0
- package/kits/physics-3d/engine3d/modelready.js +16 -0
- package/kits/physics-3d/engine3d/motion.js +39 -10
- package/kits/physics-3d/engine3d/nearshadows.js +106 -21
- package/kits/physics-3d/engine3d/optimize.js +9 -5
- package/kits/physics-3d/engine3d/orbitinput.js +522 -10
- package/kits/physics-3d/engine3d/orbitlens.js +48 -0
- package/kits/physics-3d/engine3d/ownmodel.js +213 -0
- package/kits/physics-3d/engine3d/partgeometry.js +1 -16
- package/kits/physics-3d/engine3d/paths.js +1 -9
- package/kits/physics-3d/engine3d/playTimings.js +50 -0
- package/kits/physics-3d/engine3d/playerRun.js +372 -0
- package/kits/physics-3d/engine3d/pxmodel.js +42 -11
- package/kits/physics-3d/engine3d/rapier.js +27 -0
- package/kits/physics-3d/engine3d/scatter.js +1 -11
- package/kits/physics-3d/engine3d/shadowfade.js +890 -0
- package/kits/physics-3d/engine3d/sky.js +547 -0
- package/kits/physics-3d/engine3d/skylife.js +306 -0
- package/kits/physics-3d/engine3d/squarefirst.js +177 -0
- package/kits/physics-3d/engine3d/stillshadows.js +399 -0
- package/kits/physics-3d/engine3d/sweep.js +1 -25
- package/kits/physics-3d/engine3d/unchanged.js +11 -0
- package/kits/physics-3d/engine3d/viewrange.js +52 -0
- package/kits/physics-3d/engine3d/world3d.js +1253 -76
- package/kits/physics-3d/eslint.config.js +2 -1
- package/kits/physics-3d/main.jsx +10 -2
- package/kits/physics-3d/package-lock.json +7 -0
- package/kits/physics-3d/package.json +5 -1
- package/kits/physics-3d/play/behaviors/Body.js +31 -0
- package/kits/physics-3d/play/behaviors/Door.js +37 -0
- package/kits/physics-3d/play/behaviors/Lookable.js +16 -0
- package/kits/physics-3d/play/behaviors/Model.js +23 -0
- package/kits/physics-3d/play/behaviors/Pickup.js +46 -0
- package/kits/physics-3d/play/behaviors/Player.js +1204 -0
- package/kits/physics-3d/play/behaviors/Shape.js +47 -0
- package/kits/physics-3d/play/behaviors/Solid.js +16 -0
- package/kits/physics-3d/play/behaviors/Transform.js +29 -0
- package/kits/physics-3d/pnpm-lock.yaml +8 -0
- package/kits/physics-3d/scripts/bench-shadow-fade.mjs +37 -0
- package/kits/physics-3d/scripts/build-rapier-gz.mjs +56 -0
- package/kits/physics-3d/scripts/frozen-statics-fixture.mjs +141 -0
- package/kits/physics-3d/scripts/look-baseline.mjs +155 -0
- package/kits/physics-3d/scripts/test-camera-follow.mjs +5 -1
- package/kits/physics-3d/scripts/test-camera-orbit.mjs +2613 -82
- package/kits/physics-3d/scripts/test-drop-empty-parts.mjs +2 -2
- package/kits/physics-3d/scripts/test-empty-gait-hints.mjs +89 -0
- package/kits/physics-3d/scripts/test-frame-cap-bob.mjs +438 -0
- package/kits/physics-3d/scripts/test-frame-cap.mjs +452 -0
- package/kits/physics-3d/scripts/test-frozen-nested.mjs +49 -0
- package/kits/physics-3d/scripts/test-frozen-statics-legacy-physics2d.mjs +123 -0
- package/kits/physics-3d/scripts/test-frozen-statics.mjs +434 -0
- package/kits/physics-3d/scripts/test-gait.mjs +387 -0
- package/kits/physics-3d/scripts/test-look-bake.mjs +1056 -0
- package/kits/physics-3d/scripts/test-model-parse-cache.mjs +92 -0
- package/kits/physics-3d/scripts/test-near-shadows.mjs +5 -2
- package/kits/physics-3d/scripts/test-orbit-shadow-fade.mjs +2001 -0
- package/kits/physics-3d/scripts/test-orbit-shift-lock.mjs +582 -0
- package/kits/physics-3d/scripts/test-orbit-shot.mjs +657 -0
- package/kits/physics-3d/scripts/test-orbit-view.mjs +230 -0
- package/kits/physics-3d/scripts/test-rapier-gz.mjs +106 -0
- package/kits/physics-3d/scripts/test-skip-empty-nodes.mjs +845 -0
- package/kits/physics-3d/scripts/test-sky.mjs +2470 -0
- package/kits/physics-3d/scripts/test-square-first.mjs +921 -0
- package/kits/physics-3d/scripts/test-static-actors.mjs +10 -1
- package/kits/physics-3d/scripts/test-static-physics.mjs +4 -1
- package/kits/physics-3d/scripts/test-static-scenery.mjs +2174 -0
- package/kits/physics-3d/scripts/test-steady-hover.mjs +7 -2
- package/kits/physics-3d/scripts/test-still-shadows.mjs +477 -0
- package/kits/physics-3d/scripts/test-view-range.mjs +260 -0
- package/kits/physics-3d/systems/physics3d.js +419 -9
- package/kits/real-time/castle.json +2 -2
- package/kits/real-time/code/client/connection.js +33 -10
- package/kits/real-time/code/client/gameHooks.js +2 -0
- package/kits/real-time/code/client/joinOverlay.js +9 -4
- package/kits/real-time/code/server/gameHooks.js +7 -0
- package/kits/real-time/code/server/session.js +102 -22
- package/kits/real-time/package-lock.json +1 -1
- package/package.json +2 -2
- package/dist/shell/assets/index-Cf61cNfT.css +0 -1
|
@@ -0,0 +1,585 @@
|
|
|
1
|
+
// v1.79 menu chrome, private picks, input locks and cleanup.
|
|
2
|
+
import assert from 'node:assert/strict';
|
|
3
|
+
import { setMaxListeners } from 'node:events';
|
|
4
|
+
import { register } from 'node:module';
|
|
5
|
+
|
|
6
|
+
register(`data:text/javascript,${encodeURIComponent(`
|
|
7
|
+
import { readFile } from 'node:fs/promises';
|
|
8
|
+
import { fileURLToPath } from 'node:url';
|
|
9
|
+
export async function resolve(specifier, context, next) {
|
|
10
|
+
if (['pxmodel', 'optimize', 'look', 'lookbake'].some((m) => specifier === '@imports/castle.physics-3d/engine3d/' + m)) return { url: ${JSON.stringify(new URL('./fixtures/engine-models-stub.mjs', import.meta.url).href)}, shortCircuit: true };
|
|
11
|
+
if (specifier === '@imports/castle.physics-3d/engine3d/orbitlens.js') return { url: ${JSON.stringify(new URL('../../physics-3d/engine3d/orbitlens.js', import.meta.url).href)}, shortCircuit: true };
|
|
12
|
+
if (specifier === 'castle-web-sdk') return { url: 'data:text/javascript,export const Hub = { onBack(fn) { globalThis.__menuTestHostBack = fn; } };', shortCircuit: true };
|
|
13
|
+
if (specifier === '@imports/castle.multiplayer-3d/code/client/avatars.js') return { url: 'data:text/javascript,export const dropMissing = () => {};', shortCircuit: true };
|
|
14
|
+
if (specifier === '@imports/castle.real-time/code/client/messages.js') return { url: ${JSON.stringify(new URL('../../real-time/code/client/messages.js', import.meta.url).href)}, shortCircuit: true };
|
|
15
|
+
if (specifier.startsWith('@imports/castle.physics-2d/engine/')) return { url: 'data:text/javascript,export const initialMedia = {}; export const playMedia = () => {}; export const stopMedia = () => {};', shortCircuit: true };
|
|
16
|
+
if (specifier === '../client/pack.js') return { url: 'data:text/javascript,export const cachedPacks = () => []; export const loadPack = () => {}; export const matchesOwn = () => false; export const resolveDeckDoor = () => {};', shortCircuit: true };
|
|
17
|
+
return next(specifier, context);
|
|
18
|
+
}
|
|
19
|
+
export async function load(url, context, next) {
|
|
20
|
+
if (url.endsWith('/behaviors/Player.jsx')) {
|
|
21
|
+
return { format: 'module', source: await readFile(fileURLToPath(url), 'utf8'), shortCircuit: true };
|
|
22
|
+
}
|
|
23
|
+
if (url.endsWith('/code/client/hookLayer.js')) {
|
|
24
|
+
const source = await readFile(fileURLToPath(url), 'utf8');
|
|
25
|
+
return { format: 'module', source: source.replaceAll('import.meta.glob(', '(() => ({}))('), shortCircuit: true };
|
|
26
|
+
}
|
|
27
|
+
return next(url, context);
|
|
28
|
+
}
|
|
29
|
+
`)}`);
|
|
30
|
+
const { EARNED_SHAPES } = await import('../code/client/earned.js');
|
|
31
|
+
const { HATS } = await import('../code/client/hats.js');
|
|
32
|
+
const State = await import('../code/client/state.js');
|
|
33
|
+
const hook = (await import('../code/client/hookLayer.js')).default;
|
|
34
|
+
const { installSystem } = await import('../code/systems/hub.js');
|
|
35
|
+
const { makeChrome } = await import('../code/client/chrome.js');
|
|
36
|
+
const Ballot = await import('../code/client/ballot.js');
|
|
37
|
+
const { Player } = await import('../../physics-3d/behaviors/Player.jsx');
|
|
38
|
+
const { packMove } = await import('../../multiplayer-3d/code/client/poses.js');
|
|
39
|
+
function fakeDom(view) {
|
|
40
|
+
const log = [];
|
|
41
|
+
let ids = 0;
|
|
42
|
+
const made = [];
|
|
43
|
+
function node(tag) {
|
|
44
|
+
const id = `${tag}#${(ids += 1)}`;
|
|
45
|
+
const styles = {};
|
|
46
|
+
let text = '';
|
|
47
|
+
const self = {
|
|
48
|
+
id,
|
|
49
|
+
tag,
|
|
50
|
+
children: [],
|
|
51
|
+
parent: null,
|
|
52
|
+
dataset: {},
|
|
53
|
+
attrs: {},
|
|
54
|
+
rect: null,
|
|
55
|
+
size: null,
|
|
56
|
+
style: new Proxy(styles, {
|
|
57
|
+
get: (target, key) => target[key] ?? '',
|
|
58
|
+
set(target, key, value) {
|
|
59
|
+
target[key] = String(value);
|
|
60
|
+
log.push(`${id} style.${String(key)}=${value}`);
|
|
61
|
+
return true;
|
|
62
|
+
},
|
|
63
|
+
}),
|
|
64
|
+
styles,
|
|
65
|
+
get textContent() {
|
|
66
|
+
return text;
|
|
67
|
+
},
|
|
68
|
+
set textContent(value) {
|
|
69
|
+
text = String(value);
|
|
70
|
+
log.push(`${id} text=${text}`);
|
|
71
|
+
},
|
|
72
|
+
appendChild(child) {
|
|
73
|
+
child.parent = self;
|
|
74
|
+
self.children.push(child);
|
|
75
|
+
log.push(`${id} +${child.id}`);
|
|
76
|
+
return child;
|
|
77
|
+
},
|
|
78
|
+
append(...kids) {
|
|
79
|
+
kids.forEach((kid) => self.appendChild(kid));
|
|
80
|
+
},
|
|
81
|
+
insertBefore(child, before) {
|
|
82
|
+
if (child.parent) {
|
|
83
|
+
child.parent.children = child.parent.children.filter((c) => c !== child);
|
|
84
|
+
}
|
|
85
|
+
child.parent = self;
|
|
86
|
+
const at = self.children.indexOf(before);
|
|
87
|
+
self.children.splice(at < 0 ? self.children.length : at, 0, child);
|
|
88
|
+
return child;
|
|
89
|
+
},
|
|
90
|
+
remove() {
|
|
91
|
+
if (self.parent) {
|
|
92
|
+
self.parent.children = self.parent.children.filter((c) => c !== self);
|
|
93
|
+
log.push(`${id} removed`);
|
|
94
|
+
}
|
|
95
|
+
},
|
|
96
|
+
replaceChildren(...kids) {
|
|
97
|
+
self.children = [];
|
|
98
|
+
log.push(`${id} emptied`);
|
|
99
|
+
kids.forEach((kid) => self.appendChild(kid));
|
|
100
|
+
},
|
|
101
|
+
handlers: {},
|
|
102
|
+
addEventListener(type, fn, options) {
|
|
103
|
+
self.handlers[type] = fn;
|
|
104
|
+
if (options?.signal) {
|
|
105
|
+
setMaxListeners(0, options.signal);
|
|
106
|
+
options.signal.addEventListener('abort', () => { delete self.handlers[type]; }, { once: true });
|
|
107
|
+
}
|
|
108
|
+
},
|
|
109
|
+
removeEventListener() {},
|
|
110
|
+
setAttribute(key, value) {
|
|
111
|
+
self.attrs[key] = String(value);
|
|
112
|
+
},
|
|
113
|
+
getAttribute: (key) => self.attrs[key] ?? null,
|
|
114
|
+
focus() { document.activeElement = self; },
|
|
115
|
+
blur() { if (document.activeElement === self) document.activeElement = null; },
|
|
116
|
+
// A stand-in layout: 7 px a character and 20 of padding, one 24 px line.
|
|
117
|
+
get offsetWidth() {
|
|
118
|
+
log.push(`${id} read`);
|
|
119
|
+
return (typeof self.size === 'function' ? self.size(self) : self.size)?.w ?? text.length * 7 + 20;
|
|
120
|
+
},
|
|
121
|
+
get offsetHeight() {
|
|
122
|
+
log.push(`${id} read`);
|
|
123
|
+
return (typeof self.size === 'function' ? self.size(self) : self.size)?.h ?? 24;
|
|
124
|
+
},
|
|
125
|
+
get offsetLeft() {
|
|
126
|
+
return parseFloat(styles.left) || 0;
|
|
127
|
+
},
|
|
128
|
+
get clientWidth() {
|
|
129
|
+
return self.client ?? self.offsetWidth;
|
|
130
|
+
},
|
|
131
|
+
get scrollWidth() {
|
|
132
|
+
return self.scroll ?? self.offsetWidth;
|
|
133
|
+
},
|
|
134
|
+
getBoundingClientRect() {
|
|
135
|
+
let r = self.rect ?? { left: 0, right: 0, top: 0, bottom: 0 };
|
|
136
|
+
if (styles.flexDirection === 'column-reverse') {
|
|
137
|
+
const height = self.children.length * 44 + (self.children.length - 1) * 6;
|
|
138
|
+
const bottom = styles.bottom.startsWith('max') ? 132 : parseFloat(styles.bottom);
|
|
139
|
+
r = { left: view.viewW - 162, right: view.viewW - 12, top: view.viewH - bottom - height, bottom: view.viewH - bottom };
|
|
140
|
+
}
|
|
141
|
+
return { ...r, width: r.right - r.left, height: r.bottom - r.top };
|
|
142
|
+
},
|
|
143
|
+
};
|
|
144
|
+
made.push(self);
|
|
145
|
+
return self;
|
|
146
|
+
}
|
|
147
|
+
const body = node('body');
|
|
148
|
+
globalThis.document = { body, createElement: node, activeElement: null };
|
|
149
|
+
globalThis.window = { innerWidth: view.viewW, innerHeight: view.viewH };
|
|
150
|
+
globalThis.innerWidth = view.viewW;
|
|
151
|
+
return { log, body, made };
|
|
152
|
+
}
|
|
153
|
+
const spec = { title: 'Wardrobe', note: 'Pick a colour', sections: [{ title: 'Colours', items: [{ id: 'blue', label: 'Blue', color: '#123abc', on: true }, { id: 'red', label: 'Red', color: '#ab1234', icon: 'badge-star' }] }, { title: 'Hats', items: [{ id: 'cap', label: 'Cap', icon: 'cap' }] }, { title: 'Empty', items: [] }] };
|
|
154
|
+
const offer = { spec, n: 1 };
|
|
155
|
+
const find = (dom, text) => dom.made.findLast((node) => node.textContent === text);
|
|
156
|
+
const tile = (dom, id) => dom.made.findLast((node) => node.dataset.id === id);
|
|
157
|
+
const sheet = (dom) => dom.made.findLast((node) => node.dataset.hub === 'menu');
|
|
158
|
+
const tap = (node) => node.handlers.click?.({ stopPropagation() {} });
|
|
159
|
+
let passed = 0;
|
|
160
|
+
function test(name, fn) { fn(); passed++; console.log(`ok: ${name}`); }
|
|
161
|
+
function rig() {
|
|
162
|
+
const dom = fakeDom({ viewW: 360, viewH: 780 }), sent = [], locks = [];
|
|
163
|
+
const chrome = makeChrome({ avatarCount: 4, onBack() {}, onAvatar() {} });
|
|
164
|
+
const draw = (value = offer) => chrome.setMenu(value, (id, n) => sent.push({ k: 'hub-menu-pick', id, n }), (open) => locks.push(open));
|
|
165
|
+
return { dom, sent, locks, chrome, draw };
|
|
166
|
+
}
|
|
167
|
+
function systemRig() {
|
|
168
|
+
State.clear(); Ballot.forget(); const dom = fakeDom({ viewW: 360, viewH: 780 });
|
|
169
|
+
let system; installSystem({ registerSystem(value) { system = value; } });
|
|
170
|
+
const calls = [], sent = [];
|
|
171
|
+
const chrome = makeChrome({ avatarCount: 4, onBack() {}, onAvatar() {} });
|
|
172
|
+
system.chrome = new Proxy(chrome, { get(target, name) {
|
|
173
|
+
if (['setMenu', 'clearMenu'].includes(name)) return (...args) => { calls.push([name, ...args]); return target[name](...args); };
|
|
174
|
+
return target[name];
|
|
175
|
+
} });
|
|
176
|
+
system.talk = { frame() {}, talking: () => false, typing: () => false, talkingWith: () => null };
|
|
177
|
+
system.idle = { frame() {}, draw() {}, labels: () => [] }; system.grab = { frame() {} }; system.sound = { frame() {} }; system.sayHooked = true;
|
|
178
|
+
system.together.frame = () => {};
|
|
179
|
+
for (const method of ['keepResident', 'wearAvatar', 'applyTune', 'watchSession', 'sayHello', 'followPlace', 'holdFall', 'turnSpinners', 'applySpawns', 'applyTints', 'registerInterest', 'applyVisibility', 'applyWear', 'adoptLate', 'runCommands', 'askFriends', 'stepEnd', 'faceArrival', 'measure', 'drawChrome']) system[method] = () => {};
|
|
180
|
+
system.sceneKey = 'main'; let locks = 0;
|
|
181
|
+
const scene = { sceneKey: 'main', currentScenePath: 'scenes/main.scene', multiplayer: { net: { selfId: () => 'p1', send: (msg) => sent.push(msg) } }, actorWith: () => null, persistent: { hubTickets: [], hubAvatar: 0 }, getActors: () => [], moveInput: { active: true, x: 1, y: 1 }, keys: { clear() {} }, cameraControl: 'orbit', lookInput: { lock() { locks += 1; } } };
|
|
182
|
+
return { system, scene, dom, sent, calls, chrome, locks: () => locks, frame: () => system.afterBehaviors(scene, 0.05) };
|
|
183
|
+
}
|
|
184
|
+
function facingRig() {
|
|
185
|
+
const r = systemRig(), player = { id: 'local', runtime: { facing: 0.3 }, components: { Player: Player.defaultProps, Transform: { x: 0, y: 1, z: 0, rotationY: 0.3 * 180 / Math.PI } } };
|
|
186
|
+
const behavior = new Player(Player.defaultProps);
|
|
187
|
+
r.scene.actorWith = () => player;
|
|
188
|
+
r.scene.actorsWith = () => [];
|
|
189
|
+
r.scene.keys.has = () => false;
|
|
190
|
+
r.scene.physics3d = { ready: () => true, castRay: () => ({ distance: 0.85 }), mass: () => 1, getVelocity: () => ({ x: 0, y: 0, z: 0 }), addForce() {}, applyImpulse() {} };
|
|
191
|
+
r.scene.persistent.camAngle = 0.7;
|
|
192
|
+
r.scene.update = () => { behavior.update(player, r.scene, 0.05); r.frame(); };
|
|
193
|
+
return { ...r, player, face: () => player.components.Transform.rotationY };
|
|
194
|
+
}
|
|
195
|
+
test('buffer before WORLD, opt-in only, stale versions ignored, place change clears private state', () => {
|
|
196
|
+
State.clear(); assert(!Object.hasOwn(State.hub, 'menu'));
|
|
197
|
+
hook.message({}, { k: 'hub-menu', ...offer }); assert.deepEqual(State.hub.menu, offer);
|
|
198
|
+
hook.state({}, { hubPlace: { id: 'main', menu: true } }); assert.deepEqual(State.hub.menu, offer);
|
|
199
|
+
hook.message({}, { k: 'hub-menu', spec: null, n: 2 });
|
|
200
|
+
hook.message({}, { k: 'hub-menu', ...offer }); assert.deepEqual(State.hub.menu, { spec: null, n: 2 });
|
|
201
|
+
hook.message({}, { k: 'hub-menu', spec, n: 3 });
|
|
202
|
+
hook.state({}, { hubPlace: { id: 'other', menu: true } }); assert(!Object.hasOwn(State.hub, 'menu'));
|
|
203
|
+
hook.state({}, { hubPlace: { id: 'plain' } }); hook.message({}, { k: 'hub-menu', ...offer }); assert(!Object.hasOwn(State.hub, 'menu'));
|
|
204
|
+
State.clear();
|
|
205
|
+
});
|
|
206
|
+
test('lazy sheet, sections including empty sections, square phone touch tiles, scroll, note and selection', () => {
|
|
207
|
+
const r = rig(), count = r.dom.made.length; r.draw(null); assert.equal(r.dom.made.length, count); assert.deepEqual(r.locks, []);
|
|
208
|
+
r.draw(); const card = sheet(r.dom), blue = tile(r.dom, 'blue'), red = tile(r.dom, 'red');
|
|
209
|
+
assert.equal(card.attrs.role, 'dialog'); assert.equal(card.attrs['aria-label'], 'Wardrobe'); assert.equal(card.style.maxHeight, '55vh');
|
|
210
|
+
assert.equal(card.style.bottom, '0'); assert.equal(card.style.pointerEvents, 'auto');
|
|
211
|
+
assert(card.style.background.startsWith('var(--castle-surface-'));
|
|
212
|
+
for (const text of ['Wardrobe', 'Pick a colour', 'Colours', 'Hats', 'Empty', 'Blue', 'Red', 'Cap', '✓']) assert(find(r.dom, text));
|
|
213
|
+
assert.equal(blue.style.aspectRatio, '1'); assert.equal(blue.style.minHeight, '64px'); assert.equal(blue.style.minWidth, '64px');
|
|
214
|
+
assert.equal(blue.parent.style.gridTemplateColumns, 'repeat(auto-fill, minmax(64px, 1fr))');
|
|
215
|
+
assert.equal(blue.parent.parent.style.overflowY, 'auto'); assert.equal(blue.parent.parent.style.overscrollBehavior, 'contain');
|
|
216
|
+
assert.equal(blue.attrs['aria-pressed'], 'true'); assert.equal(red.attrs['aria-pressed'], 'false'); assert(blue.style.outline.includes('2px'));
|
|
217
|
+
assert(red.children.some((node) => node.style.maskImage.includes('data:image/svg+xml')));
|
|
218
|
+
assert(tile(r.dom, 'cap').children.some((node) => node.style.maskImage.includes('data:image/svg+xml')));
|
|
219
|
+
const css = card.children.find((node) => node.tag === 'style').textContent;
|
|
220
|
+
assert(css.includes('prefers-reduced-motion'));
|
|
221
|
+
assert(css.includes('repeat(4, minmax(64px, 1fr))'));
|
|
222
|
+
assert(css.includes('repeat(3, minmax(64px, 1fr))'));
|
|
223
|
+
assert.deepEqual(r.locks, [true]); r.chrome.dispose(); assert.deepEqual(r.locks, [true, false]);
|
|
224
|
+
});
|
|
225
|
+
test('face caps the sheet at 40 percent, absent face preserves CSS and replacements restore either cap', () => {
|
|
226
|
+
const r = rig();
|
|
227
|
+
const cssBefore = `
|
|
228
|
+
.hub-menu-tile { color: inherit; font: inherit; border: 1px solid var(--castle-border-2, rgba(255,255,255,.4)); background: var(--castle-surface-4, rgba(255,255,255,.1)); border-radius: 8px; }
|
|
229
|
+
.hub-menu-tile:not(:disabled) { cursor: pointer; }
|
|
230
|
+
.hub-menu-tile:not(:disabled):active, .hub-menu-tile.is-pressed { background: var(--castle-surface-5, rgba(255,255,255,.18)); transform: scale(.96); }
|
|
231
|
+
@media (hover: hover) { .hub-menu-tile:not(:disabled):hover { border-color: var(--castle-text-primary, #fff); } }
|
|
232
|
+
@media (prefers-reduced-motion: reduce) { .hub-menu-tile:not(:disabled):active, .hub-menu-tile.is-pressed { transform: none; } }
|
|
233
|
+
@media (max-width: 600px) { .hub-menu-grid { grid-template-columns: repeat(4, minmax(64px, 1fr)) !important; } }
|
|
234
|
+
@media (max-width: 340px) { .hub-menu-grid { grid-template-columns: repeat(3, minmax(64px, 1fr)) !important; } }
|
|
235
|
+
@supports (height: 1dvh) { .hub-menu-sheet { max-height: 55dvh !important; } }
|
|
236
|
+
`;
|
|
237
|
+
r.draw(); const stylesBefore = { ...sheet(r.dom).styles };
|
|
238
|
+
for (const [i, value] of [spec, { ...spec, face: 0 }, spec, { ...spec, face: 90 }].entries()) {
|
|
239
|
+
r.draw({ n: i + 2, spec: value });
|
|
240
|
+
const card = sheet(r.dom), hasFace = Object.hasOwn(value, 'face');
|
|
241
|
+
assert.deepEqual(card.styles, { ...stylesBefore, maxHeight: hasFace ? '40vh' : '55vh' });
|
|
242
|
+
assert.equal(card.children.find((node) => node.tag === 'style').textContent, hasFace ? cssBefore.replace('55dvh', '40dvh') : cssBefore);
|
|
243
|
+
const scroll = tile(r.dom, 'blue').parent.parent;
|
|
244
|
+
assert.equal(scroll.style.overflowY, 'auto'); assert.equal(scroll.style.minHeight, '0');
|
|
245
|
+
assert.equal(scroll.style.overscrollBehavior, 'contain'); assert.equal(scroll.style.touchAction, 'pan-y');
|
|
246
|
+
}
|
|
247
|
+
r.chrome.dispose();
|
|
248
|
+
});
|
|
249
|
+
test('on rings draw independently in different sections', () => {
|
|
250
|
+
const r = rig();
|
|
251
|
+
r.draw({ n: 1, spec: { title: 'Menu', sections: ['one', 'two'].map((id) => ({ title: id, items: [{ id, label: id, on: true }] })) } });
|
|
252
|
+
for (const id of ['one', 'two']) {
|
|
253
|
+
assert.equal(tile(r.dom, id).attrs['aria-pressed'], 'true');
|
|
254
|
+
assert(tile(r.dom, id).style.outline.includes('2px'));
|
|
255
|
+
}
|
|
256
|
+
r.chrome.dispose();
|
|
257
|
+
});
|
|
258
|
+
test('every existing earned shape and hat id has an icon silhouette', () => {
|
|
259
|
+
const r = rig();
|
|
260
|
+
const icons = [...EARNED_SHAPES, ...HATS];
|
|
261
|
+
r.draw({ n: 1, spec: { title: 'Icons', sections: [{ title: 'All', items: icons.map((icon, i) => ({ id: `a${i}`, label: icon.slice(0, 16), icon })) }] } });
|
|
262
|
+
for (let i = 0; i < icons.length; i++) assert(tile(r.dom, `a${i}`).children.some((node) => node.style.maskImage.includes('data:image/svg+xml')));
|
|
263
|
+
r.chrome.dispose();
|
|
264
|
+
});
|
|
265
|
+
test('tap sends id/version with instant feedback; selection remains server truth; no focus stealing', () => {
|
|
266
|
+
const r = rig(), canvas = r.dom.body; canvas.focus(); r.draw(); assert.equal(document.activeElement, canvas);
|
|
267
|
+
const red = tile(r.dom, 'red'); let prevented = false;
|
|
268
|
+
red.handlers.pointerdown({ preventDefault() { prevented = true; } }); assert(prevented); assert.equal(document.activeElement, canvas);
|
|
269
|
+
tap(red); assert.deepEqual(r.sent, [{ k: 'hub-menu-pick', id: 'red', n: 1 }]);
|
|
270
|
+
assert.equal(red.className, 'hub-menu-tile is-pressed'); assert.equal(red.attrs['aria-pressed'], 'false'); assert.equal(tile(r.dom, 'blue').attrs['aria-pressed'], 'true');
|
|
271
|
+
const count = r.dom.made.length; r.draw(); assert.equal(r.dom.made.length, count); assert(r.chrome.menuOpen()); r.chrome.dispose();
|
|
272
|
+
});
|
|
273
|
+
test('readOnly tiles have no pick listeners/affordance; Close still works', () => {
|
|
274
|
+
const r = rig(); r.draw({ spec: { ...spec, readOnly: true }, n: 1 });
|
|
275
|
+
const blue = tile(r.dom, 'blue'); assert.equal(blue.disabled, true); assert(!blue.handlers.click); assert(!blue.handlers.pointerdown); tap(blue); assert.deepEqual(r.sent, []);
|
|
276
|
+
assert(sheet(r.dom).children.find((n) => n.tag === 'style').textContent.includes(':not(:disabled):hover'));
|
|
277
|
+
tap(find(r.dom, '×')); assert.deepEqual(r.sent, [{ k: 'hub-menu-pick', id: 'close', n: 1 }]); assert(!r.chrome.menuOpen()); r.chrome.dispose();
|
|
278
|
+
});
|
|
279
|
+
test('Close sends once, aborts old listeners, releases lock and same/stale n cannot reopen', () => {
|
|
280
|
+
const r = rig(); r.draw(); const old = sheet(r.dom), close = find(r.dom, '×'); tap(close); tap(close);
|
|
281
|
+
assert.deepEqual(r.sent, [{ k: 'hub-menu-pick', id: 'close', n: 1 }]); assert.deepEqual(r.locks, [true, false]);
|
|
282
|
+
assert(!old.parent.children.includes(old)); assert.deepEqual(close.handlers, {}); assert.deepEqual(tile(r.dom, 'red').handlers, {});
|
|
283
|
+
r.draw(); r.draw({ spec, n: 0 }); assert(!r.chrome.menuOpen()); r.draw({ spec, n: 2 }); assert(r.chrome.menuOpen()); r.chrome.dispose();
|
|
284
|
+
});
|
|
285
|
+
test('new spec replaces all tiles; null removes sheet, silent disposal/clear, keyless draw creates nothing', () => {
|
|
286
|
+
const r = rig(); r.draw(); const old = sheet(r.dom), oldBlue = tile(r.dom, 'blue');
|
|
287
|
+
r.draw({ spec: { title: 'Other', sections: [{ title: 'New', items: [{ id: 'green', label: 'Green' }] }] }, n: 2 });
|
|
288
|
+
assert(!old.parent.children.includes(old)); assert.deepEqual(oldBlue.handlers, {}); assert(tile(r.dom, 'green')); assert.equal(sheet(r.dom).attrs['aria-label'], 'Other');
|
|
289
|
+
r.draw({ spec: null, n: 3 }); assert(!r.chrome.menuOpen()); assert.deepEqual(r.sent, []);
|
|
290
|
+
r.draw({ spec, n: 2 }); assert(!r.chrome.menuOpen()); r.draw({ spec, n: 4 }); r.chrome.clearMenu(); assert(!r.chrome.menuOpen());
|
|
291
|
+
r.draw(); r.chrome.dispose(); assert.deepEqual(r.sent, []); assert.deepEqual(r.locks, [true, false, true, false, true, false, true, false]);
|
|
292
|
+
});
|
|
293
|
+
test('Escape and browser Back close and send current n; capture listeners removed', () => {
|
|
294
|
+
const add = globalThis.addEventListener, remove = globalThis.removeEventListener;
|
|
295
|
+
const listeners = [];
|
|
296
|
+
globalThis.addEventListener = (type, fn, options) => {
|
|
297
|
+
const entry = { type, fn, options }; listeners.push(entry);
|
|
298
|
+
options?.signal?.addEventListener('abort', () => { const at = listeners.indexOf(entry); if (at >= 0) listeners.splice(at, 1); }, { once: true });
|
|
299
|
+
};
|
|
300
|
+
globalThis.removeEventListener = (type, fn) => { const at = listeners.findIndex((l) => l.type === type && l.fn === fn); if (at >= 0) listeners.splice(at, 1); };
|
|
301
|
+
try {
|
|
302
|
+
for (const key of ['Escape', 'BrowserBack']) {
|
|
303
|
+
const r = rig(); r.draw(); const listener = listeners.find((l) => l.type === 'keydown' && l.options?.capture);
|
|
304
|
+
let stopped = false, prevented = false;
|
|
305
|
+
listener.fn({ key, preventDefault() { prevented = true; }, stopImmediatePropagation() { stopped = true; } });
|
|
306
|
+
assert(stopped && prevented); assert.deepEqual(r.sent, [{ k: 'hub-menu-pick', id: 'close', n: 1 }]); assert(!r.chrome.menuOpen());
|
|
307
|
+
assert(!listeners.some((l) => l.options?.capture)); r.chrome.dispose();
|
|
308
|
+
}
|
|
309
|
+
} finally { globalThis.addEventListener = add; globalThis.removeEventListener = remove; }
|
|
310
|
+
});
|
|
311
|
+
test('frame holds walking/jumps/orbit before player update; restores update/inputs on Close', () => {
|
|
312
|
+
const r = systemRig(), reads = [];
|
|
313
|
+
let jumped = true; r.scene.moveInput.consumeJump = () => { const old = jumped; jumped = false; return old; };
|
|
314
|
+
const player = { runtime: { jumpBuffer: 1 } }; r.scene.actorWith = () => player;
|
|
315
|
+
const update = () => reads.push([r.scene.moveInput.active, r.scene.moveInput.x, jumped, player.runtime.jumpBuffer]); r.scene.update = update;
|
|
316
|
+
r.frame(); assert.deepEqual(r.calls, []); assert.equal(r.scene.moveInput.active, true);
|
|
317
|
+
hook.state({}, { hubPlace: { id: 'main', menu: true } }); hook.message({}, { k: 'hub-menu', ...offer }); r.frame();
|
|
318
|
+
assert.equal(r.scene.moveInput.active, false); assert.equal(r.scene.moveInput.x, 0); assert(r.locks() > 0); assert(Object.hasOwn(r.system, 'menuInput'));
|
|
319
|
+
r.scene.moveInput.active = true; r.scene.moveInput.x = 1; jumped = true; player.runtime.jumpBuffer = 1;
|
|
320
|
+
r.scene.update(); assert.deepEqual(reads, [[false, 0, false, 0]]);
|
|
321
|
+
tap(find(r.dom, '×')); assert.equal(r.scene.update, update); assert.equal(r.scene.moveInput.active, true); assert(!Object.hasOwn(r.system, 'menuInput'));
|
|
322
|
+
assert.deepEqual(r.sent, [{ k: 'hub-menu-pick', id: 'close', n: 1 }]); r.chrome.dispose(); State.clear();
|
|
323
|
+
});
|
|
324
|
+
test('face turns the local Player each frame, preserves orbit yaw and follows replacements', () => {
|
|
325
|
+
const r = facingRig(); hook.state({}, { hubPlace: { id: 'main', menu: true } });
|
|
326
|
+
hook.message({}, { k: 'hub-menu', spec: { ...spec, face: 90 }, n: 1 }); r.frame();
|
|
327
|
+
assert.equal(r.face(), 90); assert.equal(r.player.runtime.facing, Math.PI / 2); assert.equal(r.scene.persistent.camAngle, 0.7);
|
|
328
|
+
assert.deepEqual(packMove(r.player.components.Transform), [0, 1, 0, 1.571]);
|
|
329
|
+
for (let i = 0; i < 3; i++) {
|
|
330
|
+
r.player.runtime.facing = -1; r.player.components.Transform.rotationY = -30;
|
|
331
|
+
r.scene.moveInput.active = true; r.scene.moveInput.x = 1;
|
|
332
|
+
r.scene.update(); assert.equal(r.face(), 90); assert.equal(r.player.runtime.facing, Math.PI / 2);
|
|
333
|
+
}
|
|
334
|
+
hook.message({}, { k: 'hub-menu', spec: { ...spec, face: -45 }, n: 2 }); r.scene.update();
|
|
335
|
+
assert.equal(r.face(), -45); assert.equal(r.player.runtime.facing, -Math.PI / 4);
|
|
336
|
+
hook.message({}, { k: 'hub-menu', spec: { ...spec, face: 0 }, n: 3 }); r.scene.update(); assert.equal(r.face(), 0);
|
|
337
|
+
r.chrome.dispose(); State.clear();
|
|
338
|
+
});
|
|
339
|
+
test('face releases on local/server close, replacement without face, leave and reset', () => {
|
|
340
|
+
for (const release of ['local', 'null', 'replace', 'leave', 'place', 'reset']) {
|
|
341
|
+
const r = facingRig(); hook.state({}, { hubPlace: { id: 'main', menu: true } });
|
|
342
|
+
hook.message({}, { k: 'hub-menu', spec: { ...spec, face: 90 }, n: 1 }); r.frame(); assert.equal(r.face(), 90);
|
|
343
|
+
if (release === 'local') tap(find(r.dom, '×'));
|
|
344
|
+
if (release === 'null') { hook.message({}, { k: 'hub-menu', spec: null, n: 2 }); r.frame(); }
|
|
345
|
+
if (release === 'replace') { hook.message({}, { k: 'hub-menu', spec, n: 2 }); r.frame(); }
|
|
346
|
+
if (release === 'leave') State.clear();
|
|
347
|
+
if (release === 'place') hook.state({}, { hubPlace: { id: 'plain' } });
|
|
348
|
+
if (release === 'reset') r.system.reset();
|
|
349
|
+
assert.equal(r.face(), 90); assert.equal(r.chrome.menuFace(), undefined);
|
|
350
|
+
r.scene.moveInput.active = false; r.scene.update(); assert.equal(r.face(), 90, `${release}: standing retains facing`);
|
|
351
|
+
r.player.runtime.facing = -0.5; r.player.components.Transform.rotationY = -0.5 * 180 / Math.PI;
|
|
352
|
+
r.scene.update(); assert.equal(r.player.runtime.facing, -0.5, `${release}: no residual override`);
|
|
353
|
+
if (release !== 'replace') {
|
|
354
|
+
r.scene.moveInput.active = true; r.scene.moveInput.x = 1; r.scene.moveInput.y = 0;
|
|
355
|
+
r.scene.update(); assert.notEqual(r.player.runtime.facing, -0.5, `${release}: walking controls facing`);
|
|
356
|
+
}
|
|
357
|
+
r.chrome.dispose(); State.clear();
|
|
358
|
+
}
|
|
359
|
+
});
|
|
360
|
+
test('face is applied only while the menu sheet wins over ask, conversation, ballot, decor and travel', () => {
|
|
361
|
+
for (const ui of ['ask', 'talk', 'ballot', 'decor', 'travel', 'end']) {
|
|
362
|
+
const r = facingRig(); hook.state({}, { hubPlace: { id: 'main', menu: true, ask: true, decor: {}, ballot: { lines: [] } } });
|
|
363
|
+
r.system.decor = { frame() {}, opened: () => false, dispose() {} };
|
|
364
|
+
r.system.ballot = { frame() {}, dispose() {} };
|
|
365
|
+
hook.message({}, { k: 'hub-menu', spec: { ...spec, face: 90 }, n: 1 }); r.frame(); assert.equal(r.face(), 90);
|
|
366
|
+
if (ui === 'ask') hook.message({}, { k: 'hub-ask', id: 'name', title: 'Name', max: 16, n: 1 });
|
|
367
|
+
if (ui === 'talk') r.system.talk.talking = () => true;
|
|
368
|
+
if (ui === 'ballot') hook.message(r.scene, { k: 'hub-ballot-card', card: { v: 'v1', mode: 'vote', faces: [], lines: [], who: {}, options: [] } });
|
|
369
|
+
if (ui === 'decor') r.system.decor.opened = () => true;
|
|
370
|
+
if (ui === 'travel') { r.system.trip = {}; r.system.stepTrip = () => {}; }
|
|
371
|
+
if (ui === 'end') r.system.pendingEnd = {};
|
|
372
|
+
r.player.runtime.facing = -0.5; r.player.components.Transform.rotationY = -30; r.frame();
|
|
373
|
+
assert(!r.chrome.menuOpen(), ui); assert.equal(r.player.runtime.facing, -0.5, ui); assert.equal(r.face(), -30, ui);
|
|
374
|
+
r.chrome.dispose(); State.clear(); Ballot.forget();
|
|
375
|
+
}
|
|
376
|
+
});
|
|
377
|
+
test('held and seated players retain their facing while a menu with face is open', () => {
|
|
378
|
+
for (const state of ['held', 'seated', 'both']) {
|
|
379
|
+
const r = facingRig(); hook.state({}, { hubPlace: { id: 'main', menu: true } });
|
|
380
|
+
const block = () => hook.state({}, { held: state === 'seated' ? [] : ['p1'], hubSeated: state === 'held' ? {} : { p1: 'bench' } });
|
|
381
|
+
block();
|
|
382
|
+
hook.message({}, { k: 'hub-menu', spec: { ...spec, face: 90 }, n: 1 }); r.frame();
|
|
383
|
+
assert(r.chrome.menuOpen()); assert.equal(r.player.runtime.facing, 0.3, state);
|
|
384
|
+
assert.deepEqual(packMove(r.player.components.Transform), [0, 1, 0, 0.3], state);
|
|
385
|
+
r.scene.update(); assert.equal(r.player.runtime.facing, 0.3, state); assert.equal(r.scene.persistent.camAngle, 0.7);
|
|
386
|
+
hook.state({}, { held: [], hubSeated: {} }); r.scene.update(); assert.equal(r.face(), 90);
|
|
387
|
+
block(); r.player.runtime.facing = -0.5; r.player.components.Transform.rotationY = -0.5 * 180 / Math.PI;
|
|
388
|
+
r.scene.update(); assert.equal(r.player.runtime.facing, -0.5, `${state}: an open menu yields immediately`);
|
|
389
|
+
assert.deepEqual(packMove(r.player.components.Transform), [0, 1, 0, -0.5]);
|
|
390
|
+
assert.equal(r.scene.persistent.camAngle, 0.7);
|
|
391
|
+
r.chrome.dispose(); State.clear();
|
|
392
|
+
}
|
|
393
|
+
});
|
|
394
|
+
test('menu without face never reads menuFace or alters yaw', () => {
|
|
395
|
+
const r = facingRig(); hook.state({}, { hubPlace: { id: 'main', menu: true } });
|
|
396
|
+
r.system.chrome = new Proxy(r.system.chrome, { get(target, name) { if (name === 'menuFace') assert.fail('absent face lookup'); return target[name]; } });
|
|
397
|
+
hook.message({}, { k: 'hub-menu', ...offer }); r.frame();
|
|
398
|
+
assert.equal(r.player.runtime.facing, 0.3); assert.equal(r.scene.persistent.camAngle, 0.7);
|
|
399
|
+
r.chrome.dispose(); State.clear();
|
|
400
|
+
});
|
|
401
|
+
test('follow camera ignores face without changing camAngle, including a stale orbit shot', () => {
|
|
402
|
+
for (const staleShot of [false, true]) {
|
|
403
|
+
const r = facingRig(); r.scene.cameraControl = undefined;
|
|
404
|
+
if (staleShot) r.scene.orbitShot = { look: { x: 0, y: 1, z: 0 }, distance: 2.6, pitch: 12, yaw: 60 };
|
|
405
|
+
hook.state({}, { hubPlace: { id: 'main', menu: true } });
|
|
406
|
+
hook.message({}, { k: 'hub-menu', spec: { ...spec, face: -90 }, n: 1 }); r.frame();
|
|
407
|
+
assert(r.chrome.menuOpen()); assert.equal(r.player.runtime.facing, 0.3); assert.equal(r.scene.persistent.camAngle, 0.7);
|
|
408
|
+
r.scene.update(); assert.equal(r.player.runtime.facing, Math.PI - 0.7); assert.equal(r.scene.persistent.camAngle, 0.7);
|
|
409
|
+
const yaw = r.face();
|
|
410
|
+
tap(find(r.dom, '×')); r.scene.moveInput.active = false; r.scene.update();
|
|
411
|
+
assert.equal(r.face(), yaw); assert.equal(r.scene.persistent.camAngle, 0.7);
|
|
412
|
+
r.chrome.dispose(); State.clear();
|
|
413
|
+
}
|
|
414
|
+
});
|
|
415
|
+
test('face applies under a held orbit shot without changing camera yaw', () => {
|
|
416
|
+
const r = facingRig(); hook.state({}, { hubPlace: { id: 'main', menu: true } });
|
|
417
|
+
const shot = { look: { x: 0, y: 1, z: 0 }, distance: 2.6, pitch: 12, yaw: 60 };
|
|
418
|
+
hook.message(r.scene, { k: 'hub-shot', shot }); assert.deepEqual(r.scene.orbitShot, shot);
|
|
419
|
+
hook.message({}, { k: 'hub-menu', spec: { ...spec, face: -60 }, n: 1 }); r.frame();
|
|
420
|
+
assert.equal(r.face(), -60); assert.equal(r.scene.persistent.camAngle, 0.7); assert.deepEqual(r.scene.orbitShot, shot);
|
|
421
|
+
r.scene.update(); assert.equal(r.face(), -60); assert.equal(r.scene.persistent.camAngle, 0.7); assert.deepEqual(r.scene.orbitShot, shot);
|
|
422
|
+
tap(find(r.dom, '×')); r.scene.moveInput.active = false; r.scene.update(); assert(Math.abs(r.face() + 60) < 1e-10);
|
|
423
|
+
r.chrome.dispose(); State.clear(); assert.equal(r.scene.orbitShot, undefined);
|
|
424
|
+
});
|
|
425
|
+
test('kit/host Back first closes menu with current n, subsequent Back travels normally', () => {
|
|
426
|
+
const r = systemRig(); let back = 0; r.system.back = () => { back++; };
|
|
427
|
+
hook.state({}, { hubPlace: { id: 'main', menu: true } }); hook.message({}, { k: 'hub-menu', ...offer }); r.frame();
|
|
428
|
+
globalThis.__menuTestHostBack();
|
|
429
|
+
assert.equal(back, 0); assert.deepEqual(r.sent, [{ k: 'hub-menu-pick', id: 'close', n: 1 }]);
|
|
430
|
+
assert.equal(r.scene.moveInput.active, true); r.system.backFromControl(r.scene); assert.equal(back, 1);
|
|
431
|
+
hook.message({}, { k: 'hub-menu', spec, n: 2 }); r.frame(); r.system.backFromControl(r.scene);
|
|
432
|
+
assert.equal(back, 1); assert.deepEqual(r.sent.at(-1), { k: 'hub-menu-pick', id: 'close', n: 2 });
|
|
433
|
+
r.chrome.dispose(); State.clear(); delete globalThis.__menuTestHostBack;
|
|
434
|
+
});
|
|
435
|
+
test('null, rehello, place change, state clear, scene reset and disposal release locks', () => {
|
|
436
|
+
const r = systemRig(); hook.state({}, { hubPlace: { id: 'main', menu: true } });
|
|
437
|
+
const open = (n) => { hook.message({}, { k: 'hub-menu', spec, n }); r.frame(); assert.equal(r.scene.moveInput.active, false); };
|
|
438
|
+
open(1); hook.message({}, { k: 'hub-menu', spec: null, n: 2 }); r.frame(); assert.equal(r.scene.moveInput.active, true);
|
|
439
|
+
open(3); r.system.sendHello(r.scene, r.scene.multiplayer, r.scene.multiplayer.net, 0, { resume: true }); assert.equal(r.scene.moveInput.active, true); assert(!Object.hasOwn(State.hub, 'menu'));
|
|
440
|
+
open(3); State.clear(); assert.equal(r.scene.moveInput.active, true);
|
|
441
|
+
hook.state({}, { hubPlace: { id: 'main', menu: true } }); open(4);
|
|
442
|
+
hook.state({}, { hubPlace: { id: 'other', menu: true } }); assert.equal(r.scene.moveInput.active, true); assert(!Object.hasOwn(State.hub, 'menu'));
|
|
443
|
+
open(5); hook.state({}, { hubPlace: { id: 'plain' } }); assert.equal(r.scene.moveInput.active, true); r.frame(); const count = r.calls.length; r.frame(); assert.equal(r.calls.length, count);
|
|
444
|
+
hook.state({}, { hubPlace: { id: 'main', menu: true } }); open(6); r.system.reset(); assert.equal(r.scene.moveInput.active, true); assert(!r.chrome.menuOpen());
|
|
445
|
+
open(7); r.chrome.dispose(); assert.equal(r.scene.moveInput.active, true); assert(!Object.hasOwn(r.system, 'menuInput')); State.clear();
|
|
446
|
+
});
|
|
447
|
+
test('pending sheet yields to ask/choice card; locks never nest', () => {
|
|
448
|
+
const r = systemRig(); hook.state({}, { hubPlace: { id: 'main', menu: true, ask: true, ballot: { lines: [] } } });
|
|
449
|
+
const card = { v: 'v1', mode: 'vote', faces: [], lines: [], who: {}, options: [] };
|
|
450
|
+
r.system.ballot = { frame() {}, dispose() {} };
|
|
451
|
+
hook.message(r.scene, { k: 'hub-ballot-card', card }); hook.message({}, { k: 'hub-menu', ...offer }); r.frame(); assert(!r.chrome.menuOpen());
|
|
452
|
+
hook.message({}, { k: 'hub-menu', spec, n: 2 }); hook.message(r.scene, { k: 'hub-ballot-card', card: null }); r.frame(); assert(r.chrome.menuOpen());
|
|
453
|
+
hook.message({}, { k: 'hub-ask', id: 'name', title: 'Name', max: 16, n: 1 }); r.frame();
|
|
454
|
+
assert(!r.chrome.menuOpen()); assert(r.chrome.textAskOpen()); assert(!Object.hasOwn(r.system, 'menuInput')); assert(Object.hasOwn(r.system, 'askInput'));
|
|
455
|
+
assert(r.sent.some((msg) => msg.k === 'hub-menu-pick' && msg.id === 'close' && msg.n === 2));
|
|
456
|
+
tap(find(r.dom, 'Cancel')); assert.equal(r.scene.moveInput.active, true); r.chrome.dispose(); State.clear(); Ballot.forget();
|
|
457
|
+
});
|
|
458
|
+
test('a locally consumed ask does not close a newer menu while its server close is pending', () => {
|
|
459
|
+
const r = systemRig(); hook.state({}, { hubPlace: { id: 'main', menu: true, ask: true } });
|
|
460
|
+
hook.message({}, { k: 'hub-ask', id: 'name', title: 'Name', max: 16, n: 1 }); r.frame(); assert(r.chrome.textAskOpen());
|
|
461
|
+
tap(find(r.dom, 'Cancel')); assert(!r.chrome.textAskOpen());
|
|
462
|
+
hook.message({}, { k: 'hub-menu', ...offer }); r.frame(); assert(r.chrome.menuOpen());
|
|
463
|
+
r.frame(); assert(r.chrome.menuOpen()); assert(!r.sent.some((msg) => msg.k === 'hub-menu-pick'));
|
|
464
|
+
hook.message({}, { k: 'hub-ask', id: 'name', title: 'Name', max: 16, n: 2 }); r.frame();
|
|
465
|
+
assert(!r.chrome.menuOpen()); assert(r.chrome.textAskOpen());
|
|
466
|
+
assert.deepEqual(r.sent.at(-1), { k: 'hub-menu-pick', id: 'close', n: 1 });
|
|
467
|
+
r.chrome.dispose(); State.clear();
|
|
468
|
+
});
|
|
469
|
+
test('keyless frame/state/DOM/pick trace byte identical; no menu fields or calls', () => {
|
|
470
|
+
function trace(inject) {
|
|
471
|
+
const r = systemRig(); hook.state({}, { hubPlace: { id: 'plain' } }); const at = r.dom.log.length;
|
|
472
|
+
if (inject) hook.message({}, { k: 'hub-menu', ...offer });
|
|
473
|
+
for (let i = 0; i < 3; i++) r.frame();
|
|
474
|
+
assert(!Object.hasOwn(State.hub, 'menu')); assert(!Object.hasOwn(State.hub, 'menuClose'));
|
|
475
|
+
assert(!Object.hasOwn(r.system, 'menuInput')); assert(!Object.hasOwn(r.system, 'menuDrawn'));
|
|
476
|
+
const trace = JSON.stringify([r.dom.log.slice(at), r.calls, r.sent]); r.chrome.dispose(); State.clear(); return trace;
|
|
477
|
+
}
|
|
478
|
+
assert.equal(trace(true), trace(false));
|
|
479
|
+
});
|
|
480
|
+
test('row menu has complete text columns, no icon slots and a pinned footer; close restores HUD', () => {
|
|
481
|
+
const r = rig();
|
|
482
|
+
r.chrome.setHud({ title: 'Gem Rush', big: '12', text: 'Walk into gems.' }, null);
|
|
483
|
+
const hud = find(r.dom, 'Gem Rush').parent, prompt = find(r.dom, 'Walk into gems.');
|
|
484
|
+
const rows = { title: 'Scores', presentation: 'rows', sections: [{ title: 'Rank · Player · Points', items: [{ id: 'record', label: '1st', readOnly: true, columns: ['1st', 'abcdefghijklmnopqrstuvwx', '500 pts'] }] }], footer: [{ id: 'next', label: 'More scores' }, { id: 'leave', label: 'Back to town' }] };
|
|
485
|
+
r.draw({ n: 1, spec: rows });
|
|
486
|
+
const card = sheet(r.dom), record = tile(r.dom, 'record'), leave = tile(r.dom, 'leave');
|
|
487
|
+
assert.equal(card.style.maxHeight, 'calc(100vh - 24px)');
|
|
488
|
+
assert.equal(hud.style.visibility, 'hidden'); assert.equal(prompt.style.visibility, 'hidden');
|
|
489
|
+
assert.equal(record.tag, 'div'); assert.deepEqual(record.children.map(c => c.textContent), ['1st', 'abcdefghijklmnopqrstuvwx', '500 pts']);
|
|
490
|
+
assert.equal(record.style.gridTemplateColumns, 'minmax(0, 1fr) minmax(0, 4fr) minmax(0, 2fr)');
|
|
491
|
+
assert(!record.children.some(c => c.attrs['aria-hidden'] === 'true'));
|
|
492
|
+
assert.equal(leave.parent.parent, card); assert.equal(leave.parent.style.flexShrink, '0');
|
|
493
|
+
assert.equal(leave.textContent, 'Back to town'); assert.equal(leave.style.minHeight, '44px'); assert.equal(leave.style.aspectRatio, '');
|
|
494
|
+
tap(tile(r.dom, 'next')); assert.deepEqual(r.sent, [{ k: 'hub-menu-pick', id: 'next', n: 1 }]);
|
|
495
|
+
r.draw({ n: 2, spec: { ...rows, face: 0 } }); assert.equal(sheet(r.dom).style.maxHeight, '40vh');
|
|
496
|
+
r.draw(null); assert.equal(hud.style.visibility, ''); assert.equal(prompt.style.visibility, '');
|
|
497
|
+
r.draw({ n: 3, spec }); assert.equal(tile(r.dom, 'blue').style.aspectRatio, '1');
|
|
498
|
+
r.chrome.dispose();
|
|
499
|
+
});
|
|
500
|
+
// The mask is the marker attribute plus the sheet's own !important rule; a
|
|
501
|
+
// control's own style.visibility is never read or written by it.
|
|
502
|
+
const RULE = '[data-hub-menu-covered] { visibility: hidden !important; }';
|
|
503
|
+
const covered = (node) => node.dataset.hubMenuCovered !== undefined;
|
|
504
|
+
const ruled = (dom) => sheet(dom).children.some((child) => child.tag === 'style' && child.textContent.includes(RULE));
|
|
505
|
+
test('row menu without face hides the controls under it and restores each one; tiles and face rows leave them', () => {
|
|
506
|
+
const r = rig();
|
|
507
|
+
r.chrome.soundControl(true, { volume: 0.5, muted: false }, {});
|
|
508
|
+
r.chrome.setPointers([{ id: 'goal', x: 300, y: 400, text: 'Post', angle: 0 }]);
|
|
509
|
+
const shift = document.createElement('button'); r.dom.body.appendChild(shift);
|
|
510
|
+
r.chrome.safeSurface('engine-shift-lock', shift, 'control');
|
|
511
|
+
const doors = find(r.dom, 'Doors'), dock = doors.parent, picker = find(r.dom, 'Your character').parent.parent;
|
|
512
|
+
const say = find(r.dom, '💬'), emote = find(r.dom, '☺'), pointers = find(r.dom, 'Post').parent.parent;
|
|
513
|
+
const sound = r.dom.made.findLast((node) => node.dataset.hub === 'sound');
|
|
514
|
+
emote.style.visibility = 'hidden';
|
|
515
|
+
const controls = { dock, picker, say, emote, sound, pointers, shift };
|
|
516
|
+
const own = () => Object.fromEntries(Object.entries(controls).map(([name, node]) => [name, node.style.visibility]));
|
|
517
|
+
const masks = () => Object.fromEntries(Object.entries(controls).map(([name, node]) => [name, covered(node)]));
|
|
518
|
+
const none = Object.fromEntries(Object.keys(controls).map((name) => [name, false]));
|
|
519
|
+
const all = Object.fromEntries(Object.keys(controls).map((name) => [name, true]));
|
|
520
|
+
const before = own();
|
|
521
|
+
const rows = { title: 'Rowan post', presentation: 'rows', sections: [{ title: 'Notes', items: [{ id: 'a', label: 'Hello', columns: ['1', 'Hello', 'Rowan'] }] }], footer: [{ id: 'back', label: 'Back' }] };
|
|
522
|
+
r.draw({ n: 1, spec });
|
|
523
|
+
assert.deepEqual(masks(), none, 'a tile menu leaves the controls');
|
|
524
|
+
assert.equal(ruled(r.dom), false);
|
|
525
|
+
r.draw({ n: 2, spec: rows });
|
|
526
|
+
assert.deepEqual(masks(), all);
|
|
527
|
+
assert.equal(ruled(r.dom), true);
|
|
528
|
+
assert.deepEqual(own(), before, 'the mask never writes a control\'s own visibility');
|
|
529
|
+
// A control the kit registers while the sheet is up is covered at the frame's end.
|
|
530
|
+
const late = document.createElement('button'); r.dom.body.appendChild(late);
|
|
531
|
+
r.chrome.safeSurface('act-prompt:late', late, 'control', { transient: true });
|
|
532
|
+
r.chrome.endLayoutFrame();
|
|
533
|
+
assert.equal(covered(late), true);
|
|
534
|
+
// The kit's own writes under the sheet are what it has once the sheet goes.
|
|
535
|
+
say.style.visibility = 'hidden';
|
|
536
|
+
r.draw({ n: 3, spec: { ...rows, face: 0 } });
|
|
537
|
+
assert.deepEqual(masks(), none, 'replaced by a face row menu: unmasked and left');
|
|
538
|
+
assert.equal(covered(late), false);
|
|
539
|
+
assert.equal(ruled(r.dom), false);
|
|
540
|
+
assert.equal(say.style.visibility, 'hidden');
|
|
541
|
+
say.style.visibility = '';
|
|
542
|
+
r.draw({ n: 4, spec: rows });
|
|
543
|
+
assert.deepEqual(masks(), all);
|
|
544
|
+
r.draw(null);
|
|
545
|
+
assert.deepEqual(masks(), none, 'closed: unmasked');
|
|
546
|
+
r.chrome.endLayoutFrame();
|
|
547
|
+
assert.deepEqual(masks(), none);
|
|
548
|
+
assert.deepEqual(own(), before);
|
|
549
|
+
r.draw({ n: 5, spec: rows });
|
|
550
|
+
assert.deepEqual(masks(), all);
|
|
551
|
+
r.chrome.clearMenu();
|
|
552
|
+
assert.deepEqual(masks(), none, 'teardown: unmasked');
|
|
553
|
+
r.draw({ n: 6, spec: rows });
|
|
554
|
+
r.chrome.dispose();
|
|
555
|
+
assert.deepEqual(masks(), none, 'dispose: unmasked');
|
|
556
|
+
assert.deepEqual(own(), before);
|
|
557
|
+
});
|
|
558
|
+
test('row menu without face covers a shown pad-context chip and restores it; no pad context never throws', () => {
|
|
559
|
+
const rows = { title: 'Rowan post', presentation: 'rows', sections: [], note: 'No post to read yet.', footer: [{ id: 'back', label: 'Back' }] };
|
|
560
|
+
// (b) Pad cues off: no chip was ever made, so there is nothing to cover.
|
|
561
|
+
const off = rig();
|
|
562
|
+
assert.doesNotThrow(() => off.draw({ n: 1, spec: rows }));
|
|
563
|
+
assert.doesNotThrow(() => off.chrome.endLayoutFrame());
|
|
564
|
+
assert.equal(off.dom.made.some((node) => node.dataset.hub === 'pad-context'), false);
|
|
565
|
+
assert.doesNotThrow(() => off.draw(null));
|
|
566
|
+
off.chrome.setPadContext(null);
|
|
567
|
+
assert.doesNotThrow(() => off.draw({ n: 2, spec: rows }));
|
|
568
|
+
off.chrome.dispose();
|
|
569
|
+
// (a) Pad cues on, a pad context shown.
|
|
570
|
+
const r = rig();
|
|
571
|
+
r.chrome.setPadContext({ id: 'pad', title: 'Fancy pad', secondary: '' });
|
|
572
|
+
const chip = r.dom.made.find((node) => node.dataset.hub === 'pad-context');
|
|
573
|
+
assert.ok(chip);
|
|
574
|
+
assert.equal(chip.style.visibility, '', 'the pad context is shown before the sheet');
|
|
575
|
+
r.draw({ n: 1, spec: rows });
|
|
576
|
+
assert.equal(covered(chip), true);
|
|
577
|
+
r.chrome.endLayoutFrame();
|
|
578
|
+
assert.equal(covered(chip), true);
|
|
579
|
+
r.draw(null);
|
|
580
|
+
assert.equal(covered(chip), false, 'unmasked on close');
|
|
581
|
+
r.chrome.setPadContext({ id: 'pad', title: 'Fancy pad', secondary: '' });
|
|
582
|
+
assert.equal(chip.style.visibility, '', 'shown again');
|
|
583
|
+
r.chrome.dispose();
|
|
584
|
+
});
|
|
585
|
+
console.log(`${passed} menu client tests passed`);
|