diff --git a/code/game/atoms_movable.dm b/code/game/atoms_movable.dm index fc38c768c7f6..be6849588cb9 100644 --- a/code/game/atoms_movable.dm +++ b/code/game/atoms_movable.dm @@ -433,7 +433,7 @@ //makes conga lines work with ladders and flying up and down; checks if the guy you are pulling is pulling someone, //then uses recursion to run the same function again - if (pulling.pulling) + if (pulling.pulling && (pulling.pulling != src)) // DARKPACK EDIT CHANGE - (Fix infinite recursioin) . |= pulling.pulling.get_z_move_affected(z_move_flags) /** diff --git a/modular_darkpack/modules/z_travel/code/helpers.dm b/modular_darkpack/modules/z_travel/code/helpers.dm index 33163676331d..a782ee4579a2 100644 --- a/modular_darkpack/modules/z_travel/code/helpers.dm +++ b/modular_darkpack/modules/z_travel/code/helpers.dm @@ -1,16 +1,13 @@ // Copypasta of get_z_move_affected /// Returns a list of movables that should also be affected when src moves through teleporters, and src. -/atom/movable/proc/get_teleport_move_affected() - . = list(src) +/atom/movable/proc/get_teleport_move_affected(list/returning_list = list()) + . = returning_list + . |= src if(buckled_mobs) . |= buckled_mobs for(var/mob/living/buckled as anything in buckled_mobs) if(buckled.pulling) . |= buckled.pulling - if(pulling) - . |= pulling - if (pulling.buckled_mobs) - . |= pulling.buckled_mobs - - if (pulling.pulling) - . |= pulling.pulling.get_teleport_move_affected() + //we pass in the list from this proc to ensure we dont reach an infinite loop due to mobs grabbed in a loop or two mobs grabing eachother. + if(pulling && !(pulling in .)) + . |= pulling.get_z_move_affected(.)