castle-web-cli 0.4.233 → 0.4.235
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/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 +17 -2
- package/dist/castle-host/host.js +793 -36
- package/dist/castleJson.d.ts +20 -1
- package/dist/castleJson.js +44 -2
- package/dist/check.js +9 -2
- 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 +3 -1
- 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/index.js +8 -2
- package/dist/init.js +1 -1
- package/dist/save-deck.d.ts +20 -1
- package/dist/save-deck.js +141 -5
- package/dist/serve.js +29 -11
- package/dist/shell/assets/{index-BjOxR-lW.js → index-DulbYIJm.js} +97 -97
- package/dist/shell/index.html +1 -1
- package/dist/vitePlugins.d.ts +2 -1
- package/dist/vitePlugins.js +13 -0
- package/kits/base/castle.json +1 -1
- package/kits/base/sdk/README.md +266 -3
- package/kits/base/sdk/castle.d.ts +7 -3
- package/kits/base/sdk/castle.js +2 -0
- package/kits/base/sdk/commands.d.ts +162 -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 +33 -6
- package/kits/base/sdk/hub.js +68 -5
- package/kits/base/sdk/hubRejoin.d.ts +4 -0
- package/kits/base/sdk/hubRejoin.js +15 -0
- package/kits/base/sdk/multiplayer.d.ts +7 -1
- package/kits/base/sdk/multiplayer.js +147 -40
- 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 +79 -6
- package/kits/base/sdk/server/hub.d.ts +31 -1
- package/kits/base/sdk/server/hub.js +50 -3
- package/kits/base/sdk/server/platformHandle.d.ts +13 -1
- package/kits/base/sdk/server/storage.d.ts +4 -0
- package/kits/base/sdk/server/storage.js +19 -3
- package/kits/base/sdk/server/wrapper.d.ts +7 -1
- package/kits/base/sdk/server/wrapper.js +10 -1
- package/kits/base/sdk/social.d.ts +9 -0
- package/kits/base/sdk/social.js +5 -0
- package/kits/hub-game/CLAUDE.md +123 -3
- package/kits/hub-game/README.md +63 -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/arrivalCamera.js +50 -0
- package/kits/hub-game/code/client/askSlot.js +117 -0
- package/kits/hub-game/code/client/avatar.js +4 -2
- package/kits/hub-game/code/client/avatarShare.js +2 -0
- package/kits/hub-game/code/client/backVisibility.js +13 -0
- package/kits/hub-game/code/client/ballot.js +15 -10
- package/kits/hub-game/code/client/build.js +16 -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 +1148 -258
- package/kits/hub-game/code/client/crowdNames.js +241 -0
- package/kits/hub-game/code/client/decor.js +10 -4
- 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/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 +31 -11
- package/kits/hub-game/code/client/hookLayer.js +87 -8
- 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 +14 -2
- 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/labelsNear.js +31 -2
- 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/menuRows.js +43 -0
- package/kits/hub-game/code/client/modelReady.js +7 -0
- 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/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 +64 -10
- 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/state.js +53 -0
- package/kits/hub-game/code/client/talk.js +209 -45
- package/kits/hub-game/code/client/tiers.js +68 -66
- package/kits/hub-game/code/client/together.js +7 -2
- 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/worldLabels.js +241 -0
- package/kits/hub-game/code/client/yours.js +10 -9
- package/kits/hub-game/code/npcDisplayText.js +55 -0
- package/kits/hub-game/code/server/act.js +124 -0
- package/kits/hub-game/code/server/actions.js +6 -1
- package/kits/hub-game/code/server/actors.js +2 -1
- 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/companion.js +28 -3
- package/kits/hub-game/code/server/doorAnalytics.js +52 -0
- package/kits/hub-game/code/server/earned.js +22 -5
- package/kits/hub-game/code/server/frameBatch.js +183 -0
- package/kits/hub-game/code/server/friendsAmong.js +49 -9
- package/kits/hub-game/code/server/history.js +2 -0
- package/kits/hub-game/code/server/hub.js +1306 -95
- package/kits/hub-game/code/server/idle.js +30 -1
- package/kits/hub-game/code/server/index.js +26 -4
- package/kits/hub-game/code/server/invites.js +19 -0
- package/kits/hub-game/code/server/labels.js +9 -1
- package/kits/hub-game/code/server/loadAbandon.js +106 -0
- package/kits/hub-game/code/server/manifest.js +211 -3
- package/kits/hub-game/code/server/menu.js +31 -3
- package/kits/hub-game/code/server/npcs.js +226 -64
- 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/players.js +9 -1
- 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/standing.js +4 -5
- package/kits/hub-game/code/server/storageLimit.js +187 -0
- package/kits/hub-game/code/server/vis.js +67 -5
- package/kits/hub-game/code/shared/act.js +35 -0
- package/kits/hub-game/code/shared/danceIdle.js +28 -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 +35 -1
- package/kits/hub-game/code/systems/hub.js +970 -169
- package/kits/hub-game/docs/analytics.md +279 -0
- package/kits/hub-game/docs/contract.md +1259 -42
- package/kits/hub-game/docs/home-pieces.md +9 -2
- package/kits/hub-game/docs/observed-progress.md +252 -0
- package/kits/hub-game/main.jsx +2 -0
- package/kits/hub-game/package-lock.json +10 -3
- package/kits/hub-game/package.json +6 -3
- 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 +39 -5
- package/kits/hub-game/scripts/companion-follower-wire.json +1 -1
- package/kits/hub-game/scripts/fixtures/decor-keyless-draw.json +11 -0
- package/kits/hub-game/scripts/fixtures/decor-keyless.json +5 -5
- package/kits/hub-game/scripts/fixtures/engine-models-stub.mjs +3 -0
- package/kits/hub-game/scripts/fixtures/fake-dom.mjs +19 -3
- package/kits/hub-game/scripts/fixtures/interest-legacy.json +3 -3
- package/kits/hub-game/scripts/fixtures/vis-shared-wire.json +1 -1
- package/kits/hub-game/scripts/pose-storage-fixture.mjs +46 -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 +367 -2
- package/kits/hub-game/scripts/test-actors.mjs +20 -7
- 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-slot.mjs +85 -0
- package/kits/hub-game/scripts/test-avatar-wire.mjs +49 -10
- package/kits/hub-game/scripts/test-avatar.mjs +44 -0
- package/kits/hub-game/scripts/test-back-visibility.mjs +82 -0
- package/kits/hub-game/scripts/test-ballot.mjs +11 -4
- package/kits/hub-game/scripts/test-ban-join.mjs +121 -13
- package/kits/hub-game/scripts/test-build.mjs +20 -2
- package/kits/hub-game/scripts/test-chat.mjs +206 -5
- package/kits/hub-game/scripts/test-companion-chat.mjs +20 -2
- 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 +45 -4
- package/kits/hub-game/scripts/test-decor.mjs +7 -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.mjs +33 -3
- 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-grab-orbit.mjs +47 -4
- package/kits/hub-game/scripts/test-high-only.mjs +170 -0
- package/kits/hub-game/scripts/test-hub-ops.mjs +321 -2
- package/kits/hub-game/scripts/test-hub-trip.mjs +879 -11
- package/kits/hub-game/scripts/test-hud-clear.mjs +162 -59
- 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 +66 -0
- package/kits/hub-game/scripts/test-interest-cells.mjs +20 -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-labels.mjs +71 -3
- 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 +265 -0
- package/kits/hub-game/scripts/test-menu-client.mjs +105 -0
- package/kits/hub-game/scripts/test-menu.mjs +23 -0
- package/kits/hub-game/scripts/test-npcs.mjs +917 -10
- package/kits/hub-game/scripts/test-observed.mjs +745 -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 +234 -7
- 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 +699 -5
- 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 +145 -0
- package/kits/hub-game/scripts/test-signin-client.mjs +45 -0
- package/kits/hub-game/scripts/test-soundscape.mjs +22 -17
- package/kits/hub-game/scripts/test-standing.mjs +35 -2
- package/kits/hub-game/scripts/test-storage-limit.mjs +333 -0
- package/kits/hub-game/scripts/test-stuck.mjs +5 -4
- package/kits/hub-game/scripts/test-talk-overlay-dom.mjs +130 -0
- package/kits/hub-game/scripts/test-tiers-render.mjs +86 -13
- package/kits/hub-game/scripts/test-tiers.mjs +7 -8
- package/kits/hub-game/scripts/test-vis.mjs +433 -6
- 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 +50 -6
- package/kits/hub-game/scripts/test-yours.mjs +39 -8
- package/kits/multiplayer-3d/castle.json +5 -5
- package/kits/multiplayer-3d/code/client/joinFailure.js +27 -0
- package/kits/multiplayer-3d/code/client/resumeGate.js +139 -0
- package/kits/multiplayer-3d/code/systems/multiplayer.js +369 -30
- package/kits/multiplayer-3d/package-lock.json +8 -1
- package/kits/multiplayer-3d/package.json +2 -1
- package/kits/multiplayer-3d/scripts/test-join-watchdog.mjs +436 -0
- package/kits/multiplayer-3d/scripts/test-resume-gate.mjs +624 -0
- package/kits/physics-2d/CLAUDE.md +10 -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 +87 -5
- 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-3d/CLAUDE.md +25 -1651
- 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 +35 -18
- 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 +1 -1
- package/kits/physics-3d/engine3d/PlayOnly3D.jsx +5 -1
- package/kits/physics-3d/engine3d/Scene3DPlayer.jsx +19 -333
- package/kits/physics-3d/engine3d/actornode.js +1 -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/framecap.js +4 -1
- 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 +8 -0
- package/kits/physics-3d/engine3d/initialModelFiles.js +18 -0
- package/kits/physics-3d/engine3d/look.js +7 -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 +3 -3
- package/kits/physics-3d/engine3d/nearshadows.js +77 -10
- package/kits/physics-3d/engine3d/orbitinput.js +59 -25
- 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 +3 -3
- 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 +23 -15
- package/kits/physics-3d/engine3d/sky.js +1 -1
- 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/world3d.js +468 -18
- package/kits/physics-3d/eslint.config.js +2 -1
- package/kits/physics-3d/main.jsx +6 -3
- 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/test-camera-follow.mjs +5 -1
- package/kits/physics-3d/scripts/test-camera-orbit.mjs +52 -4
- package/kits/physics-3d/scripts/test-drop-empty-parts.mjs +1 -1
- package/kits/physics-3d/scripts/test-empty-gait-hints.mjs +89 -0
- package/kits/physics-3d/scripts/test-frame-cap-bob.mjs +6 -3
- package/kits/physics-3d/scripts/test-frame-cap.mjs +1 -1
- 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-look-bake.mjs +1 -1
- package/kits/physics-3d/scripts/test-near-shadows.mjs +2 -2
- package/kits/physics-3d/scripts/test-orbit-shadow-fade.mjs +88 -7
- package/kits/physics-3d/scripts/test-orbit-shift-lock.mjs +40 -3
- package/kits/physics-3d/scripts/test-orbit-shot.mjs +75 -1
- package/kits/physics-3d/scripts/test-rapier-gz.mjs +106 -0
- package/kits/physics-3d/scripts/test-sky.mjs +1 -1
- package/kits/physics-3d/scripts/test-square-first.mjs +921 -0
- package/kits/physics-3d/scripts/test-static-actors.mjs +3 -1
- package/kits/physics-3d/scripts/test-static-physics.mjs +4 -1
- package/kits/physics-3d/scripts/test-static-scenery.mjs +5 -2
- package/kits/physics-3d/scripts/test-steady-hover.mjs +5 -2
- package/kits/physics-3d/scripts/test-still-shadows.mjs +477 -0
- package/kits/physics-3d/systems/physics3d.js +37 -4
- 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/session.js +6 -4
- package/kits/real-time/package-lock.json +1 -1
- package/package.json +2 -2
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
// or `hub.release` replaces or ends it, which stands them (`tick`).
|
|
20
20
|
|
|
21
21
|
import { warnOnce, isActor } from './actors.js';
|
|
22
|
+
import { danceFloors } from '../shared/danceIdle.js';
|
|
22
23
|
|
|
23
24
|
const DEG = Math.PI / 180;
|
|
24
25
|
|
|
@@ -56,6 +57,8 @@ export function newIdleState() {
|
|
|
56
57
|
sitBudget: new Map(),
|
|
57
58
|
// actorId -> { file, volume, radius, since }
|
|
58
59
|
loops: new Map(),
|
|
60
|
+
danceIdle: null,
|
|
61
|
+
danceIdleUsed: false,
|
|
59
62
|
shotBudget: { tokens: SHOT_BURST, at: null },
|
|
60
63
|
};
|
|
61
64
|
}
|
|
@@ -226,7 +229,7 @@ function spendSit(h, playerId) {
|
|
|
226
229
|
// no. Otherwise the player is held on the seat, facing its way.
|
|
227
230
|
// Flat distance from a point to a seat's Shape footprint (its box turned by
|
|
228
231
|
// rotationY, or its circle): the client offers a seat along its whole length.
|
|
229
|
-
function footprintDistance(actor, p) {
|
|
232
|
+
export function footprintDistance(actor, p) {
|
|
230
233
|
const t = actor.components.Transform ?? {};
|
|
231
234
|
const shape = actor.components.Shape ?? {};
|
|
232
235
|
const dx = p.x - (t.x ?? 0);
|
|
@@ -346,6 +349,7 @@ export function sound(h, actorId, file, options = {}) {
|
|
|
346
349
|
}
|
|
347
350
|
if (file === null || file === undefined) {
|
|
348
351
|
h.loops.delete(actorId);
|
|
352
|
+
if (h.danceIdle?.actor === actorId) { h.danceIdle = null; }
|
|
349
353
|
return true;
|
|
350
354
|
}
|
|
351
355
|
if (!sounds.includes(file)) {
|
|
@@ -363,6 +367,7 @@ export function sound(h, actorId, file, options = {}) {
|
|
|
363
367
|
warnOnce(h, 'sound:loops', `hub.sound: at most ${MAX_LOOPS} loops play at once in a place`);
|
|
364
368
|
return false;
|
|
365
369
|
}
|
|
370
|
+
if (h.danceIdle?.actor === actorId) { h.danceIdle = null; }
|
|
366
371
|
h.loops.set(actorId, { file, volume, radius, since: h.sim?.timeMs ?? 0 });
|
|
367
372
|
return true;
|
|
368
373
|
}
|
|
@@ -372,6 +377,7 @@ export function sound(h, actorId, file, options = {}) {
|
|
|
372
377
|
}
|
|
373
378
|
// Another sound at an actor replaces the loop playing there.
|
|
374
379
|
h.loops.delete(actorId);
|
|
380
|
+
if (h.danceIdle?.actor === actorId) { h.danceIdle = null; }
|
|
375
381
|
h.session?.broadcast({ k: 'hub-sound', actor: actorId, file, volume, radius });
|
|
376
382
|
return true;
|
|
377
383
|
}
|
|
@@ -416,6 +422,7 @@ export function fields(h) {
|
|
|
416
422
|
return {};
|
|
417
423
|
}
|
|
418
424
|
return {
|
|
425
|
+
...(h.danceIdleUsed ? { hubDanceIdle: danceIdleNow(h) } : {}),
|
|
419
426
|
...(idle.emotes ? { hubEmotes: emotesNow(h) } : {}),
|
|
420
427
|
...(idle.emotes ? h.npcs?.emoteFields() : {}),
|
|
421
428
|
...(idle.seats ? { hubSeated: seatedNow(h) } : {}),
|
|
@@ -423,6 +430,28 @@ export function fields(h) {
|
|
|
423
430
|
};
|
|
424
431
|
}
|
|
425
432
|
|
|
433
|
+
// Set once after starting/changing a sound loop. Its epoch is the loop's
|
|
434
|
+
// server clock; latched snapshot deltas send changes, never beat traffic.
|
|
435
|
+
export function danceIdle(h, actorId, options) {
|
|
436
|
+
if (options === null) {
|
|
437
|
+
if (h.danceIdleUsed) {h.danceIdle = null;}
|
|
438
|
+
return true;
|
|
439
|
+
}
|
|
440
|
+
const loop = h.loops.get(actorId);
|
|
441
|
+
const floors = danceFloors(options?.floors);
|
|
442
|
+
const bpm = options?.bpm;
|
|
443
|
+
if (!idleOf(h)?.emotes || !loop || !floors || !Number.isFinite(bpm) || bpm < 30 || bpm > 300) {return false;}
|
|
444
|
+
h.danceIdleUsed = true;
|
|
445
|
+
h.danceIdle = { actor: actorId, file: loop.file, beatAt: loop.since, bpm, floors };
|
|
446
|
+
return true;
|
|
447
|
+
}
|
|
448
|
+
|
|
449
|
+
function danceIdleNow(h) {
|
|
450
|
+
const spec = h.danceIdle;
|
|
451
|
+
const loop = spec && h.loops.get(spec.actor);
|
|
452
|
+
return loop?.file === spec?.file && loop?.since === spec?.beatAt ? spec : null;
|
|
453
|
+
}
|
|
454
|
+
|
|
426
455
|
export function forget(h, playerId) {
|
|
427
456
|
h.emotes.delete(playerId);
|
|
428
457
|
h.emoteAt.delete(playerId);
|
|
@@ -12,6 +12,8 @@ import * as World from '@imports/castle.multiplayer-3d/code/server/world.js';
|
|
|
12
12
|
import * as Limits from '@imports/castle.multiplayer-3d/code/server/limits.js';
|
|
13
13
|
import { resolveScenePath } from '@imports/castle.multiplayer-3d/code/server/sceneBodies.js';
|
|
14
14
|
import * as Hub from './hub.js';
|
|
15
|
+
import { batchFrames } from './frameBatch.js';
|
|
16
|
+
import { limitCallbacks } from './storageLimit.js';
|
|
15
17
|
|
|
16
18
|
// Root-anchored, so these are the deck's files once this kit is imported.
|
|
17
19
|
const castleJson = Object.values(import.meta.glob('/castle.json', { eager: true, import: 'default' }))[0] ?? {};
|
|
@@ -48,17 +50,37 @@ const engine = {
|
|
|
48
50
|
};
|
|
49
51
|
const hub = Hub.layer(castleJson, deckGame, placeHooks, (path) => resolveScenePath(path) === path, sceneGround, devDecks, engine);
|
|
50
52
|
|
|
51
|
-
|
|
52
|
-
...makeSession({
|
|
53
|
+
const callbacks = makeSession({
|
|
53
54
|
label: 'hub',
|
|
54
55
|
poses: Poses,
|
|
55
56
|
world: World,
|
|
56
57
|
players: hubPlayers(hub),
|
|
57
58
|
ownership: Ownership,
|
|
58
59
|
game: hub,
|
|
59
|
-
})
|
|
60
|
+
});
|
|
61
|
+
// Preserve real-time's transport bookkeeping, then finish only an opted-in
|
|
62
|
+
// pose-only visit before a same-tick replacement can hide its departure.
|
|
63
|
+
if (hub.departed) {
|
|
64
|
+
const leave = callbacks.onPlayerLeave;
|
|
65
|
+
callbacks.onPlayerLeave = (session, player) => {
|
|
66
|
+
leave?.(session, player);
|
|
67
|
+
hub.departed(session, player);
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
// v1.138: load-abandoned telemetry sees every connection start and end, and
|
|
71
|
+
// checks its timeout on every tick, even while the simulation is still building.
|
|
72
|
+
if (hub.transportJoin) {
|
|
73
|
+
const { onPlayerJoin: join, onPlayerLeave: leave, onTick: tick } = callbacks;
|
|
74
|
+
callbacks.onPlayerJoin = (session, player) => { join?.(session, player); hub.transportJoin(session, player); };
|
|
75
|
+
callbacks.onPlayerLeave = (session, player) => { leave?.(session, player); hub.transportLeave(session, player); };
|
|
76
|
+
callbacks.onTick = (session) => { tick?.(session); hub.transportTick(session); };
|
|
77
|
+
}
|
|
78
|
+
// v1.144: every callback sees one session whose storage, hub and character
|
|
79
|
+
// requests queue under the host broker's in-flight cap (storageLimit.js).
|
|
80
|
+
export default limitCallbacks({
|
|
81
|
+
...batchFrames(callbacks, castleJson.hub?.frameBatch === true),
|
|
60
82
|
// A place's NPCs answer the shared-character requests of a session the host
|
|
61
83
|
// brokers the place's characters into (a layer of the place, or a world
|
|
62
84
|
// joined through its `npcs.route`); the platform calls these only there.
|
|
63
85
|
...hub.worldCharacters,
|
|
64
|
-
};
|
|
86
|
+
});
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
// v1.95: a place can ask its own player's trusted host for a link. v1.103's
|
|
2
|
+
// optional share flag is presentation intent; no token, destination or text crosses.
|
|
3
|
+
export function request(h, playerId, options = undefined) {
|
|
4
|
+
if (h.place.invite !== true) {throw new TypeError('hub.invite: this place does not declare invite');}
|
|
5
|
+
if (typeof playerId !== 'string') {throw new TypeError('hub.invite: playerId must be a string');}
|
|
6
|
+
if (options !== undefined && (options === null || typeof options !== 'object' ||
|
|
7
|
+
![Object.prototype, null].includes(Object.getPrototypeOf(options)) ||
|
|
8
|
+
!Reflect.ownKeys(options).every((key) => key === 'share') ||
|
|
9
|
+
(Object.hasOwn(options, 'share') && typeof options.share !== 'boolean'))) {
|
|
10
|
+
throw new TypeError('hub.invite: options must contain only an optional boolean share');
|
|
11
|
+
}
|
|
12
|
+
const p = h.players.get(playerId);
|
|
13
|
+
if (!p?.arrived || p.ended || !h.sim?.players.has(playerId)) {return false;}
|
|
14
|
+
const now = h.sim.timeMs, budget = (h.inviteAt ??= new Map());
|
|
15
|
+
if (now - (budget.get(playerId) ?? -Infinity) < 1000) {return false;}
|
|
16
|
+
budget.set(playerId, now);
|
|
17
|
+
h.session?.send(playerId, { k: 'hub-invite', ...(options?.share === true ? { share: true } : {}) });
|
|
18
|
+
return true;
|
|
19
|
+
}
|
|
@@ -17,7 +17,7 @@ const SPEECH_MAX = 240;
|
|
|
17
17
|
// the whole metre and only when finite and not negative; `distance: false`
|
|
18
18
|
// has it show none. Anything else, and any other style, is a label as before.
|
|
19
19
|
// v1.81: `edge: false` makes a goal a hint, drawn only over its actor.
|
|
20
|
-
export function setLabel(h, actorId, text, { style = 'tag', ttlMs, to, about, distanceM, distance, edge } = {}, npc) {
|
|
20
|
+
export function setLabel(h, actorId, text, { style = 'tag', ttlMs, to, about, distanceM, distance, edge, at } = {}, npc) {
|
|
21
21
|
if (!actorId) {
|
|
22
22
|
return;
|
|
23
23
|
}
|
|
@@ -31,6 +31,10 @@ export function setLabel(h, actorId, text, { style = 'tag', ttlMs, to, about, di
|
|
|
31
31
|
} else if (goal && typeof distanceM === 'number' && Number.isFinite(distanceM) && distanceM >= 0) {
|
|
32
32
|
shown = { distanceM: Math.round(distanceM) };
|
|
33
33
|
}
|
|
34
|
+
// Coordinates travel only on a private goal, never in shared actor poses.
|
|
35
|
+
const position = goal && at && ['x', 'y', 'z'].every((key) => Number.isFinite(at[key])) &&
|
|
36
|
+
Math.abs(at.x) <= 200 && Math.abs(at.z) <= 200 && at.y >= -30 && at.y <= 80
|
|
37
|
+
? { x: at.x, y: at.y, z: at.z } : null;
|
|
34
38
|
const label = clear
|
|
35
39
|
? null
|
|
36
40
|
: {
|
|
@@ -44,6 +48,7 @@ export function setLabel(h, actorId, text, { style = 'tag', ttlMs, to, about, di
|
|
|
44
48
|
npc: Boolean(npc && speech),
|
|
45
49
|
...(typeof about === 'string' ? { about } : {}),
|
|
46
50
|
...shown,
|
|
51
|
+
...(position ? { at: position } : {}),
|
|
47
52
|
...(goal && edge === false ? { edge: false } : {}),
|
|
48
53
|
};
|
|
49
54
|
if (!targets) {
|
|
@@ -80,6 +85,9 @@ export function wireLabel(label) {
|
|
|
80
85
|
if (label.edge === false) {
|
|
81
86
|
wire.edge = false;
|
|
82
87
|
}
|
|
88
|
+
if (label.at) {
|
|
89
|
+
wire.at = { ...label.at };
|
|
90
|
+
}
|
|
83
91
|
return wire;
|
|
84
92
|
}
|
|
85
93
|
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
// v1.138 kind 27 load_abandoned: a town connection that never arrived. Only a
|
|
2
|
+
// main place with analytics, analyticsV111 and loadTelemetry keeps any state.
|
|
3
|
+
// Connections start and end at the transport's own join and leave callbacks
|
|
4
|
+
// (`code/server/index.js`), never by sampling the roster, so a leave and rejoin
|
|
5
|
+
// of one player id between two ticks is two connections. The timeout check runs
|
|
6
|
+
// on every transport tick, before the simulation exists too. A connection emits
|
|
7
|
+
// at most once: closed (it left before arriving) or timeout (still here, not
|
|
8
|
+
// arrived, LOAD_ABANDON_TIMEOUT_MS after it joined). A timeout suppresses the
|
|
9
|
+
// later close; an arrival suppresses both.
|
|
10
|
+
import { LOAD_STAGES, CLIENT_LOAD_STAGES, LOAD_REASONS } from '../shared/loadStages.js';
|
|
11
|
+
export { LOAD_STAGES, CLIENT_LOAD_STAGES, LOAD_REASONS };
|
|
12
|
+
|
|
13
|
+
export const LOAD_ABANDONED_KIND = 27;
|
|
14
|
+
export const LOAD_ABANDON_TIMEOUT_MS = 30000;
|
|
15
|
+
// Ghost refuses a longer value; the timeout fires long before it.
|
|
16
|
+
export const LOAD_ABANDON_MAX_MS = 120000;
|
|
17
|
+
// A browser report sooner than this after the previous one is ignored.
|
|
18
|
+
export const LOAD_REPORT_INTERVAL_MS = 1000;
|
|
19
|
+
|
|
20
|
+
export function enabled(h) {
|
|
21
|
+
return h.place?.analytics === true && h.place.analyticsV111 === true && h.place.loadTelemetry === true && !h.manifest?.house;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
function loads(h) {
|
|
25
|
+
if (h.loads?.session !== h.session) {h.loads = { session: h.session, players: new Map() };}
|
|
26
|
+
return h.loads.players;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
function emit(h, playerId, load, result, now) {
|
|
30
|
+
load.done = true;
|
|
31
|
+
const value = Math.max(0, Math.min(LOAD_ABANDON_MAX_MS, Math.round(now - load.at)));
|
|
32
|
+
try {
|
|
33
|
+
const pending = h.session?.hub?.track?.(playerId, { kind: LOAD_ABANDONED_KIND, subject: load.stage, value, result, flags: 0 });
|
|
34
|
+
pending?.catch?.(() => {});
|
|
35
|
+
return pending !== undefined && pending !== false;
|
|
36
|
+
} catch {return false;}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
// The furthest stage the server can see now; never lowers a recorded one.
|
|
40
|
+
function observe(h, playerId, load) {
|
|
41
|
+
const entry = h.players.get(playerId);
|
|
42
|
+
if (entry?.hello) {load.stage = Math.max(load.stage, LOAD_STAGES.hello);}
|
|
43
|
+
if (entry?.hello && h.sim?.players?.has(playerId)) {load.stage = Math.max(load.stage, LOAD_STAGES.body);}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
// Transport join: always a new connection. A record the transport never closed
|
|
47
|
+
// belongs to a connection that is gone, so it ends as closed first. A player
|
|
48
|
+
// the place still has arrived (a kept resume) is not loading.
|
|
49
|
+
export function join(h, session, playerId, now = Date.now()) {
|
|
50
|
+
h.session ??= session;
|
|
51
|
+
if (!enabled(h) || typeof playerId !== 'string') {return;}
|
|
52
|
+
const all = loads(h);
|
|
53
|
+
const old = all.get(playerId);
|
|
54
|
+
if (old && !old.done) {emit(h, playerId, old, LOAD_REASONS.closed, now);}
|
|
55
|
+
all.set(playerId, h.players.get(playerId)?.arrived ? { done: true } : { at: now, stage: LOAD_STAGES.connected, done: false });
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
// Transport leave: the connection ends here, whatever the next tick sees.
|
|
59
|
+
export function leave(h, playerId, now = Date.now()) {
|
|
60
|
+
if (!enabled(h) || !h.loads || h.loads.session !== h.session) {return;}
|
|
61
|
+
const all = h.loads.players, load = all.get(playerId);
|
|
62
|
+
if (!load) {return;}
|
|
63
|
+
all.delete(playerId);
|
|
64
|
+
if (load.done) {return;}
|
|
65
|
+
observe(h, playerId, load);
|
|
66
|
+
if (!h.players.get(playerId)?.arrived) {emit(h, playerId, load, LOAD_REASONS.closed, now);}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
// A hub-hello is a stage the moment it is received, before any reconcile can
|
|
70
|
+
// forget the player.
|
|
71
|
+
export function hello(h, playerId) {
|
|
72
|
+
const load = enabled(h) ? h.loads?.players.get(playerId) : undefined;
|
|
73
|
+
if (load && !load.done && h.loads.session === h.session) {load.stage = Math.max(load.stage, LOAD_STAGES.hello);}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
// Every transport tick, simulation or not.
|
|
77
|
+
export function tick(h, now = Date.now()) {
|
|
78
|
+
if (!enabled(h)) {
|
|
79
|
+
delete h.loads;
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
for (const [playerId, load] of loads(h)) {
|
|
83
|
+
if (load.done) {continue;}
|
|
84
|
+
if (h.players.get(playerId)?.arrived) {
|
|
85
|
+
load.done = true;
|
|
86
|
+
continue;
|
|
87
|
+
}
|
|
88
|
+
observe(h, playerId, load);
|
|
89
|
+
if (now - load.at >= LOAD_ABANDON_TIMEOUT_MS) {emit(h, playerId, load, LOAD_REASONS.timeout, now);}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
// `{ k: 'hub-load', stage }` from an authenticated connection. Untrusted: only
|
|
94
|
+
// a client stage, only a raise, rate limited, never text.
|
|
95
|
+
export function message(h, session, player, data, now = Date.now()) {
|
|
96
|
+
const playerId = player?.playerId;
|
|
97
|
+
if (!enabled(h) || !session?.players?.some((p) => p.playerId === playerId) ||
|
|
98
|
+
Object.keys(data).some((key) => key !== 'k' && key !== 'stage') ||
|
|
99
|
+
!CLIENT_LOAD_STAGES.includes(data.stage)) {return false;}
|
|
100
|
+
h.session ??= session;
|
|
101
|
+
const load = h.loads?.session === h.session ? h.loads.players.get(playerId) : undefined;
|
|
102
|
+
if (!load || load.done || data.stage <= load.stage || (load.reportAt !== undefined && now - load.reportAt < LOAD_REPORT_INTERVAL_MS)) {return false;}
|
|
103
|
+
load.reportAt = now;
|
|
104
|
+
load.stage = data.stage;
|
|
105
|
+
return true;
|
|
106
|
+
}
|
|
@@ -8,9 +8,10 @@
|
|
|
8
8
|
// field filled with its default.
|
|
9
9
|
|
|
10
10
|
import { readUnlocks } from './earned.js';
|
|
11
|
+
import { readQuality } from '../shared/quality.js';
|
|
11
12
|
import { readDecor } from './decor.js';
|
|
12
13
|
|
|
13
|
-
// Manifest/wire major stays 1; latest optional contract additions are v1.
|
|
14
|
+
// Manifest/wire major stays 1; latest optional contract additions are v1.128.
|
|
14
15
|
export const CONTRACT_VERSION = 1;
|
|
15
16
|
|
|
16
17
|
export const CONTROLLERS = ['walk'];
|
|
@@ -65,6 +66,7 @@ export const BALLOT_LINE_MAX = 40;
|
|
|
65
66
|
export const BALLOT_ABOUT = ['face', 'self'];
|
|
66
67
|
|
|
67
68
|
const PLACE_KEYS = [
|
|
69
|
+
'push',
|
|
68
70
|
'title',
|
|
69
71
|
'scene',
|
|
70
72
|
'minPlayers',
|
|
@@ -83,12 +85,27 @@ const PLACE_KEYS = [
|
|
|
83
85
|
'hud',
|
|
84
86
|
'decor',
|
|
85
87
|
'actions',
|
|
88
|
+
'anonymousEntry',
|
|
89
|
+
'invite',
|
|
86
90
|
'companion',
|
|
87
91
|
'ask',
|
|
88
92
|
'menu',
|
|
89
93
|
'ballot',
|
|
90
94
|
'resume',
|
|
95
|
+
'resumeVisibility',
|
|
96
|
+
'resumePose',
|
|
97
|
+
'resumeArrivalPose',
|
|
98
|
+
'houseResume',
|
|
99
|
+
'freshFriends',
|
|
100
|
+
'under13Choices',
|
|
101
|
+
'talkLog',
|
|
91
102
|
'visibility',
|
|
103
|
+
'analytics',
|
|
104
|
+
'analyticsV111',
|
|
105
|
+
'fpsTelemetry',
|
|
106
|
+
'loadTelemetry',
|
|
107
|
+
|
|
108
|
+
'analyticsRounds',
|
|
92
109
|
];
|
|
93
110
|
// `tiers` is the deck's, not a place's: the client's picture on a slow device
|
|
94
111
|
// (v1.21, `code/client/tiers.js`). The server reads nothing of it.
|
|
@@ -113,7 +130,7 @@ export const SOUNDSCAPE_SURFACES = ['grass', 'street', 'wood', 'stone', 'sand',
|
|
|
113
130
|
// `unlocks` is the deck's (v1.53): the earned items its places may give
|
|
114
131
|
// (`earned.js`). The manifest carries it only when declared, so a deck
|
|
115
132
|
// without it reads as before.
|
|
116
|
-
const TOP_KEYS = ['contract', 'places', 'interest', 'tiers', 'companionIdle', 'lowActorBudget', 'lowActorDistance', 'cues', 'stuck', 'yourGames', 'avatarColors', 'labels', 'soundscape', 'unlocks', 'house', ...PLACE_KEYS];
|
|
133
|
+
const TOP_KEYS = ['firstVisit', 'act', 'bringFriend', 'frameBatch', 'defaultEnvironment', 'weakestTier', 'highOnly', 'weakestLookBake', 'pongTimeoutMs', 'contract', 'places', 'interest', 'tiers', 'quality', 'companionIdle', 'lowActorBudget', 'lowActorDistance', 'mergeFarAvatars', 'playOnlyEntry', 'loadTimings', 'loadingCover', 'cues', 'playCards', 'stuck', 'yourGames', 'avatarColors', 'labels', 'safeInsets', 'soundscape', 'unlocks', 'house', 'weeklyCup', ...PLACE_KEYS];
|
|
117
134
|
|
|
118
135
|
const DEFAULT_SCENE = 'scenes/main.scene';
|
|
119
136
|
|
|
@@ -123,6 +140,9 @@ export function readManifest(castleJson, sceneExists = () => true) {
|
|
|
123
140
|
if (!isObject(hub)) {
|
|
124
141
|
return { errors: ['castle.json has no `hub` block: a hub-game deck declares one.'], manifest: null };
|
|
125
142
|
}
|
|
143
|
+
if (Object.hasOwn(hub, 'frameBatch') && hub.frameBatch !== true) {
|
|
144
|
+
errors.push('hub.frameBatch must be true or absent.');
|
|
145
|
+
}
|
|
126
146
|
if (hub.contract !== CONTRACT_VERSION) {
|
|
127
147
|
errors.push(
|
|
128
148
|
Number.isInteger(hub.contract) && hub.contract > CONTRACT_VERSION
|
|
@@ -131,6 +151,29 @@ export function readManifest(castleJson, sceneExists = () => true) {
|
|
|
131
151
|
);
|
|
132
152
|
}
|
|
133
153
|
unknownKeys(hub, TOP_KEYS, 'hub', errors);
|
|
154
|
+
if (hub.firstVisit !== undefined) {
|
|
155
|
+
const value = hub.firstVisit;
|
|
156
|
+
if (!isObject(value)) {errors.push('hub.firstVisit must be { live: [...] }.');}
|
|
157
|
+
else {
|
|
158
|
+
unknownKeys(value, ['live'], 'hub.firstVisit', errors);
|
|
159
|
+
if (!Array.isArray(value.live) || !value.live.length || value.live.length > 3 ||
|
|
160
|
+
value.live.some((v) => !['home', 'door', 'npc'].includes(v)) || new Set(value.live).size !== value.live.length) {
|
|
161
|
+
errors.push('hub.firstVisit.live must contain one to three unique variants: home, door, npc.');
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
if (Object.hasOwn(hub, 'bringFriend') && (hub.bringFriend !== true || hub.invite !== true)) {
|
|
166
|
+
errors.push('hub.bringFriend must be true or absent and requires hub.invite: true.');
|
|
167
|
+
}
|
|
168
|
+
if (hub.pongTimeoutMs !== undefined && (!Number.isInteger(hub.pongTimeoutMs) || hub.pongTimeoutMs < 0 || hub.pongTimeoutMs > 2_147_483_647)) {
|
|
169
|
+
errors.push('hub.pongTimeoutMs must be an integer from 0 through 2147483647.');
|
|
170
|
+
}
|
|
171
|
+
// Rendering and diagnostics flags are client-only, like the tier keys.
|
|
172
|
+
for (const key of ['defaultEnvironment', 'weakestTier', 'highOnly', 'weakestLookBake', 'mergeFarAvatars', 'playOnlyEntry', 'loadTimings']) {
|
|
173
|
+
if (hub[key] !== undefined && typeof hub[key] !== 'boolean') {
|
|
174
|
+
errors.push(`hub.${key} must be true or false.`);
|
|
175
|
+
}
|
|
176
|
+
}
|
|
134
177
|
if (hub.lowActorDistance !== undefined && typeof hub.lowActorDistance !== 'boolean') {
|
|
135
178
|
errors.push('hub.lowActorDistance must be true or false.');
|
|
136
179
|
}
|
|
@@ -140,12 +183,25 @@ export function readManifest(castleJson, sceneExists = () => true) {
|
|
|
140
183
|
if (hub.companionIdle !== undefined && typeof hub.companionIdle !== 'boolean') {
|
|
141
184
|
errors.push('hub.companionIdle must be true or false.');
|
|
142
185
|
}
|
|
186
|
+
if (hub.safeInsets !== undefined && typeof hub.safeInsets !== 'boolean') {
|
|
187
|
+
errors.push('hub.safeInsets must be true or false.');
|
|
188
|
+
}
|
|
143
189
|
if (hub.tiers !== undefined && typeof hub.tiers !== 'boolean') {
|
|
144
190
|
errors.push('hub.tiers must be true or false.');
|
|
145
191
|
}
|
|
192
|
+
if (hub.highOnly !== undefined && hub.tiers !== true) {
|
|
193
|
+
errors.push('hub.highOnly requires hub.tiers: true.');
|
|
194
|
+
}
|
|
195
|
+
const quality = readQuality(hub.quality, hub.tiers, errors);
|
|
146
196
|
if (hub.cues !== undefined && typeof hub.cues !== 'boolean') {
|
|
147
197
|
errors.push('hub.cues must be true or false.');
|
|
148
198
|
}
|
|
199
|
+
if (hub.loadingCover !== undefined && typeof hub.loadingCover !== 'boolean') {
|
|
200
|
+
errors.push('hub.loadingCover must be true or false.');
|
|
201
|
+
}
|
|
202
|
+
if (hub.playCards !== undefined && typeof hub.playCards !== 'boolean') {
|
|
203
|
+
errors.push('hub.playCards must be true or false.');
|
|
204
|
+
}
|
|
149
205
|
if (hub.yourGames !== undefined && typeof hub.yourGames !== 'boolean') {
|
|
150
206
|
errors.push('hub.yourGames must be true or false.');
|
|
151
207
|
}
|
|
@@ -155,6 +211,9 @@ export function readManifest(castleJson, sceneExists = () => true) {
|
|
|
155
211
|
if (hub.stuck !== undefined && typeof hub.stuck !== 'boolean') {
|
|
156
212
|
errors.push('hub.stuck must be true or false.');
|
|
157
213
|
}
|
|
214
|
+
if (hub.weeklyCup !== undefined && typeof hub.weeklyCup !== 'boolean') {
|
|
215
|
+
errors.push('hub.weeklyCup must be true or false.');
|
|
216
|
+
}
|
|
158
217
|
if (hub.labels !== undefined && hub.labels !== 'near') {
|
|
159
218
|
errors.push('hub.labels must be "near" (or left out).');
|
|
160
219
|
}
|
|
@@ -174,6 +233,7 @@ export function readManifest(castleJson, sceneExists = () => true) {
|
|
|
174
233
|
}
|
|
175
234
|
}
|
|
176
235
|
}
|
|
236
|
+
if (hub.act !== undefined && typeof hub.act !== 'boolean') {errors.push('hub.act must be true or false.');}
|
|
177
237
|
const soundscape = readSoundscape(hub.soundscape, errors);
|
|
178
238
|
const unlocks = readUnlocks(hub.unlocks, errors);
|
|
179
239
|
const defaultScene =
|
|
@@ -181,6 +241,7 @@ export function readManifest(castleJson, sceneExists = () => true) {
|
|
|
181
241
|
const serverMax = Number.isInteger(castleJson?.server?.maxPlayers) ? castleJson.server.maxPlayers : MAX_PLAYERS_CAP;
|
|
182
242
|
const destinations = Array.isArray(castleJson?.server?.destinations) ? castleJson.server.destinations : [];
|
|
183
243
|
const bundle = castleJson?.characterBundle ?? null;
|
|
244
|
+
validateChildAsks(bundle, errors);
|
|
184
245
|
|
|
185
246
|
const places = {};
|
|
186
247
|
places[MAIN_PLACE] = readPlace(hub, 'hub', defaultScene, serverMax, sceneExists, errors, destinations, bundle, hub.interest);
|
|
@@ -206,7 +267,14 @@ export function readManifest(castleJson, sceneExists = () => true) {
|
|
|
206
267
|
}
|
|
207
268
|
}
|
|
208
269
|
}
|
|
209
|
-
|
|
270
|
+
if (hub.act === true) {
|
|
271
|
+
for (const place of Object.values(places)) {
|
|
272
|
+
place.act = true;
|
|
273
|
+
place.grab ??= { ...GRAB_DEFAULTS };
|
|
274
|
+
place.idle = { emotes: false, sounds: [], ...place.idle, seats: true };
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
return errors.length ? { errors, manifest: null } : { errors, manifest: { contract: CONTRACT_VERSION, ...(quality ? { quality } : {}), ...(hub.act === true ? { act: true } : {}), cues: hub.cues === true, ...(hub.yourGames === true ? { yourGames: true } : {}), ...(hub.avatarColors === true ? { avatarColors: true } : {}), ...(hub.stuck === true ? { stuck: true } : {}), ...(hub.weeklyCup === true ? { weeklyCup: true } : {}), ...(soundscape ? { soundscape } : {}), ...(unlocks ? { unlocks } : {}), ...(house ? { house } : {}), ...(ballot ? { ballot: true } : {}), places } };
|
|
210
278
|
}
|
|
211
279
|
|
|
212
280
|
// `hub.soundscape`: its parts where it is on, null where it is left out or
|
|
@@ -343,6 +411,12 @@ function readPlace(block, where, defaultScene, serverMax, sceneExists, errors, d
|
|
|
343
411
|
}
|
|
344
412
|
|
|
345
413
|
place.lateJoin = block.lateJoin ?? false;
|
|
414
|
+
if (block.push !== undefined) {
|
|
415
|
+
if (!block.push || typeof block.push !== 'object' || Array.isArray(block.push) ||
|
|
416
|
+
Object.keys(block.push).join(',') !== 'version' || block.push.version !== 1) {
|
|
417
|
+
errors.push(`${where}.push must be { version: 1 } or absent.`);
|
|
418
|
+
} else {place.push = { version: 1 };}
|
|
419
|
+
}
|
|
346
420
|
if (typeof place.lateJoin !== 'boolean') {
|
|
347
421
|
errors.push(`${where}.lateJoin must be true or false.`);
|
|
348
422
|
}
|
|
@@ -405,6 +479,32 @@ function readPlace(block, where, defaultScene, serverMax, sceneExists, errors, d
|
|
|
405
479
|
if (decor) {
|
|
406
480
|
place.decor = decor;
|
|
407
481
|
}
|
|
482
|
+
if (Object.hasOwn(block, 'analytics')) {
|
|
483
|
+
if (block.analytics !== true || where !== 'hub') {errors.push(`${where}.analytics is main-place only and must be true or absent.`);}
|
|
484
|
+
else {place.analytics = true;}
|
|
485
|
+
}
|
|
486
|
+
if (Object.hasOwn(block, 'fpsTelemetry')) {
|
|
487
|
+
const fps = block.fpsTelemetry;
|
|
488
|
+
if (where !== 'hub' || block.analytics !== true || !isObject(fps) ||
|
|
489
|
+
Object.keys(fps).some((key) => !['buildSha', 'scene'].includes(key)) ||
|
|
490
|
+
typeof fps.buildSha !== 'string' || !/^[0-9a-f]{40}$/.test(fps.buildSha) || typeof fps.scene !== 'string' || !/^[a-zA-Z0-9_./-]{1,160}$/.test(fps.scene) || fps.scene !== place.scene) {
|
|
491
|
+
errors.push(`${where}.fpsTelemetry requires analytics, a full buildSha and the main scene.`);
|
|
492
|
+
} else {place.fpsTelemetry = { buildSha: fps.buildSha, scene: fps.scene };}
|
|
493
|
+
}
|
|
494
|
+
if (Object.hasOwn(block, 'analyticsRounds')) {
|
|
495
|
+
if (block.analyticsRounds !== 'authored') {errors.push(`${where}.analyticsRounds must be authored or absent.`);}
|
|
496
|
+
else {place.analyticsRounds = 'authored';}
|
|
497
|
+
}
|
|
498
|
+
if (Object.hasOwn(block, 'analyticsV111')) {
|
|
499
|
+
if (block.analyticsV111 !== true || where !== 'hub') {errors.push(`${where}.analyticsV111 is main-place only and must be true or absent.`);}
|
|
500
|
+
else if (block.analytics !== true) {errors.push(`${where}.analyticsV111 requires analytics: true.`);}
|
|
501
|
+
else {place.analyticsV111 = true;}
|
|
502
|
+
}
|
|
503
|
+
if (Object.hasOwn(block, 'loadTelemetry')) {
|
|
504
|
+
if (block.loadTelemetry !== true || where !== 'hub') {errors.push(`${where}.loadTelemetry is main-place only and must be true or absent.`);}
|
|
505
|
+
else if (block.analytics !== true || block.analyticsV111 !== true) {errors.push(`${where}.loadTelemetry requires analytics: true and analyticsV111: true.`);}
|
|
506
|
+
else {place.loadTelemetry = true;}
|
|
507
|
+
}
|
|
408
508
|
if (Object.hasOwn(block, 'visibility')) {
|
|
409
509
|
if (block.visibility !== true) {
|
|
410
510
|
errors.push(`${where}.visibility must be true or absent.`);
|
|
@@ -412,6 +512,13 @@ function readPlace(block, where, defaultScene, serverMax, sceneExists, errors, d
|
|
|
412
512
|
place.visibility = true;
|
|
413
513
|
}
|
|
414
514
|
}
|
|
515
|
+
if (Object.hasOwn(block, 'anonymousEntry')) {
|
|
516
|
+
if (block.anonymousEntry !== true) {
|
|
517
|
+
errors.push(`${where}.anonymousEntry must be true or absent.`);
|
|
518
|
+
} else {
|
|
519
|
+
place.anonymousEntry = true;
|
|
520
|
+
}
|
|
521
|
+
}
|
|
415
522
|
if (Object.hasOwn(block, 'actions')) {
|
|
416
523
|
if (block.actions !== true) {
|
|
417
524
|
errors.push(`${where}.actions must be true or absent.`);
|
|
@@ -419,6 +526,10 @@ function readPlace(block, where, defaultScene, serverMax, sceneExists, errors, d
|
|
|
419
526
|
place.actions = true;
|
|
420
527
|
}
|
|
421
528
|
}
|
|
529
|
+
if (Object.hasOwn(block, 'invite')) {
|
|
530
|
+
if (block.invite !== true) {errors.push(`${where}.invite must be true or absent.`);}
|
|
531
|
+
else {place.invite = true;}
|
|
532
|
+
}
|
|
422
533
|
if (Object.hasOwn(block, 'companion')) {
|
|
423
534
|
if (block.companion === true) {
|
|
424
535
|
place.companion = true;
|
|
@@ -467,6 +578,61 @@ function readPlace(block, where, defaultScene, serverMax, sceneExists, errors, d
|
|
|
467
578
|
}
|
|
468
579
|
}
|
|
469
580
|
}
|
|
581
|
+
// Private visibility is retained only by the bounded 60-second result-place
|
|
582
|
+
// keep mode. It remains server-only and adds no public place or wire field.
|
|
583
|
+
if (Object.hasOwn(block, 'resumeVisibility')) {
|
|
584
|
+
if (block.resumeVisibility !== true) {
|
|
585
|
+
errors.push(`${where}.resumeVisibility must be true or absent.`);
|
|
586
|
+
} else if (place.resumeKeep !== true) {
|
|
587
|
+
errors.push(`${where}.resumeVisibility requires resume: { keep: true }.`);
|
|
588
|
+
} else {
|
|
589
|
+
place.resumeVisibility = true;
|
|
590
|
+
}
|
|
591
|
+
}
|
|
592
|
+
// v1.98: town pose retention never changes result-place resume semantics.
|
|
593
|
+
if (Object.hasOwn(block, 'resumePose')) {
|
|
594
|
+
if (block.resumePose !== true) {
|
|
595
|
+
errors.push(`${where}.resumePose must be true or absent.`);
|
|
596
|
+
} else if (place.result) {
|
|
597
|
+
errors.push(`${where}.resumePose is only for a place without a result.`);
|
|
598
|
+
} else {
|
|
599
|
+
place.resumePose = true;
|
|
600
|
+
}
|
|
601
|
+
}
|
|
602
|
+
// v1.115: owner-house transport opt-in; Ghost alone grants the owner binding.
|
|
603
|
+
if (Object.hasOwn(block, 'houseResume')) {
|
|
604
|
+
if (block.houseResume !== true) {
|
|
605
|
+
errors.push(`${where}.houseResume must be true or absent.`);
|
|
606
|
+
} else if (place.result) {
|
|
607
|
+
errors.push(`${where}.houseResume is only for a place without a result.`);
|
|
608
|
+
} else {
|
|
609
|
+
place.houseResume = true;
|
|
610
|
+
}
|
|
611
|
+
}
|
|
612
|
+
// v1.99: private relationship freshness is per place and server-only.
|
|
613
|
+
if (Object.hasOwn(block, 'freshFriends')) {
|
|
614
|
+
if (block.freshFriends !== true) {
|
|
615
|
+
errors.push(`${where}.freshFriends must be true or absent.`);
|
|
616
|
+
} else {
|
|
617
|
+
place.freshFriends = true;
|
|
618
|
+
}
|
|
619
|
+
}
|
|
620
|
+
// v1.101: the trusted age stamp only changes opted-in NPC conversations.
|
|
621
|
+
if (Object.hasOwn(block, 'talkLog')) {
|
|
622
|
+
if (block.talkLog !== true) {
|
|
623
|
+
errors.push(`${where}.talkLog must be true or absent.`);
|
|
624
|
+
} else {
|
|
625
|
+
place.talkLog = true;
|
|
626
|
+
}
|
|
627
|
+
}
|
|
628
|
+
|
|
629
|
+
if (Object.hasOwn(block, 'under13Choices')) {
|
|
630
|
+
if (block.under13Choices !== true) {
|
|
631
|
+
errors.push(`${where}.under13Choices must be true or absent.`);
|
|
632
|
+
} else {
|
|
633
|
+
place.under13Choices = true;
|
|
634
|
+
}
|
|
635
|
+
}
|
|
470
636
|
if (Object.hasOwn(block, 'ask')) {
|
|
471
637
|
if (block.ask !== true) {
|
|
472
638
|
errors.push(`${where}.ask must be true or absent.`);
|
|
@@ -488,6 +654,18 @@ function readPlace(block, where, defaultScene, serverMax, sceneExists, errors, d
|
|
|
488
654
|
place.ballot = ballot;
|
|
489
655
|
}
|
|
490
656
|
}
|
|
657
|
+
// v1.117: keep only pose; ordinary leave/arrive own the visit lifecycle.
|
|
658
|
+
if (Object.hasOwn(block, 'resumeArrivalPose')) {
|
|
659
|
+
if (block.resumeArrivalPose !== true) {
|
|
660
|
+
errors.push(`${where}.resumeArrivalPose must be true or absent.`);
|
|
661
|
+
} else if (place.resumeKeep || place.resumePose || place.houseResume) {
|
|
662
|
+
errors.push(`${where}.resumeArrivalPose cannot combine with retained-visit modes.`);
|
|
663
|
+
} else if (place.result && place.resume !== true) {
|
|
664
|
+
errors.push(`${where}.resumeArrivalPose requires resume: true on a result place.`);
|
|
665
|
+
} else {
|
|
666
|
+
place.resumeArrivalPose = true;
|
|
667
|
+
}
|
|
668
|
+
}
|
|
491
669
|
return place;
|
|
492
670
|
}
|
|
493
671
|
|
|
@@ -684,6 +862,29 @@ export function readNpcTurnsAtOnce(value, fallback = 1, where = 'HubNpc.turnsAtO
|
|
|
684
862
|
return value;
|
|
685
863
|
}
|
|
686
864
|
|
|
865
|
+
// v1.142: optional published chips; ghost remains the publish authority.
|
|
866
|
+
function validateChildAsks(bundle, errors) {
|
|
867
|
+
for (const [index, character] of (Array.isArray(bundle?.characters) ? bundle.characters : []).entries()) {
|
|
868
|
+
if (character?.childAsks === undefined) {continue;}
|
|
869
|
+
const where = `characterBundle.characters[${index}].childAsks`;
|
|
870
|
+
const asks = character.childAsks;
|
|
871
|
+
if (!Array.isArray(asks) || asks.length < 3 || asks.length > 4) {
|
|
872
|
+
errors.push(`${where} must have 3-4 choices.`);
|
|
873
|
+
continue;
|
|
874
|
+
}
|
|
875
|
+
const ids = new Set();
|
|
876
|
+
for (const ask of asks) {
|
|
877
|
+
if (!isObject(ask) || typeof ask.id !== 'string' || !ask.id.trim() || ids.has(ask.id)
|
|
878
|
+
|| typeof ask.label !== 'string' || !ask.label.trim() || ask.label.length > 40
|
|
879
|
+
|| typeof ask.prompt !== 'string' || !ask.prompt.trim() || ask.prompt.length > 300) {
|
|
880
|
+
errors.push(`${where} needs unique non-empty ids, labels of 1-40 characters and prompts of 1-300 characters.`);
|
|
881
|
+
break;
|
|
882
|
+
}
|
|
883
|
+
ids.add(ask.id);
|
|
884
|
+
}
|
|
885
|
+
}
|
|
886
|
+
}
|
|
887
|
+
|
|
687
888
|
// Where a place's NPC minds live (§13): the place itself (every layer talks
|
|
688
889
|
// to ghost's one place mind), optionally a destination route whose world an
|
|
689
890
|
// older SDK joins instead, and how much conversation each character takes.
|
|
@@ -916,11 +1117,16 @@ export function checkResult(place, value) {
|
|
|
916
1117
|
// draws from, and nothing it does not need.
|
|
917
1118
|
export function publicPlace(id, place) {
|
|
918
1119
|
return {
|
|
1120
|
+
...(place.push?.version === 1 ? { push: { version: 1 } } : {}),
|
|
919
1121
|
contract: CONTRACT_VERSION,
|
|
920
1122
|
id,
|
|
1123
|
+
...(place.act === true ? { act: true } : {}),
|
|
921
1124
|
title: place.title,
|
|
922
1125
|
scene: place.scene,
|
|
923
1126
|
controller: place.controller,
|
|
1127
|
+
...(place.fpsTelemetry ? { fpsTelemetry: { ...place.fpsTelemetry } } : {}),
|
|
1128
|
+
// v1.138: only an opted-in town tells its browsers to report load stages.
|
|
1129
|
+
...(place.loadTelemetry === true ? { loadTelemetry: true } : {}),
|
|
924
1130
|
...(place.interest ? { interest: place.interest, nearestPlayers: place.nearestPlayers } : {}),
|
|
925
1131
|
maxDurationSec: place.maxDurationSec,
|
|
926
1132
|
// v1.3: the hub chrome offers Grab only where this is set; a place
|
|
@@ -933,6 +1139,8 @@ export function publicPlace(id, place) {
|
|
|
933
1139
|
...(place.decor ? { decor: place.decor } : {}),
|
|
934
1140
|
...(place.visibility === true ? { visibility: true } : {}),
|
|
935
1141
|
...(place.actions === true ? { actions: true } : {}),
|
|
1142
|
+
...(place.anonymousEntry === true ? { anonymousEntry: true } : {}),
|
|
1143
|
+
...(place.invite === true ? { invite: true } : {}),
|
|
936
1144
|
...(place.companion === true ? { companion: true } : {}),
|
|
937
1145
|
...(place.companionChat ? { companionChat: { name: place.companionChat.name } } : {}),
|
|
938
1146
|
...(place.resume === true ? { resume: true } : {}),
|