From 8134df0b865b09cc8578d1fb8cfa00ec15060db6 Mon Sep 17 00:00:00 2001 From: rizkyaz0 Date: Mon, 5 Oct 2026 14:57:35 +0700 Subject: [PATCH] Panel dummy: waktu rekaman tidak pernah negatif --- training.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/training.js b/training.js index 2345063..8213935 100644 --- a/training.js +++ b/training.js @@ -138,7 +138,7 @@ function stopRec(why) { if (R.state === 'armed') { R.state = 'idle'; if (R.keep) Object.assign(R, R.keep); R.keep = null; say(R.ev.length ? 'Perekaman dibatalkan; rekaman sebelumnya masih ada.' : 'Perekaman dibatalkan.', ''); return; } if (R.state !== 'rec') return; - const rel = S.time - R.t0; for (const k of R.down) R.ev.push({ t: rel, k, d: 0 }); R.down.clear(); + const rel = Math.max(0, S.time - R.t0); for (const k of R.down) R.ev.push({ t: rel, k, d: 0 }); R.down.clear(); R.dur = rel; R.ref = stats(); R.state = 'idle'; say(R.ev.length ? (why === 'batas' ? 'Batas 10 dtk tercapai. ' : '') + 'Rekaman siap. Tekan PUTAR.' : 'Tidak ada input terekam.', R.ev.length ? 'good' : 'bad'); } @@ -248,7 +248,7 @@ if (ai && S.beh !== 'cpu') S.beh = 'cpu'; else if (!ai && S.beh === 'cpu') S.beh = 'diam'; // Pengaturan mengubah Lawan aktif const busy = R.state !== 'idle', st = g.stats?.() || { comboHits: 0, bestCombo: 0, totalDamage: 0, comboDamage: 0 }; if (st.comboHits > 0) { S.cmb.live = true; S.cmb.hits = st.comboHits; S.cmb.dmg = st.comboDamage || 0; } else if (S.cmb.live) { S.cmb.live = false; S.cmb.last = { hits: S.cmb.hits, dmg: S.cmb.dmg }; } - const relNow = R.state === 'rec' ? S.time - R.t0 : R.state === 'play' && R.p0 !== null ? S.time - R.p0 : 0; + const relNow = Math.max(0, R.state === 'rec' ? S.time - R.t0 : R.state === 'play' && R.p0 !== null ? S.time - R.p0 : 0); const hb = hbOn(); const key = JSON.stringify([S.open, S.side, S.beh, S.inf, S.fd, hb, R.state, R.ev.length, Math.floor(relNow * 5), R.dur, R.msg, S.cmb.live, S.cmb.hits, S.cmb.dmg, S.cmb.last, st.bestCombo, st.totalDamage, S.fd ? S.fdn : 0]); if (key === S.key) return; S.key = key;