Skip to content

Commit

Permalink
Scanner things
Browse files Browse the repository at this point in the history
  • Loading branch information
MrMelbert committed May 16, 2024
1 parent 2f7ad50 commit a3e8e46
Show file tree
Hide file tree
Showing 8 changed files with 106 additions and 78 deletions.
109 changes: 50 additions & 59 deletions code/game/objects/items/devices/scanners/health_analyzer.dm
Original file line number Diff line number Diff line change
Expand Up @@ -150,12 +150,8 @@

render_list += "[span_info("Analyzing results for [target]:")]\n<span class='info ml-1'>Overall status: [mob_status]</span>\n"

if(ishuman(target))
var/mob/living/carbon/human/humantarget = target
if(humantarget.undergoing_cardiac_arrest() && humantarget.stat != DEAD)
render_list += "<span class='alert ml-1'><b>Subject suffering from heart attack: Apply defibrillation or other electric shock immediately!</b></span>\n"
if(humantarget.has_reagent(/datum/reagent/inverse/technetium))
advanced = TRUE
if(target.has_reagent(/datum/reagent/inverse/technetium))
advanced = TRUE

SEND_SIGNAL(target, COMSIG_LIVING_HEALTHSCAN, render_list, advanced, user, mode)

Expand Down Expand Up @@ -264,59 +260,58 @@

if(ishuman(target))
var/mob/living/carbon/human/humantarget = target

// Organ damage, missing organs
if(humantarget.organs && humantarget.organs.len)
var/render = FALSE
var/toReport = "<span class='info ml-1'>Organs:</span>\
<table class='ml-2'><tr>\
<td style='width:6em;'><font color='#ff0000'><b>Organ:</b></font></td>\
[advanced ? "<td style='width:3em;'><font color='#ff0000'><b>Dmg</b></font></td>" : ""]\
<td style='width:12em;'><font color='#ff0000'><b>Status</b></font></td>"

for(var/obj/item/organ/organ as anything in humantarget.organs)
var/status = organ.get_status_text()
if (status != "")
render = TRUE
toReport += "<tr><td><font color='#cc3333'>[organ.name]:</font></td>\
[advanced ? "<td><font color='#ff3333'>[CEILING(organ.damage,1)]</font></td>" : ""]\
<td>[status]</td></tr>"

var/missing_organs = list()
if(!humantarget.get_organ_slot(ORGAN_SLOT_BRAIN))
missing_organs += "brain"
if(!HAS_TRAIT_FROM(humantarget, TRAIT_NOBLOOD, SPECIES_TRAIT) && !isnull(humantarget.dna.species.mutantheart) && !humantarget.get_organ_slot(ORGAN_SLOT_HEART)) // NON-MODULE CHANGE
missing_organs += "heart"
if(!HAS_TRAIT_FROM(humantarget, TRAIT_NOBREATH, SPECIES_TRAIT) && !isnull(humantarget.dna.species.mutantlungs) && !humantarget.get_organ_slot(ORGAN_SLOT_LUNGS)) // NON-MODULE CHANGE
missing_organs += "lungs"
if(!HAS_TRAIT_FROM(humantarget, TRAIT_LIVERLESS_METABOLISM, SPECIES_TRAIT) && !isnull(humantarget.dna.species.mutantliver) && !humantarget.get_organ_slot(ORGAN_SLOT_LIVER)) // NON-MODULE CHANGE
missing_organs += "liver"
if(!HAS_TRAIT_FROM(humantarget, TRAIT_NOHUNGER, SPECIES_TRAIT) && !isnull(humantarget.dna.species.mutantstomach) && !humantarget.get_organ_slot(ORGAN_SLOT_STOMACH)) // NON-MODULE CHANGE
missing_organs += "stomach"
if(!humantarget.get_organ_slot(ORGAN_SLOT_TONGUE))
missing_organs += "tongue"
if(!humantarget.get_organ_slot(ORGAN_SLOT_EARS))
missing_organs += "ears"
if(!humantarget.get_organ_slot(ORGAN_SLOT_EYES))
missing_organs += "eyes"

if(length(missing_organs))
var/render = FALSE
var/toReport = "<span class='info ml-1'>Organs:</span>\
<table class='ml-2'><tr>\
<td style='width:8em;'><font color='#ff0000'><b>Organ:</b></font></td>\
[advanced ? "<td style='width:4em;'><font color='#ff0000'><b>Dmg</b></font></td>" : ""]\
<td style='width:30em;'><font color='#ff0000'><b>Status</b></font></td>"

for(var/obj/item/organ/organ as anything in humantarget.organs)
var/status = organ.get_status_text()
if (status)
render = TRUE
for(var/organ in missing_organs)
toReport += "<tr><td><font color='#cc3333'>[organ]:</font></td>\
[advanced ? "<td><font color='#ff3333'>["-"]</font></td>" : ""]\
<td><font color='#cc3333'>["Missing"]</font></td></tr>"

if(render)
render_list += toReport + "</table>" // tables do not need extra linebreak
toReport += "<tr><td><font color='#cc3333'>[organ.name]:</font></td>\
[advanced ? "<td><font color='#ff3333'>[CEILING(organ.damage,1)]</font></td>" : ""]\
<td>[status]</td></tr>"

var/missing_organs = list()
if(!humantarget.get_organ_slot(ORGAN_SLOT_BRAIN))
missing_organs += "brain"
if(!HAS_TRAIT_FROM(humantarget, TRAIT_NOBLOOD, SPECIES_TRAIT) && !isnull(humantarget.dna.species.mutantheart) && !humantarget.get_organ_slot(ORGAN_SLOT_HEART))
missing_organs += "heart"
if(!HAS_TRAIT_FROM(humantarget, TRAIT_NOBREATH, SPECIES_TRAIT) && !isnull(humantarget.dna.species.mutantlungs) && !humantarget.get_organ_slot(ORGAN_SLOT_LUNGS))
missing_organs += "lungs"
if(!HAS_TRAIT_FROM(humantarget, TRAIT_LIVERLESS_METABOLISM, SPECIES_TRAIT) && !isnull(humantarget.dna.species.mutantliver) && !humantarget.get_organ_slot(ORGAN_SLOT_LIVER))
missing_organs += "liver"
if(!HAS_TRAIT_FROM(humantarget, TRAIT_NOHUNGER, SPECIES_TRAIT) && !isnull(humantarget.dna.species.mutantstomach) && !humantarget.get_organ_slot(ORGAN_SLOT_STOMACH))
missing_organs += "stomach"
if(!humantarget.get_organ_slot(ORGAN_SLOT_TONGUE))
missing_organs += "tongue"
if(!humantarget.get_organ_slot(ORGAN_SLOT_EARS))
missing_organs += "ears"
if(!humantarget.get_organ_slot(ORGAN_SLOT_EYES))
missing_organs += "eyes"

if(length(missing_organs))
render = TRUE
for(var/organ in missing_organs)
toReport += "<tr><td><font color='#cc3333'>[organ]:</font></td>\
[advanced ? "<td><font color='#ff3333'>["-"]</font></td>" : ""]\
<td><font color='#cc3333'>["Missing"]</font></td></tr>"

if(render)
render_list += toReport + "</table>" // tables do not need extra linebreak

//Genetic stability
var/mutant = FALSE
if(advanced && humantarget.has_dna())
render_list += "<span class='info ml-1'>Genetic Stability: [humantarget.dna.stability]%.</span>\n"
mutant = humantarget.dna.check_mutation(/datum/mutation/human/hulk)

// Hulk and body temperature
var/datum/species/targetspecies = humantarget.dna.species
var/mutant = humantarget.dna.check_mutation(/datum/mutation/human/hulk)

render_list += "<span class='info ml-1'>Species: [targetspecies.name][mutant ? "-derived mutant" : ""]</span>\n"
var/core_temperature_message = "Core temperature: [round(humantarget.coretemperature-T0C, 0.1)] &deg;C ([round(humantarget.coretemperature*1.8-459.67,0.1)] &deg;F)"
Expand All @@ -336,21 +331,17 @@
render_list += "<span class='info ml-1'>[body_temperature_message]</span>\n"

// Time of death
if(target.station_timestamp_timeofdeath && (target.stat == DEAD || ((HAS_TRAIT(target, TRAIT_FAKEDEATH)) && !advanced)))
if(target.station_timestamp_timeofdeath && (target.stat == DEAD || (HAS_TRAIT(target, TRAIT_FAKEDEATH) && !advanced)))
render_list += "<span class='info ml-1'>Time of Death: [target.station_timestamp_timeofdeath]</span>\n"
var/tdelta = round(world.time - target.timeofdeath)
render_list += "<span class='alert ml-1'><b>Subject died [DisplayTimeText(tdelta)] ago.</b></span>\n"
render_list += "<span class='alert ml-1'><b>Subject died [DisplayTimeText(round(world.time - target.timeofdeath))] ago.</b></span>\n"

// Wounds
if(iscarbon(target))
var/mob/living/carbon/carbontarget = target
var/list/wounded_parts = carbontarget.get_wounded_bodyparts()
for(var/i in wounded_parts)
var/obj/item/bodypart/wounded_part = i
for(var/obj/item/bodypart/wounded_part as anything in carbontarget.get_wounded_bodyparts())
render_list += "<span class='alert ml-1'><b>Physical trauma[LAZYLEN(wounded_part.wounds) > 1 ? "s" : ""] detected in [wounded_part.name]</b>"
for(var/k in wounded_part.wounds)
var/datum/wound/W = k
render_list += "<div class='ml-2'>[W.name] ([W.severity_text()])\nRecommended treatment: [W.treat_text]</div>" // less lines than in woundscan() so we don't overload people trying to get basic med info
for(var/datum/wound/wound as anything in wounded_part.wounds)
render_list += "<div class='ml-2'>[wound.name] ([wound.severity_text()])\nRecommended treatment: [wound.treat_text]</div>" // less lines than in woundscan() so we don't overload people trying to get basic med info
render_list += "</span>"

//Diseases
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,14 @@
need_mob_update += affected_mob.adjustToxLoss(-radcalc * 0.75, updating_health = FALSE, required_biotype = affected_biotype)
healypoints += (radcalc / 5)

for(var/obj/item/organ/internal/organ in affected_mob.organs)
if(!(organ.organ_flags & ORGAN_IRRADIATED))
continue
organ.apply_organ_damage(-radcalc * 0.8)
if(organ.damage > 0)
continue
organ.RemoveElement(/datum/element/simple_rad)

//you're yes and... oh no!
healypoints = round(healypoints, 0.1)
affected_mob.adjustOrganLoss(ORGAN_SLOT_HEART, healypoints / 5, required_organ_flag = affected_organ_flags)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -625,11 +625,26 @@
/datum/reagent/consumable/ethanol/screwdrivercocktail/on_mob_life(mob/living/carbon/drinker, seconds_per_tick, times_fired)
. = ..()
var/obj/item/organ/internal/liver/liver = drinker.get_organ_slot(ORGAN_SLOT_LIVER)
if(HAS_TRAIT(liver, TRAIT_ENGINEER_METABOLISM))
ADD_TRAIT(drinker, TRAIT_HALT_RADIATION_EFFECTS, "[type]")
if (HAS_TRAIT(drinker, TRAIT_IRRADIATED))
if(drinker.adjustToxLoss(-2 * REM * seconds_per_tick, updating_health = FALSE, required_biotype = affected_biotype))
return UPDATE_MOB_HEALTH
if(isnull(liver) || !HAS_TRAIT(liver, TRAIT_ENGINEER_METABOLISM) || !HAS_TRAIT(drinker, TRAIT_IRRADIATED))
return

for(var/obj/item/organ/internal/organ in shuffle(drinker.organs))
if(!(organ.organ_flags & ORGAN_IRRADIATED))
continue
organ.apply_organ_damage(-1 * REM * seconds_per_tick)
if(organ.damage <= 0)
organ.RemoveElement(/datum/element/simple_rad)
break

if(drinker.adjustToxLoss(-2 * REM * seconds_per_tick, updating_health = FALSE, required_biotype = affected_biotype))
return UPDATE_MOB_HEALTH

/datum/reagent/consumable/ethanol/screwdrivercocktail/on_mob_metabolize(mob/living/carbon/user)
. = ..()
var/obj/item/organ/internal/liver/liver = user.get_organ_slot(ORGAN_SLOT_LIVER)
if(isnull(liver))
return
ADD_TRAIT(user, TRAIT_HALT_RADIATION_EFFECTS, "[type]")

/datum/reagent/consumable/ethanol/screwdrivercocktail/on_mob_end_metabolize(mob/living/drinker)
. = ..()
Expand Down
19 changes: 16 additions & 3 deletions code/modules/reagents/chemistry/reagents/medicine_reagents.dm
Original file line number Diff line number Diff line change
Expand Up @@ -510,6 +510,13 @@
if(HAS_TRAIT(affected_mob, TRAIT_IRRADIATED))
if(affected_mob.adjustToxLoss(-1 * REM * seconds_per_tick, updating_health = FALSE, required_biotype = affected_biotype))
return UPDATE_MOB_HEALTH
for(var/obj/item/organ/internal/organ in affected_mob.organs)
if(!(organ.organ_flags & ORGAN_IRRADIATED))
continue
organ.apply_organ_damage(-1 * REM * seconds_per_tick)
if(organ.damage > 0)
continue
organ.RemoveElement(/datum/element/simple_rad)

/datum/reagent/medicine/pen_acid
name = "Pentetic Acid"
Expand All @@ -534,9 +541,15 @@
. = ..()
if(affected_mob.adjustToxLoss(-2 * REM * seconds_per_tick, updating_health = FALSE, required_biotype = affected_biotype))
. = UPDATE_MOB_HEALTH
for(var/datum/reagent/R in affected_mob.reagents.reagent_list)
if(R != src)
affected_mob.reagents.remove_reagent(R.type, 2 * REM * seconds_per_tick)
for(var/datum/reagent/purged in affected_mob.reagents.reagent_list - src)
affected_mob.reagents.remove_reagent(purged.type, 2 * REM * seconds_per_tick)
for(var/obj/item/organ/internal/organ in affected_mob.organs)
if(!(organ.organ_flags & ORGAN_IRRADIATED))
continue
organ.apply_organ_damage(-5 * REM * seconds_per_tick)
if(organ.damage > 0)
continue
organ.RemoveElement(/datum/element/simple_rad)

/datum/reagent/medicine/sal_acid
name = "Salicylic Acid"
Expand Down
13 changes: 5 additions & 8 deletions code/modules/surgery/organs/_organ.dm
Original file line number Diff line number Diff line change
Expand Up @@ -316,19 +316,16 @@ INITIALIZE_IMMEDIATE(/obj/item/organ)

/// Called by medical scanners to get a simple summary of how healthy the organ is. Returns an empty string if things are fine.
/obj/item/organ/proc/get_status_text()
var/status = ""
if(organ_flags & ORGAN_IRRADIATED)
status = "<font color='#29b90f'>Irradiated</font>"
return "<font color='#29b90f'>Irradiated - Replace or use specialty medication</font>"
else if(owner.has_reagent(/datum/reagent/inverse/technetium))
status = "<font color='#E42426'>[round((damage/maxHealth)*100, 1)]% damaged.</font>"
return "<font color='#E42426'>[round((damage/maxHealth)*100, 1)]% damaged</font>"
else if(organ_flags & ORGAN_FAILING)
status = "<font color='#cc3333'>Non-Functional</font>"
return "<font color='#cc3333'>Non-Functional - Replace or operate</font>"
else if(damage > high_threshold)
status = "<font color='#ff9933'>Severely Damaged</font>"
return "<font color='#ff9933'>Severely Damaged[owner.stat == DEAD ? "" : " - Treat with rest or use specialty medication"]</font>"
else if (damage > low_threshold)
status = "<font color='#ffcc33'>Mildly Damaged</font>"

return status
return "<font color='#ffcc33'>Mildly Damaged[owner.stat == DEAD ? "" : " - Treat with rest"]</font>"

/// Tries to replace the existing organ on the passed mob with this one, with special handling for replacing a brain without ghosting target
/obj/item/organ/proc/replace_into(mob/living/carbon/new_owner)
Expand Down
2 changes: 1 addition & 1 deletion code/modules/surgery/organs/internal/_internal_organ.dm
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
return

if((organ_flags & (ORGAN_ORGANIC|ORGAN_IRRADIATED)) == (ORGAN_ORGANIC|ORGAN_IRRADIATED))
if(SPT_PROB(50, seconds_per_tick))
if(SPT_PROB(50, seconds_per_tick) && (isnull(owner) || !HAS_TRAIT(owner, TRAIT_HALT_RADIATION_EFFECTS)))
apply_organ_damage(2 * decay_factor * maxHealth * seconds_per_tick)
// Chance to gain some free tox damage when taking irradiation organ damage, 50% chance on that to actually feel it
if(prob(10) && owner?.apply_damage(1 * seconds_per_tick, TOX, zone) > 0 && owner.stat <= SOFT_CRIT && prob(50))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,8 @@
// You don't spawn with a heart, so, technically... You spawn with a heart attack
apply_status_effect(/datum/status_effect/heart_attack)
*/

/obj/item/organ/internal/heart/get_status_text()
if(!beating && !(organ_flags & ORGAN_FAILING) && owner.needs_heart() && owner.stat != DEAD)
return "<font color='#cc3333'>Cardiac Arrest - Apply defibrillation!</font>"
return ..()
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,8 @@
owner.visible_message(
span_boldwarning("[owner]'s [affected_limb.plaintext_zone] bubbles unnaturally, then bursts into blisters!"),
span_boldwarning("Your [affected_limb.plaintext_zone] bubbles unnaturally, then bursts into blisters!"),
visible_message_flags = ALWAYS_SHOW_SELF_MESSAGE,
)
if(owner.is_blind()) // melbert todo replace with visible message flag
to_chat(owner, span_boldwarning("Your [affected_limb.plaintext_zone] feels like it's bubbling, then burns like hell!"))

owner.apply_damage(12, BURN, affected_limb)
playsound(owner, pick('sound/effects/wounds/sizzle1.ogg', 'sound/effects/wounds/sizzle2.ogg'), 50, vary = TRUE)
Expand Down

0 comments on commit a3e8e46

Please sign in to comment.