Files
VMSolidus 1fbead50af Mob Ref Cleanup Part 3 (#22599)
Part 3 of the Mob Destroy Refactor, this time going through the entire
list of every ref stored up to a mob/human, and (attempting) to verify
and cleanup every possible circular ref. This PR also fixes some
mistakes made with cleaning up UI elements, namely that tgui's really
don't like it when you qdel them, and screen objects also weren't always
clearing their own references if Qdel'ed directly. There were several
niche situations too where circle refs might be retained by a mob. I
also found an issue where static lights were only cleaned up on
/atom/movable/ but actually existed farther up the chain on /atom. I
don't know if any /atoms that aren't /atom/movable ever get static
lights, but the fact that they can be needs to be correctly accounted
for.

I can't possibly have gotten all of them, but this is every single one I
could find after 3 hours of work.
2026-06-11 10:47:56 +00:00

149 lines
3.5 KiB
Plaintext

#define CLEAR_OBJECT(TARGET) \
processing -= TARGET; \
TARGET.airflow_dest = null; \
TARGET.airflow_speed = 0; \
TARGET.airflow_time = 0; \
TARGET.airflow_skip_speedcheck = FALSE; \
if (TARGET.airflow_od) { \
TARGET.density = 0; \
}
PROCESSING_SUBSYSTEM_DEF(airflow)
name = "Airflow"
wait = 1
flags = SS_NO_INIT
priority = SS_PRIORITY_AIRFLOW
/datum/controller/subsystem/processing/airflow/fire(resumed = FALSE)
CAN_BE_REDEFINED(TRUE)
if (!resumed)
currentrun = processing.Copy() // Defined in parent.
var/list/curr = currentrun // Defined in parent.
while (curr.len)
var/atom/movable/target = curr[curr.len]
curr.len--
if (target.airflow_speed <= 0)
CLEAR_OBJECT(target)
if (MC_TICK_CHECK)
return
continue
if (target.airflow_process_delay > 0)
target.airflow_process_delay -= 1
if (MC_TICK_CHECK)
return
continue
else if (target.airflow_process_delay)
target.airflow_process_delay = 0
target.airflow_speed = min(target.airflow_speed, 15)
target.airflow_speed -= GLOB.vsc.airflow_speed_decay
if (!target.airflow_skip_speedcheck)
if (target.airflow_speed > 7)
if (target.airflow_time++ >= target.airflow_speed - 7)
if (target.airflow_od)
target.density = 0
target.airflow_skip_speedcheck = TRUE
if (MC_TICK_CHECK)
return
continue
else
if (target.airflow_od)
target.density = 0
target.airflow_process_delay = max(1, 10 - (target.airflow_speed + 3))
target.airflow_skip_speedcheck = TRUE
if (MC_TICK_CHECK)
return
continue
target.airflow_skip_speedcheck = FALSE
if (target.airflow_od)
target.density = 1
if (!target.airflow_dest || target.loc == target.airflow_dest)
target.airflow_dest = locate(min(max(target.x + target.airflow_xo, 1), world.maxx), min(max(target.y + target.airflow_yo, 1), world.maxy), target.z)
if ((target.x == 1) || (target.x == world.maxx) || (target.y == 1) || (target.y == world.maxy))
CLEAR_OBJECT(target)
if (MC_TICK_CHECK)
return
continue
if (!isturf(target.loc))
CLEAR_OBJECT(target)
if (MC_TICK_CHECK)
return
continue
step_towards(target, target.airflow_dest)
if(ismob(target))
var/mob/target_mob = target
if(target_mob.client)
target_mob:setMoveCooldown(GLOB.vsc.airflow_mob_slowdown)
if (MC_TICK_CHECK)
return
#undef CLEAR_OBJECT
/atom/movable/proc/prepare_airflow(n)
if (!airflow_dest || airflow_speed < 0 || last_airflow > world.time - GLOB.vsc.airflow_delay)
return FALSE
if (airflow_speed)
airflow_speed = n / max(get_dist(src, airflow_dest), 1)
return FALSE
if (airflow_dest == loc)
step_away(src, loc)
if (!src.AirflowCanMove(n))
return FALSE
if (ismob(src))
to_chat(src, SPAN_DANGER("You are pushed away by airflow!"))
last_airflow = world.time
var/airflow_falloff = 9 - sqrt((x - airflow_dest.x) ** 2 + (y - airflow_dest.y) ** 2)
if (airflow_falloff < 1)
airflow_dest = null
return FALSE
airflow_speed = min(max(n * (9 / airflow_falloff), 1), 9)
airflow_od = 0
if (!density)
density = 1
airflow_od = 1
return TRUE
/atom/movable/proc/GotoAirflowDest(n)
if (!prepare_airflow(n))
return
airflow_xo = airflow_dest.x - src.x
airflow_yo = airflow_dest.y - src.y
airflow_dest = null
SSairflow.processing += src
/atom/movable/proc/RepelAirflowDest(n)
if (!prepare_airflow(n))
return
airflow_xo = -(airflow_dest.x - src.x)
airflow_yo = -(airflow_dest.y - src.y)
airflow_dest = null
SSairflow.processing += src