Add co-op server, deploy docs, e2e suite and wire in the music tracks
- server/: Node (ws) static server + authoritative co-op rooms; dual-stack listen, proxy-aware client IP and Origin check, keep-alive pings, per-socket rate limits, graceful shutdown; 59 node:test tests - docs/DEPLOY.md + deploy/netwall.service: Debian 13 LXC, systemd, nginx Proxy Manager walk-through, path prefix, troubleshooting - e2e/: Playwright suite (smoke, touch, end flow, two-browser co-op incl. reconnect, 14-size layout matrix); npm run e2e - Music: tracks.json now points at the uploaded theme/battle/boss/win/lose files; stingers fade out when a new game starts - PAUSED indicator, refreshed icon Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Tb8pW2KAN4oFkh1aK1BfD8
This commit is contained in:
parent
1c2071e6db
commit
faf0cfa603
27 changed files with 3383 additions and 28 deletions
|
|
@ -242,6 +242,7 @@
|
|||
|
||||
function applyMusic() {
|
||||
if (!unlocked) return;
|
||||
if (wanted) stopStinger(0.8);
|
||||
if (!wanted || muted) { stopCurrent(0.4); return; }
|
||||
if (current && current.name === wanted) return;
|
||||
const name = wanted;
|
||||
|
|
@ -264,10 +265,15 @@
|
|||
});
|
||||
}
|
||||
|
||||
let stingEl = null;
|
||||
function stopStinger(fade) {
|
||||
const el = stingEl; stingEl = null;
|
||||
if (el) fadeEl(el, 0, (fade || 0.6) * 1000, () => { try { el.pause(); } catch (e) { /* ignore */ } });
|
||||
}
|
||||
function stinger(name) {
|
||||
if (muted || !unlocked) return;
|
||||
fileFor(name, (el) => {
|
||||
if (el) { try { el.currentTime = 0; el.volume = Math.min(1, 0.9 * Math.max(0.3, musicVol)); el.play().catch(() => {}); } catch (e) { /* ignore */ } return; }
|
||||
if (el) { try { stopStinger(0.2); stingEl = el; el.currentTime = 0; el.volume = Math.min(1, 0.9 * Math.max(0.3, musicVol)); el.play().catch(() => {}); } catch (e) { /* ignore */ } return; }
|
||||
if (name === 'win') { [0, 4, 7, 12, 16, 19, 24].forEach((n, i) => tone(NOTE(69 + n), 0.3, 'triangle', 0.22, 0, i * 0.11)); }
|
||||
else { [0, -3, -7, -12, -17].forEach((n, i) => tone(NOTE(60 + n), 0.5, 'sawtooth', 0.2, NOTE(58 + n), i * 0.22)); }
|
||||
});
|
||||
|
|
@ -300,6 +306,7 @@
|
|||
unlock,
|
||||
stinger,
|
||||
get muted() { return muted; },
|
||||
get now() { return current ? { name: current.name, kind: current.kind } : null; }, // for tests / debugging
|
||||
setMuted(m) {
|
||||
muted = !!m; save();
|
||||
if (master) master.gain.value = muted ? 0 : 0.9;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue