Lag War Day 4: Under Pressure, High Voltage (#21878)

Replace /datum/gas_mixture/proc/return_pressure with XGM_PRESSURE(xgm)
macro. Having such a relatively simple statement contributing proc
overhead to procs called millions of times is ridiculous

Rename /datum/gas_mixture/proc/zburn to react, deleting the old react
which was just an alias for it. Free proc overhead

Turn check_combustibility into a macro CHECK_COMBUSTIBLE(is_cmb, xgm).
also rewrite it slightly so that it only needs to do one pass. Its a bit
nasty so I apologize for that, but speeeeed.

Delete most powernet and obj/machinery/power procs for handling power,
replacing them with macros. The fact that we were unironically calling a
draw_power() on APCs to call draw_power() on their terminals to call
draw_power() on their powernet every single process tick was insane.

Turn `between` into a macro alias for clamp() since the param order is
different

turn `Percent` into a macro AS_PCT

Rewrite significant chunks of update_canmove so its not quite as
horrifying of a proc and hopefully doesn't eat the entire mob subsystem
every movement now
This commit is contained in:
Wildkins
2026-02-27 00:35:41 +00:00
committed by GitHub
parent 52e1a34575
commit e1770df81e
131 changed files with 676 additions and 736 deletions
+2 -1
View File
@@ -123,7 +123,8 @@
if (PN)
var/power_draw = between(0, max_charge - stored_charge, charge_rate) //what we are trying to draw
power_draw = PN.draw_power(power_draw) //what we actually get
power_draw = POWERNET_POWER_DRAW(PN, power_draw) //what we actually get
DRAW_FROM_POWERNET(PN, power_draw)
stored_charge += power_draw
time_since_fail++
+2 -1
View File
@@ -85,7 +85,8 @@
return FALSE
var/shieldload = between(500, max_stored_power - storedpower, (power_draw*seconds_per_tick)) //what we try to draw
shieldload = PN.draw_power(shieldload) //what we actually get
shieldload = POWERNET_POWER_DRAW(PN, shieldload) //what we actually get
DRAW_FROM_POWERNET(PN, shieldload)
storedpower += shieldload
//If we're still in the red, then there must not be enough available power to cover our load.