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
|
@@ -7,14 +7,84 @@
|
|
|
7
7
|
import * as castleSdk from 'castle-web-sdk';
|
|
8
8
|
import * as Avatars from '@imports/castle.multiplayer-3d/code/client/avatars.js';
|
|
9
9
|
import * as Avatar from './avatar.js';
|
|
10
|
+
import * as AvatarCap from './avatarCap.js';
|
|
11
|
+
import { mergeDictionary } from './interestCap.js';
|
|
10
12
|
import * as Cabinets from './cabinets.js';
|
|
11
13
|
import { firstJoinFor } from './firstJoin.js';
|
|
12
|
-
import { deck, hub, wearingNow } from './state.js';
|
|
14
|
+
import { deck, earnedNow, hub, localArrival, mergeHidden, receiveParty, wearingNow } from './state.js';
|
|
15
|
+
import { clearShot, receiveShot } from './shot.js';
|
|
16
|
+
import * as Ballot from './ballot.js';
|
|
17
|
+
import * as Rehello from './rehello.js';
|
|
18
|
+
import { guestName } from './signIn.js';
|
|
19
|
+
import { sanitise, ownStamp } from './companion.js';
|
|
20
|
+
import { buildStamp } from './build.js';
|
|
21
|
+
import { unpackFrame } from './frameBatch.js';
|
|
22
|
+
import { setFpsTelemetry } from './fpsTelemetry.js';
|
|
23
|
+
import { setLoadTelemetry } from './loadTelemetry.js';
|
|
24
|
+
import { readQuality } from '../shared/quality.js';
|
|
25
|
+
import { noteQualityInteraction } from './quality.js';
|
|
26
|
+
import { readDanceIdle } from '../shared/danceIdle.js';
|
|
13
27
|
|
|
14
28
|
// Root-anchored: the deck's own castle.json once this kit is imported.
|
|
15
29
|
const castleJson = Object.values(import.meta.glob('/castle.json', { eager: true, import: 'default' }))[0] ?? {};
|
|
30
|
+
deck.title = typeof castleJson.title === 'string' ? castleJson.title : '';
|
|
31
|
+
// Read only when a scene opts into the spawn locator; never sent or saved.
|
|
32
|
+
localArrival.for = (id) => (id === 'main' ? castleJson.hub?.places?.main ?? castleJson.hub : castleJson.hub?.places?.[id])?.arrival;
|
|
33
|
+
// The assembly's build stamp beside it; an absent file matches nothing.
|
|
34
|
+
deck.build = buildStamp(Object.values(import.meta.glob('/build.json', { eager: true, import: 'default' }))[0]);
|
|
35
|
+
// Read the installed copy's identity, rather than the assembly's requested pin.
|
|
36
|
+
const kitBuild = Object.values(import.meta.glob('/imports/castle.hub-game/.castle-import-version.json', { eager: true, import: 'default', exhaustive: true }))[0];
|
|
37
|
+
if (deck.build && kitBuild?.source === 'builtin' && typeof kitBuild.version === 'string') {
|
|
38
|
+
deck.build = Object.freeze({ ...deck.build, hubGameBuiltinVersion: kitBuild.version,
|
|
39
|
+
...(typeof kitBuild.digest === 'string' ? { hubGameBuiltinDigest: kitBuild.digest } : {}) });
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
if (castleJson?.hub?.pongTimeoutMs > 0) { deck.pongTimeoutMs = castleJson.hub.pongTimeoutMs; }
|
|
43
|
+
else { delete deck.pongTimeoutMs; }
|
|
44
|
+
deck.invite = (castleJson?.hub?.places?.main?.invite ?? castleJson?.hub?.invite) === true;
|
|
45
|
+
deck.defaultEnvironment = castleJson?.hub?.defaultEnvironment !== false;
|
|
16
46
|
deck.tiers = castleJson?.hub?.tiers === true;
|
|
47
|
+
if (castleJson?.hub?.highOnly === true && deck.tiers) { deck.highOnly = true; }
|
|
48
|
+
else { delete deck.highOnly; }
|
|
49
|
+
if (castleJson?.hub?.quality !== undefined && deck.tiers) { deck.quality = readQuality(castleJson.hub.quality, true, []); }
|
|
50
|
+
else { delete deck.quality; }
|
|
51
|
+
if (castleJson?.hub?.safeInsets === true) { deck.safeInsets = true; }
|
|
52
|
+
else { delete deck.safeInsets; }
|
|
53
|
+
if (castleJson?.hub?.weakestTier === true) { deck.weakestTier = true; }
|
|
54
|
+
else { delete deck.weakestTier; }
|
|
55
|
+
if (castleJson?.hub?.weakestLookBake === true) { deck.weakestLookBake = true; }
|
|
56
|
+
else { delete deck.weakestLookBake; }
|
|
57
|
+
if (castleJson?.hub?.mergeFarAvatars === true) { deck.mergeFarAvatars = true; }
|
|
58
|
+
else { delete deck.mergeFarAvatars; }
|
|
59
|
+
if (castleJson?.hub?.lowActorDistance === true) { deck.lowActorDistance = true; }
|
|
60
|
+
else { delete deck.lowActorDistance; }
|
|
61
|
+
if (castleJson?.hub?.lowActorBudget === true) { deck.lowActorBudget = true; }
|
|
62
|
+
else { delete deck.lowActorBudget; }
|
|
63
|
+
if (castleJson?.hub?.companionIdle === true) { deck.companionIdle = true; }
|
|
64
|
+
else { delete deck.companionIdle; }
|
|
65
|
+
if (castleJson?.hub?.act === true) {deck.act = true;}
|
|
66
|
+
else {delete deck.act;}
|
|
17
67
|
deck.cues = castleJson?.hub?.cues === true;
|
|
68
|
+
deck.playCards = castleJson?.hub?.playCards === true;
|
|
69
|
+
deck.yourGames = castleJson?.hub?.yourGames === true;
|
|
70
|
+
if (castleJson?.hub?.avatarColors === true) {
|
|
71
|
+
deck.avatarColors = true;
|
|
72
|
+
}
|
|
73
|
+
deck.stuck = castleJson?.hub?.stuck === true;
|
|
74
|
+
deck.labels = castleJson?.hub?.labels === 'near';
|
|
75
|
+
// `hub.soundscape`: true, or an object with optional ground, ambience and UI.
|
|
76
|
+
const soundscape = castleJson?.hub?.soundscape;
|
|
77
|
+
deck.soundscape = soundscape === true || (soundscape && typeof soundscape === 'object' && !Array.isArray(soundscape)) ? {
|
|
78
|
+
babble: soundscape.babble !== false,
|
|
79
|
+
steps: soundscape.steps && typeof soundscape.steps === 'object' && !Array.isArray(soundscape.steps) ? soundscape.steps : soundscape.steps !== false,
|
|
80
|
+
...(typeof soundscape.zones === 'string' ? { zones: soundscape.zones } : {}),
|
|
81
|
+
...(soundscape.ambience && typeof soundscape.ambience === 'object' && !Array.isArray(soundscape.ambience) ? { ambience: soundscape.ambience } : {}),
|
|
82
|
+
...(Object.hasOwn(soundscape, 'ui') && typeof soundscape.ui === 'boolean' ? { ui: soundscape.ui } : {}),
|
|
83
|
+
...(Object.hasOwn(soundscape, 'cues') && typeof soundscape.cues === 'boolean' ? { cues: soundscape.cues } : {}),
|
|
84
|
+
} : null;
|
|
85
|
+
if (deck.soundscape?.cues === true) {
|
|
86
|
+
hub.cueEvents = [];
|
|
87
|
+
}
|
|
18
88
|
|
|
19
89
|
let files = null;
|
|
20
90
|
// The scene and multiplayer system of the newest snapshot, for a message that
|
|
@@ -25,22 +95,72 @@ let drawnStyle = null;
|
|
|
25
95
|
|
|
26
96
|
// Everyone's avatars with this player's own over them. A player whose avatar
|
|
27
97
|
// changed is dropped and respawns in the new one.
|
|
98
|
+
// A `hubAv2` block (v1.51) as a map, or an empty one for anything else.
|
|
99
|
+
function realAvatars(block) {
|
|
100
|
+
return new Map(Object.entries(block && typeof block === 'object' ? block : {}));
|
|
101
|
+
}
|
|
102
|
+
|
|
28
103
|
function setAvatars(scene, system) {
|
|
29
104
|
const next = new Map([...hub.avatarsAll, ...hub.avatarsMe]);
|
|
105
|
+
// v1.51: `hubAv` carries a stand-in from the first four for a player who
|
|
106
|
+
// wears a later avatar, for clients from before them; the one really worn
|
|
107
|
+
// is in `hubAv2`, and is the one drawn here. Only for a player `hubAv`
|
|
108
|
+
// lists, and only an avatar index.
|
|
109
|
+
// A viewer's block only names players omitted from the shared one. For a
|
|
110
|
+
// shared player, its real index (or its absence) wins over a stale message.
|
|
111
|
+
const own = [...hub.avatars2Me].filter(([playerId]) => !hub.avatarsAll.has(playerId));
|
|
112
|
+
for (const [playerId, avatar] of [...hub.avatars2All, ...own]) {
|
|
113
|
+
if (next.has(playerId) && Number.isInteger(avatar) && avatar >= 0) {
|
|
114
|
+
next.set(playerId, avatar);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
const colors = new Map();
|
|
118
|
+
const ownColors = [...hub.avatarColorsMe].filter(([playerId]) => !hub.avatarsAll.has(playerId));
|
|
119
|
+
for (const [playerId, color] of [...hub.avatarColorsAll, ...ownColors]) {
|
|
120
|
+
if (next.has(playerId) && Number.isInteger(color) && color > 0 && color < 16) {
|
|
121
|
+
colors.set(playerId, color);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
30
124
|
if (system) {
|
|
31
|
-
const
|
|
32
|
-
|
|
125
|
+
const changed = [];
|
|
126
|
+
const later = new Set();
|
|
33
127
|
for (const [playerId, avatar] of next) {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
changed
|
|
128
|
+
const colorChanged = (hub.avatarColors.get(playerId) ?? 0) !== (colors.get(playerId) ?? 0);
|
|
129
|
+
if (hub.avatars.has(playerId) && (hub.avatars.get(playerId) !== avatar || colorChanged)) {
|
|
130
|
+
changed.push(playerId);
|
|
131
|
+
// Changes involving a later avatar must not restore its old fading
|
|
132
|
+
// actor. The first four keep their original fade behavior.
|
|
133
|
+
if (colorChanged || Avatar.known(hub.avatars.get(playerId)) >= Avatar.DEFAULT_AVATARS || Avatar.known(avatar) >= Avatar.DEFAULT_AVATARS) {
|
|
134
|
+
later.add(playerId);
|
|
135
|
+
}
|
|
37
136
|
}
|
|
38
137
|
}
|
|
39
|
-
|
|
40
|
-
Avatars.dropMissing(system.avatars, scene, keep);
|
|
41
|
-
}
|
|
138
|
+
redraw(scene, system, changed, later);
|
|
42
139
|
}
|
|
43
140
|
hub.avatars = next;
|
|
141
|
+
hub.avatarColors = colors;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
// Drops `playerIds`' bodies so each respawns in the avatar it is drawn as
|
|
145
|
+
// now (`hooks.avatar`). One of them still fading out in `fading` is taken
|
|
146
|
+
// down too, so it cannot come back as it was.
|
|
147
|
+
function redraw(scene, system, playerIds, fading) {
|
|
148
|
+
if (playerIds.length === 0) {
|
|
149
|
+
return;
|
|
150
|
+
}
|
|
151
|
+
const keep = new Map(system.net?.others() ?? []);
|
|
152
|
+
for (const playerId of playerIds) {
|
|
153
|
+
keep.delete(playerId);
|
|
154
|
+
const leaving = system.avatars.leaving.get(playerId);
|
|
155
|
+
if (leaving && fading.has(playerId)) {
|
|
156
|
+
if (scene.getActor(leaving.actorId)) {
|
|
157
|
+
system.avatars.retired?.add(leaving.actorId);
|
|
158
|
+
scene.despawnActor(leaving.actorId);
|
|
159
|
+
}
|
|
160
|
+
system.avatars.leaving.delete(playerId);
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
Avatars.dropMissing(system.avatars, scene, keep);
|
|
44
164
|
}
|
|
45
165
|
|
|
46
166
|
// Everyone's wearables with this player's own over them (v1.4), and over
|
|
@@ -49,11 +169,18 @@ function setWearing() {
|
|
|
49
169
|
hub.wearing = wearingNow();
|
|
50
170
|
}
|
|
51
171
|
|
|
172
|
+
// `{ spot, to }` of a place's word on "Stuck?" (v1.39).
|
|
173
|
+
function stuckAnswer(msg) {
|
|
174
|
+
return { spot: msg.spot === true, to: typeof msg.to === 'string' && msg.to ? msg.to.slice(0, 40) : null };
|
|
175
|
+
}
|
|
176
|
+
|
|
52
177
|
function wearMap(value) {
|
|
53
178
|
return new Map(Object.entries(value && typeof value === 'object' ? value : {}));
|
|
54
179
|
}
|
|
55
180
|
|
|
56
181
|
export default {
|
|
182
|
+
// Travel retains these hooks: decode offers from any opted-in destination.
|
|
183
|
+
unpack: unpackFrame,
|
|
57
184
|
// A place whose NPCs have minds (`hub.npcs`, contract §13) is joined like any
|
|
58
185
|
// other, on one of its public layers, when the SDK can address the place's
|
|
59
186
|
// characters from a layer (`Multiplayer.placeCharacters`): ghost and the host
|
|
@@ -66,17 +193,81 @@ export default {
|
|
|
66
193
|
return firstJoinFor(castleJson, castleSdk.Multiplayer);
|
|
67
194
|
},
|
|
68
195
|
|
|
196
|
+
// Each deck message is marked with the player id it arrived under, so one
|
|
197
|
+
// from a session the connection has since left is dropped (`rehello.js`).
|
|
198
|
+
// Handles nothing: it goes on to the queue as before.
|
|
199
|
+
arrive(msg, system) {
|
|
200
|
+
if (msg.k === 'hub-frame-offer') {
|
|
201
|
+
if (system?.net?.unpacks === true) {
|
|
202
|
+
system.net.send({ k: 'hub-frame-ready' });
|
|
203
|
+
}
|
|
204
|
+
return true;
|
|
205
|
+
}
|
|
206
|
+
Rehello.tag(msg, system?.net ?? null);
|
|
207
|
+
return false;
|
|
208
|
+
},
|
|
209
|
+
|
|
69
210
|
message(scene, msg) {
|
|
70
211
|
files = scene.files ?? files;
|
|
71
212
|
switch (msg.k) {
|
|
213
|
+
case 'hub-companion':
|
|
214
|
+
// As actions: keep a private message before WORLD until its gate is known.
|
|
215
|
+
if ((!hub.place || hub.place.companion === true) && Number.isSafeInteger(msg.n) && msg.n >= 0) {
|
|
216
|
+
hub.companion = { c: sanitise(msg.c), n: msg.n, ...(hub.companion?.stamps !== undefined ? { stamps: hub.companion.stamps } : {}) };
|
|
217
|
+
}
|
|
218
|
+
break;
|
|
219
|
+
case 'hub-menu':
|
|
220
|
+
if ((!hub.place || hub.place.menu === true) && Number.isSafeInteger(msg.n) && msg.n >= 0 &&
|
|
221
|
+
(!hub.menu || msg.n > hub.menu.n)) {
|
|
222
|
+
hub.menu = { spec: msg.spec, n: msg.n };
|
|
223
|
+
}
|
|
224
|
+
break;
|
|
225
|
+
case 'hub-ask':
|
|
226
|
+
// Buffer before WORLD; a known keyless place keeps nothing.
|
|
227
|
+
if ((!hub.place || hub.place.ask === true) && Number.isSafeInteger(msg.n) &&
|
|
228
|
+
(!hub.ask || msg.n > hub.ask.n)) {
|
|
229
|
+
hub.ask = msg.id === null ? { id: null, n: msg.n } : { id: msg.id, title: msg.title, max: msg.max, n: msg.n };
|
|
230
|
+
}
|
|
231
|
+
break;
|
|
232
|
+
case 'hub-prompts':
|
|
233
|
+
if (deck.act === true && Array.isArray(msg.items)) {
|
|
234
|
+
hub.prompts = msg.items.filter(item => item && typeof item.id === 'string' && typeof item.verb === 'string' && typeof item.hold === 'boolean');
|
|
235
|
+
}
|
|
236
|
+
break;
|
|
237
|
+
case 'hub-actions':
|
|
238
|
+
// Buffer before WORLD; nothing draws until the place is known to opt in.
|
|
239
|
+
// A WORLD naming a keyless place drops this private offer.
|
|
240
|
+
if (!hub.place || hub.place.actions === true) {
|
|
241
|
+
hub.actions = { items: msg.items ?? null, n: msg.n };
|
|
242
|
+
}
|
|
243
|
+
break;
|
|
244
|
+
case 'hub-decor':
|
|
245
|
+
hub.decor = { button: msg.button ?? null, spec: msg.spec ?? null, grid: msg.grid ?? null };
|
|
246
|
+
break;
|
|
247
|
+
case 'hub-shot':
|
|
248
|
+
// Accepted lease renewals refresh a held or resumable shot.
|
|
249
|
+
receiveShot(scene, msg.shot, msg.lease === true);
|
|
250
|
+
break;
|
|
251
|
+
case 'hub-home-unlock':
|
|
252
|
+
hub.commands.push(msg);
|
|
253
|
+
break;
|
|
254
|
+
case 'hub-invite':
|
|
255
|
+
if (hub.place?.invite === true) {hub.commands.push({ k: 'hub-invite', ...(msg.share === true ? { share: true } : {}) });}
|
|
256
|
+
break;
|
|
72
257
|
case 'hub-go':
|
|
73
258
|
case 'hub-end':
|
|
74
259
|
case 'hub-result':
|
|
260
|
+
if (msg.k !== 'hub-result') {
|
|
261
|
+
clearShot();
|
|
262
|
+
}
|
|
75
263
|
hub.commands.push(msg);
|
|
76
264
|
break;
|
|
77
265
|
case 'hub-tune':
|
|
78
266
|
hub.tune = msg.tune && typeof msg.tune === 'object' ? msg.tune : null;
|
|
79
267
|
break;
|
|
268
|
+
case 'hub-leaving':
|
|
269
|
+
hub.leaving = typeof msg.text === 'string' ? msg.text.trim().slice(0, 120) || null : null;
|
|
270
|
+
break;
|
|
80
271
|
case 'hub-hud':
|
|
81
272
|
hub.hudMe = msg.hud ?? null;
|
|
82
273
|
break;
|
|
@@ -96,6 +287,16 @@ export default {
|
|
|
96
287
|
if (typeof msg.to === 'string') {
|
|
97
288
|
hub.jumpedTo = msg.to;
|
|
98
289
|
}
|
|
290
|
+
// v1.39, after "Stuck?" in a place with the `unstick` hook: where it put this player.
|
|
291
|
+
if (deck.stuck && msg.stuck && typeof msg.stuck === 'object') {
|
|
292
|
+
hub.unstuck = stuckAnswer(msg.stuck);
|
|
293
|
+
}
|
|
294
|
+
break;
|
|
295
|
+
case 'hub-unstick-to':
|
|
296
|
+
// v1.39: what a tap on the chip would do now. Only a deck with `hub.stuck` asks.
|
|
297
|
+
if (deck.stuck) {
|
|
298
|
+
hub.stuckTo = stuckAnswer(msg);
|
|
299
|
+
}
|
|
99
300
|
break;
|
|
100
301
|
case 'hub-where':
|
|
101
302
|
// Laid over what is known: one answer covers at most twelve players.
|
|
@@ -108,37 +309,65 @@ export default {
|
|
|
108
309
|
}
|
|
109
310
|
break;
|
|
110
311
|
case 'hub-said':
|
|
312
|
+
if (deck.quality) {noteQualityInteraction(scene, msg.player);}
|
|
111
313
|
if (hub.saidEvents.length < 64) {
|
|
112
314
|
hub.saidEvents.push(msg);
|
|
113
315
|
}
|
|
114
316
|
break;
|
|
317
|
+
case 'hub-yours':
|
|
318
|
+
if (deck.yourGames) {
|
|
319
|
+
hub.yours = { rows: Array.isArray(msg.rows) ? msg.rows.slice(0, 5) : [], hearts: Array.isArray(msg.hearts) ? msg.hearts.slice(0, 8) : [] };
|
|
320
|
+
}
|
|
321
|
+
return;
|
|
322
|
+
case 'hub-friends-wanted':
|
|
323
|
+
hub.friendsWanted = true;
|
|
324
|
+
break;
|
|
115
325
|
case 'hub-party':
|
|
116
|
-
|
|
117
|
-
members: Array.isArray(msg.members) ? msg.members : null,
|
|
118
|
-
away: Number(msg.away) || 0,
|
|
119
|
-
invite: msg.invite ?? null,
|
|
120
|
-
proposal: msg.proposal ?? null,
|
|
121
|
-
};
|
|
326
|
+
receiveParty(msg);
|
|
122
327
|
break;
|
|
123
328
|
case 'hub-av':
|
|
329
|
+
if (hub.place?.anonymousEntry === true && Array.isArray(msg.hubGuests)) {
|
|
330
|
+
hub.guestsMe = new Set(msg.hubGuests.filter((id) => typeof id === 'string'));
|
|
331
|
+
hub.guests = new Set([...(hub.guestsAll ?? []), ...hub.guestsMe]);
|
|
332
|
+
}
|
|
124
333
|
hub.avatarsMe = new Map(Object.entries(msg.hubAv && typeof msg.hubAv === 'object' ? msg.hubAv : {}));
|
|
334
|
+
// The message is whole: without `hubAv2`, none of them wears a later avatar.
|
|
335
|
+
hub.avatars2Me = realAvatars(msg.hubAv2);
|
|
336
|
+
hub.avatarColorsMe = realAvatars(msg.hubAvC);
|
|
125
337
|
setAvatars(netSystem?.scene ?? scene, netSystem?.system ?? null);
|
|
126
338
|
break;
|
|
127
339
|
case 'hub-wear':
|
|
128
340
|
hub.wearMe = wearMap(msg.hubWear);
|
|
129
341
|
setWearing();
|
|
130
342
|
break;
|
|
343
|
+
case 'hub-earned':
|
|
344
|
+
// v1.53: earned items of players in a hidden pair this player may see.
|
|
345
|
+
hub.earnedMe = wearMap(msg.hubEarned);
|
|
346
|
+
hub.earned = earnedNow();
|
|
347
|
+
break;
|
|
131
348
|
case 'hub-try':
|
|
132
349
|
// v1.28: try-ons of players in a hidden pair this player may see.
|
|
133
350
|
hub.tryMe = wearMap(msg.hubTry);
|
|
134
351
|
setWearing();
|
|
135
352
|
break;
|
|
353
|
+
case 'hub-ballot-card':
|
|
354
|
+
// v1.68: the one entry to the choice card (`ballot.js` `gate`).
|
|
355
|
+
Ballot.gate(hub.place, scene?.multiplayer?.net ?? null, msg.card);
|
|
356
|
+
break;
|
|
136
357
|
case 'hub-labels':
|
|
137
358
|
hub.labelsMe = msg.labels && typeof msg.labels === 'object' ? msg.labels : {};
|
|
138
359
|
break;
|
|
360
|
+
case 'hub-vis':
|
|
361
|
+
hub.hiddenMe = new Set(Array.isArray(msg.hide) ? msg.hide : []);
|
|
362
|
+
hub.shownMe = new Set(Array.isArray(msg.show) ? msg.show : []);
|
|
363
|
+
mergeHidden();
|
|
364
|
+
break;
|
|
139
365
|
case 'hub-npc':
|
|
140
366
|
case 'hub-npc-line':
|
|
367
|
+
case 'hub-npc-opening':
|
|
141
368
|
case 'hub-npc-notes':
|
|
369
|
+
case 'hub-npc-preferred':
|
|
370
|
+
case 'hub-npc-hooks':
|
|
142
371
|
hub.npcEvents.push(msg);
|
|
143
372
|
break;
|
|
144
373
|
case 'hub-grab-deny':
|
|
@@ -151,10 +380,22 @@ export default {
|
|
|
151
380
|
break;
|
|
152
381
|
case 'hub-sound':
|
|
153
382
|
// At most a few unplayed one-shots wait: a backgrounded tab plays none late.
|
|
154
|
-
if (hub.soundEvents.length < 8) {
|
|
383
|
+
if (hub.soundEvents.length < 8 && (!hub.soundGate || hub.soundGate())) {
|
|
155
384
|
hub.soundEvents.push(msg);
|
|
156
385
|
}
|
|
157
386
|
break;
|
|
387
|
+
case 'hub-cue':
|
|
388
|
+
// Independent of audio mute/gesture gates; private transport only.
|
|
389
|
+
if (hub.place?.companion === true && hub.companion?.c && ownStamp(msg)) {
|
|
390
|
+
hub.companion.stamps = (hub.companion.stamps ?? 0) + 1;
|
|
391
|
+
}
|
|
392
|
+
if (deck.soundscape?.cues === true && (!hub.soundGate || hub.soundGate())) {
|
|
393
|
+
const events = (hub.cueEvents ??= []);
|
|
394
|
+
if (events.length < 8) {
|
|
395
|
+
events.push(msg);
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
break;
|
|
158
399
|
default:
|
|
159
400
|
break;
|
|
160
401
|
}
|
|
@@ -166,8 +407,70 @@ export default {
|
|
|
166
407
|
hub.lastT = msg.t;
|
|
167
408
|
hub.lastTAt = msg.localMs ?? performance.now();
|
|
168
409
|
}
|
|
410
|
+
// `hub-arrived` is sent before the state block containing the server's
|
|
411
|
+
// own-player clamp. Multiplayer applies that clamp after this hook, so
|
|
412
|
+
// the hub system observes this latch on the following frame, once the
|
|
413
|
+
// corrected position has reached Transform. A later WORLD is equivalent
|
|
414
|
+
// on reconnect; the initial WORLD cannot qualify before hub-arrived.
|
|
415
|
+
if (!hub.arrivalPlaced && hub.arrivedFacing !== null && (
|
|
416
|
+
msg.k === 'w' ||
|
|
417
|
+
// Match multiplayer's clamp acceptance exactly. `packPlayer` puts 1/0
|
|
418
|
+
// on the wire, while older composed fixtures may still carry true.
|
|
419
|
+
(msg.ps ?? []).some((row) => row?.[0] === system?.net?.selfId?.() && Boolean(row[5]))
|
|
420
|
+
)) {
|
|
421
|
+
hub.arrivalPlaced = true;
|
|
422
|
+
}
|
|
169
423
|
if (msg.hubPlace) {
|
|
424
|
+
setFpsTelemetry(system?.net, msg.hubPlace.fpsTelemetry);
|
|
425
|
+
setLoadTelemetry(system?.net, msg.hubPlace.loadTelemetry);
|
|
426
|
+
if (Object.hasOwn(hub, 'menu') && hub.place && hub.place.id !== msg.hubPlace.id) {
|
|
427
|
+
hub.menuClose?.();
|
|
428
|
+
delete hub.menu;
|
|
429
|
+
}
|
|
430
|
+
if (Object.hasOwn(hub, 'ask') && hub.place && hub.place.id !== msg.hubPlace.id) {
|
|
431
|
+
hub.askClose?.();
|
|
432
|
+
delete hub.ask;
|
|
433
|
+
}
|
|
170
434
|
hub.place = msg.hubPlace;
|
|
435
|
+
if (hub.place.anonymousEntry !== true) {
|
|
436
|
+
delete hub.guests;
|
|
437
|
+
delete hub.guestsAll;
|
|
438
|
+
delete hub.guestsMe;
|
|
439
|
+
}
|
|
440
|
+
if (hub.place.menu !== true) {
|
|
441
|
+
hub.menuClose?.();
|
|
442
|
+
delete hub.menuClose;
|
|
443
|
+
delete hub.menu;
|
|
444
|
+
}
|
|
445
|
+
if (hub.place.actions !== true && Object.hasOwn(hub, 'actions')) {
|
|
446
|
+
delete hub.actions;
|
|
447
|
+
}
|
|
448
|
+
if (hub.place.companion !== true) {
|
|
449
|
+
delete hub.companion;
|
|
450
|
+
delete hub.glow;
|
|
451
|
+
}
|
|
452
|
+
if (hub.place.ask !== true && Object.hasOwn(hub, 'ask')) {
|
|
453
|
+
hub.askClose?.();
|
|
454
|
+
delete hub.ask;
|
|
455
|
+
}
|
|
456
|
+
if (!hub.place.decor) {
|
|
457
|
+
delete hub.decor;
|
|
458
|
+
}
|
|
459
|
+
}
|
|
460
|
+
if (hub.place?.anonymousEntry === true && Array.isArray(msg.hubGuests)) {
|
|
461
|
+
hub.guestsAll = new Set(msg.hubGuests.filter((id) => typeof id === 'string'));
|
|
462
|
+
hub.guests = new Set([...hub.guestsAll, ...(hub.guestsMe ?? [])]);
|
|
463
|
+
}
|
|
464
|
+
// v1.68: a card the gate held before the place was known is kept or
|
|
465
|
+
// dropped by it. Nothing unless the gate held one.
|
|
466
|
+
if (msg.hubPlace && Ballot.held) {
|
|
467
|
+
Ballot.settle(msg.hubPlace);
|
|
468
|
+
}
|
|
469
|
+
// v1.33: a snapshot (it carries `hubPlace`) says whether this place takes
|
|
470
|
+
// "Stuck?". Read only in a deck with `hub.stuck`.
|
|
471
|
+
if (deck.stuck && msg.hubPlace) {
|
|
472
|
+
const to = msg.hubStuck && typeof msg.hubStuck === 'object' ? msg.hubStuck.to : undefined;
|
|
473
|
+
hub.stuck = to === undefined ? null : { to: typeof to === 'string' && to ? to.slice(0, 40) : null, ...(msg.hubStuck.hook === true ? { hook: true } : {}) };
|
|
171
474
|
}
|
|
172
475
|
netSystem = { scene, system };
|
|
173
476
|
// The viewer's set changed under a running page (the experiment answered
|
|
@@ -185,14 +488,49 @@ export default {
|
|
|
185
488
|
system.avatars.leaving.clear();
|
|
186
489
|
}
|
|
187
490
|
drawnStyle = style;
|
|
491
|
+
// v1.51: `hubAv2` comes only from a place where someone wears a later
|
|
492
|
+
// avatar, `{}` once when the last is gone; a snapshot (it carries
|
|
493
|
+
// `hubPlace`) without it means nobody does.
|
|
494
|
+
const hadColors = hub.avatarColorsAll.size > 0;
|
|
495
|
+
if (msg.hubAvC && typeof msg.hubAvC === 'object') {
|
|
496
|
+
hub.avatarColorsAll = realAvatars(msg.hubAvC);
|
|
497
|
+
} else if (msg.hubPlace) {
|
|
498
|
+
hub.avatarColorsAll = new Map();
|
|
499
|
+
}
|
|
500
|
+
const hadReal = hub.avatars2All.size > 0;
|
|
501
|
+
if (msg.hubAv2 && typeof msg.hubAv2 === 'object') {
|
|
502
|
+
hub.avatars2All = realAvatars(msg.hubAv2);
|
|
503
|
+
} else if (msg.hubPlace && hadReal) {
|
|
504
|
+
hub.avatars2All = new Map();
|
|
505
|
+
}
|
|
188
506
|
if (msg.hubAv) {
|
|
189
507
|
hub.avatarsAll = new Map(Object.entries(msg.hubAv));
|
|
508
|
+
}
|
|
509
|
+
if (msg.hubAv || msg.hubAv2 || msg.hubAvC || (msg.hubPlace && (hadReal || hadColors))) {
|
|
190
510
|
setAvatars(scene, system);
|
|
191
511
|
}
|
|
512
|
+
// The farthest of too many different characters are drawn as their
|
|
513
|
+
// stand-ins (`avatarCap.js`); a change is a later avatar's either way.
|
|
514
|
+
if (system?.avatars) {
|
|
515
|
+
const swapped = AvatarCap.frame(scene, system);
|
|
516
|
+
redraw(scene, system, swapped, new Set(swapped));
|
|
517
|
+
}
|
|
518
|
+
if (hub.place?.companion === true) {
|
|
519
|
+
if (Array.isArray(msg.hubGlow)) {
|
|
520
|
+
hub.glow = new Set(msg.hubGlow.filter((id) => typeof id === 'string'));
|
|
521
|
+
} else if (msg.hubPlace) {
|
|
522
|
+
delete hub.glow;
|
|
523
|
+
}
|
|
524
|
+
}
|
|
192
525
|
if (msg.hubWear) {
|
|
193
526
|
hub.wearAll = wearMap(msg.hubWear);
|
|
194
527
|
setWearing();
|
|
195
528
|
}
|
|
529
|
+
// v1.53: only a place where someone shows an earned item sends this.
|
|
530
|
+
if (msg.hubEarned) {
|
|
531
|
+
hub.earnedAll = wearMap(msg.hubEarned);
|
|
532
|
+
hub.earned = earnedNow();
|
|
533
|
+
}
|
|
196
534
|
// v1.28: only a place that shows a try-on sends this. A snapshot (it
|
|
197
535
|
// carries `hubPlace`) without one means none is up. `tryMe` is not the
|
|
198
536
|
// snapshot's to clear: the place sends `hub-try` on the tick before a
|
|
@@ -209,17 +547,24 @@ export default {
|
|
|
209
547
|
hub.hud = msg.hud ?? null;
|
|
210
548
|
}
|
|
211
549
|
if (msg.hidden) {
|
|
212
|
-
hub.
|
|
550
|
+
hub.hiddenAll = new Set(msg.hidden);
|
|
551
|
+
mergeHidden();
|
|
213
552
|
}
|
|
214
553
|
if (msg.tints) {
|
|
215
554
|
hub.tints = msg.tints;
|
|
216
555
|
}
|
|
556
|
+
if (msg.tintsD) {
|
|
557
|
+
hub.tints = mergeDictionary(hub.tints, msg.tintsD);
|
|
558
|
+
}
|
|
217
559
|
if (msg.hubDoors) {
|
|
218
560
|
hub.doors = msg.hubDoors;
|
|
219
561
|
}
|
|
220
562
|
if (msg.marks) {
|
|
221
563
|
hub.marks = msg.marks;
|
|
222
564
|
}
|
|
565
|
+
if (msg.marksD) {
|
|
566
|
+
hub.marks = mergeDictionary(hub.marks, msg.marksD);
|
|
567
|
+
}
|
|
223
568
|
if (msg.spawnTemplates) {
|
|
224
569
|
hub.spawnTemplates = msg.spawnTemplates;
|
|
225
570
|
}
|
|
@@ -232,6 +577,9 @@ export default {
|
|
|
232
577
|
if (msg.labels) {
|
|
233
578
|
hub.labels = msg.labels;
|
|
234
579
|
}
|
|
580
|
+
if (msg.labelsD) {
|
|
581
|
+
hub.labels = mergeDictionary(hub.labels, msg.labelsD);
|
|
582
|
+
}
|
|
235
583
|
// v1.27: only a place that keeps an object for a player sends this.
|
|
236
584
|
if (msg.hubKept && typeof msg.hubKept === 'object') {
|
|
237
585
|
hub.keptFor = new Map(Object.entries(msg.hubKept));
|
|
@@ -240,24 +588,41 @@ export default {
|
|
|
240
588
|
if (msg.hubEmotes && typeof msg.hubEmotes === 'object') {
|
|
241
589
|
hub.emotes = msg.hubEmotes;
|
|
242
590
|
}
|
|
591
|
+
// v1.47: only a place where an NPC has emoted sends this.
|
|
592
|
+
if (msg.hubNpcEmotes && typeof msg.hubNpcEmotes === 'object') {
|
|
593
|
+
hub.npcEmotes = msg.hubNpcEmotes;
|
|
594
|
+
}
|
|
243
595
|
if (msg.hubSeated && typeof msg.hubSeated === 'object') {
|
|
244
596
|
hub.seated = msg.hubSeated;
|
|
245
597
|
}
|
|
246
598
|
if (msg.hubSounds && typeof msg.hubSounds === 'object') {
|
|
247
599
|
hub.sounds = msg.hubSounds;
|
|
248
600
|
}
|
|
601
|
+
if (Object.hasOwn(msg, 'hubDanceIdle')) {
|
|
602
|
+
hub.danceIdle = readDanceIdle(msg.hubDanceIdle);
|
|
603
|
+
}
|
|
249
604
|
},
|
|
250
605
|
|
|
251
606
|
// Everyone is drawn as their avatar; until a player's hello has reached the
|
|
252
607
|
// place they are not drawn, so nobody flashes in a default body. The set
|
|
253
608
|
// is this viewer's own (`Avatar.style`).
|
|
254
609
|
avatar(playerId, username) {
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
610
|
+
// An index past this kit's own (a later kit's character) is drawn as one
|
|
611
|
+
// of the first four (`Avatar.known`), never left out.
|
|
612
|
+
// Or its stand-in while the cap has this player as one (`avatarCap.js`).
|
|
613
|
+
const index = AvatarCap.shown(playerId);
|
|
614
|
+
const blueprint = index === null ? null : Avatar.blueprint(files, index, Avatar.style(), AvatarCap.shownColor(playerId));
|
|
615
|
+
return blueprint ? { blueprint, username: hub.guests?.has(playerId) ? guestName(username) : username } : null;
|
|
258
616
|
},
|
|
259
617
|
|
|
260
618
|
presence(status) {
|
|
261
619
|
return status.solo ? 'solo' : `${status.others + 1} here`;
|
|
262
620
|
},
|
|
621
|
+
|
|
622
|
+
reset() {
|
|
623
|
+
clearShot();
|
|
624
|
+
},
|
|
625
|
+
dispose() {
|
|
626
|
+
clearShot();
|
|
627
|
+
},
|
|
263
628
|
};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
// v1.131: title above the world and one next-action sentence below it.
|
|
2
|
+
// Door authors shorten prompts to about 48 characters; layout QA flags wrapping.
|
|
3
|
+
export const HUD_COPY_STYLE = {
|
|
4
|
+
background: 'rgba(20,16,12,0.78)',
|
|
5
|
+
borderRadius: '14px',
|
|
6
|
+
padding: '4px 8px',
|
|
7
|
+
boxSizing: 'border-box',
|
|
8
|
+
width: 'max-content',
|
|
9
|
+
maxWidth: '100%',
|
|
10
|
+
margin: '0 auto',
|
|
11
|
+
lineHeight: '1.3',
|
|
12
|
+
whiteSpace: 'normal',
|
|
13
|
+
overflowWrap: 'anywhere',
|
|
14
|
+
overflow: 'hidden',
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
const checked = new WeakMap();
|
|
18
|
+
// Called only in dev serving. Check again when copy or viewport changes, so a
|
|
19
|
+
// timer frame never repeats an author's warning. Effective width includes
|
|
20
|
+
// safe-inset reconciliation, which can narrow a row after setHud.
|
|
21
|
+
export function warnHudCopy(node, row, lines = 2) {
|
|
22
|
+
const key = [node.textContent, window.innerWidth, window.innerHeight, node.clientWidth, lines].join('\u0001');
|
|
23
|
+
if (checked.get(node) === key) { return; }
|
|
24
|
+
checked.set(node, key);
|
|
25
|
+
if (!node.textContent) { return; }
|
|
26
|
+
const style = getComputedStyle(node);
|
|
27
|
+
const room = lines * parseFloat(style.lineHeight) + parseFloat(style.paddingTop) + parseFloat(style.paddingBottom);
|
|
28
|
+
if (node.scrollHeight > Math.ceil(room)) {
|
|
29
|
+
console.warn(`[hub HUD] ${row} exceeds ${lines === 1 ? 'one line' : 'two lines'} at ${window.innerWidth}x${window.innerHeight}; shorten door copy (check at 844x390):`, node.textContent);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
// Preserve authored bytes on the wire; only presentation takes the first
|
|
34
|
+
// sentence. Decimal points are not sentence endings. Never add an ellipsis.
|
|
35
|
+
export function firstPromptSentence(text) {
|
|
36
|
+
const words = String(text ?? '').trim();
|
|
37
|
+
for (const end of words.matchAll(/[.!?](?:["'”’)]*)(?=\s|$)/gu)) {
|
|
38
|
+
const before = words.slice(0, end.index);
|
|
39
|
+
// A person's title is not the end of the action naming them.
|
|
40
|
+
if (end[0] === '.' && /\b(?:Mr|Mrs|Ms|Dr|Prof|St)$/i.test(before)) {continue;}
|
|
41
|
+
return words.slice(0, end.index + end[0].length);
|
|
42
|
+
}
|
|
43
|
+
return words;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
// A projected label crossing the bottom prompt moves just above it. The top
|
|
47
|
+
// HUD keeps its existing downward clearance; the prompt is a separate band.
|
|
48
|
+
export function promptShift(box, prompt) {
|
|
49
|
+
if (!prompt || box.right <= prompt.left || box.left >= prompt.right || box.bottom <= prompt.top || box.top >= prompt.bottom) { return 0; }
|
|
50
|
+
return Math.max(-box.top, prompt.top - 6 - box.bottom);
|
|
51
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
const INPUT_EVENTS = ['pointerdown', 'pointerup', 'touchstart', 'touchend', 'keydown', 'keyup'];
|
|
2
|
+
|
|
3
|
+
// Only panels rest on alternate Weakest frames; motion and input never do.
|
|
4
|
+
export function makeHudRate(target = globalThis.window) {
|
|
5
|
+
let input = false, skip = false, previous;
|
|
6
|
+
const onInput = () => { input = true; };
|
|
7
|
+
for (const type of INPUT_EVENTS) {target?.addEventListener?.(type, onInput, true);}
|
|
8
|
+
return {
|
|
9
|
+
frame(weakest, signature) {
|
|
10
|
+
const tick = !weakest || input || signature !== previous || !skip;
|
|
11
|
+
previous = signature;
|
|
12
|
+
if (tick) {input = false;}
|
|
13
|
+
skip = weakest && tick;
|
|
14
|
+
return tick;
|
|
15
|
+
},
|
|
16
|
+
dispose() {
|
|
17
|
+
for (const type of INPUT_EVENTS) {target?.removeEventListener?.(type, onInput, true);}
|
|
18
|
+
},
|
|
19
|
+
};
|
|
20
|
+
}
|