Maybe makes stuff like zombie powder more consistent / less buggy with status effects (#93836)

This commit is contained in:
MrMelbert
2025-11-27 06:22:11 -07:00
committed by GitHub
parent aa9ae1a8d3
commit c4542c2085
6 changed files with 108 additions and 30 deletions
@@ -98,34 +98,39 @@
status_type = STATUS_EFFECT_UNIQUE
duration = STATUS_EFFECT_PERMANENT //Will remove self when block breaks.
alert_type = /atom/movable/screen/alert/status_effect/freon/stasis
tick_interval = STATUS_EFFECT_NO_TICK
/// The cube we will place our mob into.
var/obj/structure/ice_stasis/cube
/// Whether or not this version of the status effect can be resisted out of.
var/resistable = TRUE
/datum/status_effect/frozenstasis/on_apply()
if(resistable)
RegisterSignal(owner, COMSIG_LIVING_RESIST, PROC_REF(breakCube))
cube = new /obj/structure/ice_stasis(get_turf(owner))
owner.forceMove(cube)
RegisterSignal(cube, COMSIG_QDELETING, PROC_REF(clear_effect))
RegisterSignal(owner, COMSIG_MOVABLE_MOVED, PROC_REF(has_escaped))
if(resistable)
RegisterSignal(owner, COMSIG_LIVING_RESIST, PROC_REF(clear_effect))
ADD_TRAIT(owner, TRAIT_GODMODE, TRAIT_STATUS_EFFECT(id))
return ..()
return TRUE
/datum/status_effect/frozenstasis/tick(seconds_between_ticks)
if(!cube || owner.loc != cube)
owner.remove_status_effect(src)
/datum/status_effect/frozenstasis/proc/breakCube()
/datum/status_effect/frozenstasis/proc/clear_effect(...)
SIGNAL_HANDLER
owner.remove_status_effect(src)
qdel(src)
/datum/status_effect/frozenstasis/proc/has_escaped(...)
SIGNAL_HANDLER
if(owner.loc != cube)
qdel(src)
/datum/status_effect/frozenstasis/on_remove()
if(cube)
qdel(cube)
REMOVE_TRAIT(owner, TRAIT_GODMODE, TRAIT_STATUS_EFFECT(id))
if(resistable)
UnregisterSignal(owner, COMSIG_LIVING_RESIST)
UnregisterSignal(owner, COMSIG_MOVABLE_MOVED)
UnregisterSignal(owner, COMSIG_LIVING_RESIST)
UnregisterSignal(cube, COMSIG_QDELETING)
QDEL_NULL(cube)
/datum/status_effect/frozenstasis/irresistable
resistable = FALSE