Files
Wildkins e1770df81e 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
2026-02-27 00:35:41 +00:00

49 lines
1.6 KiB
Plaintext

/obj/abstract/weather_system/proc/get_movement_delay(var/datum/gas_mixture/env, var/travel_dir)
// It's quiet. Too quiet.
if(!wind_direction || !base_wind_delay || !travel_dir || !env || XGM_PRESSURE(env) < MIN_WIND_PRESSURE)
return 0
// May the wind be always at your back!
var/current_wind_strength = round(wind_strength * base_wind_delay)
if(wind_direction == travel_dir)
return -(current_wind_strength)
if(travel_dir & wind_direction)
return -(round(current_wind_strength * 0.5))
// Never spit into the wind.
var/reversed_wind = REVERSE_DIR(wind_direction)
if(reversed_wind == travel_dir)
return current_wind_strength
if(travel_dir & reversed_wind)
return round(current_wind_strength * 0.5)
return 0
/obj/abstract/weather_system/proc/adjust_temperature(initial_temperature)
return initial_temperature
/obj/abstract/weather_system/proc/show_weather(var/mob/M)
var/mob_ref = WEAKREF(M)
if(mob_shown_weather[mob_ref])
return FALSE
var/singleton/state/weather/current_weather = weather_system?.current_state
if(!istype(current_weather))
return FALSE
mob_shown_weather[mob_ref] = TRUE
current_weather.show_to(M, src)
return TRUE
/obj/abstract/weather_system/proc/lightning_strike()
set waitfor = FALSE
animate(lightning_overlay, alpha = 255, time = 2)
for(var/client/C)
if(!isliving(C.mob))
continue
var/turf/T = get_turf(C.mob)
if(!(T.z in affecting_zs))
continue
sound_to(C.mob, sound('sound/effects/weather/thunder.ogg', repeat = FALSE, wait = 0, volume = 100))
sleep(3)
animate(lightning_overlay, alpha = initial(lightning_overlay.alpha), time = 5 SECONDS)