From c87143f2540de2c1f243ffd5022bedb6fac79ad6 Mon Sep 17 00:00:00 2001 From: HMBGERDO <61080616+HMBGERDO@users.noreply.github.com> Date: Sun, 2 Feb 2025 04:58:07 +0100 Subject: [PATCH] Tentacle fix 2, no runtime on adjacent hit, cling beartrap activates now (#28175) * tentacle beartrap works now, tentacle no longer causes runtimes on melee shots * yeah well lets do it that way * this should be here too * i am not stupid trust me * this name is better? * Update code/modules/antagonists/changeling/powers/mutations.dm Co-authored-by: Luc <89928798+lewcc@users.noreply.github.com> Signed-off-by: HMBGERDO <61080616+HMBGERDO@users.noreply.github.com> --------- Signed-off-by: HMBGERDO <61080616+HMBGERDO@users.noreply.github.com> Co-authored-by: Luc <89928798+lewcc@users.noreply.github.com> --- .../changeling/powers/mutations.dm | 21 ++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/code/modules/antagonists/changeling/powers/mutations.dm b/code/modules/antagonists/changeling/powers/mutations.dm index 912db6732717..8d82961b4663 100644 --- a/code/modules/antagonists/changeling/powers/mutations.dm +++ b/code/modules/antagonists/changeling/powers/mutations.dm @@ -213,6 +213,20 @@ throw_range = 0 throw_speed = 0 var/datum/action/changeling/weapon/parent_action + /// Used for deleting gun after hitting something + var/hit_something = FALSE + /// True if we're shooting our shot -- used to track shooting to prevent deleting mid shot + var/shooting_right_now = FALSE + +/obj/item/gun/magic/tentacle/process_fire(atom/target, mob/living/user, message, params, zone_override, bonus_spread) + shooting_right_now = TRUE + . = ..() + shooting_right_now = FALSE + check_should_delete() + +/obj/item/gun/magic/tentacle/proc/check_should_delete() + if(!shooting_right_now && hit_something) + qdel(src) /obj/item/gun/magic/tentacle/customised_abstract_text(mob/living/carbon/owner) return "[owner.p_their(TRUE)] [owner.l_hand == src ? "left arm" : "right arm"] has been turned into a grotesque tentacle." @@ -294,7 +308,8 @@ /obj/item/projectile/tentacle/on_hit(atom/target, blocked = 0) var/mob/living/carbon/human/H = firer - qdel(source.gun) + source.gun.hit_something = TRUE + source.gun.check_should_delete() if(blocked >= 100) return FALSE if(isitem(target)) @@ -353,8 +368,8 @@ add_attack_logs(H, C, "imobilised with a changeling tentacle") if(!iscarbon(H)) return TRUE - var/obj/item/restraints/legcuffs/beartrap/changeling/B = new(H.loc) - B.Crossed(C) + var/obj/item/restraints/legcuffs/beartrap/changeling/B = new(get_turf(L)) + B.on_atom_entered(C, L) return TRUE if(INTENT_HARM)