SOURCE / PINNED RELEASE
Made of little things.
City Breaker
- Release
- 94d2b8664b10…
- Author-recorded commit
- df23103cbcc1…
- License
- LICENSE
- Author’s source reference
- nostr://npub1sj2vketepqw9v6fmge5fdzuj7atj9sv6qv2jss05n2z6rl64lcfqumdsnt/wss%3A%2F%2Fgit.napplet.soy%2F/n-cf8b858653e
Archive hash verified: eeeed725668c1ece…. The source-to-build association is the author’s claim; it has not been independently rebuilt.
import { config } from '@napplet/sdk';
import { runtimeHasDomain } from './domain-availability.js';
import { audio } from './game/audio';
import { prefs } from './game/prefs';
import settingsSchema from '../config.schema.json';
// The optional config domain lets the player tune volume, screen effects and text
// size. Without it the defaults in prefs.ts and styles.css apply.
if (runtimeHasDomain('config')) {
void (async () => {
if (!config.schema) {
await config.registerSchema(settingsSchema as Parameters<typeof config.registerSchema>[0]);
}
const subscription = config.subscribe((values) => {
if (typeof values.volume === 'number') prefs.volume = Math.max(0, Math.min(1, values.volume / 100));
if (typeof values.screenEffects === 'number') prefs.motion = Math.max(0, Math.min(1, values.screenEffects / 100));
if (typeof values.textSize === 'number') document.documentElement.style.fontSize = `${values.textSize}px`;
audio.applyVolume();
});
window.addEventListener('pagehide', () => subscription.close(), { once: true });
})().catch(() => {
// Optional operations may be unavailable even when a host exposes the domain.
});
}
