From a5dc2dde63bbe3855ef85088a3b46ca18ebcbb6d Mon Sep 17 00:00:00 2001 From: thgvr Date: Mon, 19 Feb 2024 20:48:42 -0800 Subject: [PATCH] Fix traits+status --- code/datums/status_effects/debuffs.dm | 25 ++++++++++++++--------- code/game/machinery/medical/_medical.dm | 27 ++++++++++++++++--------- 2 files changed, 32 insertions(+), 20 deletions(-) diff --git a/code/datums/status_effects/debuffs.dm b/code/datums/status_effects/debuffs.dm index db1963460fb7..a8e3d9d89c3b 100644 --- a/code/datums/status_effects/debuffs.dm +++ b/code/datums/status_effects/debuffs.dm @@ -179,10 +179,15 @@ id = "life_support" duration = -1 tick_interval = 10 - alert_type = /obj/screen/alert/status_effect/life_support + alert_type = /atom/movable/screen/alert/status_effect/life_support ///last time the affected person was dead var/last_dead_time +/atom/movable/screen/alert/status_effect/life_support + name = "Life Support" + desc = "You are in a state of life suspension, and you can't die. Pray that someone doesn't pull the cord." + icon_state = "stasis" + /** * Updates the time of death * @@ -202,23 +207,23 @@ . = ..() if(.) update_time_of_death() - ADD_TRAIT(owner,TRAIT_NOCRITDAMAGE,"life_support") - ADD_TRAIT(owner,TRAIT_NODEATH,"life_support") + +/datum/status_effect/grouped/life_support/on_apply() + . = ..() + if(!.) + return + ADD_TRAIT(owner, TRAIT_NOCRITDAMAGE, TRAIT_STATUS_EFFECT(id)) + ADD_TRAIT(owner, TRAIT_NODEATH, TRAIT_STATUS_EFFECT(id)) /datum/status_effect/grouped/life_support/tick() update_time_of_death() /datum/status_effect/grouped/life_support/on_remove() - REMOVE_TRAIT(owner,TRAIT_NOCRITDAMAGE,"life_support") - REMOVE_TRAIT(owner,TRAIT_NODEATH,"life_support") + REMOVE_TRAIT(owner,TRAIT_NOCRITDAMAGE, TRAIT_STATUS_EFFECT(id)) + REMOVE_TRAIT(owner,TRAIT_NODEATH, TRAIT_STATUS_EFFECT(id)) update_time_of_death() return ..() -/obj/screen/alert/status_effect/life_support - name = "Life Support" - desc = "You are in a state of life suspension, and you can't die. Pray that someone doesn't pull the cord." - icon_state = "stasis" - //STASIS /datum/status_effect/grouped/stasis id = "stasis" diff --git a/code/game/machinery/medical/_medical.dm b/code/game/machinery/medical/_medical.dm index e6356a47de2b..7356f705666c 100644 --- a/code/game/machinery/medical/_medical.dm +++ b/code/game/machinery/medical/_medical.dm @@ -22,28 +22,35 @@ /obj/machinery/medical/MouseDrop(mob/living/target) . = ..() - if(!ishuman(usr) || !usr.canUseTopic(src, BE_CLOSE) || !isliving(target)) - return - - if(attached) - usr.visible_message("[usr] deattaches [src] from [target].", "You deattach [src] from [target].") - clear_status() - attached = null + if(!ishuman(usr) || !usr.canUseTopic(src, BE_CLOSE) || !isliving(target) || attached) return if(!target.has_dna()) - to_chat(usr, "The [name] beeps: \"Warning, incompatible creature!\"") + to_chat(usr, span_warning("The [name] beeps: 'Warning, incompatible creature!'")) return if(Adjacent(target) && usr.Adjacent(target)) - usr.visible_message("[usr] attaches [src] to [target].", "You attach [src] to [target].") + usr.visible_message(span_warning("[usr] attaches [src] to [target]."), span_notice("You attach [src] to [target].")) add_fingerprint(usr) attached = target update_overlays() +/obj/machinery/medical/attack_hand(mob/user) + . = ..() + if(.) + return + if(!ishuman(user)) + return + if(attached) + visible_message(span_notice("[attached] is detached from [src].")) + attached = null + clear_status() + update_appearance() + return + /obj/machinery/medical/process() update_overlays() - update_icon() + update_appearance() if(!attached) use_power = IDLE_POWER_USE