view update

This commit is contained in:
2026-11-17 14:17:50 +01:00
parent 3e565cf8c7
commit e0496fa089
45 changed files with 2024 additions and 149 deletions

View File

@@ -138,6 +138,7 @@
shield: 0, gcd: 0, gUses: st.gadget && st.gadget.charges || 0,
lost: { armour: false, wheels: false, weapon: false, tower: false }, // parts torn off during the fight
onOil: false, // standing in a slick: less grip, lazy steering
g3: false, // last gadget button state (for one-shot gadgets)
cd: 0, cd2: 0, spin: 0, swing: 0, flipAnim: 0, boost: 0, sawOn: false, flameOn: false, gunOn: false,
turretA: p.a, dealt: 0, taken: 0, pressT: 0, craneT: 0, fx: 0,
};
@@ -312,7 +313,7 @@
s.events.push({ type: 'wall', who: r.i, x: r.x, z: r.z, speed: vn });
damage(s, r, (vn - 1.8) * 4.5, null, { kind: 'spikes' });
// slammed into the spikes hard -> bounces up and can land on its back
if (vn > 3.5 && r.y < 0.05 && !r.st.invertible && !r.st.lowProfile && s.rand() < 0.3) { r.vy = Math.max(r.vy, 2); r.flipped = 2.2; r.av += (s.rand() - 0.5) * 6; }
if (vn > 3.5 && r.y < 0.05 && !r.st.invertible && !r.st.lowProfile && s.rand() < 0.3 * (r.st.topHeavy || 1)) { r.vy = Math.max(r.vy, 2); r.flipped = 2.2; r.av += (s.rand() - 0.5) * 6; }
}
r.vx += w.nx * vn * 1.45; r.vz += w.nz * vn * 1.45; // bounce (0.45 restitution)
}
@@ -364,10 +365,10 @@
if (w && w.type === 'wedge' && e.y < 0.05 && !e.st.lowProfile) {
const light = Math.sqrt(me.st.mass / e.st.mass);
e.vy = Math.max(e.vy, 2.3 * light); e.stun = Math.max(e.stun, 0.25);
if (!e.st.invertible && !e.st.lowProfile && s.rand() < 0.3 * light && impact > 3) { e.flipped = 2.2; e.av += (s.rand() - 0.5) * 6; }
if (!e.st.invertible && !e.st.lowProfile && s.rand() < 0.3 * light * (e.st.topHeavy || 1) && impact > 3) { e.flipped = 2.2; e.av += (s.rand() - 0.5) * 6; }
} else if (impact > 4.5 && e.y < 0.05 && !e.st.lowProfile && !e.st.invertible) {
const light = Math.sqrt(me.st.mass / e.st.mass);
if (s.rand() < 0.22 * light) { e.vy = Math.max(e.vy, 1.8 * light); e.flipped = 2.2; e.av += (s.rand() - 0.5) * 5; s.events.push({ type: 'flip', who: e.i, x: e.x, z: e.z }); }
if (s.rand() < 0.22 * light * (e.st.topHeavy || 1)) { e.vy = Math.max(e.vy, 1.8 * light); e.flipped = 2.2; e.av += (s.rand() - 0.5) * 5; s.events.push({ type: 'flip', who: e.i, x: e.x, z: e.z }); }
}
}
}
@@ -408,7 +409,7 @@
e.vx += fx * 3 * light; e.vz += fz * 3 * light;
e.av += (s.rand() - 0.5) * 6;
damage(s, e, w.dmg, r, { kind: 'flip' });
if (!e.st.invertible && s.rand() < (e.st.lowProfile ? 0.25 : 0.45)) e.flipped = 2.2;
if (!e.st.invertible && s.rand() < (e.st.lowProfile ? 0.25 : 0.45) * (e.st.topHeavy || 1)) e.flipped = 2.2;
}
}
break;
@@ -452,7 +453,7 @@
damage(s, e, w.dmg * k, r, { kind: 'spin' });
e.vy = Math.max(e.vy, 6.5 * k * light);
e.vx += fx * 1.5 * k; e.vz += fz * 1.5 * k; e.av += 7 * k;
if (!e.st.invertible && s.rand() < 0.5 * k) e.flipped = 2.2;
if (!e.st.invertible && s.rand() < 0.5 * k * (e.st.topHeavy || 1)) e.flipped = 2.2;
r.spin *= 0.3; r.cd = 0.35;
s.events.push({ type: 'spinhit', who: r.i, x: (r.x + e.x) / 2, z: (r.z + e.z) / 2, k });
}
@@ -523,7 +524,10 @@
r.gcd = Math.max(0, r.gcd - dt);
if (r.shield > 0) r.shield = Math.max(0, r.shield - dt);
const g = r.st.gadget;
const pressed = !!inp.fire3 && !r.g3; // rising edge: one action per press
r.g3 = !!inp.fire3;
if (!g || r.out || r.dead || !inp.fire3 || r.gcd > 0) return;
if (g.type === 'mines' && !pressed) return; // one mine per press, never a whole trail
const held = r.lifted > 0 || r.grabbedBy !== null;
switch (g.type) {
case 'righter': // flip back upright