Skip to content

Health Analyzer Changes #6802

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions code/__DEFINES/mobs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,6 @@
#define RESPIRATION_N2 (1 << 1)
#define RESPIRATION_PLASMA (1 << 2)

//Organ defines for carbon mobs
#define ORGAN_ORGANIC 1
#define ORGAN_ROBOTIC 2
#define ORGAN_MINERAL 3 // Used for the plasmaman liver

#define DEFAULT_BODYPART_ICON_ORGANIC 'icons/mob/species/human/bodyparts_greyscale.dmi'
#define DEFAULT_BODYPART_ICON_ROBOTIC 'icons/mob/augmentation/augments.dmi'

Expand Down
58 changes: 40 additions & 18 deletions code/__DEFINES/surgery.dm
Original file line number Diff line number Diff line change
@@ -1,24 +1,46 @@
/// Helper to figure out if an organ is organic
#define IS_ORGANIC_ORGAN(organ) (organ.organ_flags & ORGAN_ORGANIC)
/// Helper to figure out if an organ is robotic
#define IS_ROBOTIC_ORGAN(organ) (organ.organ_flags & ORGAN_ROBOTIC)
/// Helper to figure out if an organ is unremovable
#define IS_ORGAN_UNREMOVABLE(organ) (organ.organ_flags & ORGAN_UNREMOVABLE)

// Flags for the organ_flags var on /obj/item/organ
///Synthetic organs, or cybernetic organs. Reacts to EMPs and don't deteriorate or heal
#define ORGAN_SYNTHETIC (1<<0)
///Frozen organs, don't deteriorate
#define ORGAN_FROZEN (1<<1)
///Failing organs perform damaging effects until replaced or fixed
#define ORGAN_FAILING (1<<2)
///Currently only the brain
#define ORGAN_VITAL (1<<3)
///is a snack? :D
#define ORGAN_EDIBLE (1<<4)
///Synthetic organ affected by an EMP. Deteriorates over time.
#define ORGAN_SYNTHETIC_EMP (1<<5)
///Can't be removed using surgery
#define ORGAN_UNREMOVABLE (1<<6)
/// Organic organs, the default. Don't get affected by EMPs.
#define ORGAN_ORGANIC (1<<0)
/// Synthetic organs, or cybernetic organs. Reacts to EMPs and don't deteriorate or heal
#define ORGAN_ROBOTIC (1<<1)
/// Mineral organs. Snowflakey.
#define ORGAN_MINERAL (1<<2)
/// Frozen organs, don't deteriorate
#define ORGAN_FROZEN (1<<3)
/// Failing organs perform damaging effects until replaced or fixed, and typically they don't function properly either
#define ORGAN_FAILING (1<<4)
/// Synthetic organ affected by an EMP. Deteriorates over time.
#define ORGAN_EMP (1<<5)
/// Currently only the brain - Removing this organ KILLS the owner
#define ORGAN_VITAL (1<<6)
/// Can be eaten
#define ORGAN_EDIBLE (1<<7)
/// Can't be removed using surgery or other common means
#define ORGAN_UNREMOVABLE (1<<8)
/// Can't be seen by scanners, doesn't anger body purists
#define ORGAN_HIDDEN (1<<7)
#define ORGAN_HIDDEN (1<<9)
/// Has the organ already been inserted inside someone
#define ORGAN_VIRGIN (1<<10) // Not used yet just a placeholder as of monkepr#6802.
/// ALWAYS show this when scanned by advanced scanners, even if it is totally healthy
#define ORGAN_PROMINENT (1<<11)
/// An organ that is ostensibly dangerous when inside a body
#define ORGAN_HAZARDOUS (1<<12)
/// Synthetic organ granted by a species (for use for organ replacements between species)
#define ORGAN_SYNTHETIC_FROM_SPECIES (1<<8)
#define ORGAN_SYNTHETIC_FROM_SPECIES (1<<13)
/// This organ has no impact on conversion via flash, such as revs or bbs. Doesn't affect hypnosis and whatnot, though. MONKESTATION EDIT
#define ORGAN_DOESNT_PROTECT_AGAINST_CONVERSION (1<<9)
#define ORGAN_DOESNT_PROTECT_AGAINST_CONVERSION (1<<14)

/// Helper to figure out if a limb is organic
#define IS_ORGANIC_LIMB(limb) (limb.bodytype & BODYTYPE_ORGANIC)
/// Helper to figure out if a limb is robotic
#define IS_ROBOTIC_LIMB(limb) (limb.bodytype & BODYTYPE_ROBOTIC)

// Flags for the bodypart_flags var on /obj/item/bodypart
/// Bodypart cannot be dismembered or amputated
Expand Down Expand Up @@ -50,7 +72,7 @@
/// All head flags, default for most heads
#define HEAD_ALL_FEATURES (HEAD_HAIR|HEAD_FACIAL_HAIR|HEAD_LIPS|HEAD_EYESPRITES|HEAD_EYECOLOR|HEAD_EYEHOLES|HEAD_DEBRAIN)

/// When the surgery step fails :(
/// Return value when the surgery step fails :(
#define SURGERY_STEP_FAIL -1

// Flags for surgery_flags on surgery datums
Expand Down
3 changes: 0 additions & 3 deletions code/__HELPERS/bodyparts.dm

This file was deleted.

6 changes: 4 additions & 2 deletions code/_globalvars/bitfields.dm
Original file line number Diff line number Diff line change
Expand Up @@ -499,12 +499,14 @@ DEFINE_BITFIELD(emote_flags, list(
))

DEFINE_BITFIELD(organ_flags, list(
"ORGAN_SYNTHETIC" = ORGAN_SYNTHETIC,
"ORGAN_ORGANIC" = ORGAN_ORGANIC,
"ORGAN_ROBOTIC" = ORGAN_ROBOTIC,
"ORGAN_MINERAL" = ORGAN_MINERAL,
"ORGAN_FROZEN" = ORGAN_FROZEN,
"ORGAN_FAILING" = ORGAN_FAILING,
"ORGAN_EMP" = ORGAN_EMP,
"ORGAN_VITAL" = ORGAN_VITAL,
"ORGAN_EDIBLE" = ORGAN_EDIBLE,
"ORGAN_SYNTHETIC_EMP" = ORGAN_SYNTHETIC_EMP,
"ORGAN_UNREMOVABLE" = ORGAN_UNREMOVABLE,
"ORGAN_HIDDEN" = ORGAN_HIDDEN, //Monkestation edit: BLOOD_DATUMS, how was this forgotten
))
Expand Down
8 changes: 8 additions & 0 deletions code/datums/components/irradiated.dm
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,13 @@
/datum/component/irradiated/RegisterWithParent()
RegisterSignal(parent, COMSIG_COMPONENT_CLEAN_ACT, PROC_REF(on_clean))
RegisterSignal(parent, COMSIG_GEIGER_COUNTER_SCAN, PROC_REF(on_geiger_counter_scan))
RegisterSignal(parent, COMSIG_LIVING_HEALTHSCAN, PROC_REF(on_healthscan))

/datum/component/irradiated/UnregisterFromParent()
UnregisterSignal(parent, list(
COMSIG_COMPONENT_CLEAN_ACT,
COMSIG_GEIGER_COUNTER_SCAN,
COMSIG_LIVING_HEALTHSCAN,
))

/datum/component/irradiated/Destroy(force)
Expand Down Expand Up @@ -186,6 +188,12 @@

return COMSIG_GEIGER_COUNTER_SCAN_SUCCESSFUL

/datum/component/irradiated/proc/on_healthscan(datum/source, list/render_list, advanced, mob/user, mode, tochat)
SIGNAL_HANDLER

render_list += conditional_tooltip("<span class='alert ml-1'>Subject is irradiated.</span>", "Supply antiradiation or antitoxin, such as [/datum/reagent/medicine/potass_iodide::name] or [/datum/reagent/medicine/pen_acid::name].", tochat)
render_list += "<br>"

/atom/movable/screen/alert/irradiated
name = "Irradiated"
desc = "You're irradiated! Heal your toxins quick, and stand under a shower to halt the incoming damage."
Expand Down
1 change: 0 additions & 1 deletion code/datums/components/surgery_initiator.dm
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,6 @@
var/required_tool_type = TOOL_CAUTERY
var/obj/item/close_tool = user.get_inactive_held_item()
var/is_robotic = the_surgery.requires_bodypart_type == BODYTYPE_ROBOTIC

if(is_robotic)
required_tool_type = TOOL_SCREWDRIVER

Expand Down
12 changes: 6 additions & 6 deletions code/datums/quirks/negative_quirks/body_purist.dm
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@
if(!istype(owner))
return
for(var/obj/item/bodypart/limb as anything in owner.bodyparts)
if(!IS_ORGANIC_LIMB(limb))
if(IS_ROBOTIC_LIMB(limb))
cybernetics_level++
for(var/obj/item/organ/organ as anything in owner.organs)
if((organ.organ_flags & ORGAN_SYNTHETIC || organ.status == ORGAN_ROBOTIC) && !(organ.organ_flags & ORGAN_HIDDEN))
if(IS_ROBOTIC_ORGAN(organ) && !(organ.organ_flags & ORGAN_HIDDEN))
cybernetics_level++
update_mood()

Expand All @@ -46,24 +46,24 @@

/datum/quirk/body_purist/proc/on_organ_gain(datum/source, obj/item/organ/new_organ, special)
SIGNAL_HANDLER
if((new_organ.organ_flags & ORGAN_SYNTHETIC || new_organ.status == ORGAN_ROBOTIC) && !(new_organ.organ_flags & ORGAN_HIDDEN)) //why the fuck are there 2 of them
if(IS_ROBOTIC_ORGAN(new_organ) && !(new_organ.organ_flags & ORGAN_HIDDEN)) //why the fuck are there 2 of them
cybernetics_level++
update_mood()

/datum/quirk/body_purist/proc/on_organ_lose(datum/source, obj/item/organ/old_organ, special)
SIGNAL_HANDLER
if((old_organ.organ_flags & ORGAN_SYNTHETIC || old_organ.status == ORGAN_ROBOTIC) && !(old_organ.organ_flags & ORGAN_HIDDEN))
if(IS_ROBOTIC_ORGAN(old_organ) && !(old_organ.organ_flags & ORGAN_HIDDEN))
cybernetics_level--
update_mood()

/datum/quirk/body_purist/proc/on_limb_gain(datum/source, obj/item/bodypart/new_limb, special)
SIGNAL_HANDLER
if(!IS_ORGANIC_LIMB(new_limb))
if(IS_ROBOTIC_LIMB(new_limb))
cybernetics_level++
update_mood()

/datum/quirk/body_purist/proc/on_limb_lose(datum/source, obj/item/bodypart/old_limb, special)
SIGNAL_HANDLER
if(!IS_ORGANIC_LIMB(old_limb))
if(IS_ROBOTIC_LIMB(old_limb))
cybernetics_level--
update_mood()
4 changes: 2 additions & 2 deletions code/datums/quirks/negative_quirks/junkie.dm
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@
var/mob/living/carbon/carbon_holder = quirk_holder
var/obj/item/organ/internal/lungs/smoker_lungs = null
var/obj/item/organ/internal/lungs/old_lungs = carbon_holder.get_organ_slot(ORGAN_SLOT_LUNGS)
if(old_lungs && !(old_lungs.organ_flags & ORGAN_SYNTHETIC))
if(old_lungs && IS_ORGANIC_ORGAN(old_lungs))
if(isplasmaman(carbon_holder))
smoker_lungs = /obj/item/organ/internal/lungs/plasmaman/plasmaman_smoker
else if(isethereal(carbon_holder))
Expand Down Expand Up @@ -192,7 +192,7 @@
quirk_holder.add_mob_memory(/datum/memory/key/quirk_alcoholic, protagonist = quirk_holder, preferred_brandy = initial(favorite_alcohol.name))
// alcoholic livers have 25% less health and healing
var/obj/item/organ/internal/liver/alcohol_liver = quirk_holder.get_organ_slot(ORGAN_SLOT_LIVER)
if(alcohol_liver && !(alcohol_liver.organ_flags & ORGAN_SYNTHETIC)) // robotic livers aren't affected
if(alcohol_liver && IS_ORGANIC_ORGAN(alcohol_liver)) // robotic livers aren't affected
alcohol_liver.maxHealth = alcohol_liver.maxHealth * 0.75
alcohol_liver.healing_factor = alcohol_liver.healing_factor * 0.75

Expand Down
13 changes: 9 additions & 4 deletions code/datums/status_effects/debuffs/genetic_damage.dm
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,20 @@
qdel(src)
return

/datum/status_effect/genetic_damage/proc/on_healthscan(datum/source, list/render_list, advanced)
/datum/status_effect/genetic_damage/proc/on_healthscan(datum/source, list/render_list, advanced, mob/user, mode, tochat)
SIGNAL_HANDLER

var/message = ""
if(advanced)
render_list += "<span class='alert ml-1'>Genetic damage: [round(total_damage / minimum_before_tox_damage * 100, 0.1)]%</span>\n"
message += "Genetic damage: [round(total_damage / minimum_before_tox_damage * 100, 0.1)]%"
else if(total_damage >= minimum_before_tox_damage)
render_list += "<span class='alert ml-1'>Severe genetic damage detected.</span>\n"
message += "Severe genetic damage detected."
else
render_list += "<span class='alert ml-1'>Minor genetic damage detected.</span>\n"
message += "Minor genetic damage detected."

if(message)
render_list += conditional_tooltip("<span class='alert ml-1'>[message]</span>", "Irreparable under normal circumstances - will decay over time.", tochat)
render_list += "<br>"

#undef GORILLA_MUTATION_CHANCE_PER_SECOND
#undef GORILLA_MUTATION_MINIMUM_DAMAGE
6 changes: 3 additions & 3 deletions code/datums/status_effects/debuffs/hallucination.dm
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,13 @@
))

/// Signal proc for [COMSIG_LIVING_HEALTHSCAN]. Show we're hallucinating to (advanced) scanners.
/datum/status_effect/hallucination/proc/on_health_scan(datum/source, list/render_list, advanced, mob/user, mode)
/datum/status_effect/hallucination/proc/on_health_scan(datum/source, list/render_list, advanced, mob/user, mode, tochat)
SIGNAL_HANDLER

if(!advanced)
return

render_list += "<span class='info ml-1'>Subject is hallucinating.</span>\n"
render_list += conditional_tooltip("<span class='info ml-1'>Subject is hallucinating.</span>", "Supply antipsychotic medication.", tochat)
render_list += "<br>"

/// Signal proc for [COMSIG_CARBON_CHECKING_BODYPART],
/// checking bodyparts while hallucinating can cause them to appear more damaged than they are
Expand Down
35 changes: 24 additions & 11 deletions code/datums/wounds/_wounds.dm
Original file line number Diff line number Diff line change
Expand Up @@ -664,29 +664,42 @@
return span_bold("[desc]!")
return "[desc]."

/**
* Prints the details about the wound for the wound scanner on simple mode
*/
/datum/wound/proc/get_scanner_description(mob/user)
return "Type: [name]\n\
Severity: [severity_text(simple = FALSE)]\n\
Description: [desc]\n\
return "Type: [name]<br>\
Severity: [severity_text()]<br>\
Description: [desc]<br>\
Recommended Treatment: [treat_text]"

/**
* Prints the details about the wound for the wound scanner on complex mode
*/
/datum/wound/proc/get_simple_scanner_description(mob/user)
return "[name] detected!\n\
Risk: [severity_text(simple = TRUE)]\n\
Description: [simple_desc ? simple_desc : desc]\n\
<i>Treatment Guide: [simple_treat_text]</i>\n\
var/severity_text_formatted = severity_text()
for(var/i in 1 to severity)
severity_text_formatted += "!"

return "[name] detected!<br>\
Risk: [severity_text_formatted]<br>\
Description: [simple_desc || desc]<br>\
<i>Treatment Guide: [simple_treat_text]</i><br>\
<i>Homemade Remedies: [homemade_treat_text]</i>"

/datum/wound/proc/severity_text(simple = FALSE)
/**
* Returns what text describes this wound
*/
/datum/wound/proc/severity_text()
switch(severity)
if(WOUND_SEVERITY_TRIVIAL)
return "Trivial"
if(WOUND_SEVERITY_MODERATE)
return "Moderate" + (simple ? "!" : "")
return "Moderate"
if(WOUND_SEVERITY_SEVERE)
return "Severe" + (simple ? "!!" : "")
return "<b>Severe</b>"
if(WOUND_SEVERITY_CRITICAL)
return "Critical" + (simple ? "!!!" : "")
return "<b>Critical</b>"

/// Getter proc for our scar_keyword, in case we might have some custom scar gen logic.
/datum/wound/proc/get_scar_keyword(obj/item/bodypart/scarred_limb, add_to_scars)
Expand Down
40 changes: 30 additions & 10 deletions code/datums/wounds/burns.dm
Original file line number Diff line number Diff line change
Expand Up @@ -45,18 +45,13 @@
/// Once we reach infestation beyond WOUND_INFESTATION_SEPSIS, we get this many warnings before the limb is completely paralyzed (you'd have to ignore a really bad burn for a really long time for this to happen)
var/strikes_to_lose_limb = 3

/datum/wound/burn/flesh/severity_text(simple = FALSE)
if(infestation > WOUND_INFECTION_MODERATE)
return "Infected, [..()]"
return ..()

/datum/wound/burn/flesh/handle_process(seconds_per_tick, times_fired)

if (QDELETED(victim) || HAS_TRAIT(victim, TRAIT_STASIS))
return

. = ..()
if(strikes_to_lose_limb == 0) // we've already hit sepsis, nothing more to do
if(strikes_to_lose_limb <= 0) // we've already hit sepsis, nothing more to do
victim.adjustToxLoss(0.25 * seconds_per_tick)
if(SPT_PROB(0.5, seconds_per_tick))
victim.visible_message(span_danger("The infection on the remnants of [victim]'s [limb.plaintext_zone] shift and bubble nauseatingly!"), span_warning("You can feel the infection on the remnants of your [limb.plaintext_zone] coursing through your veins!"), vision_distance = COMBAT_MESSAGE_RANGE)
Expand Down Expand Up @@ -148,6 +143,13 @@
var/datum/brain_trauma/severe/paralysis/sepsis = new (limb.body_zone)
victim.gain_trauma(sepsis)

/datum/wound/burn/flesh/set_disabling(new_value)
. = ..()
if(new_value && strikes_to_lose_limb <= 0)
treat_text_short = "Amputate or augment limb immediately, or place the patient into cryogenics."
else
treat_text_short = initial(treat_text_short)

/datum/wound/burn/flesh/get_wound_description(mob/user)
if(strikes_to_lose_limb <= 0)
return span_deadsay("<B>[victim.p_their(TRUE)] [limb.plaintext_zone] has locked up completely and is non-functional.</B>")
Expand Down Expand Up @@ -181,9 +183,25 @@

return "<B>[condition.Join()]</B>"

/datum/wound/burn/flesh/severity_text(simple = FALSE)
. = ..()
. += " Burn / "
switch(infestation)
if(-INFINITY to WOUND_INFECTION_MODERATE)
. += "No"
if(WOUND_INFECTION_MODERATE to WOUND_INFECTION_SEVERE)
. += "Moderate"
if(WOUND_INFECTION_SEVERE to WOUND_INFECTION_CRITICAL)
. += "<b>Severe</b>"
if(WOUND_INFECTION_CRITICAL to WOUND_INFECTION_SEPTIC)
. += "<b>Critical</b>"
if(WOUND_INFECTION_SEPTIC to INFINITY)
. += "<b>Total</b>"
. += " Infection"

/datum/wound/burn/flesh/get_scanner_description(mob/user)
if(strikes_to_lose_limb <= 0) // Unclear if it can go below 0, best to not take the chance
var/oopsie = "Type: [name]\nSeverity: [severity_text()]"
var/oopsie = "Type: [name]<br>Severity: [severity_text()]"
oopsie += "<div class='ml-3'>Infection Level: [span_deadsay("The body part has suffered complete sepsis and must be removed. Amputate or augment limb immediately.")]</div>"
return oopsie

Expand Down Expand Up @@ -262,7 +280,7 @@
// people complained about burns not healing on stasis beds, so in addition to checking if it's cured, they also get the special ability to very slowly heal on stasis beds if they have the healing effects stored
/datum/wound/burn/flesh/on_stasis(seconds_per_tick, times_fired)
. = ..()
if(strikes_to_lose_limb == 0) // we've already hit sepsis, nothing more to do
if(strikes_to_lose_limb <= 0) // we've already hit sepsis, nothing more to do
if(SPT_PROB(0.5, seconds_per_tick))
victim.visible_message(span_danger("The infection on the remnants of [victim]'s [limb.plaintext_zone] shift and bubble nauseatingly!"), span_warning("You can feel the infection on the remnants of your [limb.plaintext_zone] coursing through your veins!"), vision_distance = COMBAT_MESSAGE_RANGE)
return
Expand Down Expand Up @@ -321,7 +339,8 @@
treat_text = "Swiftly apply healing aids such as Synthflesh or regenerative mesh to the wound. \
Disinfect the wound and surgically debride any infected skin, and wrap in clean gauze / use ointment to prevent further infection. \
If the limb has locked up, it must be amputated, augmented or treated with cryogenics."
treat_text_short = "Apply healing aid such as regenerative mesh or Synthflesh and disinfect / debride."
treat_text_short = "Apply healing aid such as regenerative mesh, Synthflesh, or cryogenics and disinfect / debride. \
Clean gauze or ointment will slow infection rate."
examine_desc = "appears seriously charred, with aggressive red splotches"
occur_text = "chars rapidly, exposing ruined tissue and spreading angry red burns"
severity = WOUND_SEVERITY_SEVERE
Expand Down Expand Up @@ -350,7 +369,8 @@
treat_text = "Immediately apply healing aids such as Synthflesh or regenerative mesh to the wound. \
Disinfect the wound and surgically debride any infected skin, and wrap in clean gauze / use ointment to prevent further infection. \
If the limb has locked up, it must be amputated, augmented or treated with cryogenics."
treat_text_short = "Apply healing aid such as regenerative mesh or Synthflesh and disinfect / debride."
treat_text_short = "Apply healing aid such as regenerative mesh, Synthflesh, or cryogenics and disinfect / debride. \
Clean gauze or ointment will slow infection rate."
examine_desc = "is a ruined mess of blanched bone, melted fat, and charred tissue"
occur_text = "vaporizes as flesh, bone, and fat melt together in a horrifying mess"
severity = WOUND_SEVERITY_CRITICAL
Expand Down
2 changes: 1 addition & 1 deletion code/game/gamemodes/objective.dm
Original file line number Diff line number Diff line change
Expand Up @@ -957,7 +957,7 @@ GLOBAL_LIST_EMPTY(possible_items)
continue
//this is an objective item
var/obj/item/organ/wanted = stolen
if(!(wanted.organ_flags & ORGAN_FAILING) && !(wanted.organ_flags & ORGAN_SYNTHETIC))
if(!(wanted.organ_flags & ORGAN_FAILING) && !IS_ROBOTIC_ORGAN(wanted))
stolen_count++
return stolen_count >= amount

Expand Down
Loading
Loading