mirror of
https://github.com/Aurorastation/Aurora.3.git
synced 2026-08-17 18:09:26 +01:00
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
39 lines
1.5 KiB
Plaintext
39 lines
1.5 KiB
Plaintext
/obj/abstract/weather_system
|
|
var/tmp/wind_direction = 0 // Bitflag; current wind direction.
|
|
var/tmp/wind_strength = 1 // How string is the wind currently?
|
|
var/const/base_wind_delay = 1 // What is the base movement delay or increase applied by wind strength?
|
|
|
|
// Randomizes wind speed and direction sometimes.
|
|
/obj/abstract/weather_system/proc/handle_wind()
|
|
// TODO: turbulence for chance of wind changes,
|
|
// ferocity for strength of wind changes
|
|
if(prob(66))
|
|
return
|
|
if(prob(10))
|
|
if(!wind_direction)
|
|
wind_direction = pick(GLOB.alldirs)
|
|
else
|
|
wind_direction = turn(wind_direction, pick(45, -45))
|
|
mob_shown_wind.Cut()
|
|
if(prob(10))
|
|
var/old_strength = wind_strength
|
|
wind_strength = clamp(wind_strength + rand(-1, 1), 5, -5)
|
|
if(old_strength != wind_strength)
|
|
mob_shown_wind.Cut()
|
|
|
|
/obj/abstract/weather_system/proc/show_wind(var/mob/M, var/force = FALSE)
|
|
var/mob_ref = WEAKREF(M)
|
|
if(mob_shown_wind[mob_ref] && !force)
|
|
return FALSE
|
|
mob_shown_wind[mob_ref] = TRUE
|
|
. = TRUE
|
|
var/turf/T = get_turf(M)
|
|
if(istype(T))
|
|
var/datum/gas_mixture/environment = T.return_air()
|
|
if(SAFE_XGM_PRESSURE(environment) >= MIN_WIND_PRESSURE) // Arbitrary low pressure bound.
|
|
var/absolute_strength = abs(wind_strength)
|
|
if(absolute_strength <= 0.5 || !wind_direction)
|
|
to_chat(M, SPAN_NOTICE("The wind is calm."))
|
|
else
|
|
to_chat(M, SPAN_NOTICE("The wind is blowing[absolute_strength > 2 ? " strongly" : ""] towards the [dir2text(wind_direction)]."))
|