voltaic cyberheart: stoppable overlay timer, losing overdrive on heart loss (#94817)

Co-authored-by: Hatterhat <Hatterhat@users.noreply.github.com>
This commit is contained in:
Hatterhat
2026-01-18 17:24:51 +11:00
committed by GitHub
co-authored by Hatterhat
parent a6656316a7
commit 55279df884
@@ -30,6 +30,10 @@
var/core_removable = TRUE
/obj/item/organ/heart/cybernetic/anomalock/Destroy()
if(lightning_timer)
deltimer(lightning_timer)
if(lightning_overlay)
lightning_overlay = null
QDEL_NULL(core)
return ..()
@@ -51,10 +55,12 @@
. = ..()
if(!core)
return
clear_lightning_overlay(organ_owner)
UnregisterSignal(organ_owner, SIGNAL_ADDTRAIT(TRAIT_CRITICAL_CONDITION))
UnregisterSignal(organ_owner, COMSIG_ATOM_EMP_ACT)
organ_owner.RemoveElement(/datum/element/empprotection, EMP_PROTECT_SELF|EMP_PROTECT_CONTENTS|EMP_NO_EXAMINE)
tesla_zap(source = organ_owner, zap_range = 20, power = 2.5e5, cutoff = 1e3)
qdel(src)
QDEL_IN(src, 0)
/obj/item/organ/heart/cybernetic/anomalock/attack(mob/living/target_mob, mob/living/user, list/modifiers, list/attack_modifiers)
if(target_mob != user || !istype(target_mob) || !core)
@@ -79,14 +85,16 @@
/obj/item/organ/heart/cybernetic/anomalock/proc/add_lightning_overlay(time_to_last = 10 SECONDS)
if(lightning_overlay)
lightning_timer = addtimer(CALLBACK(src, PROC_REF(clear_lightning_overlay)), time_to_last, (TIMER_UNIQUE|TIMER_OVERRIDE))
lightning_timer = addtimer(CALLBACK(src, PROC_REF(clear_lightning_overlay), owner), time_to_last, (TIMER_UNIQUE|TIMER_OVERRIDE|TIMER_STOPPABLE|TIMER_DELETE_ME))
return
lightning_overlay = mutable_appearance(icon = 'icons/effects/effects.dmi', icon_state = "lightning")
owner.add_overlay(lightning_overlay)
lightning_timer = addtimer(CALLBACK(src, PROC_REF(clear_lightning_overlay)), time_to_last, (TIMER_UNIQUE|TIMER_OVERRIDE))
lightning_timer = addtimer(CALLBACK(src, PROC_REF(clear_lightning_overlay), owner), time_to_last, (TIMER_UNIQUE|TIMER_OVERRIDE|TIMER_STOPPABLE|TIMER_DELETE_ME))
/obj/item/organ/heart/cybernetic/anomalock/proc/clear_lightning_overlay()
owner.cut_overlay(lightning_overlay)
/obj/item/organ/heart/cybernetic/anomalock/proc/clear_lightning_overlay(mob/organ_owner)
organ_owner?.cut_overlay(lightning_overlay)
if(lightning_timer)
deltimer(lightning_timer)
lightning_overlay = null
/obj/item/organ/heart/cybernetic/anomalock/attack_self(mob/user, modifiers)
@@ -121,15 +129,16 @@
var/obj/item/stock_parts/power_store/cell = pick(batteries)
cell.give(cell.max_charge() * 0.1)
///Does a few things to try to help you live whatever you may be going through
///Does a few things to try to help you live whatever you may be going through. Returns TRUE if it activated successfully.
/obj/item/organ/heart/cybernetic/anomalock/proc/activate_survival(mob/living/carbon/organ_owner)
if(!COOLDOWN_FINISHED(src, survival_cooldown))
return
return FALSE
organ_owner.apply_status_effect(/datum/status_effect/voltaic_overdrive)
add_lightning_overlay(30 SECONDS)
COOLDOWN_START(src, survival_cooldown, survival_cooldown_time)
addtimer(CALLBACK(src, PROC_REF(notify_cooldown), organ_owner), COOLDOWN_TIMELEFT(src, survival_cooldown))
return TRUE
///Alerts our owner that the organ is ready to do its thing again
/obj/item/organ/heart/cybernetic/anomalock/proc/notify_cooldown(mob/living/carbon/organ_owner)
@@ -202,6 +211,7 @@
/datum/status_effect/voltaic_overdrive/on_apply()
. = ..()
RegisterSignal(owner, COMSIG_CARBON_LOSE_ORGAN, PROC_REF(on_organ_lost))
owner.add_movespeed_mod_immunities(type, /datum/movespeed_modifier/damage_slowdown)
REMOVE_TRAIT(src, TRAIT_CRITICAL_CONDITION, STAT_TRAIT)
owner.reagents.add_reagent(/datum/reagent/medicine/coagulant, 5)
@@ -211,11 +221,18 @@
/datum/status_effect/voltaic_overdrive/on_remove()
. = ..()
UnregisterSignal(owner, COMSIG_CARBON_LOSE_ORGAN)
owner.remove_movespeed_mod_immunities(type, /datum/movespeed_modifier/damage_slowdown)
owner.remove_filter("emp_shield")
owner.balloon_alert(owner, "your heart weakens")
owner.remove_traits(list(TRAIT_NOSOFTCRIT, TRAIT_NOHARDCRIT, TRAIT_ANALGESIA), REF(src))
/// Called when an organ is lost in the owner. In the event the owner just lost their voltaic (presumably, the one giving this effect), ends the buff and clears the overlay.
/datum/status_effect/voltaic_overdrive/proc/on_organ_lost(mob/living/carbon/source, obj/item/organ/organ, special)
SIGNAL_HANDLER
if(istype(organ, /obj/item/organ/heart/cybernetic/anomalock))
qdel(src)
/atom/movable/screen/alert/status_effect/anomalock_active
name = "voltaic overdrive"
use_user_hud_icon = TRUE