Fixes many mech bugs (#22983)

Four major fixes. These are all pretty clearly bugs, but the result is a
substantial mech nerf (except EMPs against EM armor.)

First, EMP armour.
EMP armour did nothing, it was partially ported to use TG's Element flag
system, this finishes that.
Rather than make the EMP armour immune to EMP, it spends power to negate
it.
The cost is 1000 / severity. Heavy EMP is 1, Light EMP is 2. This is 5%
of a basic mech cell for light, 10% for heavy.
Also fixes the pilot getting EMP'd twice for every EMP act on the mech.

Second, open hatches let attacks hit the pilot. Chance is 80% from the
front, 20% from the sides.
The chance is mostly so that turrets that always aim torso don't shoot
mechs forever, always hitting the pilot inside.

Third, cockpit damage actually matters now. Previously shooting the mech
in the chest was nearly worthless, no important components were there
and destroying it did not destroy the mech.
Now if the cockpit is completely destroyed, attacks against it penetrate
through to hit the pilot.
These attacks still account for the mech's armour.
Combined with the hatch getting stuck closed, you can have tense rescues
of pilots bleeding out inside their suits.

Fourth, the mech running out of power actually stops it doing things.
Uranium and Phoron power cores allowed mechs to keep running forever,
even at fractional power, because they recharged slightly every tick.
Now if the mech ever cannot afford the power cost of an action it shuts
down.
It can be powered back up immediately if the power core recharges it,
but it cannot now do costly actions at single digit power.

I fixed mech combat shields.
They suck, they use the auras system which does not play nicely with the
new projectile code.
Recursive calls and spaghetti mess.
Works for now but could use a complete rewrite.

---------

Signed-off-by: FenodyreeAv <fenodyree.av@gmail.com>
This commit is contained in:
FenodyreeAv
2026-08-06 09:40:33 +00:00
committed by GitHub
parent 9e2975ddb3
commit d47cdb8f04
9 changed files with 162 additions and 48 deletions
+1 -2
View File
@@ -56,8 +56,7 @@
//Auras, essentially magic and encompassing around us, gets checked first
if(!src.aura_check(AURA_TYPE_BULLET, hitting_projectile, def_zone, piercing_hit))
blocked = 100
return BULLET_ACT_FORCE_PIERCE
return BULLET_ACT_BLOCK
//Shields, in front of us (hopefully), check the bullet before it reaches us
var/shield_check = check_shields(hitting_projectile.damage, hitting_projectile, hitting_projectile.firer, def_zone, "the [hitting_projectile.name]")