From 148eae540b1cb9dc9aadaa89bb0130c7599abd13 Mon Sep 17 00:00:00 2001 From: Kenionatus Date: Sat, 14 Sep 2024 05:07:34 +0200 Subject: [PATCH] fix squeak component (#26709) fixes #10334 "Blood crawling slaughter demons make rubber duckies squeak" fixes squeak component being confused about what is the crossed and what is the crossing atom prevents some potential runtimes in play_squeak_crossed --- code/datums/components/squeak.dm | 38 +++++++++++++++++++------------- 1 file changed, 23 insertions(+), 15 deletions(-) diff --git a/code/datums/components/squeak.dm b/code/datums/components/squeak.dm index c2aef66bcaa..31dbb4897d1 100644 --- a/code/datums/components/squeak.dm +++ b/code/datums/components/squeak.dm @@ -71,26 +71,34 @@ else steps++ -/datum/component/squeak/proc/play_squeak_crossed(atom/movable/AM) - if(isitem(AM)) - var/obj/item/I = AM - if(I.flags & ABSTRACT) - return - else if(isprojectile(AM)) - var/obj/item/projectile/P = AM - if(P.original != parent) - return - if(ismob(AM)) - var/mob/M = AM +/datum/component/squeak/proc/play_squeak_crossed(atom/source, atom/movable/crossing) + if(istype(crossing, /obj/effect)) + return + if(ismob(crossing)) + var/mob/M = crossing if(M.flying) return - if(isliving(AM)) + if(isliving(crossing)) var/mob/living/L = M if(L.floating) return - var/atom/current_parent = parent - if(isturf(current_parent.loc)) - play_squeak() + else if(isitem(crossing)) + var/obj/item/I = source + if(I.flags & ABSTRACT) + return + if(isprojectile(crossing)) + var/obj/item/projectile/P = crossing + if(P.original != parent) + return + if(ismob(source)) + var/mob/M = source + if(M.flying) + return + if(isliving(source)) + var/mob/living/L = M + if(L.floating) + return + play_squeak() /datum/component/squeak/proc/use_squeak() if(last_use + use_delay < world.time)