hughe update
This commit is contained in:
281
game/game.js
281
game/game.js
@@ -5,7 +5,7 @@
|
||||
(function () {
|
||||
'use strict';
|
||||
const $ = Kit.$;
|
||||
const W = 960, H = 540; // design size of the stage
|
||||
const W = 1280, H = 720; // design size of the stage (16:9, higher res = denser UI)
|
||||
const ID = 'robotclash'; // localStorage prefix
|
||||
|
||||
// Paste the Firebase Realtime Database URL here to switch the online fame ranking on
|
||||
@@ -26,7 +26,7 @@
|
||||
const t = L.t;
|
||||
const store = Kit.store(ID);
|
||||
// steer: 'simple' (keys = screen direction) | 'tank' · diff: 'easy' | 'normal' | 'hard' · autofire: weapon fires by itself in reach
|
||||
const settings = Object.assign({ gfx: 'high', intro: true, steer: 'tank', diff: 'easy', autofire: true, cam: 'fpv', arena: 'random' }, store.get('settings', {}));
|
||||
const settings = Object.assign({ gfx: 'medium', intro: true, steer: 'tank', diff: 'easy', autofire: true, cam: 'fpv', arena: 'random' }, store.get('settings', {}));
|
||||
// v2: Michael found "simple" steering worse -> tank is the default again, old saved choice reset once
|
||||
// v3: fights start in first person (cockpit) -> old saved camera reset once
|
||||
if (!settings.v || settings.v < 2) settings.steer = 'tank';
|
||||
@@ -39,9 +39,18 @@
|
||||
money: 800, fame: 0, best: 0, season: 1, beaten: 0, wins: 0, losses: 0, games: 0,
|
||||
owned: Object.values(RC.STARTER).filter(Boolean), build: Object.assign({}, RC.STARTER),
|
||||
paint: { body: 0xff7a1a, accent: 0x15171b }, robotName: 'Clank', flag: 'XX', tutorialSeen: false,
|
||||
robots: [], active: 0, // hangar: saved robot builds; the active one mirrors build/paint/robotName
|
||||
});
|
||||
const MAX_ROBOTS = 6;
|
||||
const newRobotDef = n => ({ name: n || 'Robot', build: Object.assign({}, RC.STARTER), paint: { body: 0xff7a1a, accent: 0x15171b, decal: null, drawn: false } });
|
||||
// keep the active hangar slot in sync with the live build/paint/robotName before saving
|
||||
function syncActive() {
|
||||
if (!save || !save.robots || !save.robots[save.active]) return;
|
||||
const r = save.robots[save.active];
|
||||
r.name = save.robotName; r.build = save.build; r.paint = save.paint;
|
||||
}
|
||||
let slot = null, save = null; // per account, set by enterAccount()
|
||||
const persist = () => { if (slot && save) slot.save(save); };
|
||||
const persist = () => { if (slot && save) { syncActive(); slot.save(save); } };
|
||||
const audio = Kit.createAudio({
|
||||
prefix: ID,
|
||||
files: ['sfx_click', 'sfx_buy', 'sfx_hit', 'sfx_saw', 'sfx_boom', 'sfx_win', 'sfx_lose', 'music_title', 'music_garage', 'music_fight'],
|
||||
@@ -49,6 +58,7 @@
|
||||
});
|
||||
const scores = Kit.scores({ url: DB_URL });
|
||||
const DEV = new URLSearchParams(location.search);
|
||||
if (DEV.has('touch')) document.body.classList.add('forcetouch'); // dev: &touch shows the touch pad on desktop
|
||||
const net = RC.Net(NET_CFG);
|
||||
const FLAGS = ['DE', 'AT', 'CH', 'GB', 'US', 'FR', 'ES', 'IT', 'NL', 'PL', 'TR', 'RU', 'BR', 'JP', 'KR', 'XX'];
|
||||
const flagHtml = c => `<span class="fl fl-${FLAGS.includes(c) ? c : 'XX'}"></span>`;
|
||||
@@ -58,7 +68,7 @@
|
||||
const input = Kit.input({
|
||||
keys: {
|
||||
ArrowUp: 'up', w: 'up', ArrowDown: 'down', s: 'down', ArrowLeft: 'left', a: 'left', ArrowRight: 'right', d: 'right',
|
||||
' ': 'fire', Shift: 'fire2', e: 'fire2', p: 'pause', Escape: 'pause', m: 'mute', Enter: 'ok', c: 'cam',
|
||||
' ': 'fire', Shift: 'fire2', e: 'fire2', g: 'fire3', p: 'pause', Escape: 'pause', m: 'mute', Enter: 'ok', c: 'cam',
|
||||
},
|
||||
onPress(a) {
|
||||
if (mode === 'intro') { skipIntro(); return; }
|
||||
@@ -96,6 +106,7 @@
|
||||
case 'press': audio.sfx('sfx_hit'); audio.noise(0.5, 0.65, 300); audio.tone(55, 0.5, 'sine', 0.6, -20); break;
|
||||
case 'crane': audio.tone(140, 0.6, 'sawtooth', 0.07, 140); break;
|
||||
case 'drop': case 'land': audio.noise(0.22, 0.35, 500); break;
|
||||
case 'broke': audio.sfx('sfx_hit'); audio.noise(0.45, 0.5, 900); audio.tone(240, 0.35, 'sawtooth', 0.22, -190); break;
|
||||
case 'pit_open': for (let k = 0; k < 3; k++) audio.tone(700, 0.3, 'square', 0.12, -250, k * 0.4); break;
|
||||
case 'pit': audio.tone(420, 1.2, 'sawtooth', 0.14, -360); break;
|
||||
case 'grab': audio.tone(150, 0.25, 'square', 0.12, -60); break;
|
||||
@@ -117,7 +128,9 @@
|
||||
let ctx = cv.getContext('2d');
|
||||
let view = null;
|
||||
try { view = RC.Render($('gl'), W, H); view.setQuality(settings.gfx); } catch (err) { console.error(err); }
|
||||
Kit.fit($('app'), { canvases: [[cv, W, H]], onFit(sc) { ctx = cv.getContext('2d'); if (view) view.resize(sc); } });
|
||||
// cap upscaling so the UI does not get huge on big / high-DPI screens (960x540 stage, max ~2x)
|
||||
Kit.fit($('app'), { max: 2.0, margin: document.documentElement.classList.contains('exe') ? 1 : 0.98,
|
||||
canvases: [[cv, W, H]], onFit(sc) { ctx = cv.getContext('2d'); if (view) view.resize(sc); } });
|
||||
Kit.host.dragArea(document.body);
|
||||
const hex = n => '#' + (n >>> 0).toString(16).padStart(6, '0');
|
||||
const img = name => Kit.asset('assets/Sprites/' + name);
|
||||
@@ -126,9 +139,11 @@
|
||||
$('icoFame').innerHTML = `<img src="${img('ico_fame.png')}" alt="" onerror="this.classList.add('missing')">`;
|
||||
|
||||
const shop = RC.Shop({
|
||||
t, getSave: () => save, onSave: () => { persist(); hud(); }, // buy / sell -> credits in the header
|
||||
t, getSave: () => save, onSave: () => { persist(); hud(); }, // buy/sell/rename -> header
|
||||
onBuild: () => view.showGarage(save.build, paintObj()),
|
||||
onPaint: () => view.setPaint(paintObj()),
|
||||
onPreview: b => { if (mode === 'garage') view.showGarage(b, paintObj()); }, // show the selected part on the robot
|
||||
onHangarView: el => renderHangar(el), // Hangar tab content
|
||||
sfx: SFX,
|
||||
});
|
||||
|
||||
@@ -164,6 +179,9 @@
|
||||
overlay.style.backgroundImage = opt.bg ? `linear-gradient(rgba(5,6,10,.55), rgba(5,6,10,.75)), url("${img(opt.bg)}")` : '';
|
||||
}
|
||||
function hideOverlay() { overlay.classList.add('hide'); overlay.innerHTML = ''; overlay.style.backgroundImage = ''; }
|
||||
// fade a menu in once; the class is dropped again so live lists (lobby) do not flicker on every refresh
|
||||
let enterT = 0;
|
||||
function overlayEnter() { overlay.classList.add('enter'); clearTimeout(enterT); enterT = setTimeout(() => overlay.classList.remove('enter'), 220); }
|
||||
const esc = s => String(s).replace(/[&<>"]/g, c => ({ '&': '&', '<': '<', '>': '>', '"': '"' }[c]));
|
||||
const seasonMul = () => 1 + (save.season - 1) * 0.5;
|
||||
const weaponName = b => (b.weapon ? RC.PARTS[b.weapon].name : t('unarmed')) + (b.tower ? ' + ' + RC.PARTS[b.tower].name : '');
|
||||
@@ -180,11 +198,14 @@
|
||||
$('hFame').textContent = save ? Kit.fmt(save.fame) : '–';
|
||||
$('hLeague').textContent = save ? t('league_chip', { s: save.season, n: save.beaten, m: RC.LEAGUE.length }) : '–';
|
||||
$('hUser').textContent = fbUser() ? '👤 ' + fbUser().name : accounts.current ? (accounts.current.guest ? '👤 ' + t('guest') : '👤 ' + accounts.current.name) : save ? '👤 ' + t('guest') : '👤 –';
|
||||
$('bMute').textContent = audio.muted ? t('sound_off') : t('sound_on');
|
||||
$('bMute').textContent = audio.muted ? '🔇' : '🔊';
|
||||
$('bMute').title = (audio.muted ? t('sound_off') : t('sound_on')) + ' (M)';
|
||||
}
|
||||
function setScreen(m) {
|
||||
if (m !== 'garage' && painter.isOpen) painter.close();
|
||||
if (m !== mode) overlayEnter();
|
||||
mode = m;
|
||||
document.body.dataset.mode = m; // CSS shows/places the HUD per screen
|
||||
document.body.classList.toggle('fighting', m === 'fight' || m === 'pause');
|
||||
show('shop', m === 'garage');
|
||||
show('fightHud', m === 'fight' || m === 'pause' || m === 'result');
|
||||
@@ -225,11 +246,17 @@
|
||||
const btns = acc
|
||||
? `<button class="primary" id="bPlay">${t('play_as', { name: esc(acc.name) })}</button>${online}<button id="bSwitch">${t('switch_account')}</button>`
|
||||
: `<button class="primary" id="bLogin">${t('login')}</button><button id="bReg">${t('register')}</button><button id="bGuest">${t('play_guest')}</button>${online}`;
|
||||
overlay.innerHTML = `<div class="title"><div class="big">ROBOT CLASH</div><div class="tag">${t('menu_text')}</div>
|
||||
<div class="row">${btns}</div>
|
||||
<div class="row"><button id="bSet">⚙ ${t('settings')}</button><button id="bHelp">${t('how_to')}</button>
|
||||
// logo picture when ComfyGen made one, otherwise the lettering (never both, never nothing)
|
||||
const logo = `<img class="tlogoimg" src="${Kit.asset('assets/Sprites/logo.png')}" alt="ROBOT CLASH"
|
||||
onerror="this.remove()" onload="this.nextElementSibling.style.display='none'"><div class="big">ROBOT CLASH</div>`;
|
||||
overlay.innerHTML = `<div class="title"><div class="tpanel">
|
||||
${logo}
|
||||
<div class="tag">${t('menu_text')}</div>
|
||||
<div class="hazbar"></div>
|
||||
<div class="tmenu">${btns}</div>
|
||||
<div class="trow2"><button id="bSet">⚙ ${t('settings')}</button><button id="bHelp">${t('how_to')}</button>
|
||||
<button id="bLang" title="English / Deutsch">🌐 ${t('lang_self')}</button>${scores.enabled ? `<button id="bRank">🏆 ${t('ranking')}</button>` : ''}</div>
|
||||
<p class="credits">${CREDITS}</p></div>`;
|
||||
<p class="credits">${CREDITS}</p></div></div>`;
|
||||
overlay.classList.remove('hide'); overlay.classList.add('clear'); overlay.style.backgroundImage = '';
|
||||
const on = (id, f) => { const el = $(id); if (el) el.onclick = () => { SFX.click(); f(); }; };
|
||||
on('bPlay', () => enterAccount());
|
||||
@@ -297,34 +324,42 @@
|
||||
overlay.querySelectorAll('input').forEach(el => el.addEventListener('keydown', e => { e.stopPropagation(); if (e.key === 'Enter') $('oGo').click(); }));
|
||||
}
|
||||
function showLobby() {
|
||||
if (!lobbyRoom) lobbyRoom = 'all'; // filter: 'all' or a country code
|
||||
setScreen('lobby'); renderLobby();
|
||||
}
|
||||
// compact one-view lobby: country filter + flag dropdowns, slim player list
|
||||
// two-pane lobby: country rooms on the left, players of the chosen room on the right (own style, not copied art)
|
||||
function renderLobby() {
|
||||
if (!lobbyRoom) return renderRooms();
|
||||
const here = lobbyRows.filter(r => (FLAGS.includes(r.flag) ? r.flag : 'XX') === lobbyRoom);
|
||||
const meRow = `<div class="prow me"><span class="pf">${flagHtml(lobbyRoom)}</span><span class="pn">${esc(playerName())} <span class="muted">(${t('you')})</span></span><span class="pfame">⭐ ${Kit.fmt(save.fame | 0)}</span><span class="pbusy"></span></div>`;
|
||||
const list = here.map(r => `<div class="prow" data-uid="${r.uid}"><span class="pf">${flagHtml(r.flag)}</span><span class="pn">${esc(r.name)}</span><span class="pfame">⭐ ${Kit.fmt(r.fame | 0)}</span>${r.state === 'idle' ? `<button class="chal" data-uid="${r.uid}">${t('challenge')}</button>` : `<span class="pbusy">${t('busy')}</span>`}</div>`).join('');
|
||||
card(`<h2>${flagHtml(lobbyRoom)} ${t('room_title', { room: t('cc_' + lobbyRoom) })}</h2>
|
||||
<p class="muted">${t('room_count', { n: here.length + 1 })}</p>
|
||||
<div class="plist">${meRow}${list || `<div class="muted" style="padding:14px">${t('lobby_empty')}</div>`}</div>
|
||||
${pendingOut ? `<p class="muted">${t('waiting_accept')} <button class="link" id="lCancel">${t('cancel')}</button></p>` : ''}
|
||||
<div class="row"><button id="lRooms">🌍 ${t('other_rooms')}</button><button id="lQuick">${t('quick_match')}</button><button id="lBack">${t('back')}</button></div>`, { wide: true, bg: 'bg_title.jpg' });
|
||||
const code = r => (FLAGS.includes(r.flag) ? r.flag : 'XX');
|
||||
const all = lobbyRows;
|
||||
const myFlag = FLAGS.includes(save.flag) ? save.flag : 'XX';
|
||||
// I am in the lobby too: count myself in my own country (and in "all"), and only list me there
|
||||
const total = all.length + 1;
|
||||
const cnt = f => all.filter(r => code(r) === f).length + (f === myFlag ? 1 : 0);
|
||||
const here = lobbyRoom === 'all' ? all : all.filter(r => code(r) === lobbyRoom);
|
||||
const showMe = lobbyRoom === 'all' || lobbyRoom === myFlag;
|
||||
const flagOpts = FLAGS.map(f => `<option value="${f}" ${f === myFlag ? 'selected' : ''}>${t('cc_' + f)}</option>`).join('');
|
||||
const room = (f, label, flag) => `<button class="rroom ${lobbyRoom === f ? 'on' : ''}" data-f="${f}"><span class="rfl">${flag ? flagHtml(f) : ''}</span><span class="rn">${label}</span><span class="cnt ${cnt(f) ? 'live' : ''}">${f === 'all' ? total : cnt(f)}</span></button>`;
|
||||
const rooms = room('all', t('all_countries'), false) + FLAGS.map(f => room(f, t('cc_' + f), true)).join('');
|
||||
const prow = (r, me) => `<div class="prow ${me ? 'me' : ''}" ${me ? '' : `data-uid="${r.uid}"`}><span class="pf">${flagHtml(me ? save.flag : r.flag)}</span><span class="pn">${esc(me ? playerName() : r.name)}${me ? ` <span class="muted">(${t('you')})</span>` : ''}</span><span class="pfame">\u2B50 ${Kit.fmt((me ? save.fame : r.fame) | 0)}</span>${me ? '<span class="pbusy"></span>' : (r.state === 'idle' ? `<button class="chal" data-uid="${r.uid}">${t('challenge')}</button>` : `<span class="pbusy">${t('busy')}</span>`)}</div>`;
|
||||
const list = here.map(r => prow(r, false)).join('');
|
||||
const title = lobbyRoom === 'all' ? '🌍 ' + t('all_countries') : flagHtml(lobbyRoom) + ' ' + t('cc_' + lobbyRoom);
|
||||
overlay.innerHTML = `<div class="lobbyfull">
|
||||
<div class="lobbyL"><div class="lobbyLh">🌍 ${t('lobby')}</div><div class="roomlist">${rooms}</div></div>
|
||||
<div class="lobbyR">
|
||||
<div class="lobbyRh">${title} <span class="muted">(${here.length + (showMe ? 1 : 0)})</span><span class="grow"></span>
|
||||
<label class="flagpick">${t('your_flag')} <select id="lFlag">${flagOpts}</select></label></div>
|
||||
<div class="plist">${showMe ? prow(null, true) : ''}${list || (showMe ? '' : `<div class="muted" style="padding:16px;text-align:center">${t('lobby_empty')}</div>`)}</div>
|
||||
${pendingOut ? `<p class="muted" style="margin:6px 0 0">${t('waiting_accept')} <button class="link" id="lCancel">${t('cancel')}</button></p>` : ''}
|
||||
<div class="row" style="margin-top:8px"><button id="lBack">${t('back')}</button><button class="primary" id="lQuick">${t('quick_match')}</button></div>
|
||||
</div></div>`;
|
||||
overlay.classList.remove('hide'); overlay.classList.remove('clear');
|
||||
overlay.style.backgroundImage = `linear-gradient(rgba(5,6,10,.6), rgba(5,6,10,.8)), url("${img('bg_title.jpg')}")`;
|
||||
overlay.querySelectorAll('.rroom').forEach(b => { b.onclick = () => { SFX.click(); lobbyRoom = b.dataset.f; renderLobby(); }; });
|
||||
$('lFlag').onchange = e => { save.flag = e.target.value; persist(); if (lobby) lobby.refresh(); renderLobby(); };
|
||||
overlay.querySelectorAll('.chal').forEach(b => { b.onclick = () => { SFX.click(); pendingOut = b.dataset.uid; lobby.challenge(b.dataset.uid); renderLobby(); }; });
|
||||
if ($('lCancel')) $('lCancel').onclick = () => { SFX.click(); lobby.cancel(); pendingOut = null; renderLobby(); };
|
||||
$('lQuick').onclick = () => { const idle = here.find(r => r.state === 'idle'); if (idle) { SFX.click(); pendingOut = idle.uid; lobby.challenge(idle.uid); renderLobby(); } else SFX.deny(); };
|
||||
$('lRooms').onclick = () => { SFX.click(); lobbyRoom = null; renderLobby(); };
|
||||
$('lBack').onclick = () => { SFX.click(); lobbyRoom = null; if (save) openGarage(); else showTitle(); };
|
||||
}
|
||||
// room picker: every country with how many players sit in it right now
|
||||
function renderRooms() {
|
||||
const count = f => lobbyRows.filter(r => (FLAGS.includes(r.flag) ? r.flag : 'XX') === f).length;
|
||||
const rooms = FLAGS.map(f => { const n = count(f); return `<button class="room ${n ? 'live' : ''}" data-f="${f}">${flagHtml(f)}<span class="rn">${t('cc_' + f)}</span><span class="rc">${n ? '● ' + n : '0'}</span></button>`; }).join('');
|
||||
card(`<h2>🌍 ${t('lobby')}</h2><p class="muted">${t('pick_room')}</p>
|
||||
<div class="rooms">${rooms}</div>
|
||||
<div class="row"><button id="lBack">${t('back')}</button></div>`, { wide: true, bg: 'bg_title.jpg' });
|
||||
overlay.querySelectorAll('.room').forEach(b => { b.onclick = () => {
|
||||
SFX.click(); lobbyRoom = b.dataset.f; save.flag = lobbyRoom; persist(); if (lobby) lobby.refresh(); renderLobby();
|
||||
}; });
|
||||
$('lQuick').onclick = () => { const idle = here.find(r => r.state === 'idle') || all.find(r => r.state === 'idle'); if (idle) { SFX.click(); pendingOut = idle.uid; lobby.challenge(idle.uid); renderLobby(); } else SFX.deny(); };
|
||||
$('lBack').onclick = () => { SFX.click(); if (save) openGarage(); else showTitle(); };
|
||||
}
|
||||
function showIncoming(c) {
|
||||
@@ -400,16 +435,66 @@
|
||||
shop.reset();
|
||||
if (!save.tutorialSeen) { save.tutorialSeen = true; persist(); showHelp(openGarage); } else openGarage();
|
||||
}
|
||||
// saves from older versions: missing parts, invalid ids
|
||||
// saves from older versions: missing parts, invalid ids, hangar migration
|
||||
function repairSave() {
|
||||
save.owned = (save.owned || []).filter(id => RC.PARTS[id]);
|
||||
for (const sl of RC.SLOTS) {
|
||||
if (save.build[sl] && !RC.PARTS[save.build[sl]]) save.build[sl] = null;
|
||||
if (save.build[sl] && !save.owned.includes(save.build[sl])) save.owned.push(save.build[sl]);
|
||||
// hangar migration: older saves have only build/paint/robotName -> make it robot slot 0
|
||||
if (!Array.isArray(save.robots) || !save.robots.length) {
|
||||
save.robots = [{ name: save.robotName || 'Clank', build: save.build || Object.assign({}, RC.STARTER), paint: save.paint || { body: 0xff7a1a, accent: 0x15171b } }];
|
||||
save.active = 0;
|
||||
}
|
||||
for (const sl of Object.keys(RC.REQUIRED)) if (!save.build[sl]) { save.build[sl] = RC.STARTER[sl]; if (!save.owned.includes(RC.STARTER[sl])) save.owned.push(RC.STARTER[sl]); }
|
||||
save.active = Kit.clamp(save.active | 0, 0, save.robots.length - 1);
|
||||
const fixBuild = b => {
|
||||
for (const sl of RC.SLOTS) {
|
||||
if (b[sl] && !RC.PARTS[b[sl]]) b[sl] = null;
|
||||
if (b[sl] && !save.owned.includes(b[sl])) save.owned.push(b[sl]);
|
||||
}
|
||||
for (const sl of Object.keys(RC.REQUIRED)) if (!b[sl]) { b[sl] = RC.STARTER[sl]; if (!save.owned.includes(RC.STARTER[sl])) save.owned.push(RC.STARTER[sl]); }
|
||||
};
|
||||
for (const r of save.robots) { r.build = r.build || Object.assign({}, RC.STARTER); r.paint = r.paint || { body: 0xff7a1a, accent: 0x15171b }; r.name = r.name || 'Robot'; fixBuild(r.build); }
|
||||
// load the active robot into the live fields the rest of the game uses
|
||||
const a = save.robots[save.active];
|
||||
save.build = a.build; save.paint = a.paint; save.robotName = a.name;
|
||||
save.beaten = Kit.clamp(save.beaten | 0, 0, RC.LEAGUE.length - 1);
|
||||
}
|
||||
// hangar: switch / add / delete robot slots (owned parts are shared)
|
||||
function switchRobot(i) {
|
||||
if (i === save.active || !save.robots[i]) return;
|
||||
syncActive();
|
||||
save.active = i;
|
||||
const a = save.robots[i];
|
||||
save.build = a.build; save.paint = a.paint; save.robotName = a.name;
|
||||
persist();
|
||||
RC.layerFromData(layer, save.paint.decal, () => { if (mode === 'garage') view.showGarage(save.build, paintObj()); });
|
||||
shop.reset(); shop.render(); view.showGarage(save.build, paintObj()); renderHangar();
|
||||
}
|
||||
function addRobot() {
|
||||
if (save.robots.length >= MAX_ROBOTS) { SFX.deny(); return; }
|
||||
syncActive();
|
||||
save.robots.push(newRobotDef(t('robot_n', { n: save.robots.length + 1 })));
|
||||
switchRobot(save.robots.length - 1);
|
||||
SFX.buy();
|
||||
}
|
||||
function delRobot(i) {
|
||||
if (save.robots.length <= 1) { SFX.deny(); return; }
|
||||
save.robots.splice(i, 1);
|
||||
save.active = Kit.clamp(save.active >= i ? save.active - (save.active === i ? 0 : 1) : save.active, 0, save.robots.length - 1);
|
||||
const a = save.robots[save.active]; save.build = a.build; save.paint = a.paint; save.robotName = a.name;
|
||||
persist(); RC.layerFromData(layer, save.paint.decal, () => {}); shop.reset(); shop.render(); view.showGarage(save.build, paintObj()); renderHangar();
|
||||
}
|
||||
// hangar management (shop top-tab): list of robots with weapon, switch / delete + add button
|
||||
function renderHangar(el) {
|
||||
el = el || $('hangarView'); if (!el) return;
|
||||
const rows = save.robots.map((r, i) => `<div class="hmrow ${i === save.active ? 'on' : ''}" data-i="${i}">
|
||||
<div><div class="hmn">${esc(r.name)}</div><div class="hmw">${esc(weaponName(r.build))}</div></div>
|
||||
${i === save.active ? `<span class="muted" style="font-size:12px">${t('active_robot')}</span>` : `<button data-use="${i}">${t('use')}</button>`}
|
||||
${save.robots.length > 1 ? `<button data-del="${i}" title="${t('delete')}">✕</button>` : '<span></span>'}</div>`).join('');
|
||||
el.innerHTML = `<div class="hmgr">${rows}</div>
|
||||
${save.robots.length < MAX_ROBOTS ? `<button class="primary" id="hAdd" style="margin-top:8px">+ ${t('new_robot')}</button>` : `<p class="muted" style="margin-top:8px">${t('hangar_full')}</p>`}`;
|
||||
el.querySelectorAll('[data-use]').forEach(b => { b.onclick = () => { SFX.click(); switchRobot(+b.dataset.use); shop.setTab('build'); } ; });
|
||||
el.querySelectorAll('[data-del]').forEach(b => { b.onclick = () => { SFX.click(); delRobot(+b.dataset.del); renderHangar(); } ; });
|
||||
if ($('hAdd')) $('hAdd').onclick = () => { addRobot(); shop.setTab('build'); };
|
||||
}
|
||||
function signOut() {
|
||||
persist();
|
||||
if (lobby && onlineReady) { lobby.leave(); onlineReady = false; lobbyRows = []; pendingOut = null; }
|
||||
@@ -431,6 +516,7 @@
|
||||
|
||||
// ---------------------------------------------------------------- settings / help / ranking
|
||||
function showSettings(back) {
|
||||
overlayEnter();
|
||||
const prev = mode;
|
||||
const seg = (id, val, opts) => `<div class="seg" id="${id}">${opts.map(([v, label]) => `<button data-v="${v}" class="${v === val ? 'on' : ''}">${label}</button>`).join('')}</div>`;
|
||||
const who = fbAcc() || (accounts.current && !accounts.current.guest ? accounts.current : null);
|
||||
@@ -478,11 +564,13 @@
|
||||
<b>${t('key_pad')}</b><span>${t('key_pad_text')}</span></div>`;
|
||||
}
|
||||
function showHelp(back) {
|
||||
overlayEnter();
|
||||
card(`<h2>${t('how_to')}</h2><p>${t('help_text')}</p>${keysHtml()}
|
||||
<p style="margin-top:12px">${t('help_arena')}</p><button class="primary" id="bOk">${t('ok')}</button>`, { bg: 'bg_title.jpg' });
|
||||
$('bOk').onclick = () => { SFX.click(); back(); };
|
||||
}
|
||||
function showRanking(back) {
|
||||
overlayEnter();
|
||||
card(`<h2>🏆 ${t('ranking')}</h2><ol class="board" id="board"><li class="muted">${t('loading')}</li></ol><div class="row"><button class="primary" id="bBack">${t('back')}</button></div>`, { bg: 'bg_title.jpg' });
|
||||
$('bBack').onclick = () => { SFX.click(); back(); };
|
||||
fillBoard();
|
||||
@@ -519,6 +607,8 @@
|
||||
view.showGarage(save.build, paintObj());
|
||||
audio.music('music_garage');
|
||||
shop.render(); hud();
|
||||
$('zIn').onclick = () => { SFX.click(); view.zoomGarage(1.18); };
|
||||
$('zOut').onclick = () => { SFX.click(); view.zoomGarage(1 / 1.18); };
|
||||
}
|
||||
$('bGMenu').onclick = () => { SFX.click(); persist(); startIntroOrTitle(); };
|
||||
$('bGOnline').onclick = () => { SFX.click(); persist(); startOnline(); };
|
||||
@@ -567,9 +657,10 @@
|
||||
const seed = online ? online.seed : (Date.now() & 0xffff) + save.games * 31;
|
||||
// arena: league scales with the opponent, online derives from the shared seed, training uses the setting
|
||||
const ids = RC.ARENAS.map(a => a.id), idx = RC.LEAGUE.indexOf(opp);
|
||||
const bySize = RC.ARENAS.slice().sort((a, b) => a.half - b.half).map(a => a.id); // small -> big for league progression
|
||||
const arenaId = DEV.get('arena') ? DEV.get('arena')
|
||||
: online ? ids[seed % ids.length]
|
||||
: idx >= 0 ? ids[Math.min(ids.length - 1, Math.floor(idx / 3))]
|
||||
: idx >= 0 ? bySize[Math.min(bySize.length - 1, Math.floor(idx * bySize.length / RC.LEAGUE.length))]
|
||||
: settings.arena === 'random' || !settings.arena ? ids[(Math.random() * ids.length) | 0] : settings.arena;
|
||||
const s = RC.Combat.create({ robots: [stA, stB], seed, names: [save.robotName, opp.name], arena: arenaId });
|
||||
const skill = Kit.clamp(opp.skill + (save.season - 1) * 0.12 + D.skill, 0, 1);
|
||||
@@ -598,6 +689,9 @@
|
||||
setScreen('fight');
|
||||
audio.music('music_fight');
|
||||
banner('📍 ' + t('arena_' + s.arena.id), '#ff7a1a', 2.2);
|
||||
const pg = $('padGadget'); if (pg) pg.style.display = s.robots[0].st.gadget ? '' : 'none';
|
||||
buildCds();
|
||||
buildDmg(0, save.build); buildDmg(1, opp.build);
|
||||
fightHud();
|
||||
}
|
||||
|
||||
@@ -608,23 +702,23 @@
|
||||
const b = i => !!(gp.buttons[i] && gp.buttons[i].pressed);
|
||||
if (b(9) && every('gpStart', 400)) togglePause();
|
||||
return { throttle: -dz(gp.axes[1] || 0) + (b(12) ? 1 : 0) - (b(13) ? 1 : 0), turn: dz(gp.axes[0] || 0) + (b(15) ? 1 : 0) - (b(14) ? 1 : 0),
|
||||
fire: b(0) || b(7), fire2: b(1) || b(2) || b(6) };
|
||||
fire: b(0) || b(7), fire2: b(1) || b(2) || b(6), fire3: b(3) || b(5) };
|
||||
}
|
||||
// up/down + left/right from keys, touch pad and gamepad
|
||||
function playerInput() {
|
||||
let ky = (input.down('up') ? 1 : 0) - (input.down('down') ? 1 : 0);
|
||||
let kx = (input.down('right') ? 1 : 0) - (input.down('left') ? 1 : 0);
|
||||
let fire = input.down('fire'), fire2 = input.down('fire2');
|
||||
let fire = input.down('fire'), fire2 = input.down('fire2'), fire3 = input.down('fire3');
|
||||
const g = pad();
|
||||
if (g) { ky = Kit.clamp(ky + g.throttle, -1, 1); kx = Kit.clamp(kx + g.turn, -1, 1); fire = fire || g.fire; fire2 = fire2 || g.fire2; }
|
||||
if (g) { ky = Kit.clamp(ky + g.throttle, -1, 1); kx = Kit.clamp(kx + g.turn, -1, 1); fire = fire || g.fire; fire2 = fire2 || g.fire2; fire3 = fire3 || g.fire3; }
|
||||
const s = F.s, me = s.robots[0], en = s.robots[1];
|
||||
let k = { throttle: ky, turn: kx, fire, fire2 };
|
||||
let k = { throttle: ky, turn: kx, fire, fire2, fire3 };
|
||||
if (settings.steer === 'simple' && view.camMode === 'iso') {
|
||||
// keys = direction on screen; the robot turns towards it and drives
|
||||
// (iso camera: screen up = world (-1,-1), screen right = world (1,-1))
|
||||
const dx = (kx - ky) / Math.SQRT2, dz = (-kx - ky) / Math.SQRT2;
|
||||
const wrap = a => { while (a > Math.PI) a -= 2 * Math.PI; while (a < -Math.PI) a += 2 * Math.PI; return a; };
|
||||
if (Math.hypot(dx, dz) < 0.2) k = { throttle: 0, turn: 0, fire, fire2 };
|
||||
if (Math.hypot(dx, dz) < 0.2) k = { throttle: 0, turn: 0, fire, fire2, fire3 };
|
||||
else {
|
||||
let diff = wrap(Math.atan2(dz, dx) - me.a);
|
||||
// target behind: drive backwards there instead of a slow 180° turn on the spot
|
||||
@@ -634,18 +728,25 @@
|
||||
if (back) diff = wrap(diff + Math.PI);
|
||||
const ad = Math.abs(diff);
|
||||
const thr = ad < 0.9 ? 1 : ad < 1.6 ? 0.6 : 0.2; // keep rolling while turning
|
||||
k = { throttle: back ? -thr : thr, turn: Kit.clamp(diff * 3.5, -1, 1), fire, fire2 };
|
||||
k = { throttle: back ? -thr : thr, turn: Kit.clamp(diff * 3.5, -1, 1), fire, fire2, fire3 };
|
||||
}
|
||||
}
|
||||
// weapon helper: fires the main weapon in reach, the tower when in range
|
||||
if (settings.autofire) {
|
||||
const w = me.st.weapon, tw = me.st.tower, dist = Math.hypot(en.x - me.x, en.z - me.z);
|
||||
if (w && !k.fire) {
|
||||
if (w.type === 'spinner') k.fire = dist < 5;
|
||||
if (w.type === 'spinner' || w.type === 'vspinner') k.fire = dist < 5;
|
||||
else if (w.type === 'saw') k.fire = dist < 2.4;
|
||||
else if (w.type !== 'wedge') k.fire = RC.Combat.inZone(s, me, en);
|
||||
}
|
||||
if (tw && !k.fire2) k.fire2 = dist < tw.range * 0.95;
|
||||
if (tw && !k.fire2) {
|
||||
// the turret fires forward now, so only help when the enemy is actually in front
|
||||
const d = Math.atan2(en.z - me.z, en.x - me.x) - me.a;
|
||||
const ahead = Math.abs(Math.atan2(Math.sin(d), Math.cos(d)));
|
||||
const near = tw.type === 'flamer' || tw.type === 'zapper';
|
||||
k.fire2 = dist < tw.range * 0.95 && ahead < (near ? 0.5 : 0.3);
|
||||
}
|
||||
if (me.st.gadget && !k.fire3) k.fire3 = RC.Combat.wantGadget(s, me, en);
|
||||
}
|
||||
return k;
|
||||
}
|
||||
@@ -661,19 +762,26 @@
|
||||
// minimap for chase / cockpit view: arena, traps, pit, both robots
|
||||
function minimap() {
|
||||
const touch = window.matchMedia && matchMedia('(pointer: coarse)').matches;
|
||||
const s = F.s, A = RC.ARENA, S = touch ? 104 : 128, X = W - S - 14, Y = touch ? 84 : H - S - 14, k = S / (A.half * 2);
|
||||
const s = F.s, A = s.arena, S = touch ? 104 : 128, X = W - S - 14, Y = touch ? 84 : H - S - 14, k = S / (A.half * 2);
|
||||
// rotate 45° like the iso view, so "up" matches the arena camera
|
||||
const P = (x, z) => [X + S / 2 + (x - z) * k * 0.7071, Y + S / 2 + (x + z) * k * 0.7071];
|
||||
ctx.save();
|
||||
ctx.fillStyle = 'rgba(10,12,16,.72)'; ctx.strokeStyle = 'rgba(255,255,255,.25)'; ctx.lineWidth = 1;
|
||||
const poly = pts => { ctx.beginPath(); pts.forEach(([x, z], i) => { const [px, py] = P(x, z); if (i) ctx.lineTo(px, py); else ctx.moveTo(px, py); }); ctx.closePath(); };
|
||||
const h = A.half;
|
||||
poly([[-h, -h], [h, -h], [h, h], [-h, h]]); ctx.fill(); ctx.stroke();
|
||||
if (A.shape === 'round') poly(Array.from({ length: 20 }, (_, i) => { const a = i / 20 * Math.PI * 2; return [Math.cos(a) * h, Math.sin(a) * h]; }));
|
||||
else if (A.shape === 'octagon') { const d = h * 0.67; poly([[-d, -h], [d, -h], [h, -d], [h, d], [d, h], [-d, h], [-h, d], [-h, -d]]); }
|
||||
else poly([[-h, -h], [h, -h], [h, h], [-h, h]]);
|
||||
ctx.fill(); ctx.stroke();
|
||||
const rect = (o, col) => { ctx.fillStyle = col; poly([[o.x - o.hw, o.z - o.hd], [o.x + o.hw, o.z - o.hd], [o.x + o.hw, o.z + o.hd], [o.x - o.hw, o.z + o.hd]]); ctx.fill(); };
|
||||
rect(A.press, 'rgba(242,181,28,.35)'); rect(A.crane, 'rgba(242,181,28,.35)');
|
||||
rect(A.pit, s.pitOpen >= 1 ? 'rgba(255,40,40,.85)' : 'rgba(255,255,255,.12)');
|
||||
for (const f of A.flames) rect(f, RC.hazardOn(f, s.t) ? 'rgba(255,110,20,.85)' : 'rgba(255,110,20,.25)');
|
||||
for (const sw of A.saws) { const [px, py] = P(sw.x, sw.z); ctx.fillStyle = RC.hazardOn(sw, s.t) ? 'rgba(255,60,60,.9)' : 'rgba(200,200,200,.3)'; ctx.beginPath(); ctx.arc(px, py, sw.r * k, 0, 7); ctx.fill(); }
|
||||
for (const bl of A.belts) rect(bl, 'rgba(80,170,255,.35)');
|
||||
for (const o of A.oil) { const [px, py] = P(o.x, o.z); ctx.fillStyle = 'rgba(12,12,20,.65)'; ctx.beginPath(); ctx.arc(px, py, o.r * k, 0, 7); ctx.fill(); }
|
||||
for (const m of A.rams) rect(m, RC.hazardOn(m, s.t) ? 'rgba(255,60,60,.8)' : 'rgba(200,200,200,.25)');
|
||||
for (const b of A.blocks) rect(b, 'rgba(150,160,175,.6)');
|
||||
s.robots.forEach((r, i) => {
|
||||
if (r.out) return;
|
||||
const [px, py] = P(r.x, r.z), [qx, qy] = P(r.x + Math.cos(r.a), r.z + Math.sin(r.a)), ang = Math.atan2(qy - py, qx - px);
|
||||
@@ -708,10 +816,11 @@
|
||||
}
|
||||
for (const e of events) {
|
||||
SFX.event(e);
|
||||
if (e.type === 'dmg') F.acc[e.who] += e.amount;
|
||||
if (e.type === 'dmg') { F.acc[e.who] += e.amount; if (e.amount >= 3) flashBox(e.who); }
|
||||
else if (e.type === 'pit_open') banner(t('pit_open'), '#ff4a3a', 2);
|
||||
else if (e.type === 'pit') banner(t('into_pit'), '#ff4a3a', 2.2);
|
||||
else if (e.type === 'ko') banner(t('knockout'), '#ff7a1a', 2.2);
|
||||
else if (e.type === 'broke') banner(t(e.who === 0 ? 'broke_you' : 'broke_enemy', { p: t('slot_' + e.part) }), e.who === 0 ? '#ff5a4a' : '#ffc940', 1.8);
|
||||
}
|
||||
view.events(events);
|
||||
s.events.length = 0;
|
||||
@@ -730,10 +839,59 @@
|
||||
if (s.result && s.endIn <= 0 && !F.ended) { F.ended = true; endFight(); }
|
||||
}
|
||||
|
||||
// cooldown chips for the parts actually fitted (built once, only --p changes per frame)
|
||||
const CD_KEY = { weapon: '␣', tower: '⇧', gadget: 'G' };
|
||||
function buildCds() {
|
||||
const el = $('fCds');
|
||||
el.innerHTML = RC.Combat.cooldowns(F.s.robots[0]).map(c =>
|
||||
`<div class="cdchip" data-slot="${c.slot}" style="--p:0"><div class="in">${RC.pic('part_' + c.id, '🔧')}</div>` +
|
||||
`<b class="k">${CD_KEY[c.slot]}</b>${c.n === undefined ? '' : `<b class="n">${c.n}</b>`}</div>`).join('');
|
||||
}
|
||||
// condition panel: every part that can be torn off, shown per robot and greyed out when it is gone
|
||||
const BREAKABLE = ['armour', 'wheels', 'weapon', 'tower'];
|
||||
function buildDmg(i, build) {
|
||||
const icons = BREAKABLE.filter(k => build[k]).map(k =>
|
||||
`<span class="pt" data-part="${k}" title="${t('slot_' + k)}">${RC.pic('part_' + build[k], GLYPH_SLOT[k])}</span>`).join('');
|
||||
$('fD' + i).innerHTML = `<span class="hpn"></span><span class="pts">${icons}</span>`;
|
||||
}
|
||||
const GLYPH_SLOT = { armour: '🛡️', wheels: '🛞', weapon: '🪓', tower: '🔥' };
|
||||
|
||||
// short red flash on the box that just took a solid hit
|
||||
let hitT = [0, 0];
|
||||
function flashBox(who) {
|
||||
const el = $(who === 0 ? 'fLeft' : 'fRight');
|
||||
el.classList.add('hit');
|
||||
clearTimeout(hitT[who]);
|
||||
hitT[who] = setTimeout(() => el.classList.remove('hit'), 120);
|
||||
}
|
||||
|
||||
function fightHud() {
|
||||
if (!F) return;
|
||||
const s = F.s;
|
||||
for (let i = 0; i < 2; i++) $('fH' + i).style.width = (s.robots[i].hp / s.robots[i].maxHp * 100).toFixed(1) + '%';
|
||||
for (let i = 0; i < 2; i++) {
|
||||
const r = s.robots[i], pct = r.hp / r.maxHp;
|
||||
$('fH' + i).style.width = (pct * 100).toFixed(1) + '%';
|
||||
$('fG' + i).style.width = (pct * 100).toFixed(1) + '%'; // trails behind (CSS transition)
|
||||
$(i === 0 ? 'fLeft' : 'fRight').classList.toggle('hurt', pct < 0.25 && !r.dead);
|
||||
// readable damage: hit points left, and every torn-off part crossed out live
|
||||
const el = $('fD' + i), hpn = el.querySelector('.hpn');
|
||||
const txt = `${Math.ceil(r.hp)}/${Math.round(r.maxHp)}`;
|
||||
if (hpn && hpn.textContent !== txt) hpn.textContent = txt;
|
||||
for (const ps of el.querySelectorAll('.pt')) ps.classList.toggle('gone', !!(r.lost && r.lost[ps.dataset.part]));
|
||||
}
|
||||
const own = s.robots[0].hp / s.robots[0].maxHp;
|
||||
$('dmgvig').style.opacity = own < 0.3 && !s.robots[0].out ? ((0.3 - own) / 0.3 * 0.6).toFixed(2) : 0;
|
||||
const cds = RC.Combat.cooldowns(s.robots[0]), chips = $('fCds').children;
|
||||
for (let i = 0; i < chips.length && i < cds.length; i++) {
|
||||
const ch = chips[i], c = cds[i];
|
||||
ch.style.setProperty('--p', c.p.toFixed(2));
|
||||
ch.classList.toggle('on', !!c.on);
|
||||
ch.classList.toggle('spent', c.n === 0);
|
||||
ch.classList.toggle('broke', !!c.broke);
|
||||
const n = ch.querySelector('.n');
|
||||
if (n && n.textContent !== String(c.n)) n.textContent = c.n;
|
||||
if (c.slot === 'gadget') { const pg = $('padGadget'); if (pg) pg.style.setProperty('--p', c.p.toFixed(2)); }
|
||||
}
|
||||
const sec = Math.ceil(s.left);
|
||||
$('fTime').textContent = `${Math.floor(sec / 60)}:${String(sec % 60).padStart(2, '0')}`;
|
||||
$('fTime').classList.toggle('low', sec <= 10);
|
||||
@@ -741,7 +899,7 @@
|
||||
let st = '';
|
||||
if (me.lifted) st = t('st_lifted'); else if (me.grabbedBy !== null) st = t('st_grabbed');
|
||||
else if (me.flipped > 0 && !me.st.invertible) st = t('st_flipped'); else if (me.stun > 0) st = t('st_stunned');
|
||||
else if (s.pitAlarm) st = t('pit_is_open'); else if (s.left - RC.ARENA.pitOpensAt < 10 && s.left > RC.ARENA.pitOpensAt) st = t('pit_soon');
|
||||
else if (s.pitAlarm) st = t('pit_is_open'); else if (s.left - s.arena.pitOpensAt < 10 && s.left > s.arena.pitOpensAt) st = t('pit_soon');
|
||||
$('fState').textContent = st;
|
||||
}
|
||||
|
||||
@@ -839,11 +997,21 @@
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------- loop
|
||||
let lastNow = 0;
|
||||
let lastNow = 0, fpsN = 0, fpsT = 0, fpsVal = 0;
|
||||
function render(alpha, now) {
|
||||
// cap rendering: ~60 fps during action, ~16 fps when a static menu covers the arena (saves CPU/GPU on
|
||||
// high-refresh monitors and in menus). update() stays fixed 60 Hz via the loop, so physics is unaffected.
|
||||
const active = mode === 'fight' || mode === 'pause' || mode === 'intro' || mode === 'garage';
|
||||
const minGap = active ? 15.5 : 60;
|
||||
if (lastNow && now - lastNow < minGap) return;
|
||||
const dt = Math.min(0.05, lastNow ? (now - lastNow) / 1000 : 0.016); lastNow = now;
|
||||
if (view) view.frame(mode === 'pause' ? 0 : dt, now);
|
||||
ctx.clearRect(0, 0, W, H);
|
||||
if (DEV.has('fps')) { // dev: ?fps shows the effective render rate
|
||||
fpsN++; if (now - fpsT > 500) { fpsVal = Math.round(fpsN * 1000 / (now - fpsT)); fpsN = 0; fpsT = now; }
|
||||
ctx.fillStyle = '#6dff9e'; ctx.font = '14px monospace'; ctx.textAlign = 'left'; ctx.textBaseline = 'top';
|
||||
ctx.fillText(fpsVal + ' fps · ' + settings.gfx, 10, 10);
|
||||
}
|
||||
if (mode === 'intro' && view) {
|
||||
const it = view.introTime;
|
||||
if (it > 5.6) {
|
||||
@@ -884,6 +1052,7 @@
|
||||
const loop = Kit.loop({ step: 1000 / 60, update, render }).start();
|
||||
|
||||
function togglePause() {
|
||||
overlayEnter();
|
||||
if (F && F.online && mode === 'fight') { banner(t('no_pause_online'), '#ffffff', 1.4); return; }
|
||||
if (mode === 'fight') {
|
||||
mode = 'pause'; loop.pause();
|
||||
@@ -923,7 +1092,10 @@
|
||||
if (DEV.get('equip')) for (const id of DEV.get('equip').split(',')) { const p = RC.PARTS[id]; if (p) { if (!save.owned.includes(id)) save.owned.push(id); save.build[p.slot] = id; } }
|
||||
if (DEV.get('arena')) settings.arena = DEV.get('arena');
|
||||
RC.layerFromData(layer, save.paint.decal, () => { if (mode === 'garage') view.showGarage(save.build, paintObj()); });
|
||||
if (DEV.get('hangar')) { const n = Math.min(MAX_ROBOTS, +DEV.get('hangar') || 3); while (save.robots.length < n) save.robots.push(newRobotDef(t('robot_n', { n: save.robots.length + 1 }))); }
|
||||
if (DEV.has('fight')) startFight(RC.LEAGUE[Kit.clamp(+DEV.get('fight') || 0, 0, 7)], true); else openGarage();
|
||||
if (DEV.get('shoptab') && mode === 'garage') shop.setTab(DEV.get('shoptab'));
|
||||
if (DEV.get('sel') && mode === 'garage') { const id = DEV.get('sel'), p = RC.PARTS[id]; if (p) { const tb = document.querySelector(`.tab[data-slot="${p.slot}"]`); if (tb) tb.click(); const it = document.querySelector(`.item[data-id="${id}"]`); if (it) it.click(); } }
|
||||
// dev: ?play&screen=league|vs|settings|help|lobby|pause opens that screen (layout screenshots)
|
||||
const scr = DEV.get('screen');
|
||||
if (scr === 'league') { save.beaten = Math.max(save.beaten, 3); showLeague(); }
|
||||
@@ -949,4 +1121,5 @@
|
||||
} else if (DEV.has('online') && net.enabled) { startIntroOrTitle(); startOnline(); }
|
||||
else if (DEV.has('title')) startIntroOrTitle();
|
||||
else startIntro();
|
||||
if (DEV.has('uicheck') && RC.uiCheckRun) RC.uiCheckRun(); // dev: &uicheck prints layout faults as text
|
||||
})();
|
||||
|
||||
Reference in New Issue
Block a user