From 108751ce0346c28b9bbf1ed6dcd841f3e8242a70 Mon Sep 17 00:00:00 2001 From: fira Date: Wed, 28 Jun 2023 06:20:29 +0100 Subject: [PATCH] Fix Infinite Recursion in Hugger Custom Rebound (#3730) # About the pull request ``` hugger egg trigger -> /obj/effect/alien/egg/proc/release_hugger -> /obj/item/clothing/mask/facehugger/proc/leap_at_nearest_target -> throw_atom -> collide against crusher in the way <<------------------------- -> launch_impact | -> hugger custom mob_launch_collision | -> step away | -> launch_impact didn't have time to reset throw yet | -> collides with something as throw again -------------------------- ``` # Testing Photographs and Procedure Untested # Changelog :cl: fix: Fixed a MC crash related to NPC huggers rebounding logic. /:cl: --- code/modules/mob/living/carbon/xenomorph/Facehuggers.dm | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/code/modules/mob/living/carbon/xenomorph/Facehuggers.dm b/code/modules/mob/living/carbon/xenomorph/Facehuggers.dm index 212688c8c98f..8b3b1d54f26d 100644 --- a/code/modules/mob/living/carbon/xenomorph/Facehuggers.dm +++ b/code/modules/mob/living/carbon/xenomorph/Facehuggers.dm @@ -209,6 +209,11 @@ if(stat == UNCONSCIOUS) return + // Force reset throw now because [/atom/movable/proc/launch_impact] only does that later on + // If we DON'T, step()'s move below can collide, rebound, trigger this proc again, into infinite recursion + throwing = FALSE + rebounding = FALSE + if(leaping && can_hug(L, hivenumber)) attach(L) else if(L.density)