Fixes and standarizes a few liver troubles. Re-enables liver failure.
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
#define LIVER_DEFAULT_HEALTH 100 //amount of damage required for liver failure
|
||||
#define LIVER_DEFAULT_TOX_TOLERANCE 3 //amount of toxins the liver can filter out
|
||||
#define LIVER_DEFAULT_TOX_LETHALITY 0.01 //lower values lower how harmful toxins are to the liver
|
||||
#define LIVER_SWELLING_MOVE_MODIFY "pharma"
|
||||
|
||||
/obj/item/organ/liver
|
||||
name = "liver"
|
||||
@@ -15,12 +14,14 @@
|
||||
healing_factor = STANDARD_ORGAN_HEALING
|
||||
decay_factor = STANDARD_ORGAN_DECAY
|
||||
|
||||
high_threshold_passed = "<span class='warning'>You feel a stange ache in your abdomen, almost like a stitch. This pain is encumbering your movements.</span>"
|
||||
high_threshold_cleared = "<span class='notice'>The stitching ache in your abdomen passes away, unencumbering your movements.</span>"
|
||||
now_fixed = "<span class='notice'>The stabbing pain in your abdomen slowly calms down into a more tolerable ache.</span>"
|
||||
|
||||
var/alcohol_tolerance = ALCOHOL_RATE//affects how much damage the liver takes from alcohol
|
||||
var/failing //is this liver failing?
|
||||
var/toxTolerance = LIVER_DEFAULT_TOX_TOLERANCE//maximum amount of toxins the liver can just shrug off
|
||||
var/toxLethality = LIVER_DEFAULT_TOX_LETHALITY//affects how much damage toxins do to the liver
|
||||
var/filterToxins = TRUE //whether to filter toxins
|
||||
var/swelling = 0
|
||||
var/cachedmoveCalc = 1
|
||||
|
||||
/obj/item/organ/liver/on_life()
|
||||
@@ -28,8 +29,6 @@
|
||||
|
||||
if(istype(C))
|
||||
if(!(organ_flags & ORGAN_FAILING))//can't process reagents with a failing liver
|
||||
//slowly heal liver damage
|
||||
damage = max(0, damage - 0.1)
|
||||
|
||||
if(filterToxins && !HAS_TRAIT(owner, TRAIT_TOXINLOVER))
|
||||
//handle liver toxin filtration
|
||||
@@ -46,42 +45,41 @@
|
||||
if(damage > 10 && prob(damage/3))//the higher the damage the higher the probability
|
||||
to_chat(C, "<span class='warning'>You feel a dull pain in your abdomen.</span>")
|
||||
|
||||
if(damage > maxHealth)//cap liver damage
|
||||
damage = maxHealth
|
||||
|
||||
if(swelling >= 10)
|
||||
pharmacokinesis()
|
||||
|
||||
/obj/item/organ/liver/prepare_eat()
|
||||
var/obj/S = ..()
|
||||
S.reagents.add_reagent(/datum/reagent/iron, 5)
|
||||
return S
|
||||
|
||||
//Just in case
|
||||
/obj/item/organ/liver/applyOrganDamage(d, maximum = maxHealth)
|
||||
. = ..()
|
||||
if(!.)
|
||||
return
|
||||
if(damage >= high_threshold)
|
||||
var/move_calc = 1+((round(damage) - high_threshold)/(high_threshold/3))
|
||||
owner.add_movespeed_modifier(MOVESPEED_ID_CIRRHOSIS, TRUE, 100, NONE, override = TRUE, multiplicative_slowdown = move_calc)
|
||||
sizeMoveMod(move_calc, owner)
|
||||
else
|
||||
owner.remove_movespeed_modifier(MOVESPEED_ID_CIRRHOSIS)
|
||||
sizeMoveMod(1, owner)
|
||||
|
||||
/obj/item/organ/liver/Insert(mob/living/carbon/M, special = FALSE, drop_if_replaced = TRUE)
|
||||
. = ..()
|
||||
if(. && damage >= high_threshold)
|
||||
var/move_calc = 1+((round(damage) - high_threshold)/(high_threshold/3))
|
||||
M.add_movespeed_modifier(MOVESPEED_ID_CIRRHOSIS, TRUE, 100, NONE, override = TRUE, multiplicative_slowdown = move_calc)
|
||||
sizeMoveMod(move_calc, owner)
|
||||
|
||||
/obj/item/organ/liver/Remove(special = FALSE)
|
||||
if(!QDELETED(owner))
|
||||
owner.remove_movespeed_modifier(LIVER_SWELLING_MOVE_MODIFY)
|
||||
owner.ResetBloodVol() //At the moment, this shouldn't allow application twice. You either have this OR a thirsty ferret.
|
||||
owner.remove_movespeed_modifier(MOVESPEED_ID_CIRRHOSIS)
|
||||
sizeMoveMod(1, owner)
|
||||
return ..()
|
||||
|
||||
//Applies some of the effects to the patient.
|
||||
/obj/item/organ/liver/proc/pharmacokinesis()
|
||||
var/moveCalc = 1+((round(swelling) - 9)/3)
|
||||
if(moveCalc == cachedmoveCalc)//reduce calculations
|
||||
return
|
||||
if(prob(5))
|
||||
to_chat(owner, "<span class='notice'>You feel a stange ache in your side, almost like a stitch. This pain is affecting your movements and making you feel lightheaded.</span>")
|
||||
var/mob/living/carbon/human/H = owner
|
||||
H.add_movespeed_modifier(LIVER_SWELLING_MOVE_MODIFY, TRUE, 100, NONE, override = TRUE, multiplicative_slowdown = moveCalc)
|
||||
H.AdjustBloodVol(moveCalc/3)
|
||||
sizeMoveMod(moveCalc, H)
|
||||
|
||||
/obj/item/organ/liver/proc/sizeMoveMod(var/value, mob/living/carbon/human/H)
|
||||
/obj/item/organ/liver/proc/sizeMoveMod(value, mob/living/carbon/C)
|
||||
if(cachedmoveCalc == value)
|
||||
return
|
||||
H.next_move_modifier /= cachedmoveCalc
|
||||
H.next_move_modifier *= value
|
||||
C.next_move_modifier /= cachedmoveCalc
|
||||
C.next_move_modifier *= value
|
||||
cachedmoveCalc = value
|
||||
|
||||
/obj/item/organ/liver/fly
|
||||
|
||||
Reference in New Issue
Block a user