organ/on_life tweaks.

This commit is contained in:
Ghommie
2020-04-25 16:19:43 +02:00
parent debbd3edab
commit 8440b48a9a
17 changed files with 164 additions and 155 deletions
+13 -14
View File
@@ -134,18 +134,19 @@
organ_flags &= ~ORGAN_FROZEN
return FALSE
/obj/item/organ/proc/on_life() //repair organ damage if the organ is not failing
if(organ_flags & ORGAN_FAILING)
return
/obj/item/organ/proc/on_life() //repair organ damage if the organ is not failing or synthetic
if(organ_flags & ORGAN_FAILING || !owner)
return FALSE
if(is_cold())
return
///Damage decrements by a percent of its maxhealth
var/healing_amount = -(maxHealth * healing_factor)
///Damage decrements again by a percent of its maxhealth, up to a total of 4 extra times depending on the owner's health
healing_amount -= owner.satiety > 0 ? 4 * healing_factor * owner.satiety / MAX_SATIETY : 0
if(healing_amount)
applyOrganDamage(healing_amount) //to FERMI_TWEAK
//Make it so each threshold is stuck.
return FALSE
if(damage)
///Damage decrements by a percent of its maxhealth
var/healing_amount = -(maxHealth * healing_factor)
///Damage decrements again by a percent of its maxhealth, up to a total of 4 extra times depending on the owner's satiety
healing_amount -= owner.satiety > 0 ? 4 * healing_factor * owner.satiety / MAX_SATIETY : 0
if(healing_amount)
applyOrganDamage(healing_amount) //to FERMI_TWEAK
return TRUE
/obj/item/organ/examine(mob/user)
. = ..()
@@ -205,9 +206,7 @@
///Adjusts an organ's damage by the amount "d", up to a maximum amount, which is by default max damage
/obj/item/organ/proc/applyOrganDamage(var/d, var/maximum = maxHealth) //use for damaging effects
if(!d) //Micro-optimization.
return FALSE
if(maximum < damage)
if(!d || maximum < damage) //Micro-optimization.
return FALSE
damage = clamp(damage + d, 0, maximum)
var/mess = check_damage_thresholds()