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
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
import assert from 'node:assert/strict';
|
|
2
|
+
import { readFileSync } from 'node:fs';
|
|
3
|
+
import { PerspectiveCamera } from 'three';
|
|
4
|
+
import { makeHudRate } from '../code/client/hudRate.js';
|
|
5
|
+
import { makeChrome } from '../code/client/chrome.js';
|
|
6
|
+
import { fakeDom } from './fixtures/fake-dom.mjs';
|
|
7
|
+
import * as Hub from '../code/client/state.js';
|
|
8
|
+
import { makeAskSlot, padsAt as askPadsAt } from '../code/client/askSlot.js';
|
|
9
|
+
import { attend, makeAttention } from '../code/client/attention.js';
|
|
10
|
+
import { goalAt } from '../code/client/labelsNear.js';
|
|
11
|
+
import { mapWorldPoint, offsetWorldPoint, worldLabelFocus } from '../code/client/worldLabels.js';
|
|
12
|
+
import { bodyBox } from '../code/client/padOccupancy.js';
|
|
13
|
+
import { goalPointers, goalText, pointerAt } from '../code/client/together.js';
|
|
14
|
+
import { makeSay, REACTIONS } from '../code/client/say.js';
|
|
15
|
+
import { chatModerationEnabled } from '../code/client/chatModeration.js';
|
|
16
|
+
import { joinErrorText } from '../code/client/joinError.js';
|
|
17
|
+
import { padCuesEnabled } from '../code/client/padCues.js';
|
|
18
|
+
|
|
19
|
+
const inputEvents = ['pointerdown', 'pointerup', 'touchstart', 'touchend', 'keydown', 'keyup'];
|
|
20
|
+
function inputTarget() {
|
|
21
|
+
const listeners = new Map();
|
|
22
|
+
return {
|
|
23
|
+
listeners,
|
|
24
|
+
addEventListener(type, fn, capture) {
|
|
25
|
+
assert.equal(capture, true, `${type} must precede stopped bubbling`);
|
|
26
|
+
assert.ok(!listeners.has(type), `${type} installed once`);
|
|
27
|
+
listeners.set(type, fn);
|
|
28
|
+
},
|
|
29
|
+
removeEventListener(type, fn, capture) {
|
|
30
|
+
assert.equal(capture, true);
|
|
31
|
+
assert.equal(listeners.get(type), fn);
|
|
32
|
+
listeners.delete(type);
|
|
33
|
+
},
|
|
34
|
+
fire(type) {listeners.get(type)?.();},
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
for (const weakest of [false, true]) {
|
|
38
|
+
const target = inputTarget(), rate = makeHudRate(target);
|
|
39
|
+
assert.deepEqual(Array.from({ length: 6 }, () => rate.frame(weakest, 'same')),
|
|
40
|
+
weakest ? [true, false, true, false, true, false] : [true, true, true, true, true, true]);
|
|
41
|
+
assert.deepEqual([...target.listeners.keys()], inputEvents);
|
|
42
|
+
rate.dispose();
|
|
43
|
+
assert.equal(target.listeners.size, 0);
|
|
44
|
+
}
|
|
45
|
+
for (const event of inputEvents) {
|
|
46
|
+
const target = inputTarget(), rate = makeHudRate(target);
|
|
47
|
+
assert.equal(rate.frame(true, 'same'), true);
|
|
48
|
+
target.fire(event);
|
|
49
|
+
assert.equal(rate.frame(true, 'same'), true, `${event} wakes a skip frame`);
|
|
50
|
+
assert.equal(rate.frame(true, 'same'), false, `${event} resets parity and clears input`);
|
|
51
|
+
assert.equal(rate.frame(true, 'same'), true);
|
|
52
|
+
rate.dispose();
|
|
53
|
+
}
|
|
54
|
+
{
|
|
55
|
+
const rate = makeHudRate(inputTarget());
|
|
56
|
+
assert.equal(rate.frame(true, 'Grab'), true);
|
|
57
|
+
assert.equal(rate.frame(true, 'Throw'), true, 'prompt change wakes a skip frame');
|
|
58
|
+
assert.equal(rate.frame(true, 'Throw'), false);
|
|
59
|
+
assert.equal(rate.frame(false, 'Throw'), true, 'leaving Weakest ticks immediately');
|
|
60
|
+
assert.equal(rate.frame(false, 'Throw'), true);
|
|
61
|
+
assert.equal(rate.frame(true, 'Throw'), true, 'returning to Weakest starts with a tick');
|
|
62
|
+
rate.dispose();
|
|
63
|
+
}
|
|
64
|
+
console.log('HUD rate: cadence, capture input, prompt changes, profile transitions and disposal passed');
|
|
65
|
+
|
|
66
|
+
// Like test-weakest-tier, exercise production Hub methods with only the
|
|
67
|
+
// engine/avatar boundary substituted. Chrome and its prompt signature are real.
|
|
68
|
+
const source = readFileSync(new URL('../code/systems/hub.js', import.meta.url), 'utf8');
|
|
69
|
+
const method = name => {
|
|
70
|
+
const start = source.indexOf(` ${name}(`);
|
|
71
|
+
assert.ok(start >= 0, name);
|
|
72
|
+
return source.slice(start, source.indexOf('\n }\n', start) + 4);
|
|
73
|
+
};
|
|
74
|
+
const projectStart = source.indexOf('function project(');
|
|
75
|
+
const project = source.slice(projectStart, source.indexOf('\n}\n', projectStart) + 2);
|
|
76
|
+
const constants = ['GOALS_MAX', 'GOAL_NEAR_M', 'RIBBON_MS', 'TOAST_MS', 'WENT_ASK_MS', 'HERE_CUE_MS']
|
|
77
|
+
.map(name => source.match(new RegExp(`^const ${name} = .*;$`, 'm'))[0]).join('\n');
|
|
78
|
+
const dependencies = { Hub, makeHudRate, askPadsAt, attend, goalAt, worldLabelFocus, mapWorldPoint, offsetWorldPoint,
|
|
79
|
+
bodyBox, goalPointers, goalText, pointerAt, REACTIONS, chatModerationEnabled, joinErrorText, padCuesEnabled,
|
|
80
|
+
Avatar: { current: scene => scene.persistent.avatar, colorsAvailable: () => false, style: () => 'toon',
|
|
81
|
+
currentColor: () => 0, top: () => 1.5, drawn: () => 0 },
|
|
82
|
+
Cabinets: { nearest: () => null }, kitBackNeeded: () => false,
|
|
83
|
+
loadingCover: null, clearShot() {},
|
|
84
|
+
};
|
|
85
|
+
const Harness = new Function(...Object.keys(dependencies), `${constants}\n${project}
|
|
86
|
+
return class { ${['drawChrome', 'drawPanelControls', 'drawNearPrompt', 'dispose'].map(method).join('\n')} };`
|
|
87
|
+
)(...Object.values(dependencies));
|
|
88
|
+
const panelSetters = ['showPicker', 'setDoors', 'setPeople', 'setSay', 'setFeed', 'setHud', 'setToast'];
|
|
89
|
+
const motionSetters = ['setWorldViewport', 'setPointers', 'setLabels', 'setCabinet', 'setRibbon', 'setWorldAvatar', 'setCompanionBadge', 'setCompanionTalk'];
|
|
90
|
+
|
|
91
|
+
for (const tier of [undefined, { active: false, profile: 'weakest' }, { active: true, profile: 'middle' },
|
|
92
|
+
{ active: true, profile: 'low' }, { active: true, profile: 'high' }, { active: true, profile: 'weakest' }]) {
|
|
93
|
+
Hub.clear();
|
|
94
|
+
Hub.hub.place = { id: 'town', companion: true, companionChat: { name: 'Guide' } };
|
|
95
|
+
Hub.hub.saidEvents.push({ player: 'self', r: 0 });
|
|
96
|
+
Hub.hub.hud = { text: 'Town' };
|
|
97
|
+
Hub.hub.labels = { sign: { text: 'Street', style: 'sign' }, goal: { text: 'Go', style: 'goal' } };
|
|
98
|
+
const dom = fakeDom({ viewW: 400, viewH: 800 }), target = inputTarget();
|
|
99
|
+
Object.assign(window, {
|
|
100
|
+
addEventListener(type, fn, capture) {if (capture === true) {target.addEventListener(type, fn, capture);}},
|
|
101
|
+
removeEventListener(type, fn, capture) {if (capture === true) {target.removeEventListener(type, fn, capture);}},
|
|
102
|
+
});
|
|
103
|
+
const local = { id: 'self', components: { Transform: { x: 0, y: 0, z: 0 } } };
|
|
104
|
+
const actors = new Map([['sign', { components: { Transform: { x: 1, y: 0, z: 0 } } }],
|
|
105
|
+
['goal', { components: { Transform: { x: 1.5, y: 0, z: 0 } } }]]);
|
|
106
|
+
actors.set('self', local);
|
|
107
|
+
const camera = new PerspectiveCamera(60, 0.5, 0.1, 100);
|
|
108
|
+
camera.position.set(0, 3, 10); camera.lookAt(0, 0, 0); camera.updateMatrixWorld();
|
|
109
|
+
const scene = { persistent: { hubTickets: [], avatar: 0 }, files: {}, data: { engine: {} },
|
|
110
|
+
multiplayer: { net: { others: () => new Map(), selfId: () => 'self' } },
|
|
111
|
+
three: { camera }, getActor: id => actors.get(id), getActors: () => [...actors.values()] };
|
|
112
|
+
const chrome = makeChrome({ onBack() {}, onAvatar: i => {scene.persistent.avatar = i;}, avatarCount: 2 });
|
|
113
|
+
chrome.measureLabel = null; // Use Hub's ordinary projected-label path.
|
|
114
|
+
const calls = new Map(), order = [];
|
|
115
|
+
for (const name of [...panelSetters, ...motionSetters]) {
|
|
116
|
+
const original = chrome[name];
|
|
117
|
+
chrome[name] = (...args) => {order.push(name); const history = calls.get(name) ?? []; history.push(args); calls.set(name, history); return original.apply(chrome, args);};
|
|
118
|
+
}
|
|
119
|
+
const system = Object.assign(new Harness(), { chrome, scene, weakestTier: tier, trip: null, pendingEnd: null,
|
|
120
|
+
toast: { text: '', until: 0 }, askSlot: makeAskSlot(), attention: makeAttention(),
|
|
121
|
+
ask: () => null, retireExpiredAsk() {}, startBeside() {}, people: () => [],
|
|
122
|
+
together: { beside: () => null, arrivals: () => [], partyLine: () => null,
|
|
123
|
+
pointers: (scene, local, cam, view) => [pointerAt(cam, view, { x: -1, y: 1, z: 0 }, 'guide', 'Friend')] },
|
|
124
|
+
companion: { dispose() {}, labels: () => [], screen: (cam, view, project) => project(cam, 2, 1.6, 0, view) },
|
|
125
|
+
talk: { talking: () => false, talkingWith: () => null },
|
|
126
|
+
chat: { frame() {}, incoming: [], peers: null, available: () => false },
|
|
127
|
+
say: makeSay(), idle: { labels: () => [] }, markItems: () => [],
|
|
128
|
+
});
|
|
129
|
+
const weakest = tier?.active && tier.profile === 'weakest';
|
|
130
|
+
const draw = frame => {
|
|
131
|
+
// Match afterBehaviors: the existing snapshot wraps every draw, including skips.
|
|
132
|
+
chrome.beginLayoutFrame();
|
|
133
|
+
system.drawChrome(scene, local, frame * 60);
|
|
134
|
+
chrome.endLayoutFrame();
|
|
135
|
+
};
|
|
136
|
+
for (let frame = 0; frame < 4; frame++) {
|
|
137
|
+
camera.position.x += 0.1; camera.updateMatrixWorld();
|
|
138
|
+
draw(frame);
|
|
139
|
+
}
|
|
140
|
+
for (const name of motionSetters) {assert.equal(calls.get(name).length, 4, `${tier?.profile}: ${name} every frame`);}
|
|
141
|
+
for (const name of panelSetters) {assert.equal(calls.get(name).length, weakest ? 2 : 4, `${tier?.profile}: ${name} cadence`);}
|
|
142
|
+
assert.notEqual(calls.get('setLabels')[0][0][0].x, calls.get('setLabels')[1][0][0].x, 'world label follows moving camera on skip');
|
|
143
|
+
for (const id of ['goal:goal', 'guide']) {
|
|
144
|
+
assert.notEqual(calls.get('setPointers')[0][0].find(item => item.id === id).x,
|
|
145
|
+
calls.get('setPointers')[1][0].find(item => item.id === id).x, `${id} follows moving camera on skip`);
|
|
146
|
+
}
|
|
147
|
+
assert.notEqual(calls.get('setLabels')[0][0].find(item => item.id === 'react:self').x,
|
|
148
|
+
calls.get('setLabels')[1][0].find(item => item.id === 'react:self').x, 'speech bubble follows moving camera on skip');
|
|
149
|
+
|
|
150
|
+
if (!weakest) {
|
|
151
|
+
const legacyOrder = ['showPicker', 'setDoors', 'setPeople', 'setSay', 'setFeed', 'setHud', 'setWorldViewport',
|
|
152
|
+
'setPointers', 'setLabels', 'setCompanionBadge', 'setCompanionTalk', 'setCabinet', 'setRibbon', 'setToast', 'setWorldAvatar'];
|
|
153
|
+
assert.deepEqual(order, Array.from({ length: 4 }, () => legacyOrder).flat(), 'other profiles retain setter order');
|
|
154
|
+
}
|
|
155
|
+
if (weakest) {
|
|
156
|
+
draw(4); // Tick; frame 5 would skip.
|
|
157
|
+
const pick = dom.made.find(node => node.getAttribute('aria-label') === 'Character: Petal');
|
|
158
|
+
target.fire('pointerdown'); target.fire('pointerup');
|
|
159
|
+
pick.handlers.click({ stopPropagation() {} });
|
|
160
|
+
assert.equal(pick.getAttribute('aria-pressed'), 'false');
|
|
161
|
+
draw(5);
|
|
162
|
+
assert.equal(pick.getAttribute('aria-pressed'), 'true', 'press state updates on the would-be skip frame');
|
|
163
|
+
const count = calls.get('setHud').length;
|
|
164
|
+
draw(6);
|
|
165
|
+
assert.equal(calls.get('setHud').length, count, 'forced input tick resets parity');
|
|
166
|
+
draw(7);
|
|
167
|
+
chrome.grabPrompt('Grab');
|
|
168
|
+
draw(8);
|
|
169
|
+
assert.equal(calls.get('setHud').length, count + 2, 'pickup prompt wakes all panels');
|
|
170
|
+
draw(9);
|
|
171
|
+
assert.equal(calls.get('setHud').length, count + 2);
|
|
172
|
+
chrome.talkPrompt('Biscuit');
|
|
173
|
+
draw(10);
|
|
174
|
+
assert.equal(calls.get('setHud').length, count + 3, 'talk prompt wakes all panels');
|
|
175
|
+
Hub.hub.prompts = [{ id: 'counter', verb: 'Trade' }];
|
|
176
|
+
draw(11);
|
|
177
|
+
assert.equal(calls.get('setHud').length, count + 4, 'act prompt wakes all panels');
|
|
178
|
+
chrome.sitPrompt('Sit');
|
|
179
|
+
draw(12);
|
|
180
|
+
assert.equal(calls.get('setHud').length, count + 5, 'sit prompt wakes all panels');
|
|
181
|
+
const act = document.createElement('button');
|
|
182
|
+
act.textContent = 'Trade'; act.setAttribute('aria-label', 'Trade');
|
|
183
|
+
chrome.safeSurface('act-prompt:counter', act, 'control');
|
|
184
|
+
draw(13);
|
|
185
|
+
assert.equal(calls.get('setHud').length, count + 6, 'visible act prompt wakes all panels');
|
|
186
|
+
system.together.beside = () => ({ playerId: 'friend', username: 'Friend' });
|
|
187
|
+
draw(14);
|
|
188
|
+
assert.equal(calls.get('setHud').length, count + 7, 'nearby invitation prompt wakes all panels');
|
|
189
|
+
system.ask = () => ({ key: 'ask', text: 'Join?', yes: 'Yes', no: 'No' });
|
|
190
|
+
draw(15);
|
|
191
|
+
assert.equal(calls.get('setHud').length, count + 8, 'question card wakes all panels');
|
|
192
|
+
const toggle = dom.made.find(node => node.textContent === 'Character');
|
|
193
|
+
toggle.handlers.pointerdown({ stopPropagation() {} });
|
|
194
|
+
draw(16);
|
|
195
|
+
assert.equal(calls.get('setHud').length, count + 9, 'menu opening wakes all panels');
|
|
196
|
+
// Each draw below lands on a would-be skip frame: the previous one ticked.
|
|
197
|
+
Hub.hub.doors = [...(Hub.hub.doors ?? [])];
|
|
198
|
+
draw(17);
|
|
199
|
+
assert.equal(calls.get('setDoors').length, count + 10, 'a new door offer replaces Go buttons at once');
|
|
200
|
+
Hub.hub.hud = { text: 'Reported. Thanks.' };
|
|
201
|
+
draw(18);
|
|
202
|
+
assert.equal(calls.get('setHud').length, count + 11, 'HUD copy wakes all panels');
|
|
203
|
+
system.toast = { text: 'Saved', until: performance.now() + 5000 };
|
|
204
|
+
draw(19);
|
|
205
|
+
assert.equal(calls.get('setToast').length, count + 12, 'a toast wakes all panels');
|
|
206
|
+
Hub.hub.hud = { text: 'Reported. Thanks.', timer: { since: 0 } };
|
|
207
|
+
draw(20);
|
|
208
|
+
draw(21);
|
|
209
|
+
assert.equal(calls.get('setHud').length, count + 13, 'a running timer alone waits for the next tick');
|
|
210
|
+
const writes = dom.log.length;
|
|
211
|
+
chrome.hudPromptSignature();
|
|
212
|
+
assert.equal(dom.log.length, writes, 'prompt signature makes no layout reads or DOM writes');
|
|
213
|
+
assert.equal(target.listeners.size, 6, 'one listener set after many frames');
|
|
214
|
+
// Run the production dispose method, substituting unrelated owners.
|
|
215
|
+
Object.assign(system, { clearPadReadability() {}, environment: { restore() {} }, idle: null });
|
|
216
|
+
system.weakestTier = { ...tier, restore() {} };
|
|
217
|
+
system.dispose();
|
|
218
|
+
assert.equal(target.listeners.size, 0, 'Hub disposal removes capture listeners');
|
|
219
|
+
} else {
|
|
220
|
+
chrome.dispose();
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
Hub.clear();
|
|
224
|
+
console.log('Hub HUD: Weakest-only panel cadence, per-frame projection, same-frame press/prompt updates and disposal passed');
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
// Exercise the real CSS cascade: safe-inset corrections must not reveal an
|
|
2
|
+
// empty HUD score row or override the renderer's subsequent visibility changes.
|
|
3
|
+
import assert from 'node:assert/strict';
|
|
4
|
+
import { readFile } from 'node:fs/promises';
|
|
5
|
+
import { fileURLToPath } from 'node:url';
|
|
6
|
+
import { chromium } from 'playwright-core';
|
|
7
|
+
import { launchChromium } from '../../../experiments/hub-town/qa/launch.mjs';
|
|
8
|
+
|
|
9
|
+
const root = new URL('../../../', import.meta.url);
|
|
10
|
+
const browser = await launchChromium(chromium, { executablePath: process.env.CHROME });
|
|
11
|
+
try {
|
|
12
|
+
const page = await browser.newPage();
|
|
13
|
+
await page.route('**/*', async route => {
|
|
14
|
+
const url = new URL(route.request().url());
|
|
15
|
+
assert.equal(url.origin, 'http://layout.test');
|
|
16
|
+
if (url.pathname === '/') {
|
|
17
|
+
return route.fulfill({ contentType: 'text/html', body: '<script type="importmap">{"imports":{"three":"/node_modules/three/build/three.module.js"}}</script><body style="margin:0"></body>' });
|
|
18
|
+
}
|
|
19
|
+
const file = new URL(`.${url.pathname}`, root);
|
|
20
|
+
assert(fileURLToPath(file).startsWith(fileURLToPath(root)));
|
|
21
|
+
await route.fulfill({ contentType: 'text/javascript', body: await readFile(file, 'utf8') });
|
|
22
|
+
});
|
|
23
|
+
let checks = 0;
|
|
24
|
+
for (const [width, height] of [[844, 390], [412, 915]]) {
|
|
25
|
+
await page.setViewportSize({ width, height });
|
|
26
|
+
await page.goto('http://layout.test/');
|
|
27
|
+
const rows = await page.evaluate(async () => {
|
|
28
|
+
const { makeChrome } = await import('/kits/hub-game/code/client/chrome.js');
|
|
29
|
+
const chrome = makeChrome({ avatarCount: 1, onBack() {}, onAvatar() {}, safeInsets: true });
|
|
30
|
+
const title = document.querySelector('[data-hub-copy="subtitle"]');
|
|
31
|
+
const hud = title.parentElement;
|
|
32
|
+
const score = hud.children[1];
|
|
33
|
+
const prompt = document.querySelector('[data-hub="hud-prompt"]');
|
|
34
|
+
const visible = node => getComputedStyle(node).display !== 'none' &&
|
|
35
|
+
getComputedStyle(node).visibility !== 'hidden' && node.getBoundingClientRect().height > 0;
|
|
36
|
+
const stages = [
|
|
37
|
+
['title only', { title: 'You have a house here', text: 'Step on its pad.' }, null],
|
|
38
|
+
['score', { title: 'Town', big: '12', text: 'Keep going.' }, null],
|
|
39
|
+
['timer', { title: 'Town', text: 'Time remaining.' }, 1.5],
|
|
40
|
+
['empty score again', { title: 'You have a house here', text: 'Step on its pad.' }, null],
|
|
41
|
+
['score only', { big: '7' }, null],
|
|
42
|
+
['zero timer', { title: 'Town', text: 'Finished.' }, 0],
|
|
43
|
+
['no HUD', null, null],
|
|
44
|
+
['title restored', { title: 'Town', text: 'Step on its pad.' }, null],
|
|
45
|
+
];
|
|
46
|
+
const rows = [];
|
|
47
|
+
try {
|
|
48
|
+
for (const [name, spec, timer] of stages) {
|
|
49
|
+
chrome.setHudClear(true);
|
|
50
|
+
chrome.setHud(spec, timer);
|
|
51
|
+
// Flush the actual safe-inset controller after the renderer, then
|
|
52
|
+
// let its observer/frame cadence run before reading computed CSS.
|
|
53
|
+
chrome.flushSafeInsets();
|
|
54
|
+
await new Promise(resolve => requestAnimationFrame(() => requestAnimationFrame(resolve)));
|
|
55
|
+
chrome.frameSafeInsets();
|
|
56
|
+
rows.push({ name, title: visible(title) && visible(hud), score: visible(score) && visible(hud),
|
|
57
|
+
prompt: visible(prompt), scoreText: score.textContent, scoreDisplay: getComputedStyle(score).display,
|
|
58
|
+
scoreHeight: score.getBoundingClientRect().height });
|
|
59
|
+
}
|
|
60
|
+
} finally {
|
|
61
|
+
chrome.dispose();
|
|
62
|
+
}
|
|
63
|
+
return rows;
|
|
64
|
+
});
|
|
65
|
+
const expected = [
|
|
66
|
+
[true, false, true, ''], [true, true, true, '12'], [true, true, true, '1.5'],
|
|
67
|
+
[true, false, true, ''], [false, true, false, '7'], [true, true, true, '0.0'],
|
|
68
|
+
[false, false, false, '0.0'], [true, false, true, ''],
|
|
69
|
+
];
|
|
70
|
+
for (let i = 0; i < rows.length; i++) {
|
|
71
|
+
const row = rows[i];
|
|
72
|
+
assert.deepEqual([row.title, row.score, row.prompt, row.scoreText], expected[i], `${width}x${height}: ${JSON.stringify(row)}`);
|
|
73
|
+
if (expected[i][3] === '') {
|
|
74
|
+
assert.equal(row.scoreDisplay, 'none', `${width}x${height}: ${row.name} must keep the empty score hidden`);
|
|
75
|
+
assert.equal(row.scoreHeight, 0, `${width}x${height}: ${row.name} must paint no empty score background`);
|
|
76
|
+
}
|
|
77
|
+
checks++;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
console.log(`HUD safe-inset visibility: ${checks} real DOM transition checks passed`);
|
|
81
|
+
} finally {
|
|
82
|
+
await browser.close();
|
|
83
|
+
}
|
|
@@ -874,5 +874,71 @@ test('v1.82: Sit stays exact; Lie down draws self and others face-up, centred, r
|
|
|
874
874
|
}
|
|
875
875
|
});
|
|
876
876
|
|
|
877
|
+
test('v1.109: song clock is latched once, joins replay it, and manual answers do not share its cooldown', () => {
|
|
878
|
+
let answers = 0;
|
|
879
|
+
const { h, hub, world, say, tick } = boot({ hooks: { emote: () => { answers++; } } });
|
|
880
|
+
const floors = [{ x: 0, z: 0, halfX: 3, halfZ: 4 }];
|
|
881
|
+
h.delta();
|
|
882
|
+
assert.equal('hubDanceIdle' in h.join(), false);
|
|
883
|
+
assert.equal(hub.danceIdle('jukebox', { bpm: 120, floors }), false);
|
|
884
|
+
hub.sound('jukebox', SOUNDS[0], { loop: true });
|
|
885
|
+
assert.equal(hub.danceIdle('jukebox', { bpm: 120, floors }), true);
|
|
886
|
+
const clock = h.delta().hubDanceIdle;
|
|
887
|
+
assert.deepEqual(clock, { actor: 'jukebox', file: SOUNDS[0], bpm: 120, beatAt: world.timeMs, floors });
|
|
888
|
+
floors[0].halfX = 99;
|
|
889
|
+
assert.equal(h.join().hubDanceIdle.floors[0].halfX, 3, 'copies caller data');
|
|
890
|
+
assert.equal('hubDanceIdle' in (h.delta() ?? {}), false);
|
|
891
|
+
hub.sound('jukebox', SOUNDS[0], { loop: true });
|
|
892
|
+
assert.equal(h.delta().hubDanceIdle, null, 'same-file same-tick replacement invalidates old clock');
|
|
893
|
+
hub.danceIdle('jukebox', { bpm: 120, floors: clock.floors });
|
|
894
|
+
h.delta();
|
|
895
|
+
tick(1500);
|
|
896
|
+
assert.equal('hubDanceIdle' in (h.delta() ?? {}), false, 'no per-beat traffic');
|
|
897
|
+
say('p1', { k: 'hub-emote', id: 'wave' });
|
|
898
|
+
assert.equal(answers, 1, 'idle never spends the manual cooldown');
|
|
899
|
+
hub.sound('jukebox', SOUNDS[1], { loop: true });
|
|
900
|
+
assert.equal(h.delta().hubDanceIdle, null, 'old clock cannot survive song change');
|
|
901
|
+
assert.equal(hub.danceIdle('jukebox', { bpm: NaN, floors }), false);
|
|
902
|
+
assert.equal(hub.danceIdle('jukebox', { bpm: 120, floors: [{ x: 0, z: 0, halfX: -1, halfZ: 1 }] }), false);
|
|
903
|
+
hub.danceIdle('jukebox', { bpm: 90, floors });
|
|
904
|
+
assert.equal(h.join().hubDanceIdle.beatAt, world.timeMs);
|
|
905
|
+
h.delta();
|
|
906
|
+
hub.sound('jukebox', null);
|
|
907
|
+
assert.equal(h.delta().hubDanceIdle, null);
|
|
908
|
+
});
|
|
909
|
+
|
|
910
|
+
test('v1.109: looping rig pose yields to manual motion, exits and restores without changing Transform', () => {
|
|
911
|
+
clearClient();
|
|
912
|
+
const actors = new Map(['player', 'other'].map((id) => [id, { id, components: { Transform: { x: 0, y: 1, z: 0 } } }]));
|
|
913
|
+
const rigs = new Map(['player', 'other'].map((id) => { const r = new Group(); r.position.y = 2; return [id, r]; }));
|
|
914
|
+
const scene = { multiplayer: { net: { selfId: () => 'p1' }, avatars: { actors: new Map([['p2', 'other']]) } },
|
|
915
|
+
getActor: (id) => actors.get(id), three: { nodes: new Map([...rigs].map(([id, r]) => [id, { node: { children: [r] } }])) } };
|
|
916
|
+
const idle = ClientIdle.makeIdle({});
|
|
917
|
+
clientHub.danceIdle = { actor: 'jukebox', file: SOUNDS[0], bpm: 120, beatAt: 0, floors: [{ x: 0, z: 0, halfX: 3, halfZ: 4 }] };
|
|
918
|
+
clientHub.sounds = { jukebox: { file: SOUNDS[0], since: 0 } };
|
|
919
|
+
const at = (ms) => { clientHub.lastT = ms; clientHub.lastTAt = performance.now(); idle.draw(scene, actors.get('player')); };
|
|
920
|
+
try {
|
|
921
|
+
at(250);
|
|
922
|
+
assert.ok(rigs.get('player').position.y > 2.23);
|
|
923
|
+
assert.equal(rigs.get('player').rotation.z, rigs.get('other').rotation.z, 'same phase on both avatars');
|
|
924
|
+
clientHub.emotes = { p1: { id: 'bow', at: 0, until: 2400 } };
|
|
925
|
+
at(1200);
|
|
926
|
+
assert.ok(rigs.get('player').rotation.x > .79);
|
|
927
|
+
assert.equal(rigs.get('player').rotation.z, 0, 'manual pose alone');
|
|
928
|
+
at(2500);
|
|
929
|
+
assert.notEqual(rigs.get('player').rotation.y, 0, 'idle returns at current beat, no restart');
|
|
930
|
+
actors.get('player').components.Transform.x = 4;
|
|
931
|
+
at(2750);
|
|
932
|
+
assert.equal(rigs.get('player').position.y, 2);
|
|
933
|
+
assert.ok(rigs.get('other').position.y > 2.23);
|
|
934
|
+
clientHub.sounds = {};
|
|
935
|
+
at(3000);
|
|
936
|
+
assert.equal(rigs.get('other').position.y, 2);
|
|
937
|
+
assert.deepEqual(actors.get('other').components.Transform, { x: 0, y: 1, z: 0 });
|
|
938
|
+
clearClient();
|
|
939
|
+
assert.equal(clientHub.danceIdle, null);
|
|
940
|
+
} finally { idle.dispose(); clearClient(); }
|
|
941
|
+
});
|
|
942
|
+
|
|
877
943
|
console.warn = warn;
|
|
878
944
|
console.log(`test-idle: ${n} passed`);
|
|
@@ -61,6 +61,7 @@ async function room({
|
|
|
61
61
|
hidden = false,
|
|
62
62
|
extra = {},
|
|
63
63
|
ids = ['a', 'b', 'c'],
|
|
64
|
+
guests = [],
|
|
64
65
|
objectHook,
|
|
65
66
|
hubOps = {},
|
|
66
67
|
} = {}) {
|
|
@@ -123,6 +124,7 @@ async function room({
|
|
|
123
124
|
playerId,
|
|
124
125
|
userId: String(101 + i),
|
|
125
126
|
username: playerId,
|
|
127
|
+
...(guests.includes(playerId) ? { isAnonymous: true } : {}),
|
|
126
128
|
}));
|
|
127
129
|
const session = {
|
|
128
130
|
sessionId: 'dev:cells',
|
|
@@ -363,6 +365,24 @@ r.cap(1);
|
|
|
363
365
|
assert.deepEqual([...r.hooks.interest(r.sim, new Map()).get('a')], ['c']);
|
|
364
366
|
assert.deepEqual(await r.ctx.friendsAmong('a', ['102', '103']), ['103']);
|
|
365
367
|
assert.ok(r.traffic.every(({ msg }) => !/"(?:follows|followedBy)"\s*:/.test(JSON.stringify(msg))));
|
|
368
|
+
// A guest is over 13 like any other player: a guest viewer's relations are
|
|
369
|
+
// read, a guest is a candidate, and a guest friend comes first.
|
|
370
|
+
const guestCalls = [];
|
|
371
|
+
r = await room({ guests: ['a', 'c'], hubOps: { relationsAmong: async (playerId, userIds) => {
|
|
372
|
+
guestCalls.push([playerId, userIds]);
|
|
373
|
+
return { friends: playerId === 'a' ? ['103'] : [], follows: [], followedBy: [] };
|
|
374
|
+
} } });
|
|
375
|
+
for (const player of r.session.players) {
|
|
376
|
+
r.server.onMessage(r.session, player, { k: 'hub-hello', avatar: 0 });
|
|
377
|
+
}
|
|
378
|
+
r.tick();
|
|
379
|
+
await new Promise((resolve) => setImmediate(resolve));
|
|
380
|
+
assert.deepEqual(guestCalls.find(([id]) => id === 'a'), ['a', ['102', '103']], 'a guest viewer is read, a guest is a candidate');
|
|
381
|
+
r.sim.players.get('c').at.x = 20;
|
|
382
|
+
r.tick();
|
|
383
|
+
r.cap(1);
|
|
384
|
+
assert.deepEqual([...r.hooks.interest(r.sim, new Map()).get('a')], ['c'], 'a guest friend comes first');
|
|
385
|
+
assert.deepEqual(await r.ctx.friendsAmong('a', ['102', '103']), ['103']);
|
|
366
386
|
// An unfollow cannot retain expired priority, even while the refresh is pending.
|
|
367
387
|
let unfollowed = false;
|
|
368
388
|
let settleUnfollow;
|
|
@@ -125,6 +125,21 @@ const rows = (msg) => (msg.ps ?? []).map(([id]) => id).sort();
|
|
|
125
125
|
assert.deepEqual(Object.keys(only.msg), ['k', 't', 'ps', 'os', 'own']);
|
|
126
126
|
}
|
|
127
127
|
|
|
128
|
+
// No hook: a client back on a body it kept is sent the world again, since the
|
|
129
|
+
// broadcasts it missed while away carried only what changed.
|
|
130
|
+
{
|
|
131
|
+
const game = hooks();
|
|
132
|
+
const r = await placeOf(game, ['a', 'b']);
|
|
133
|
+
r.tick();
|
|
134
|
+
r.move('b', 4);
|
|
135
|
+
r.tick();
|
|
136
|
+
r.rejoin('a');
|
|
137
|
+
const again = r.tick().find((s) => s.to === 'a' && s.msg.k === 'w')?.msg;
|
|
138
|
+
assert.ok(again, 'a fresh WORLD for the kept body');
|
|
139
|
+
assert.deepEqual(rows(again), ['a', 'b']);
|
|
140
|
+
assert.equal(again.ps.find(([id]) => id === 'b')[1], 4, 'carrying where the others are now');
|
|
141
|
+
}
|
|
142
|
+
|
|
128
143
|
// A hook that stops answering has everyone sent again with `in`, not left out.
|
|
129
144
|
{
|
|
130
145
|
let off = false;
|