Migrate health analyzer to the new attack chain. (#32248)

* Migrate health analyzer to the new attack chain.

* Apply suggestions from CRUNCH review

Co-authored-by: CRUNCH <143041327+CRUNCH-Borg@users.noreply.github.com>
Signed-off-by: Alan <alfalfascout@users.noreply.github.com>

---------

Signed-off-by: Alan <alfalfascout@users.noreply.github.com>
Co-authored-by: CRUNCH <143041327+CRUNCH-Borg@users.noreply.github.com>
This commit is contained in:
Alan
2026-07-24 19:42:17 +00:00
committed by GitHub
co-authored by CRUNCH
parent 83acadbdf1
commit cce2323f7c
@@ -77,36 +77,46 @@
var/mode = DETAILED_HEALTH_SCAN
/// Is the health analyzer upgraded? Allows reagents in the body to be seen.
var/advanced = FALSE
new_attack_chain = TRUE
/obj/item/healthanalyzer/examine(mob/user)
. = ..()
. += SPAN_NOTICE("Use [src] in hand to toggle showing localised damage.")
/obj/item/healthanalyzer/attack_self__legacy__attackchain(mob/user)
/obj/item/healthanalyzer/activate_self(mob/user)
if(..())
return ITEM_INTERACT_COMPLETE
mode = !mode
add_fingerprint(user)
switch(mode)
if(DETAILED_HEALTH_SCAN)
to_chat(user, SPAN_NOTICE("The scanner is now showing localised limb damage."))
if(SIMPLE_HEALTH_SCAN)
to_chat(user, SPAN_NOTICE("The scanner is no longer showing localised limb damage."))
return ITEM_INTERACT_COMPLETE
/obj/item/healthanalyzer/attack__legacy__attackchain(mob/living/M, mob/living/user)
/obj/item/healthanalyzer/interact_with_atom(atom/target, mob/living/user, list/modifiers)
if((HAS_TRAIT(user, TRAIT_CLUMSY) || user.getBrainLoss() >= 60) && prob(50))
var/list/msgs = list()
user.visible_message(SPAN_WARNING("[user] analyzes the floor's vitals!"), SPAN_NOTICE("You stupidly try to analyze the floor's vitals!"))
user.visible_message(
SPAN_WARNING("[user] analyzes the floor's vitals!"),
SPAN_WARNING("You stupidly try to analyze the floor's vitals!")
)
msgs += SPAN_NOTICE("Analyzing results for The floor:\nOverall status: Healthy")
msgs += SPAN_NOTICE("Key: <font color='blue'>Suffocation</font>/<font color='green'>Toxin</font>/<font color='#FFA500'>Burn</font>/<font color='red'>Brute</font>")
msgs += SPAN_NOTICE("Damage specifics: <font color='blue'>0</font> - <font color='green'>0</font> - <font color='#FFA500'>0</font> - <font color='red'>0</font>")
msgs += SPAN_NOTICE("Body temperature: ???")
to_chat(user, chat_box_healthscan(msgs.Join("<br>")))
return
add_fingerprint(user)
return ITEM_INTERACT_COMPLETE
user.visible_message(
SPAN_NOTICE("[user] analyzes [M]'s vitals."),
SPAN_NOTICE("You analyze [M]'s vitals.")
SPAN_NOTICE("[user] analyzes [target]'s vitals."),
SPAN_NOTICE("You analyze [target]'s vitals.")
)
healthscan(user, M, mode, advanced)
healthscan(user, target, mode, advanced)
add_fingerprint(user)
return ITEM_INTERACT_COMPLETE
// Used by the PDA medical scanner too.
/proc/healthscan(mob/user, mob/living/M, mode = DETAILED_HEALTH_SCAN, advanced = FALSE)
@@ -114,6 +124,17 @@
var/scanned_name = "[M]"
// These sensors are designed for organic life.
if(!ismob(M) || issilicon(M) || ismachineperson(M) || (HAS_TRAIT(user, TRAIT_MED_MACHINE_HALLUCINATING) && prob(5)))
msgs += SPAN_NOTICE("Analyzing Results for ERROR:\nOverall Status: ERROR")
msgs += "Key: [SPAN_HEALTHSCAN_OXY("Suffocation")]/<font color='green'>Toxin</font>/<font color='#FFA500'>Burns</font>/<font color='red'>Brute</font>"
msgs += "Damage Specifics: [SPAN_HEALTHSCAN_OXY("?")] - <font color='green'>?</font> - <font color='#FFA500'>?</font> - <font color='red'>?</font>"
msgs += SPAN_NOTICE("Body Temperature: [ismob(M) ? M.bodytemperature-T0C : "ERROR"]&deg;C ([ismob(M) ? M.bodytemperature*1.8-459.67 : "ERROR"]&deg;F)")
msgs += SPAN_WARNING("<b>Warning: Blood Level ERROR: --% --cl.</span><span class='notice'>Type: ERROR")
msgs += SPAN_NOTICE("Subject's pulse: <font color='red'>-- bpm.</font>")
to_chat(user, chat_box_healthscan(msgs.Join("<br>")))
return ITEM_INTERACT_COMPLETE
var/probably_dead = (M.stat == DEAD)
// show your own health, evil
@@ -123,7 +144,7 @@
if(HAS_TRAIT(user, TRAIT_MED_MACHINE_HALLUCINATING) && prob(10) && IS_HORIZONTAL(M))
probably_dead = TRUE
if(isanimal_or_basicmob(M))
if(!ishuman(M))
// No box here, keep it simple.
if(probably_dead)
to_chat(user, SPAN_NOTICE("Analyzing Results for [M]:\nOverall Status: <font color='red'>Dead</font>"))
@@ -133,17 +154,6 @@
to_chat(user, "\t Damage Specifics: <font color='red'>[M.maxHealth - M.health]</font>")
return
// These sensors are designed for organic life.
if(!ishuman(M) || ismachineperson(M) || (HAS_TRAIT(user, TRAIT_MED_MACHINE_HALLUCINATING) && prob(5)))
msgs += SPAN_NOTICE("Analyzing Results for ERROR:\nOverall Status: ERROR")
msgs += "Key: [SPAN_HEALTHSCAN_OXY("Suffocation")]/<font color='green'>Toxin</font>/<font color='#FFA500'>Burns</font>/<font color='red'>Brute</font>"
msgs += "Damage Specifics: [SPAN_HEALTHSCAN_OXY("?")] - <font color='green'>?</font> - <font color='#FFA500'>?</font> - <font color='red'>?</font>"
msgs += SPAN_NOTICE("Body Temperature: [M.bodytemperature-T0C]&deg;C ([M.bodytemperature*1.8-459.67]&deg;F)")
msgs += SPAN_WARNING("<b>Warning: Blood Level ERROR: --% --cl.</span><span class='notice'>Type: ERROR")
msgs += SPAN_NOTICE("Subject's pulse: <font color='red'>-- bpm.</font>")
to_chat(user, chat_box_healthscan(msgs.Join("<br>")))
return
var/mob/living/carbon/human/H = M
var/fake_oxy = max(rand(1,40), H.getOxyLoss(), (300 - (H.getToxLoss() + H.getFireLoss() + H.getBruteLoss())))
var/OX = H.getOxyLoss()
@@ -333,23 +343,25 @@
to_chat(user, chat_box_healthscan(msgs.Join("<br>")))
/obj/item/healthanalyzer/attackby__legacy__attackchain(obj/item/I, mob/user, params)
if(!istype(I, /obj/item/healthupgrade))
/obj/item/healthanalyzer/item_interaction(mob/user, obj/item/used, list/modifiers)
if(!istype(used, /obj/item/healthupgrade))
return ..()
if(advanced)
to_chat(user, SPAN_NOTICE("An upgrade is already installed on [src]."))
return
return ITEM_INTERACT_COMPLETE
if(!user.unequip(I))
if(!user.unequip(used))
to_chat(user, SPAN_WARNING("[src] is stuck to your hand!"))
return
return ITEM_INTERACT_COMPLETE
to_chat(user, SPAN_NOTICE("You install the upgrade on [src]."))
icon_state = "health2"
playsound(loc, I.usesound, 50, TRUE)
playsound(loc, used.usesound, 50, TRUE)
advanced = TRUE
qdel(I)
qdel(used)
add_fingerprint(user)
return ITEM_INTERACT_COMPLETE
/obj/item/healthanalyzer/advanced
name = "advanced health analyzer"