From d338467755f768472bade388a93d0dca13e9367b Mon Sep 17 00:00:00 2001 From: Cyberboss Date: Thu, 26 Jan 2017 03:39:55 -0500 Subject: [PATCH] Fixes /datum/Beam failing to GC (#23285) --- code/datums/beam.dm | 6 +++--- .../gamemodes/miniantags/revenant/revenant_abilities.dm | 5 ++--- .../mob/living/simple_animal/hostile/venus_human_trap.dm | 8 ++++++++ code/modules/projectiles/guns/medbeam.dm | 8 +++++++- 4 files changed, 20 insertions(+), 7 deletions(-) diff --git a/code/datums/beam.dm b/code/datums/beam.dm index 9fce5ab37be..f4c27262d32 100644 --- a/code/datums/beam.dm +++ b/code/datums/beam.dm @@ -43,12 +43,12 @@ Reset() Draw() sleep(sleep_time) - - qdel(src) + if(!qdeleted(src)) + qdel(src) /datum/beam/proc/End() - finished = 1 + finished = TRUE /datum/beam/proc/Reset() diff --git a/code/game/gamemodes/miniantags/revenant/revenant_abilities.dm b/code/game/gamemodes/miniantags/revenant/revenant_abilities.dm index d096c397402..68727883752 100644 --- a/code/game/gamemodes/miniantags/revenant/revenant_abilities.dm +++ b/code/game/gamemodes/miniantags/revenant/revenant_abilities.dm @@ -54,9 +54,8 @@ reveal(46) stun(46) target.visible_message("[target] suddenly rises slightly into the air, [target.p_their()] skin turning an ashy gray.") - var/datum/beam/B = Beam(target,icon_state="drain_life",time=46) + var/datum/beam/B = Beam(target,icon_state="drain_life",time=INFINITY) if(do_after(src, 46, 0, target)) //As one cannot prove the existance of ghosts, ghosts cannot prove the existance of the target they were draining. - qdel(B) change_essence_amount(essence_drained, 0, target) if(essence_drained <= 90 && target.stat != DEAD) essence_regen_cap += 5 @@ -71,11 +70,11 @@ drained_mobs.Add(target) target.death(0) else - qdel(B) src << "[target ? "[target] has":"They have"] been drawn out of your grasp. The link has been broken." if(target) //Wait, target is WHERE NOW? target.visible_message("[target] slumps onto the ground.", \ "Violets lights, dancing in your vision, receding--") + qdel(B) else src << "You are not close enough to siphon [target ? "[target]'s":"their"] soul. The link has been broken." draining = 0 diff --git a/code/modules/mob/living/simple_animal/hostile/venus_human_trap.dm b/code/modules/mob/living/simple_animal/hostile/venus_human_trap.dm index feeaf63a565..f28233ba45d 100644 --- a/code/modules/mob/living/simple_animal/hostile/venus_human_trap.dm +++ b/code/modules/mob/living/simple_animal/hostile/venus_human_trap.dm @@ -69,6 +69,14 @@ var/grasp_pull_chance = 85 var/grasp_range = 4 del_on_death = 1 + +/mob/living/simple_animal/hostile/venus_human_trap/Destroy() + for(var/L in grasping) + var/datum/beam/B = grasping[L] + if(B) + qdel(B) + grasping = null + return ..() /mob/living/simple_animal/hostile/venus_human_trap/handle_automated_action() if(..()) diff --git a/code/modules/projectiles/guns/medbeam.dm b/code/modules/projectiles/guns/medbeam.dm index bcc9e3bd8a5..33c45537095 100644 --- a/code/modules/projectiles/guns/medbeam.dm +++ b/code/modules/projectiles/guns/medbeam.dm @@ -20,6 +20,11 @@ ..() START_PROCESSING(SSobj, src) +/obj/item/weapon/gun/medbeam/Destroy(mob/user) + STOP_PROCESSING(SSobj, src) + LoseTarget() + return ..() + /obj/item/weapon/gun/medbeam/dropped(mob/user) ..() LoseTarget() @@ -31,6 +36,7 @@ /obj/item/weapon/gun/medbeam/proc/LoseTarget() if(active) qdel(current_beam) + current_beam = null active = 0 on_beam_release(current_target) current_target = null @@ -45,7 +51,7 @@ return current_target = target - active = 1 + active = TRUE current_beam = new(user,current_target,time=6000,beam_icon_state="medbeam",btype=/obj/effect/ebeam/medical) addtimer(CALLBACK(current_beam, /datum/beam.proc/Start), 0)