Skip to content

Commit

Permalink
Fix traits+status
Browse files Browse the repository at this point in the history
  • Loading branch information
thgvr committed Feb 20, 2024
1 parent ddcb8d2 commit a5dc2dd
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 20 deletions.
25 changes: 15 additions & 10 deletions code/datums/status_effects/debuffs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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
*
Expand All @@ -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"
Expand Down
27 changes: 17 additions & 10 deletions code/game/machinery/medical/_medical.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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("<span class='warning'>[usr] deattaches [src] from [target].</span>", "<span class='notice'>You deattach [src] from [target].</span>")
clear_status()
attached = null
if(!ishuman(usr) || !usr.canUseTopic(src, BE_CLOSE) || !isliving(target) || attached)
return

if(!target.has_dna())
to_chat(usr, "<span class='danger'>The [name] beeps: \"Warning, incompatible creature!\"</span>")
to_chat(usr, span_warning("The [name] beeps: 'Warning, incompatible creature!'"))
return

if(Adjacent(target) && usr.Adjacent(target))
usr.visible_message("<span class='warning'>[usr] attaches [src] to [target].</span>", "<span class='notice'>You attach [src] to [target].</span>")
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
Expand Down

0 comments on commit a5dc2dd

Please sign in to comment.