map change

This commit is contained in:
2026-11-15 20:05:02 +01:00
parent 319436a5f9
commit 3e565cf8c7
15 changed files with 242 additions and 26 deletions

View File

@@ -19,7 +19,17 @@
// Credits (standard for every game): shown on the title screen, links open in the normal browser
const DISCORD = 'https://discord.gg/Ej4JPmCZva';
const CREDITS = `© 2026 Michael Media · <a href="${DISCORD}" target="_blank" rel="noopener">Discord</a>`;
const SITE = 'https://michael-media.de';
// build stamp comes from build-web.mjs; identifies the exact release in a leaked copy
const BUILD = (typeof window !== 'undefined' && window.RC_BUILD) || '';
const CREDITS = `© 2026 <a href="${SITE}" target="_blank" rel="noopener">Michael Media</a>`
+ ` · <a href="${DISCORD}" target="_blank" rel="noopener">Discord</a>`
+ (BUILD ? ` · <span class="build">${BUILD}</span>` : '');
// Soft domain lock: the published build only runs on our own site. Local file, localhost and the
// exe always run. This stops a lazy re-upload, nothing more - the file itself can always be copied.
const HOSTS = ['michael-media.de', 'www.michael-media.de', 'localhost', '127.0.0.1', ''];
const hostOk = () => location.protocol === 'file:' || HOSTS.includes(location.hostname)
|| (Kit.host && Kit.host.exe) || document.documentElement.classList.contains('exe');
// ---------------------------------------------------------------- services
const L = Kit.i18n(window.LANG, { prefix: ID });
@@ -107,6 +117,7 @@
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 'mine_drop': audio.tone(520, 0.08, 'square', 0.12, -160); audio.noise(0.06, 0.12, 2200); 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;
@@ -214,6 +225,27 @@
// ---------------------------------------------------------------- intro + title
let introCue = 0;
let gateDone = false;
function startGate(next) {
if (gateDone) { next(); return; }
gateDone = true;
setScreen('intro'); // defined UI state while the gate is up (HUD stays hidden)
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="hazbar"></div><p class="tag">${t('click_start')}</p>
<p class="credits">${CREDITS}</p></div></div>`;
overlay.classList.remove('hide'); overlay.classList.add('clear'); overlay.style.backgroundImage = '';
const go = e => {
if (e) { e.stopPropagation(); if (e.preventDefault) e.preventDefault(); } // must not also skip the intro
removeEventListener('pointerdown', go, true); removeEventListener('keydown', go, true);
if (audio.unlock) audio.unlock();
next();
};
addEventListener('pointerdown', go, true);
addEventListener('keydown', go, true);
}
function startIntro() {
setScreen('intro');
hideOverlay();
@@ -230,7 +262,7 @@
function introTick() {
if (mode !== 'intro' || !view) return;
const it = view.introTime;
for (const [at, f] of [[1.2, SFX.clunk], [1.5, SFX.clunk], [1.62, SFX.clunk], [4.25, SFX.clunk], [4.6, SFX.clunk]]) {
for (const [at, f] of [[0.4, SFX.clunk], [0.62, SFX.clunk], [2.2, SFX.clunk], [2.5, SFX.clunk], [3.4, SFX.clunk]]) {
if (introCue < at && it >= at) f();
}
introCue = it;
@@ -433,7 +465,7 @@
persist();
hud();
shop.reset();
if (!save.tutorialSeen) { save.tutorialSeen = true; persist(); showHelp(openGarage); } else openGarage();
if (!save.tutorialSeen) { save.tutorialSeen = true; persist(); startTutorial(openGarage); } else openGarage();
}
// saves from older versions: missing parts, invalid ids, hangar migration
function repairSave() {
@@ -563,6 +595,25 @@
<b>Shift / E</b><span>${t('key_tower')}</span><b>C</b><span>${t('key_cam')}</span><b>P / Esc</b><span>${t('pause')}</span><b>M</b><span>${t('sound_on')} / ${t('sound_off')}</span>
<b>${t('key_pad')}</b><span>${t('key_pad_text')}</span></div>`;
}
// first start: four short cards instead of the full help page
const TUT = ['tut_1', 'tut_2', 'tut_3', 'tut_4'];
function startTutorial(done) {
let i = 0;
const step = () => {
if (i >= TUT.length) { done(); return; }
const n = i + 1;
overlayEnter();
card(`<h2>${t('tut_title')} <span class="muted">${n}/${TUT.length}</span></h2>
<p>${t(TUT[i])}</p>
<div class="row"><button id="tSkip">${t('tut_skip')}</button>
<button class="primary" id="tNext">${n === TUT.length ? t('tut_go') : t('tut_next')}</button></div>`,
{ bg: 'bg_workshop.jpg' });
$('tNext').onclick = () => { SFX.click(); i++; step(); };
$('tSkip').onclick = () => { SFX.click(); done(); };
};
step();
}
function showHelp(back) {
overlayEnter();
card(`<h2>${t('how_to')}</h2><p>${t('help_text')}</p>${keysHtml()}
@@ -689,6 +740,7 @@
setScreen('fight');
audio.music('music_fight');
banner('📍 ' + t('arena_' + s.arena.id), '#ff7a1a', 2.2);
if (save.games === 0 && !F.online) setTimeout(() => { if (mode === 'fight') banner(t('tut_controls'), '#ffffff', 5); }, 2400);
const pg = $('padGadget'); if (pg) pg.style.display = s.robots[0].st.gadget ? '' : 'none';
buildCds();
buildDmg(0, save.build); buildDmg(1, opp.build);
@@ -782,6 +834,11 @@
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)');
for (const mn of s.mines || []) {
const [px, py] = P(mn.x, mn.z);
ctx.fillStyle = mn.arm > 0 ? 'rgba(200,200,200,.45)' : 'rgba(255,70,40,.95)';
ctx.beginPath(); ctx.arc(px, py, Math.max(2, mn.r * k), 0, 7); ctx.fill();
}
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);
@@ -1083,7 +1140,9 @@
accounts.resume();
if (net && net.enabled) { net.auth.resume(); net.auth.onChange(() => { hud(); if (mode === 'title') showTitle(); }); }
hud();
if (!view) {
if (!hostOk()) {
card(`<h1>Robot Clash</h1><p>${t('wrong_host')}</p><p class="credits">${CREDITS}</p>`);
} else if (!view) {
card(`<h1>Robot Clash</h1><p>${t('no_webgl')}</p><p class="credits">${CREDITS}</p>`);
} else if (DEV.has('fight') || DEV.has('play')) {
// dev: ?play = straight into the shop, ?fight=N = training fight against league robot N
@@ -1119,7 +1178,8 @@
painter.open(); view.showGarage(save.build, paintObj());
}
} else if (DEV.has('online') && net.enabled) { startIntroOrTitle(); startOnline(); }
else if (DEV.has('title')) startIntroOrTitle();
else startIntro();
else if (DEV.has('title')) startGate(startIntroOrTitle);
else startGate(startIntro);
if (DEV.has('tut')) startTutorial(openGarage); // dev: ?play&tut previews the first-start cards
if (DEV.has('uicheck') && RC.uiCheckRun) RC.uiCheckRun(); // dev: &uicheck prints layout faults as text
})();