Memory leak fix (#8647)

This commit is contained in:
Guti
2024-07-15 22:52:32 +02:00
committed by GitHub
parent ffdee45663
commit f9b5161ab5
15 changed files with 104 additions and 33 deletions

View File

@@ -30,8 +30,8 @@ GLOBAL_DATUM_INIT(turf_exited_event, /decl/observ/turf_exited, new)
/turf/Entered(var/atom/movable/am, var/atom/old_loc) /turf/Entered(var/atom/movable/am, var/atom/old_loc)
. = ..() . = ..()
SEND_SIGNAL(src, COMSIG_OBSERVER_TURF_ENTERED, am, old_loc) SEND_SIGNAL(src, COMSIG_OBSERVER_TURF_ENTERED, WEAKREF(am), old_loc)
/turf/Exited(var/atom/movable/am, var/atom/new_loc) /turf/Exited(var/atom/movable/am, var/atom/new_loc)
. = ..() . = ..()
SEND_SIGNAL(src, COMSIG_OBSERVER_TURF_EXITED, am, new_loc) SEND_SIGNAL(src, COMSIG_OBSERVER_TURF_EXITED, WEAKREF(am), new_loc)

View File

@@ -152,6 +152,7 @@
// Used to be for the PROXMOVE flag, but that was terrible, so instead it's just here as a stub for // Used to be for the PROXMOVE flag, but that was terrible, so instead it's just here as a stub for
// all the atoms that still have the proc, but get events other ways. // all the atoms that still have the proc, but get events other ways.
/atom/proc/HasProximity(turf/T, atom/movable/AM, old_loc) /atom/proc/HasProximity(turf/T, atom/movable/AM, old_loc)
SIGNAL_HANDLER // CHOMPAdd
return return
//Register listeners on turfs in a certain range //Register listeners on turfs in a certain range

View File

@@ -70,7 +70,7 @@
/obj/machinery/camera/Destroy() /obj/machinery/camera/Destroy()
if(isMotion()) if(isMotion())
unsense_proximity(callback = /atom/proc/HasProximity) unsense_proximity(callback = TYPE_PROC_REF(/atom,HasProximity)) // CHOMPEdit
deactivate(null, 0) //kick anyone viewing out deactivate(null, 0) //kick anyone viewing out
if(assembly) if(assembly)
qdel(assembly) qdel(assembly)

View File

@@ -54,9 +54,17 @@
detectTime = -1 detectTime = -1
return 1 return 1
/obj/machinery/camera/HasProximity(turf/T, atom/movable/AM, old_loc) // CHOMPEdit start
/obj/machinery/camera/HasProximity(turf/T, datum/weakref/WF, old_loc)
SIGNAL_HANDLER
if(isnull(WF))
return
var/atom/movable/AM = WF.resolve()
if(isnull(AM))
log_debug("DEBUG: HasProximity called with [AM] on [src] ([usr]).")
return
// CHOMPEdit End
// Motion cameras outside of an "ai monitored" area will use this to detect stuff. // Motion cameras outside of an "ai monitored" area will use this to detect stuff.
if (!area_motion) if (!area_motion)
if(isliving(AM)) if(isliving(AM))
newTarget(AM) newTarget(AM)

View File

@@ -245,7 +245,7 @@ var/global/list/engineering_networks = list(
assembly.upgrades.Add(new /obj/item/device/assembly/prox_sensor(assembly)) assembly.upgrades.Add(new /obj/item/device/assembly/prox_sensor(assembly))
setPowerUsage() setPowerUsage()
START_MACHINE_PROCESSING(src) START_MACHINE_PROCESSING(src)
sense_proximity(callback = /atom/proc/HasProximity) sense_proximity(callback = TYPE_PROC_REF(/atom,HasProximity)) // CHOMPEdit
update_coverage() update_coverage()
/obj/machinery/camera/proc/setPowerUsage() /obj/machinery/camera/proc/setPowerUsage()

View File

@@ -97,7 +97,17 @@
flash() flash()
..(severity) ..(severity)
/obj/machinery/flasher/portable/HasProximity(turf/T, atom/movable/AM, oldloc) // CHOMPEdit Start
/obj/machinery/flasher/portable/HasProximity(turf/T, datum/weakref/WF, oldloc)
SIGNAL_HANDLER
if(isnull(WF))
return
var/atom/movable/AM = WF.resolve()
if(isnull(AM))
log_debug("DEBUG: HasProximity called with [AM] on [src] ([usr]).")
return
// CHOMPEdit End
if(disable || !anchored || (last_flash && world.time < last_flash + 150)) if(disable || !anchored || (last_flash && world.time < last_flash + 150))
return return
@@ -114,12 +124,12 @@
if(!anchored) if(!anchored)
user.show_message(text("<span class='warning'>[src] can now be moved.</span>")) user.show_message(text("<span class='warning'>[src] can now be moved.</span>"))
cut_overlays() cut_overlays()
unsense_proximity(callback = /atom/proc/HasProximity) unsense_proximity(callback = TYPE_PROC_REF(/atom,HasProximity)) // CHOMPEdit
else if(anchored) else if(anchored)
user.show_message(text("<span class='warning'>[src] is now secured.</span>")) user.show_message(text("<span class='warning'>[src] is now secured.</span>"))
add_overlay("[base_state]-s") add_overlay("[base_state]-s")
sense_proximity(callback = /atom/proc/HasProximity) sense_proximity(callback = TYPE_PROC_REF(/atom,HasProximity)) // CHOMPEdit
/obj/machinery/button/flasher /obj/machinery/button/flasher
name = "flasher button" name = "flasher button"

View File

@@ -55,16 +55,24 @@
SStgui.update_uis(src) // update all UIs attached to src SStgui.update_uis(src) // update all UIs attached to src
return return
// CHOMPEdit Start
/obj/item/device/transfer_valve/HasProximity(turf/T, datum/weakref/WF, old_loc)
SIGNAL_HANDLER
if(isnull(WF))
return
/obj/item/device/transfer_valve/HasProximity(turf/T, atom/movable/AM, old_loc) var/atom/movable/AM = WF.resolve()
if(isnull(AM))
log_debug("DEBUG: HasProximity called with [AM] on [src] ([usr]).")
// CHOMPEdit End
attached_device?.HasProximity(T, AM, old_loc) attached_device?.HasProximity(T, AM, old_loc)
/obj/item/device/transfer_valve/Moved(old_loc, direction, forced) /obj/item/device/transfer_valve/Moved(old_loc, direction, forced)
. = ..() . = ..()
if(isturf(old_loc)) if(isturf(old_loc))
unsense_proximity(callback = /atom/proc/HasProximity, center = old_loc) unsense_proximity(callback = TYPE_PROC_REF(/atom,HasProximity), center = old_loc) // CHOMPEdit
if(isturf(loc)) if(isturf(loc))
sense_proximity(callback = /atom/proc/HasProximity) sense_proximity(callback = TYPE_PROC_REF(/atom,HasProximity)) // CHOMPEdit
/obj/item/device/transfer_valve/attack_self(mob/user) /obj/item/device/transfer_valve/attack_self(mob/user)
tgui_interact(user) tgui_interact(user)

View File

@@ -661,13 +661,22 @@ var/list/global/tank_gauge_cache = list()
tank.update_icon() tank.update_icon()
tank.cut_overlay("bomb_assembly") tank.cut_overlay("bomb_assembly")
/obj/item/device/tankassemblyproxy/HasProximity(turf/T, atom/movable/AM, old_loc) // CHOMPEdit Start
/obj/item/device/tankassemblyproxy/HasProximity(turf/T, datum/weakref/WF, old_loc)
SIGNAL_HANDLER
if(isnull(WF))
return
var/atom/movable/AM = WF.resolve()
if(isnull(AM))
log_debug("DEBUG: HasProximity called with [AM] on [src] ([usr]).")
return
// CHOMPEdit End
assembly?.HasProximity(T, AM, old_loc) assembly?.HasProximity(T, AM, old_loc)
/obj/item/device/tankassemblyproxy/Moved(old_loc, direction, forced) /obj/item/device/tankassemblyproxy/Moved(old_loc, direction, forced)
if(isturf(old_loc)) if(isturf(old_loc))
unsense_proximity(callback = /atom/proc/HasProximity, center = old_loc) unsense_proximity(callback = TYPE_PROC_REF(/atom,HasProximity), center = old_loc) // CHOMPEdit
if(isturf(loc)) if(isturf(loc))
sense_proximity(callback = /atom/proc/HasProximity) sense_proximity(callback = TYPE_PROC_REF(/atom,HasProximity)) // CHOMPEdit
#undef TANK_IDEAL_PRESSURE #undef TANK_IDEAL_PRESSURE

View File

@@ -66,11 +66,20 @@
/obj/item/device/assembly_holder/Moved(atom/old_loc, direction, forced = FALSE) /obj/item/device/assembly_holder/Moved(atom/old_loc, direction, forced = FALSE)
. = ..() . = ..()
if(isturf(old_loc)) if(isturf(old_loc))
unsense_proximity(callback = /atom/proc/HasProximity, center = old_loc) unsense_proximity(callback = TYPE_PROC_REF(/atom,HasProximity), center = old_loc) // CHOMPEdit
if(isturf(loc)) if(isturf(loc))
sense_proximity(callback = /atom/proc/HasProximity) sense_proximity(callback = TYPE_PROC_REF(/atom,HasProximity)) // CHOMPEdit
/obj/item/device/assembly_holder/HasProximity(turf/T, atom/movable/AM, old_loc) // CHOMPEdit Start
/obj/item/device/assembly_holder/HasProximity(turf/T, datum/weakref/WF, old_loc)
SIGNAL_HANDLER
if(isnull(WF))
return
var/atom/movable/AM = WF.resolve()
if(isnull(AM))
log_debug("DEBUG: HasProximity called with [AM] on [src] ([usr]).")
return
// CHOMPEdit End
if(a_left) if(a_left)
a_left.HasProximity(T, AM, old_loc) a_left.HasProximity(T, AM, old_loc)
if(a_right) if(a_right)

View File

@@ -32,10 +32,16 @@
update_icon() update_icon()
return secured return secured
/obj/item/device/assembly/prox_sensor/HasProximity(turf/T, atom/movable/AM, old_loc) // CHOMPEdit Start
if(!istype(AM)) /obj/item/device/assembly/prox_sensor/HasProximity(turf/T, datum/weakref/WF, old_loc)
SIGNAL_HANDLER
if(isnull(WF))
return
var/atom/movable/AM = WF.resolve()
if(isnull(AM))
log_debug("DEBUG: HasProximity called with [AM] on [src] ([usr]).") log_debug("DEBUG: HasProximity called with [AM] on [src] ([usr]).")
return return
// CHOMPEdit End
if (istype(AM, /obj/effect/beam)) if (istype(AM, /obj/effect/beam))
return return
if (!isobserver(AM) && AM.move_speed < 12) if (!isobserver(AM) && AM.move_speed < 12)
@@ -90,9 +96,9 @@
/obj/item/device/assembly/prox_sensor/Moved(atom/old_loc, direction, forced = FALSE) /obj/item/device/assembly/prox_sensor/Moved(atom/old_loc, direction, forced = FALSE)
. = ..() . = ..()
if(isturf(old_loc)) if(isturf(old_loc))
unsense_proximity(range = range, callback = /atom/proc/HasProximity, center = old_loc) unsense_proximity(range = range, callback = TYPE_PROC_REF(/atom,HasProximity), center = old_loc) // CHOMPEdit
if(isturf(loc)) if(isturf(loc))
sense_proximity(range = range, callback = /atom/proc/HasProximity) sense_proximity(range = range, callback = TYPE_PROC_REF(/atom,HasProximity)) // CHOMPEdit
sense() sense()
/obj/item/device/assembly/prox_sensor/tgui_interact(mob/user, datum/tgui/ui) /obj/item/device/assembly/prox_sensor/tgui_interact(mob/user, datum/tgui/ui)

View File

@@ -112,7 +112,7 @@
name = seed.display_name name = seed.display_name
max_health = round(seed.get_trait(TRAIT_ENDURANCE)/2) max_health = round(seed.get_trait(TRAIT_ENDURANCE)/2)
if(seed.get_trait(TRAIT_SPREAD)==2) if(seed.get_trait(TRAIT_SPREAD)==2)
sense_proximity(callback = /atom/proc/HasProximity) // Grabby sense_proximity(callback = TYPE_PROC_REF(/atom,HasProximity)) // Grabby - CHOMPEdit
max_growth = VINE_GROWTH_STAGES max_growth = VINE_GROWTH_STAGES
growth_threshold = max_health/VINE_GROWTH_STAGES growth_threshold = max_health/VINE_GROWTH_STAGES
icon = 'icons/obj/hydroponics_vines.dmi' icon = 'icons/obj/hydroponics_vines.dmi'

View File

@@ -1,5 +1,13 @@
/obj/effect/plant/HasProximity(turf/T, atom/movable/AM, old_loc) // CHOMPEdit Start
/obj/effect/plant/HasProximity(turf/T, datum/weakref/WF, old_loc)
SIGNAL_HANDLER
if(isnull(WF))
return
var/atom/movable/AM = WF.resolve()
if(isnull(AM))
log_debug("DEBUG: HasProximity called with [AM] on [src] ([usr]).")
return
// CHOMPEdit End
if(!is_mature() || seed.get_trait(TRAIT_SPREAD) != 2) if(!is_mature() || seed.get_trait(TRAIT_SPREAD) != 2)
return return
@@ -20,9 +28,9 @@
. = ..() . = ..()
if(seed.get_trait(TRAIT_SPREAD)==2) if(seed.get_trait(TRAIT_SPREAD)==2)
if(isturf(old_loc)) if(isturf(old_loc))
unsense_proximity(callback = /atom/proc/HasProximity, center = old_loc) unsense_proximity(callback = TYPE_PROC_REF(/atom,HasProximity), center = old_loc) // CHOMPEdit
if(isturf(loc)) if(isturf(loc))
sense_proximity(callback = /atom/proc/HasProximity) sense_proximity(callback = TYPE_PROC_REF(/atom,HasProximity)) // CHOMPEdit
/obj/effect/plant/attack_hand(var/mob/user) /obj/effect/plant/attack_hand(var/mob/user)
manual_unbuckle(user) manual_unbuckle(user)

View File

@@ -168,7 +168,7 @@
//Unfreeze some things //Unfreeze some things
does_not_breathe = FALSE does_not_breathe = FALSE
update_canmove() update_canmove()
weakened = 2 stunned = 2 // CHOMPEdit - Whoops, crawling is a thing now.
revive_ready = world.time + 10 MINUTES //set the cooldown CHOMPEdit: Reduced this to 10 minutes, you're playing with fire if you're reviving that often. revive_ready = world.time + 10 MINUTES //set the cooldown CHOMPEdit: Reduced this to 10 minutes, you're playing with fire if you're reviving that often.

View File

@@ -85,13 +85,16 @@
//While regenerating //While regenerating
if(H.revive_ready == REVIVING_NOW || H.revive_ready == REVIVING_DONE) if(H.revive_ready == REVIVING_NOW || H.revive_ready == REVIVING_DONE)
H.weakened = 5 H.stunned = 5 // CHOMPEdit - Crawling is a thing now
H.canmove = 0 H.canmove = 0
H.does_not_breathe = TRUE H.does_not_breathe = TRUE
var/regen_sounds = H.regen_sounds var/regen_sounds = H.regen_sounds
if(prob(2)) // 2% chance of playing squelchy noise while reviving, which is run roughly every 2 seconds/tick while regenerating. if(prob(2)) // 2% chance of playing squelchy noise while reviving, which is run roughly every 2 seconds/tick while regenerating.
playsound(H, pick(regen_sounds), 30) playsound(H, pick(regen_sounds), 30)
H.visible_message("<span class='danger'><p><font size=4>[H.name]'s motionless form shudders grotesquely, rippling unnaturally.</font></p></span>") H.visible_message("<span class='danger'><p><font size=4>[H.name]'s motionless form shudders grotesquely, rippling unnaturally.</font></p></span>")
// CHOMPAdd - F A L L
if(!H.lying)
H.lay_down()
//Cold/pressure effects when not regenerating //Cold/pressure effects when not regenerating
else else

View File

@@ -21,7 +21,7 @@
/obj/machinery/containment_field/Initialize() /obj/machinery/containment_field/Initialize()
. = ..() . = ..()
shockdirs = list(turn(dir,90),turn(dir,-90)) shockdirs = list(turn(dir,90),turn(dir,-90))
sense_proximity(callback = /atom/proc/HasProximity) sense_proximity(callback = TYPE_PROC_REF(/atom,HasProximity)) // CHOMPEdit
/obj/machinery/containment_field/set_dir(new_dir) /obj/machinery/containment_field/set_dir(new_dir)
. = ..() . = ..()
@@ -29,7 +29,7 @@
shockdirs = list(turn(dir,90),turn(dir,-90)) shockdirs = list(turn(dir,90),turn(dir,-90))
/obj/machinery/containment_field/Destroy() /obj/machinery/containment_field/Destroy()
unsense_proximity(callback = /atom/proc/HasProximity) unsense_proximity(callback = TYPE_PROC_REF(/atom,HasProximity)) // CHOMPEdit
if(FG1 && !FG1.clean_up) if(FG1 && !FG1.clean_up)
FG1.cleanup() FG1.cleanup()
if(FG2 && !FG2.clean_up) if(FG2 && !FG2.clean_up)
@@ -52,7 +52,16 @@
return return
shock(L) shock(L)
/obj/machinery/containment_field/HasProximity(turf/T, atom/movable/AM, old_loc) // CHOMPEdit Start
/obj/machinery/containment_field/HasProximity(turf/T, datum/weakref/WF, old_loc)
SIGNAL_HANDLER
if(isnull(WF))
return
var/atom/movable/AM = WF.resolve()
if(isnull(AM))
log_debug("DEBUG: HasProximity called with [AM] on [src] ([usr]).")
return
// CHOMPEdit End
if(!istype(AM, /mob/living) || AM:incorporeal_move) if(!istype(AM, /mob/living) || AM:incorporeal_move)
return 0 return 0
if(!(get_dir(src,AM) in shockdirs)) if(!(get_dir(src,AM) in shockdirs))