diff --git a/code/modules/hallucinations/effects/moderate.dm b/code/modules/hallucinations/effects/moderate.dm index 74744363c90..187639a5cc5 100644 --- a/code/modules/hallucinations/effects/moderate.dm +++ b/code/modules/hallucinations/effects/moderate.dm @@ -344,11 +344,7 @@ /obj/effect/hallucination/stunprodding/Initialize(mapload, mob/living/carbon/target) . = ..() - var/list/turfs = list() - for(var/turf/T in range(world.view, target)) - turfs += T - - var/turf/T = pick(turfs) + var/turf/T = pick(RANGE_TURFS(15, target)) target.playsound_local(T, 'sound/weapons/egloves.ogg', 25, TRUE) target.playsound_local(T, get_sfx("bodyfall"), 25, TRUE) target.playsound_local(T, "sparks", 50, TRUE) @@ -370,12 +366,8 @@ /obj/effect/hallucination/energy_sword/Initialize(mapload, mob/living/carbon/target) . = ..() - var/list/turfs = list() - for(var/turf/T in range(world.view, target)) - turfs += T - - var/turf/T = pick(turfs) - loc = T + var/turf/T = pick(RANGE_TURFS(15, target)) + forceMove(T) target.playsound_local(T, 'sound/weapons/saberon.ogg', 20, TRUE) var/scream_sound = pick('sound/goonstation/voice/female_scream.ogg', 'sound/goonstation/voice/male_scream.ogg') @@ -406,12 +398,8 @@ /obj/effect/hallucination/gunfire/Initialize(mapload, mob/living/carbon/target) . = ..() - var/list/turfs = list() - for(var/turf/T in range(world.view, target)) - turfs += T - - var/turf/T = pick(turfs) - loc = T + var/turf/T = pick(RANGE_TURFS(15, target)) + forceMove(T) var/gun_sound = pick('sound/weapons/gunshots/gunshot_pistol.ogg', 'sound/weapons/gunshots/gunshot_strong.ogg') var/scream_sound = pick('sound/goonstation/voice/female_scream.ogg', 'sound/goonstation/voice/male_scream.ogg') diff --git a/code/modules/hallucinations/hallucinations.dm b/code/modules/hallucinations/hallucinations.dm index d01413019a1..aefeb0d1e4e 100644 --- a/code/modules/hallucinations/hallucinations.dm +++ b/code/modules/hallucinations/hallucinations.dm @@ -52,9 +52,12 @@ GLOBAL_LIST_INIT(hallucinations, list( /// Lazy list of images created as part of the hallucination. Cleared on destruction. var/list/image/images = null -/obj/effect/hallucination/Initialize(mapload, mob/living/carbon/target) +/obj/effect/hallucination/Initialize(mapload, mob/living/carbon/hallucination_target) . = ..() - src.target = target + if(QDELETED(hallucination_target)) + qdel(src) + return + target = hallucination_target if(hallucination_icon && hallucination_icon_state) var/image/I = image(hallucination_icon, hallucination_override ? src : get_turf(src), hallucination_icon_state) I.override = hallucination_override