castle-web-cli 0.4.232 → 0.4.233
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/castle-host/host.d.ts +1 -0
- package/dist/castle-host/host.js +51 -3
- package/dist/castleJson.d.ts +4 -2
- package/dist/castleJson.js +2 -0
- package/dist/check.d.ts +3 -1
- package/dist/check.js +11 -1
- package/dist/devSessionStorage.js +47 -1
- 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 +5 -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 +5 -0
- package/dist/save-deck.js +37 -4
- package/dist/serve.js +3 -0
- package/dist/shell/assets/{index-D2tWM896.js → index-BjOxR-lW.js} +4 -4
- 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/kits/base/castle.json +1 -1
- package/kits/base/package-lock.json +1 -1
- package/kits/base/sdk/README.md +79 -2
- package/kits/base/sdk/avatar.d.ts +6 -2
- package/kits/base/sdk/avatar.js +12 -4
- package/kits/base/sdk/castle.d.ts +1 -1
- package/kits/base/sdk/commands.d.ts +14 -0
- package/kits/base/sdk/hub.d.ts +6 -2
- package/kits/base/sdk/hub.js +13 -0
- package/kits/base/sdk/multiplayer.js +17 -1
- package/kits/base/sdk/save.js +2 -1
- package/kits/base/sdk/server/hub.d.ts +87 -0
- package/kits/base/sdk/server/hub.js +70 -0
- package/kits/base/sdk/server/platformHandle.d.ts +31 -1
- package/kits/base/sdk/server/storage.d.ts +13 -0
- package/kits/base/sdk/server/storage.js +46 -0
- package/kits/base/sdk/server/wrapper.d.ts +36 -5
- package/kits/base/sdk/server/wrapper.js +83 -8
- package/kits/hub-game/CLAUDE.md +329 -11
- 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/code/client/actorBudget.js +47 -0
- package/kits/hub-game/code/client/attention.js +11 -2
- package/kits/hub-game/code/client/avatar.js +309 -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 +251 -0
- package/kits/hub-game/code/client/ballot.js +467 -0
- package/kits/hub-game/code/client/build.js +22 -0
- package/kits/hub-game/code/client/chrome.js +1144 -50
- 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/decor.js +509 -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/grab.js +339 -20
- package/kits/hub-game/code/client/hookLayer.js +299 -13
- package/kits/hub-game/code/client/idle.js +163 -22
- package/kits/hub-game/code/client/interestCap.js +81 -0
- package/kits/hub-game/code/client/keys.js +36 -0
- package/kits/hub-game/code/client/labelsNear.js +205 -0
- package/kits/hub-game/code/client/menuIcons.js +34 -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/rehello.js +167 -0
- package/kits/hub-game/code/client/shot.js +92 -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 +109 -1
- package/kits/hub-game/code/client/stuck.js +259 -0
- package/kits/hub-game/code/client/talk.js +538 -47
- package/kits/hub-game/code/client/tiers.js +516 -27
- package/kits/hub-game/code/client/toastBand.js +37 -0
- package/kits/hub-game/code/client/together.js +32 -0
- package/kits/hub-game/code/client/visibility.js +43 -0
- package/kits/hub-game/code/client/wear.js +461 -170
- package/kits/hub-game/code/client/yours.js +199 -0
- package/kits/hub-game/code/companionSpec.js +45 -0
- package/kits/hub-game/code/privateText.js +7 -0
- package/kits/hub-game/code/server/actions.js +133 -0
- package/kits/hub-game/code/server/actors.js +9 -1
- 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 +82 -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/earned.js +461 -0
- package/kits/hub-game/code/server/friendBests.js +166 -0
- package/kits/hub-game/code/server/friendsAmong.js +232 -0
- package/kits/hub-game/code/server/history.js +5 -0
- package/kits/hub-game/code/server/hub.js +1254 -50
- package/kits/hub-game/code/server/idle.js +30 -11
- package/kits/hub-game/code/server/index.js +2 -2
- package/kits/hub-game/code/server/labels.js +28 -2
- package/kits/hub-game/code/server/manifest.js +378 -7
- package/kits/hub-game/code/server/menu.js +133 -0
- package/kits/hub-game/code/server/npcs.js +830 -80
- package/kits/hub-game/code/server/party.js +2 -2
- package/kits/hub-game/code/server/players.js +22 -0
- package/kits/hub-game/code/server/shot.js +110 -0
- package/kits/hub-game/code/server/standing.js +124 -0
- package/kits/hub-game/code/server/vis.js +113 -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/cues.js +9 -0
- package/kits/hub-game/code/shared/decor.js +41 -0
- package/kits/hub-game/code/shared/shot.js +19 -0
- package/kits/hub-game/code/shared/spin.js +57 -0
- package/kits/hub-game/code/systems/hub.js +845 -95
- package/kits/hub-game/docs/content-pack.md +1 -1
- package/kits/hub-game/docs/contract.md +2244 -61
- package/kits/hub-game/docs/home-pieces.md +64 -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 +2 -0
- package/kits/hub-game/package.json +2 -1
- package/kits/hub-game/scripts/check.mjs +78 -11
- package/kits/hub-game/scripts/companion-follower-wire.json +1 -0
- package/kits/hub-game/scripts/fixtures/decor-keyless-draw.json +121 -0
- package/kits/hub-game/scripts/fixtures/decor-keyless.json +293 -0
- package/kits/hub-game/scripts/fixtures/engine-models-stub.mjs +23 -0
- package/kits/hub-game/scripts/fixtures/fake-dom.mjs +107 -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/soundscape-wave-analysis.mjs +125 -0
- package/kits/hub-game/scripts/test-actions-client.mjs +488 -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 +19 -17
- package/kits/hub-game/scripts/test-ask-client.mjs +358 -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 +753 -0
- package/kits/hub-game/scripts/test-avatar.mjs +540 -7
- package/kits/hub-game/scripts/test-ballot.mjs +1001 -0
- package/kits/hub-game/scripts/test-build.mjs +31 -0
- package/kits/hub-game/scripts/test-cells.mjs +71 -0
- package/kits/hub-game/scripts/test-chat.mjs +662 -0
- package/kits/hub-game/scripts/test-classic.mjs +2 -0
- package/kits/hub-game/scripts/test-companion-chat.mjs +198 -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-decor-client.mjs +303 -0
- package/kits/hub-game/scripts/test-decor.mjs +457 -0
- package/kits/hub-game/scripts/test-earned-client.mjs +459 -0
- package/kits/hub-game/scripts/test-earned.mjs +1194 -0
- package/kits/hub-game/scripts/test-emote-bubble.mjs +110 -0
- package/kits/hub-game/scripts/test-friend-bests.mjs +435 -0
- package/kits/hub-game/scripts/test-grab-orbit.mjs +918 -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-hub-leaving.mjs +203 -0
- package/kits/hub-game/scripts/test-hub-ops.mjs +439 -2
- package/kits/hub-game/scripts/test-hub-trip.mjs +716 -2
- package/kits/hub-game/scripts/test-hud-clear.mjs +328 -4
- package/kits/hub-game/scripts/test-idle.mjs +361 -1
- package/kits/hub-game/scripts/test-interest-cap.mjs +36 -0
- package/kits/hub-game/scripts/test-interest-cells.mjs +493 -0
- package/kits/hub-game/scripts/test-interest-client.mjs +118 -0
- package/kits/hub-game/scripts/test-keys.mjs +46 -1
- package/kits/hub-game/scripts/test-labels.mjs +596 -0
- package/kits/hub-game/scripts/test-manifest.mjs +207 -0
- package/kits/hub-game/scripts/test-menu-client.mjs +480 -0
- package/kits/hub-game/scripts/test-menu.mjs +296 -0
- package/kits/hub-game/scripts/test-npcs.mjs +1718 -12
- package/kits/hub-game/scripts/test-object-entry.mjs +76 -0
- package/kits/hub-game/scripts/test-pack.mjs +7 -0
- package/kits/hub-game/scripts/test-picker.mjs +314 -0
- package/kits/hub-game/scripts/test-rehello.mjs +1039 -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-shot.mjs +756 -0
- package/kits/hub-game/scripts/test-soundscape.mjs +5432 -0
- package/kits/hub-game/scripts/test-spin.mjs +314 -0
- package/kits/hub-game/scripts/test-standing.mjs +416 -0
- package/kits/hub-game/scripts/test-stuck.mjs +1903 -0
- package/kits/hub-game/scripts/test-tier-cells.mjs +706 -0
- package/kits/hub-game/scripts/test-tiers-render.mjs +339 -0
- package/kits/hub-game/scripts/test-tiers.mjs +477 -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 +343 -0
- package/kits/hub-game/scripts/test-visibility.mjs +134 -0
- package/kits/hub-game/scripts/test-yours-chrome.mjs +166 -0
- package/kits/hub-game/scripts/test-yours.mjs +372 -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/nameTags.js +59 -4
- 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 +74 -4
- package/kits/multiplayer-3d/package.json +2 -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-own-name-tag.mjs +247 -0
- package/kits/physics-2d/CLAUDE.md +9 -0
- package/kits/physics-2d/castle.json +2 -2
- package/kits/physics-2d/engine/scene.js +253 -1
- 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/scripts/test-skip-unchanged.mjs +326 -1
- package/kits/physics-3d/CLAUDE.md +1169 -30
- package/kits/physics-3d/behaviors/Player.jsx +629 -72
- package/kits/physics-3d/castle.json +3 -3
- package/kits/physics-3d/docs/pxmodel-format.md +8 -0
- package/kits/physics-3d/engine3d/Scene3DPlayer.jsx +69 -13
- package/kits/physics-3d/engine3d/actornode.js +86 -0
- package/kits/physics-3d/engine3d/animationBudget.js +23 -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 +96 -0
- package/kits/physics-3d/engine3d/gait.js +118 -0
- package/kits/physics-3d/engine3d/kithooks.js +47 -0
- package/kits/physics-3d/engine3d/look.js +507 -48
- package/kits/physics-3d/engine3d/lookbake.js +208 -0
- package/kits/physics-3d/engine3d/materialpresets.js +2 -0
- package/kits/physics-3d/engine3d/motion.js +39 -10
- package/kits/physics-3d/engine3d/nearshadows.js +37 -19
- package/kits/physics-3d/engine3d/optimize.js +9 -5
- package/kits/physics-3d/engine3d/orbitinput.js +487 -9
- package/kits/physics-3d/engine3d/orbitlens.js +48 -0
- package/kits/physics-3d/engine3d/ownmodel.js +213 -0
- package/kits/physics-3d/engine3d/pxmodel.js +42 -11
- package/kits/physics-3d/engine3d/shadowfade.js +882 -0
- package/kits/physics-3d/engine3d/sky.js +547 -0
- package/kits/physics-3d/engine3d/skylife.js +306 -0
- 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 +796 -69
- package/kits/physics-3d/main.jsx +5 -0
- package/kits/physics-3d/package.json +1 -1
- package/kits/physics-3d/scripts/look-baseline.mjs +155 -0
- package/kits/physics-3d/scripts/test-camera-orbit.mjs +2563 -80
- package/kits/physics-3d/scripts/test-drop-empty-parts.mjs +1 -1
- package/kits/physics-3d/scripts/test-frame-cap-bob.mjs +435 -0
- package/kits/physics-3d/scripts/test-frame-cap.mjs +452 -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 +3 -0
- package/kits/physics-3d/scripts/test-orbit-shadow-fade.mjs +1920 -0
- package/kits/physics-3d/scripts/test-orbit-shift-lock.mjs +545 -0
- package/kits/physics-3d/scripts/test-orbit-shot.mjs +583 -0
- package/kits/physics-3d/scripts/test-orbit-view.mjs +230 -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-static-actors.mjs +8 -1
- package/kits/physics-3d/scripts/test-static-scenery.mjs +2171 -0
- package/kits/physics-3d/scripts/test-steady-hover.mjs +2 -0
- package/kits/physics-3d/scripts/test-view-range.mjs +260 -0
- package/kits/physics-3d/systems/physics3d.js +383 -6
- package/kits/real-time/castle.json +2 -2
- package/kits/real-time/code/server/gameHooks.js +7 -0
- package/kits/real-time/code/server/session.js +97 -19
- package/package.json +2 -2
- package/dist/shell/assets/index-Cf61cNfT.css +0 -1
|
@@ -0,0 +1,259 @@
|
|
|
1
|
+
// "Stuck?" (contract v1.33, a deck with `hub.stuck`; the rule below is
|
|
2
|
+
// v1.39's): telling a player who walks and gets nowhere from one who is
|
|
3
|
+
// walking, and where the chip that offers the way out may sit, with no DOM in
|
|
4
|
+
// it so `scripts/test-stuck.mjs` can hold it. The hub system
|
|
5
|
+
// (`systems/hub.js`) makes one only in a deck that asks, and only offers:
|
|
6
|
+
// nobody is ever moved by this -- a player leaning on a wall to read a sign is
|
|
7
|
+
// not stuck, and a tap on the offer is what asks the place to move them.
|
|
8
|
+
//
|
|
9
|
+
// The rule. Look back from now over the shortest stretch that holds
|
|
10
|
+
// STUCK_AFTER_MS of walk input SEEN, never further than STUCK_WINDOW_MS: the
|
|
11
|
+
// offer shows when there is such a stretch and the body got nowhere in it.
|
|
12
|
+
// The input need not be without a break -- a player who walks in bursts,
|
|
13
|
+
// pushing and letting go, is counted across the breaks (v1.33 started the
|
|
14
|
+
// count again at every break of 250 ms, and such a player never saw the chip).
|
|
15
|
+
//
|
|
16
|
+
// "Nowhere" is the net of the stretch, not its path: the diagonal of the box,
|
|
17
|
+
// on the ground (a jump on the spot is no way out), round every position the
|
|
18
|
+
// body was seen at in it is under STUCK_MOVE_M. So pacing 0.9 m back and forth
|
|
19
|
+
// against a wall is stuck; pacing across 3 m, or circling a prop, is not, and
|
|
20
|
+
// a free walker's box is metres across within a second.
|
|
21
|
+
//
|
|
22
|
+
// Seen: a frame counts for its own length, up to STUCK_FRAME_MAX_MS, so a
|
|
23
|
+
// phone drawing 10 frames a second is offered the chip as soon as a fast one.
|
|
24
|
+
// A frame longer than STUCK_HITCH_MS is a hitch and counts for nothing,
|
|
25
|
+
// without anything being forgotten -- a page that stutters neither accuses
|
|
26
|
+
// the player nor forgets them -- and a gap of STUCK_PAUSE_MS between two
|
|
27
|
+
// frames, a clock that went backwards, or a hidden page starts everything
|
|
28
|
+
// over, since nothing is known of what happened in it.
|
|
29
|
+
//
|
|
30
|
+
// Once it shows it stays while the window holds STUCK_KEEP_MS of input (the
|
|
31
|
+
// stretch looked over is then the one holding that much), and goes the
|
|
32
|
+
// moment that stretch's box is STUCK_MOVE_M across,
|
|
33
|
+
// when the place changes, or STUCK_RELEASE_MS after the player last gave walk
|
|
34
|
+
// input -- not at once, since on a phone the thumb that walks is the thumb
|
|
35
|
+
// that taps it.
|
|
36
|
+
|
|
37
|
+
import { HUD_GAP } from './hudClear.js';
|
|
38
|
+
|
|
39
|
+
// This much walk input seen without getting anywhere shows the offer.
|
|
40
|
+
export const STUCK_AFTER_MS = 3000;
|
|
41
|
+
// It is looked for no further back than this: walking less than 3 s in 8 is
|
|
42
|
+
// not trying to get anywhere.
|
|
43
|
+
export const STUCK_WINDOW_MS = 8000;
|
|
44
|
+
// "Anywhere": the box round where the body was in that stretch is this far
|
|
45
|
+
// across, corner to corner on the ground. A free walker at the Player's 6 m/s
|
|
46
|
+
// covers some 17 m in 3 s of walking, and about 6 m at 10 frames a second
|
|
47
|
+
// with the player loop's 33 ms step (below), so nothing that moves is near it.
|
|
48
|
+
export const STUCK_MOVE_M = 1;
|
|
49
|
+
// Once the offer shows it stays while the window still holds this much walk
|
|
50
|
+
// input: a player whose input sits right at STUCK_AFTER_MS (375 ms of every
|
|
51
|
+
// second is exactly 3 s in 8) would otherwise see it come and go as frames
|
|
52
|
+
// enter and leave the window. The stretch looked over is then the one holding
|
|
53
|
+
// this much.
|
|
54
|
+
export const STUCK_KEEP_MS = 2500;
|
|
55
|
+
// Every frame of the window is kept as it was seen, so what the window holds
|
|
56
|
+
// is exactly the frames no older than it -- kept in coarser slices, whole
|
|
57
|
+
// slices left it at once, up to 100 ms early, and a player right at the
|
|
58
|
+
// threshold flickered. No more frames than this are kept: only a page drawing
|
|
59
|
+
// over 500 frames a second for 8 s reaches it, and then looks less far back.
|
|
60
|
+
const FRAMES_MAX = 4096;
|
|
61
|
+
// The offer stays this long after the player lets go.
|
|
62
|
+
export const STUCK_RELEASE_MS = 3000;
|
|
63
|
+
// One ask in this long (the server's own limit, `UNSTICK_EVERY_MS`).
|
|
64
|
+
export const STUCK_EVERY_MS = 5000;
|
|
65
|
+
// The longest one frame counts for. Not the player loop's own step: that
|
|
66
|
+
// loop moves the body by no more than 33 ms of walking a frame
|
|
67
|
+
// (`Math.min(0.033, ...)` in physics-3d `engine3d/Scene3DPlayer.jsx`
|
|
68
|
+
// `startLoop`), and counting frames by that bound made a 12 fps phone wait
|
|
69
|
+
// 7 s and more. A slow frame rate cannot make a free walker look stuck, which
|
|
70
|
+
// is all the cap would be for: at 6 m/s and 10 frames a second the clamped
|
|
71
|
+
// body still covers 0.2 m a frame, about 2 m/s, and is STUCK_MOVE_M off in
|
|
72
|
+
// half a second, so the distance test alone clears them however the time is
|
|
73
|
+
// counted. What the cap must keep out is a pause, and STUCK_HITCH_MS and
|
|
74
|
+
// STUCK_PAUSE_MS do that.
|
|
75
|
+
export const STUCK_FRAME_MAX_MS = 100;
|
|
76
|
+
// A frame longer than this is a hitch: it counts for nothing, and resets nothing.
|
|
77
|
+
export const STUCK_HITCH_MS = 250;
|
|
78
|
+
// Two frames this far apart are a pause (a hidden tab, a stall), not a frame.
|
|
79
|
+
export const STUCK_PAUSE_MS = 1000;
|
|
80
|
+
// The drag stick's dead zone, as the Player behavior reads it.
|
|
81
|
+
const STICK_MIN = 0.15;
|
|
82
|
+
|
|
83
|
+
// `frames` is the last STUCK_WINDOW_MS, oldest first: each `{ at, walked, x,
|
|
84
|
+
// z }`, when the frame was drawn, the walk input it counted for and where the
|
|
85
|
+
// body was; `walked` is their sum.
|
|
86
|
+
export function makeStuck() {
|
|
87
|
+
return { key: null, frames: [], walked: 0, last: null, walkedAt: null, shown: false };
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
export function resetStuck(s) {
|
|
91
|
+
s.key = null;
|
|
92
|
+
s.frames = [];
|
|
93
|
+
s.walked = 0;
|
|
94
|
+
s.last = null;
|
|
95
|
+
s.walkedAt = null;
|
|
96
|
+
s.shown = false;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
// Whether the Player behavior walks the body on this input: its own rule,
|
|
100
|
+
// mirrored from physics-3d `behaviors/Player.jsx` (the kit is not this one's
|
|
101
|
+
// to change, and exports neither function).
|
|
102
|
+
//
|
|
103
|
+
// The default (drive) camera, `readDrive` (lines 23-38) and `update` (line
|
|
104
|
+
// 582, `drive.forward !== 0`): W/up and S/down are forward and back, D/right
|
|
105
|
+
// and A/left turn; the stick is read only when the keys ask for neither, it
|
|
106
|
+
// is held, and it is pushed 0.15 or more of the way -- its LENGTH, so
|
|
107
|
+
// { x: 0.9, y: 0.1 } is read -- and then forward is `-stick.y`. The body
|
|
108
|
+
// walks when forward is not 0.
|
|
109
|
+
//
|
|
110
|
+
// The orbit camera (`scene.cameraControl === 'orbit'`, line 557),
|
|
111
|
+
// `driveOrbiting` (lines 284-295): W/up and S/down walk ahead and back, D and
|
|
112
|
+
// A walk sideways (left/right only swing the camera); the stick is read only
|
|
113
|
+
// when those keys ask for neither, by the same test, as ahead `-stick.y` and
|
|
114
|
+
// aside `stick.x`. The body walks when the two are not both 0.
|
|
115
|
+
//
|
|
116
|
+
// Space jumps under both and is no walk.
|
|
117
|
+
export function walkInput(keys, stick, orbit) {
|
|
118
|
+
const down = (...codes) => codes.some((code) => keys?.has?.(code) === true);
|
|
119
|
+
const stickRead = Boolean(stick?.active) && Math.hypot(stick.x, stick.y) >= STICK_MIN;
|
|
120
|
+
let ahead = (down('KeyW', 'ArrowUp') ? 1 : 0) - (down('KeyS', 'ArrowDown') ? 1 : 0);
|
|
121
|
+
if (orbit) {
|
|
122
|
+
let aside = (down('KeyD') ? 1 : 0) - (down('KeyA') ? 1 : 0);
|
|
123
|
+
if (ahead === 0 && aside === 0 && stickRead) {
|
|
124
|
+
ahead = -stick.y;
|
|
125
|
+
aside = stick.x;
|
|
126
|
+
}
|
|
127
|
+
return Math.hypot(ahead, aside) !== 0;
|
|
128
|
+
}
|
|
129
|
+
const turn = (down('KeyD', 'ArrowRight') ? 1 : 0) - (down('KeyA', 'ArrowLeft') ? 1 : 0);
|
|
130
|
+
if (ahead === 0 && turn === 0 && stickRead) {
|
|
131
|
+
ahead = -stick.y;
|
|
132
|
+
}
|
|
133
|
+
return ahead !== 0;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
// How far across the body's box is over the stretch holding the newest
|
|
137
|
+
// `need` ms of walk input seen (STUCK_AFTER_MS, or STUCK_KEEP_MS once the offer
|
|
138
|
+
// shows), or null when the window holds less.
|
|
139
|
+
export function stuckSpan(s, need = s.shown ? STUCK_KEEP_MS : STUCK_AFTER_MS) {
|
|
140
|
+
// The running sum only rules the scan out; the scan's own sum decides.
|
|
141
|
+
if (s.walked < need - 1) {
|
|
142
|
+
return null;
|
|
143
|
+
}
|
|
144
|
+
let walked = 0;
|
|
145
|
+
let x0 = Infinity;
|
|
146
|
+
let x1 = -Infinity;
|
|
147
|
+
let z0 = Infinity;
|
|
148
|
+
let z1 = -Infinity;
|
|
149
|
+
for (let i = s.frames.length - 1; i >= 0; i -= 1) {
|
|
150
|
+
const frame = s.frames[i];
|
|
151
|
+
walked += frame.walked;
|
|
152
|
+
x0 = Math.min(x0, frame.x);
|
|
153
|
+
x1 = Math.max(x1, frame.x);
|
|
154
|
+
z0 = Math.min(z0, frame.z);
|
|
155
|
+
z1 = Math.max(z1, frame.z);
|
|
156
|
+
if (walked >= need) {
|
|
157
|
+
return Math.hypot(x1 - x0, z1 - z0);
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
return null;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
// One frame. `key` names the place the player is in (any change of it starts
|
|
164
|
+
// over), `x`/`z` are the player's body on the ground, `walking` is
|
|
165
|
+
// `walkInput`, `hidden` whether the page is hidden. Returns whether the offer
|
|
166
|
+
// shows.
|
|
167
|
+
export function stuckFrame(s, { key, x, z, walking, hidden = false }, now) {
|
|
168
|
+
const here = Number.isFinite(x) && Number.isFinite(z);
|
|
169
|
+
let dt = s.last === null ? 0 : now - s.last;
|
|
170
|
+
if (key !== s.key || !here || hidden || !(dt >= 0) || dt >= STUCK_PAUSE_MS) {
|
|
171
|
+
resetStuck(s);
|
|
172
|
+
s.key = here && !hidden ? key : null;
|
|
173
|
+
// The frame that starts over counts for nothing: the time since the one
|
|
174
|
+
// before it is the pause, or a clock that went backwards (a negative
|
|
175
|
+
// length, which would take walk time away).
|
|
176
|
+
dt = 0;
|
|
177
|
+
}
|
|
178
|
+
if (s.key === null) {
|
|
179
|
+
return false;
|
|
180
|
+
}
|
|
181
|
+
s.last = now;
|
|
182
|
+
// Out go the frames older than the window, and only those: each frame
|
|
183
|
+
// leaves by its own time.
|
|
184
|
+
let gone = 0;
|
|
185
|
+
while (gone < s.frames.length && (s.frames[gone].at <= now - STUCK_WINDOW_MS || s.frames.length - gone >= FRAMES_MAX)) {
|
|
186
|
+
s.walked -= s.frames[gone].walked;
|
|
187
|
+
gone += 1;
|
|
188
|
+
}
|
|
189
|
+
if (gone) {
|
|
190
|
+
s.frames.splice(0, gone);
|
|
191
|
+
}
|
|
192
|
+
// Invariant: a frame counts for 0 to STUCK_FRAME_MAX_MS, never less, so
|
|
193
|
+
// `s.walked` is never negative and is always the sum of the frames kept
|
|
194
|
+
// (held to 0 against rounding, and exactly 0 when none are kept).
|
|
195
|
+
const walked = walking && dt <= STUCK_HITCH_MS ? Math.max(0, Math.min(dt, STUCK_FRAME_MAX_MS)) : 0;
|
|
196
|
+
s.walked = s.frames.length ? Math.max(0, s.walked) : 0;
|
|
197
|
+
s.frames.push({ at: now, walked, x, z });
|
|
198
|
+
s.walked += walked;
|
|
199
|
+
if (walking) {
|
|
200
|
+
s.walkedAt = now;
|
|
201
|
+
}
|
|
202
|
+
// The stretch is looked over only where the rest of the rule already holds.
|
|
203
|
+
const span = s.walkedAt !== null && now - s.walkedAt < STUCK_RELEASE_MS ? stuckSpan(s) : null;
|
|
204
|
+
s.shown = span !== null && span < STUCK_MOVE_M;
|
|
205
|
+
return s.shown;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
// Where the chip may sit. `box` is the chip where the chrome hangs it (bottom
|
|
209
|
+
// centre, over the invite button's row), `above` what is drawn from the top of
|
|
210
|
+
// the view down and must be cleared by going under it -- the HUD, a question
|
|
211
|
+
// (an invitation, a party's door, "Play <door> again?") -- and `others` every
|
|
212
|
+
// other control the chrome shows now; all `{ left, right, top, bottom }` in
|
|
213
|
+
// CSS pixels, `viewH` the view's height. Returns how far down from `box` the
|
|
214
|
+
// chip is drawn, 0 where it is clear as it hangs, or null when there is no
|
|
215
|
+
// room: under everything in `above`, whole in the view, and `gap` clear of
|
|
216
|
+
// every other thing. A short view (a phone on its side) is where it moves, or
|
|
217
|
+
// goes: the Doors row is still there.
|
|
218
|
+
export function chipShift(box, above, others, viewH, gap = HUD_GAP) {
|
|
219
|
+
const at = (down) => ({ left: box.left, right: box.right, top: box.top + down, bottom: box.bottom + down });
|
|
220
|
+
const touches = (a, b) => a.right > b.left && a.left < b.right && a.bottom + gap > b.top && a.top < b.bottom + gap;
|
|
221
|
+
let down = Math.max(0, gap - box.top);
|
|
222
|
+
for (const rect of [...above].sort((a, b) => a.top - b.top)) {
|
|
223
|
+
if (touches(at(down), rect)) {
|
|
224
|
+
down = rect.bottom + gap - box.top;
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
const placed = at(down);
|
|
228
|
+
if (placed.bottom > viewH - gap || [...above, ...others].some((rect) => touches(placed, rect))) {
|
|
229
|
+
return null;
|
|
230
|
+
}
|
|
231
|
+
return down;
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
// The offer's words: where the tap goes. `to` is the place's name for where
|
|
235
|
+
// it will put the player ("the square", "the street"), or null where it gives
|
|
236
|
+
// none; `spot` (v1.39) whether that is a spot the place picks for a player
|
|
237
|
+
// stuck where this one is (its `unstick` hook) rather than its arrival.
|
|
238
|
+
export function stuckText(to, spot = false) {
|
|
239
|
+
if (to) {
|
|
240
|
+
return `Stuck? Tap to go to ${to}`;
|
|
241
|
+
}
|
|
242
|
+
return spot ? 'Stuck? Tap to get unstuck' : 'Stuck? Tap to go back to the start';
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
// The Doors row's line under "Stuck?", and what is said once the player is there.
|
|
246
|
+
export function stuckWhere(to, spot = false) {
|
|
247
|
+
if (to) {
|
|
248
|
+
return `Back to ${to}`;
|
|
249
|
+
}
|
|
250
|
+
return spot ? 'Get unstuck' : 'Back to the start';
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
// What is said once a place with the `unstick` hook has moved the player (v1.39).
|
|
254
|
+
export function stuckDone(to, spot) {
|
|
255
|
+
if (to) {
|
|
256
|
+
return `Back to ${to}`;
|
|
257
|
+
}
|
|
258
|
+
return spot ? "You're unstuck" : 'Back to the start';
|
|
259
|
+
}
|