mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-07-21 03:55:05 +01:00
Liver rework (#31410)
* Remove old stuff * Liver expansion * Slimepeople don't take constant tox damage * oops * Makes this use the helper * Oops * Fixes * Oops * Capitalization * Comment update
This commit is contained in:
@@ -14,6 +14,7 @@
|
||||
|
||||
if(.) //not dead
|
||||
handle_kidneys()
|
||||
check_for_missing_organs()
|
||||
|
||||
if(check_mutations)
|
||||
domutcheck(src)
|
||||
@@ -1016,3 +1017,14 @@
|
||||
total_damage *= 0.05
|
||||
|
||||
adjustToxLoss(total_damage)
|
||||
|
||||
/// A proc that checks for any missing organs and gives you damage for not having them
|
||||
/mob/living/carbon/human/proc/check_for_missing_organs()
|
||||
if(NO_BLOOD in dna.species.species_traits)
|
||||
return
|
||||
|
||||
// Currently only checks for a liver
|
||||
// This has to be here since we can't check this in the on_life of organs
|
||||
var/obj/item/organ/internal/liver = get_int_organ(/obj/item/organ/internal/liver)
|
||||
if(!liver && !isslimeperson(src))
|
||||
adjustToxLoss(2)
|
||||
|
||||
@@ -1152,6 +1152,12 @@
|
||||
affected.custom_pain("You feel a stabbing pain in your chest!")
|
||||
L.linked_organ.receive_damage(max(L.linked_organ.min_bruised_damage - L.linked_organ.damage, 2))
|
||||
|
||||
/mob/living/carbon/human/proc/has_liver_cirrhosis()
|
||||
var/obj/item/organ/internal/liver/liver = get_int_organ(/obj/item/organ/internal/liver)
|
||||
if(!liver || liver.status & ORGAN_ROBOT)
|
||||
return FALSE
|
||||
return liver.get_wound(/datum/wound/cirrhosis)
|
||||
|
||||
/mob/living/carbon/human/resist_restraints(attempt_breaking)
|
||||
if(HAS_TRAIT(src, TRAIT_HULK))
|
||||
say(pick(";RAAAAAAAARGH!", ";HNNNNNNNNNGGGGGGH!", ";GWAAAAAAAARRRHHH!", "NNNNNNNNGGGGGGGGHH!", ";AAAAAAARRRGH!" ))
|
||||
|
||||
@@ -1651,6 +1651,10 @@
|
||||
var/mob/living/carbon/human/H = M
|
||||
for(var/obj/item/organ/internal/I in M.internal_organs) // 60 healing to all internal organs.
|
||||
I.heal_internal_damage(4, TRUE)
|
||||
if(istype(I, /obj/item/organ/internal/liver))
|
||||
var/obj/item/organ/internal/liver/liver = I
|
||||
liver.damaged_ticks = 0
|
||||
|
||||
if(istype(I, /obj/item/organ/internal/cyberimp)) // Fix disabled implants like the ipc charging implant
|
||||
var/obj/item/organ/internal/cyberimp/crit = I
|
||||
crit.crit_fail = FALSE
|
||||
|
||||
@@ -829,6 +829,17 @@
|
||||
build_path = /obj/item/organ/internal/liver/cybernetic
|
||||
category = list("Medical")
|
||||
|
||||
/datum/design/cybernetic_liver_u
|
||||
name = "Upgraded Cybernetic Liver"
|
||||
desc = "An upgraded cybernetic liver."
|
||||
id = "cybernetic_liver_u"
|
||||
req_tech = list("biotech" = 5, "materials" = 5, "engineering" = 5)
|
||||
build_type = PROTOLATHE | MECHFAB
|
||||
materials = list(MAT_METAL = 500, MAT_GLASS = 500, MAT_SILVER = 500)
|
||||
construction_time = 60
|
||||
build_path = /obj/item/organ/internal/liver/cybernetic/upgraded
|
||||
category = list("Medical")
|
||||
|
||||
/datum/design/cybernetic_kidneys
|
||||
name = "Cybernetic Kidneys"
|
||||
desc = "A cybernetic pair of kidneys."
|
||||
|
||||
@@ -4,51 +4,66 @@
|
||||
organ_tag = "liver"
|
||||
parent_organ = "groin"
|
||||
slot = "liver"
|
||||
/// How hard does alcohol hit? This is a multiplier, so 2 would be twice as strong
|
||||
var/alcohol_intensity = 1
|
||||
/// Amount of ticks that we have been at a damaged state. Never goes down.
|
||||
var/damaged_ticks = 0
|
||||
/// Heal multiplier
|
||||
var/heal_multiplier = 1
|
||||
/// Is this liver immune to high toxin damage?
|
||||
var/tox_damage_immune = FALSE
|
||||
|
||||
/obj/item/organ/internal/liver/rejuvenate()
|
||||
. = ..()
|
||||
damaged_ticks = 0
|
||||
|
||||
#define THRESHOLD_FAINT 180 SECONDS
|
||||
|
||||
/obj/item/organ/internal/liver/on_life()
|
||||
if(germ_level > INFECTION_LEVEL_ONE)
|
||||
if(prob(1))
|
||||
to_chat(owner, SPAN_WARNING("Your skin itches."))
|
||||
if(germ_level > INFECTION_LEVEL_TWO)
|
||||
if(prob(1))
|
||||
owner.vomit()
|
||||
if(!owner)
|
||||
return
|
||||
if(status & ORGAN_DEAD)
|
||||
owner.adjustToxLoss(2)
|
||||
// Dead liver? That's not good
|
||||
return
|
||||
|
||||
if(owner.life_tick % PROCESS_ACCURACY == 0)
|
||||
var/datum/wound/cirrhosis = get_wound(/datum/wound/cirrhosis)
|
||||
if(cirrhosis)
|
||||
// Not as bad as having a dead liver but you're close
|
||||
cirrhosis.do_effect()
|
||||
return
|
||||
|
||||
//High toxins levels are dangerous
|
||||
if(owner.getToxLoss() >= 60 && !owner.reagents.has_reagent("charcoal"))
|
||||
//Healthy liver suffers on its own
|
||||
if(damage < min_broken_damage)
|
||||
receive_damage(0.2 * PROCESS_ACCURACY)
|
||||
//Damaged one shares the fun
|
||||
else
|
||||
var/obj/item/organ/internal/O = pick(owner.internal_organs)
|
||||
if(O)
|
||||
O.receive_damage(0.2 * PROCESS_ACCURACY)
|
||||
if(!is_robotic() && damage >= (max_damage / 2))
|
||||
damaged_ticks++
|
||||
|
||||
//Detox can heal small amounts of damage
|
||||
if(damage && damage < min_bruised_damage && owner.reagents.has_reagent("charcoal"))
|
||||
receive_damage(-0.2 * PROCESS_ACCURACY)
|
||||
// Cirrhosis happens when you run around for more than 3 minutes with a very damaged liver
|
||||
if(!is_robotic() && damaged_ticks >= 100 && !get_wound(/datum/wound/cirrhosis))
|
||||
add_wound(/datum/wound/cirrhosis)
|
||||
|
||||
// Get the effectiveness of the liver.
|
||||
var/filter_effect = 3
|
||||
if(is_bruised())
|
||||
filter_effect -= 1
|
||||
if(is_broken())
|
||||
filter_effect -= 2
|
||||
var/toxloss = owner.getToxLoss()
|
||||
switch(toxloss)
|
||||
if(0)
|
||||
var/datum/status_effect/transient/drunkenness/drunk = owner.has_status_effect(STATUS_EFFECT_DRUNKENNESS)
|
||||
if(drunk?.cached_strength >= THRESHOLD_FAINT)
|
||||
return
|
||||
|
||||
// Damaged liver means some chemicals are very dangerous
|
||||
if(damage >= min_bruised_damage)
|
||||
for(var/datum/reagent/R in owner.reagents.reagent_list)
|
||||
// Ethanol and all drinks are bad
|
||||
if(istype(R, /datum/reagent/consumable/ethanol))
|
||||
owner.adjustToxLoss(0.1 * PROCESS_ACCURACY)
|
||||
if(damage < min_bruised_damage)
|
||||
// 0.1 damage healing per second
|
||||
heal_internal_damage(0.2)
|
||||
|
||||
// Can't cope with toxins at all
|
||||
for(var/toxin in GLOB.liver_toxins)
|
||||
if(owner.reagents.has_reagent(toxin))
|
||||
owner.adjustToxLoss(0.3 * PROCESS_ACCURACY)
|
||||
if(0 to 40)
|
||||
// Very minor healing
|
||||
owner.adjustToxLoss(-0.2 * heal_multiplier)
|
||||
if(40 to 80)
|
||||
// Still low healing, but slightly higher
|
||||
owner.adjustToxLoss(-0.4 * heal_multiplier)
|
||||
if(80 to INFINITY)
|
||||
// The liver is overwhelmed, less healing and also liver damage
|
||||
owner.adjustToxLoss(-0.2 * heal_multiplier)
|
||||
if(!tox_damage_immune)
|
||||
receive_damage(0.4)
|
||||
|
||||
#undef THRESHOLD_FAINT
|
||||
|
||||
/obj/item/organ/internal/liver/cybernetic
|
||||
name = "cybernetic liver"
|
||||
@@ -57,3 +72,13 @@
|
||||
origin_tech = "biotech=4"
|
||||
materials = list(MAT_METAL = 500, MAT_GLASS = 500)
|
||||
status = ORGAN_ROBOT
|
||||
alcohol_intensity = 0.5
|
||||
|
||||
/obj/item/organ/internal/liver/cybernetic/upgraded
|
||||
name = "upgraded cybernetic liver"
|
||||
icon_state = "liver-c-u"
|
||||
desc = "An electronic device designed to mimic the functions of a human liver. It works better than a normal liver."
|
||||
origin_tech = "biotech=5"
|
||||
alcohol_intensity = 0.25
|
||||
heal_multiplier = 2
|
||||
tox_damage_immune = TRUE
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
/obj/item/organ/internal/lungs/receive_damage(amount, silent)
|
||||
..()
|
||||
if(damage >= min_bruised_damage && amount > 1 && !get_wound(/datum/wound/ruptured_lungs))
|
||||
wound_list += new /datum/wound/ruptured_lungs(src)
|
||||
add_wound(/datum/wound/ruptured_lungs)
|
||||
|
||||
/obj/item/organ/internal/lungs/heal_internal_damage(amount, robo_repair)
|
||||
..()
|
||||
|
||||
@@ -344,6 +344,11 @@ I use this so that this can be made better once the organ overhaul rolls out --
|
||||
to_chat(owner, msg)
|
||||
next_pain_time = world.time + 10 SECONDS
|
||||
|
||||
/// Wound datum adding helper. Returns the wound datum
|
||||
/obj/item/organ/proc/add_wound(wound_path)
|
||||
// Passing the organ with the arg puts it on the wound list automatically
|
||||
return new wound_path(src)
|
||||
|
||||
/// Finds a wound datum. `wound_to_find` should be a typepath, and if `exact` is FALSE, it will grab subtypes aswell.
|
||||
/obj/item/organ/proc/get_wound(wound_to_find, exact = FALSE)
|
||||
if(!wound_to_find)
|
||||
|
||||
@@ -812,11 +812,10 @@ Note that amputating the affected organ does in fact remove the infection from t
|
||||
release_restraints()
|
||||
|
||||
/obj/item/organ/external/proc/create_fracture_wound(fracture_name_override)
|
||||
var/picked_type = pick(typesof(/datum/wound/fracture))
|
||||
var/datum/wound/fracture = new picked_type(src)
|
||||
var/datum/wound/fracture = add_wound(pick(typesof(/datum/wound/fracture)))
|
||||
|
||||
if(fracture_name_override)
|
||||
fracture.name = fracture_name_override
|
||||
wound_list += fracture
|
||||
|
||||
/obj/item/organ/external/proc/mend_fracture()
|
||||
if(is_robotic())
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
INVOKE_ASYNC(src, GLOBAL_PROC_REF(qdel), src)
|
||||
return
|
||||
parent = _parent
|
||||
parent.wound_list += src
|
||||
RegisterSignal(parent, COMSIG_PARENT_QDELETING, PROC_REF(remove_and_destroy))
|
||||
|
||||
/datum/wound/Destroy(force, ...)
|
||||
@@ -36,21 +37,21 @@
|
||||
|
||||
// MARK: Fractures
|
||||
/datum/wound/fracture
|
||||
name = "hairline fracture"
|
||||
name = "Hairline fracture"
|
||||
|
||||
// One day these will be more than just renamed variants
|
||||
/datum/wound/fracture/spiral
|
||||
name = "spiral fracture"
|
||||
name = "Spiral fracture"
|
||||
|
||||
/datum/wound/fracture/transverse
|
||||
name = "transverse fracture"
|
||||
name = "Transverse fracture"
|
||||
|
||||
/datum/wound/facture/linear
|
||||
name = "linear fracture"
|
||||
name = "Linear fracture"
|
||||
|
||||
// MARK: Ruptured lungs
|
||||
/datum/wound/ruptured_lungs
|
||||
name = "ruptured lungs"
|
||||
name = "Ruptured lungs"
|
||||
|
||||
/datum/wound/ruptured_lungs/do_effect()
|
||||
if(prob(2) && !(NO_BLOOD in parent.owner.dna.species.species_traits))
|
||||
@@ -59,3 +60,27 @@
|
||||
if(prob(4))
|
||||
parent.owner.custom_emote(EMOTE_VISIBLE, "gasps for air!")
|
||||
parent.owner.AdjustLoseBreath(10 SECONDS)
|
||||
|
||||
// MARK: Cirrhosis
|
||||
/datum/wound/cirrhosis
|
||||
name = "Cirrhosis"
|
||||
/// Cirrhosis has two "gamefied" stages, mild and severe
|
||||
var/stage = CIRRHOSIS_MILD
|
||||
|
||||
/datum/wound/cirrhosis/do_effect()
|
||||
switch(stage)
|
||||
if(CIRRHOSIS_MILD)
|
||||
parent.max_damage = 40
|
||||
parent.owner.adjustToxLoss(0.5)
|
||||
if(parent.damage >= 20 && prob(5))
|
||||
stage = CIRRHOSIS_SEVERE
|
||||
|
||||
if(CIRRHOSIS_SEVERE)
|
||||
parent.max_damage = 20
|
||||
parent.owner.adjustToxLoss(1)
|
||||
// You're on a slow clock. 400 seconds until death
|
||||
parent.receive_damage(0.1)
|
||||
|
||||
/datum/wound/cirrhosis/cure_wound()
|
||||
. = ..()
|
||||
parent.max_damage = initial(parent.max_damage)
|
||||
|
||||
Reference in New Issue
Block a user