mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-10 18:22:39 +00:00
Memory leak fix (#8647)
This commit is contained in:
@@ -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)
|
||||
. = ..()
|
||||
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)
|
||||
. = ..()
|
||||
SEND_SIGNAL(src, COMSIG_OBSERVER_TURF_EXITED, am, new_loc)
|
||||
SEND_SIGNAL(src, COMSIG_OBSERVER_TURF_EXITED, WEAKREF(am), new_loc)
|
||||
|
||||
@@ -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
|
||||
// all the atoms that still have the proc, but get events other ways.
|
||||
/atom/proc/HasProximity(turf/T, atom/movable/AM, old_loc)
|
||||
SIGNAL_HANDLER // CHOMPAdd
|
||||
return
|
||||
|
||||
//Register listeners on turfs in a certain range
|
||||
|
||||
@@ -70,7 +70,7 @@
|
||||
|
||||
/obj/machinery/camera/Destroy()
|
||||
if(isMotion())
|
||||
unsense_proximity(callback = /atom/proc/HasProximity)
|
||||
unsense_proximity(callback = TYPE_PROC_REF(/atom,HasProximity)) // CHOMPEdit
|
||||
deactivate(null, 0) //kick anyone viewing out
|
||||
if(assembly)
|
||||
qdel(assembly)
|
||||
|
||||
@@ -54,9 +54,17 @@
|
||||
detectTime = -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.
|
||||
if (!area_motion)
|
||||
if(isliving(AM))
|
||||
newTarget(AM)
|
||||
|
||||
|
||||
@@ -245,7 +245,7 @@ var/global/list/engineering_networks = list(
|
||||
assembly.upgrades.Add(new /obj/item/device/assembly/prox_sensor(assembly))
|
||||
setPowerUsage()
|
||||
START_MACHINE_PROCESSING(src)
|
||||
sense_proximity(callback = /atom/proc/HasProximity)
|
||||
sense_proximity(callback = TYPE_PROC_REF(/atom,HasProximity)) // CHOMPEdit
|
||||
update_coverage()
|
||||
|
||||
/obj/machinery/camera/proc/setPowerUsage()
|
||||
|
||||
@@ -97,7 +97,17 @@
|
||||
flash()
|
||||
..(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))
|
||||
return
|
||||
|
||||
@@ -114,12 +124,12 @@
|
||||
if(!anchored)
|
||||
user.show_message(text("<span class='warning'>[src] can now be moved.</span>"))
|
||||
cut_overlays()
|
||||
unsense_proximity(callback = /atom/proc/HasProximity)
|
||||
unsense_proximity(callback = TYPE_PROC_REF(/atom,HasProximity)) // CHOMPEdit
|
||||
|
||||
else if(anchored)
|
||||
user.show_message(text("<span class='warning'>[src] is now secured.</span>"))
|
||||
add_overlay("[base_state]-s")
|
||||
sense_proximity(callback = /atom/proc/HasProximity)
|
||||
sense_proximity(callback = TYPE_PROC_REF(/atom,HasProximity)) // CHOMPEdit
|
||||
|
||||
/obj/machinery/button/flasher
|
||||
name = "flasher button"
|
||||
|
||||
@@ -55,16 +55,24 @@
|
||||
SStgui.update_uis(src) // update all UIs attached to src
|
||||
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)
|
||||
|
||||
/obj/item/device/transfer_valve/Moved(old_loc, direction, forced)
|
||||
. = ..()
|
||||
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))
|
||||
sense_proximity(callback = /atom/proc/HasProximity)
|
||||
sense_proximity(callback = TYPE_PROC_REF(/atom,HasProximity)) // CHOMPEdit
|
||||
|
||||
/obj/item/device/transfer_valve/attack_self(mob/user)
|
||||
tgui_interact(user)
|
||||
|
||||
@@ -661,13 +661,22 @@ var/list/global/tank_gauge_cache = list()
|
||||
tank.update_icon()
|
||||
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)
|
||||
|
||||
/obj/item/device/tankassemblyproxy/Moved(old_loc, direction, forced)
|
||||
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))
|
||||
sense_proximity(callback = /atom/proc/HasProximity)
|
||||
sense_proximity(callback = TYPE_PROC_REF(/atom,HasProximity)) // CHOMPEdit
|
||||
|
||||
#undef TANK_IDEAL_PRESSURE
|
||||
|
||||
@@ -66,11 +66,20 @@
|
||||
/obj/item/device/assembly_holder/Moved(atom/old_loc, direction, forced = FALSE)
|
||||
. = ..()
|
||||
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))
|
||||
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)
|
||||
a_left.HasProximity(T, AM, old_loc)
|
||||
if(a_right)
|
||||
|
||||
@@ -32,10 +32,16 @@
|
||||
update_icon()
|
||||
return secured
|
||||
|
||||
/obj/item/device/assembly/prox_sensor/HasProximity(turf/T, atom/movable/AM, old_loc)
|
||||
if(!istype(AM))
|
||||
// CHOMPEdit Start
|
||||
/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]).")
|
||||
return
|
||||
// CHOMPEdit End
|
||||
if (istype(AM, /obj/effect/beam))
|
||||
return
|
||||
if (!isobserver(AM) && AM.move_speed < 12)
|
||||
@@ -90,9 +96,9 @@
|
||||
/obj/item/device/assembly/prox_sensor/Moved(atom/old_loc, direction, forced = FALSE)
|
||||
. = ..()
|
||||
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))
|
||||
sense_proximity(range = range, callback = /atom/proc/HasProximity)
|
||||
sense_proximity(range = range, callback = TYPE_PROC_REF(/atom,HasProximity)) // CHOMPEdit
|
||||
sense()
|
||||
|
||||
/obj/item/device/assembly/prox_sensor/tgui_interact(mob/user, datum/tgui/ui)
|
||||
|
||||
@@ -112,7 +112,7 @@
|
||||
name = seed.display_name
|
||||
max_health = round(seed.get_trait(TRAIT_ENDURANCE)/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
|
||||
growth_threshold = max_health/VINE_GROWTH_STAGES
|
||||
icon = 'icons/obj/hydroponics_vines.dmi'
|
||||
|
||||
@@ -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)
|
||||
return
|
||||
|
||||
@@ -20,9 +28,9 @@
|
||||
. = ..()
|
||||
if(seed.get_trait(TRAIT_SPREAD)==2)
|
||||
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))
|
||||
sense_proximity(callback = /atom/proc/HasProximity)
|
||||
sense_proximity(callback = TYPE_PROC_REF(/atom,HasProximity)) // CHOMPEdit
|
||||
|
||||
/obj/effect/plant/attack_hand(var/mob/user)
|
||||
manual_unbuckle(user)
|
||||
|
||||
@@ -168,7 +168,7 @@
|
||||
//Unfreeze some things
|
||||
does_not_breathe = FALSE
|
||||
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.
|
||||
|
||||
|
||||
@@ -85,13 +85,16 @@
|
||||
|
||||
//While regenerating
|
||||
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.does_not_breathe = TRUE
|
||||
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.
|
||||
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>")
|
||||
// CHOMPAdd - F A L L
|
||||
if(!H.lying)
|
||||
H.lay_down()
|
||||
|
||||
//Cold/pressure effects when not regenerating
|
||||
else
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
/obj/machinery/containment_field/Initialize()
|
||||
. = ..()
|
||||
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)
|
||||
. = ..()
|
||||
@@ -29,7 +29,7 @@
|
||||
shockdirs = list(turn(dir,90),turn(dir,-90))
|
||||
|
||||
/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)
|
||||
FG1.cleanup()
|
||||
if(FG2 && !FG2.clean_up)
|
||||
@@ -52,7 +52,16 @@
|
||||
return
|
||||
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)
|
||||
return 0
|
||||
if(!(get_dir(src,AM) in shockdirs))
|
||||
|
||||
Reference in New Issue
Block a user