Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions code/game/objects/effects/anomalies/anomalies_gravity.dm
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,10 @@

/obj/effect/anomaly/grav/proc/gravShock(mob/living/Guy)
if(boing && isliving(Guy) && !Guy.stat)
// PENTEST ADDITION - Prevent throwing mobs that are already being thrown to avoid recursion
if(Guy.throwing)
return
// PENTEST ADDITION END
Guy.Paralyze(40)
var/atom/target = get_edge_target_turf(Guy, get_dir(src, get_step_away(Guy, src)))
Guy.throw_at(target, 5, 1)
Expand Down
14 changes: 14 additions & 0 deletions code/modules/mob/living/status_procs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
//The effects include: stun, knockdown, unconscious, sleeping, resting,
// eye damage, eye_blind, eye_blurry, druggy, TRAIT_BLIND trait, and TRAIT_NEARSIGHT trait.

// PENTEST ADDITION - Recursion guards to prevent infinite loops
GLOBAL_LIST_EMPTY(paralyze_processing_guard)
// PENTEST ADDITION END

////////////////////////////// STUN ////////////////////////////////////

Expand Down Expand Up @@ -175,17 +178,28 @@
return 0

/mob/living/proc/Paralyze(amount, ignore_canstun = FALSE) //Can't go below remaining duration
// PENTEST ADDITION - Prevent infinite recursion (e.g., from gravity anomalies during throws)
if(GLOB.paralyze_processing_guard[src])
stack_trace("Paralyze: Recursion detected and prevented for [src] [src.type]")
return
GLOB.paralyze_processing_guard[src] = TRUE
// PENTEST ADDITION END

if(SEND_SIGNAL(src, COMSIG_LIVING_STATUS_PARALYZE, amount, ignore_canstun) & COMPONENT_NO_STUN)
GLOB.paralyze_processing_guard -= src // PENTEST ADDITION - Cleanup guard
return
if(((status_flags & CANKNOCKDOWN) && !HAS_TRAIT(src, TRAIT_STUNIMMUNE)) || ignore_canstun)
if(absorb_stun(amount, ignore_canstun))
GLOB.paralyze_processing_guard -= src // PENTEST ADDITION - Cleanup guard
return
var/datum/status_effect/incapacitating/paralyzed/P = IsParalyzed(FALSE)
if(P)
P.duration = max(world.time + amount, P.duration)
else if(amount > 0)
P = apply_status_effect(STATUS_EFFECT_PARALYZED, amount)
GLOB.paralyze_processing_guard -= src // PENTEST ADDITION - Cleanup guard
return P
GLOB.paralyze_processing_guard -= src // PENTEST ADDITION - Cleanup guard

/mob/living/proc/SetParalyzed(amount, ignore_canstun = FALSE) //Sets remaining duration
if(SEND_SIGNAL(src, COMSIG_LIVING_STATUS_PARALYZE, amount, ignore_canstun) & COMPONENT_NO_STUN)
Expand Down
Loading