Skip to content

Open-source platform for 3D AI agents. Turn text or a photo into a rigged, animated GLB avatar, give it an LLM brain, memory and a wallet, and embed it anywhere with one web component. Remote MCP server, x402 payments, Three.js, browser-native.

Play zen mode: honor ?ui= through the URL rewrite, hide remaining chrome

nirholas18a7688411b2
diff --git a/src/game/coincommunities-ui.js b/src/game/coincommunities-ui.js
index 319be9aeb..82476f048 100644
--- a/src/game/coincommunities-ui.js
+++ b/src/game/coincommunities-ui.js
@@ -1320,12 +1320,12 @@ export class CommunityUI {
]);
onPowerSaverChange((on) => this.powerBtn.setAttribute('aria-pressed', on ? 'true' : 'false'));
- // Zen mode — hide every overlay so the world renders clean. Same
+ // Zen mode: hide every overlay so the world renders clean. Same
// body.is-zen contract as /walk; Z is the hotkey (wired by the host) and
// the floating exit pill below is the only control left on screen.
this.zenBtn = el('button', {
class: 'cc-zen-btn', type: 'button', 'aria-pressed': 'false',
- 'aria-label': 'Zen mode', title: 'Zen mode — hide every panel, just the world (Z)',
+ 'aria-label': 'Zen mode', title: 'Zen mode: hide every panel, just the world (Z)',
onclick: () => this.h.onZen?.(),
}, [
el('span', { class: 'cc-zen-ico', 'aria-hidden': 'true', text: '🧘' }),
diff --git a/src/game/coincommunities.css b/src/game/coincommunities.css
index 39420cceb..2ffa0a6c2 100644
--- a/src/game/coincommunities.css
+++ b/src/game/coincommunities.css
@@ -2925,8 +2925,8 @@ select.npc-svc-input { cursor: pointer; appearance: none; -webkit-appearance: no
/* ── end King of the Totem ──────────────────────────────────────────────────── */
/* ── Zen mode (hide all UI) ──────────────────────────────────────────────────
- Z, the HUD button, or a ?ui=hidden link strips every overlay — banner, chat,
- world HUD, hotbar, prompts, name tags — so the world renders clean for
+ Z, the HUD button, or a ?ui=hidden link strips every overlay (banner, chat,
+ world HUD, hotbar, prompts, name tags) so the world renders clean for
screenshots and ambient play. Movement affordances survive (the joystick and
the driving pedal cluster), and panels the player opens on purpose (build
palettes, shops, boards, the emote wheel) still show. Same body.is-zen
@@ -2955,11 +2955,15 @@ body.is-zen .combat-attack-btn,
body.is-zen .combat-mob-label,
body.is-zen .combat-zone-label,
body.is-zen .tik-prompt,
-body.is-zen .ac-prompt {
+body.is-zen .ac-prompt,
+body.is-zen #cc-build,
+body.is-zen #po-strip,
+body.is-zen .cc-it-marker,
+body.is-zen .twx-i18n-fab {
display: none !important;
}
-/* zen toggle — under the power saver, same visual family */
+/* zen toggle: under the power saver, same visual family */
.cc-zen-btn {
position: fixed; top: 184px; right: 14px; z-index: 22;
display: inline-flex; align-items: center; gap: 8px;
@@ -2974,7 +2978,7 @@ body.is-zen .ac-prompt {
.cc-zen-ico { line-height: 1; filter: grayscale(1); }
.cc-zen-label { line-height: 1; }
-/* zen exit pill — the one control left on screen, faded in a frame after entry */
+/* zen exit pill: the one control left on screen, faded in a frame after entry */
#cc-zen-exit {
position: fixed; z-index: 30;
top: calc(env(safe-area-inset-top, 0px) + 14px); right: 14px;
diff --git a/src/game/coincommunities.js b/src/game/coincommunities.js
index 439019a15..858a2b28b 100644
--- a/src/game/coincommunities.js
+++ b/src/game/coincommunities.js
@@ -508,7 +508,7 @@ export class CoinCommunities {
onOpenFeatured: () => this._openFeatured(),
onPublishBuild: (meta) => this._publishBuild(meta),
onDance: () => this._triggerDance(),
- // Zen mode — strip every overlay for a clean view of the world.
+ // Zen mode: strip every overlay for a clean view of the world.
onZen: () => this._setZen(!this._zen),
onFeaturedClosed: () => { this._featuredOpen = false; },
});
@@ -574,6 +574,10 @@ export class CoinCommunities {
// for this session only — never persisted over the player's saved avatar.
const p = new URLSearchParams(location.search);
this._urlAvatar = (p.get('avatar') || '').trim();
+ // Capture ?ui= before enter() canonicalises the URL (the share-link
+ // rewrite drops unknown params); _restoreZen() reads it at world entry,
+ // where the zen preference actually applies.
+ this._urlUi = (p.get('ui') || '').trim();
const mint = p.get('coin');
if (mint) {
const tier = p.get('tier') === 'holders' ? 'holders' : 'general';
@@ -1012,6 +1016,9 @@ export class CoinCommunities {
if (coin.symbol) q.set('symbol', coin.symbol);
if (coin.image) q.set('image', coin.image);
if (tier === 'holders') q.set('tier', 'holders');
+ // Keep ?ui= on the canonical URL so a shared zen link stays a zen link
+ // when copied back out of the address bar (or refreshed).
+ if (this._urlUi) q.set('ui', this._urlUi);
history.replaceState(null, '', location.pathname + '?' + q.toString());
} catch { /* non-fatal */ }
await loadManifest();
@@ -2522,7 +2529,7 @@ export class CoinCommunities {
// ---------------------------------------------------------------- zen mode
// Hides every overlay (HUD, chat, prompts, name tags) so the world renders
- // clean — the same body.is-zen contract /walk uses. Movement affordances
+ // clean (the same body.is-zen contract /walk uses). Movement affordances
// stay (joystick, driving pedals), and panels the player opens on purpose
// (build palettes, shops, the emote wheel) still show. The preference
// persists across sessions, and a shared ?ui=hidden link starts in zen.
@@ -2543,16 +2550,16 @@ export class CoinCommunities {
}
// Restore the zen preference on world entry: URL param wins (?ui=hidden for
- // shared links, ?ui=on to force chrome back), then the stored choice.
+ // shared links, ?ui=on to force chrome back), then the stored choice. Uses
+ // the boot-time capture because enter() rewrites the URL before this runs.
_restoreZen() {
- let param = null;
- try { param = new URLSearchParams(location.search).get('ui'); } catch {}
+ const param = this._urlUi;
if (param === 'hidden' || param === 'off') { this._setZen(true); return; }
if (param === 'on' || param === 'shown') return;
try { if (localStorage.getItem('play:zen') === '1') this._setZen(true); } catch {}
}
- // Drop the zen body classes without touching the stored preference — the
+ // Drop the zen body classes without touching the stored preference: the
// lobby always shows its UI; _restoreZen() re-applies zen next world entry.
_suspendZen() {
this._zen = false;
@@ -2652,7 +2659,7 @@ export class CoinCommunities {
this._toggleFriends();
return;
}
- // Z toggles zen mode — every overlay hidden, just the world. Plain Z
+ // Z toggles zen mode (every overlay hidden, just the world). Plain Z
// only: Ctrl/Cmd+Z stays the build-mode undo above.
if (k === 'z' && !this.buildHud.active && !e.ctrlKey && !e.metaKey && !e.repeat) {
e.preventDefault();