Add healing boost to organs while mob is sleeping (#76679)

## About The Pull Request
This adds the healing bonuses from sleeping effects (mood, pillow,
sleeping in darkness, etc.) and applies it to organs natural healing
regeneration. The regen rate is very low, so I added a heavy x5
multiplication rate to all the sleep bonuses for organs specifically.

If an organ is dying or robotic then the effects don't apply.

## Why It's Good For The Game
More benefits to sleeping after injuries. This encourages patients to
rest properly after revival or major surgery.

## Changelog
🆑
add: Add healing boost to organs while mob is sleeping (does not apply
to robotic or dying organs)
/🆑
This commit is contained in:
Tim
2023-07-17 08:56:56 +02:00
committed by GitHub
parent bb9cadb21f
commit a0e297cb49
2 changed files with 25 additions and 9 deletions
+24 -8
View File
@@ -1,3 +1,8 @@
/// The damage healed per tick while sleeping without any modifiers
#define HEALING_SLEEP_DEFAULT 0.2
/// The sleep healing multipler for organ passive healing (since organs heal slowly)
#define HEALING_SLEEP_ORGAN_MULTIPLIER 5
//Largely negative status effects go here, even if they have small benificial effects
//STUN EFFECTS
/datum/status_effect/incapacitating
@@ -154,8 +159,6 @@
ADD_TRAIT(owner, TRAIT_KNOCKEDOUT, TRAIT_STATUS_EFFECT(id))
tick_interval = initial(tick_interval)
#define HEALING_SLEEP_DEFAULT 0.2
/datum/status_effect/incapacitating/sleeping/tick()
if(owner.maxHealth)
var/health_ratio = owner.health / owner.maxHealth
@@ -202,10 +205,22 @@
if(locate(/obj/item/pillow) in owner.loc)
healing += 0.1
if(healing > 0 && health_ratio > 0.8)
owner.adjustBruteLoss(-1 * healing, required_bodytype = BODYTYPE_ORGANIC)
owner.adjustFireLoss(-1 * healing, required_bodytype = BODYTYPE_ORGANIC)
owner.adjustToxLoss(-1 * healing * 0.5, TRUE, TRUE, required_biotype = MOB_ORGANIC)
if(healing > 0)
if(iscarbon(owner))
var/mob/living/carbon/carbon_owner = owner
for(var/obj/item/organ/target_organ as anything in carbon_owner.organs)
// no healing boost for robotic or dying organs
if(IS_ROBOTIC_ORGAN(target_organ) || !target_organ.damage || target_organ.organ_flags & ORGAN_FAILING)
continue
// organ regeneration is very low so we crank up the healing rate to give a good bonus
var/healing_bonus = target_organ.healing_factor * healing * HEALING_SLEEP_ORGAN_MULTIPLIER
target_organ.apply_organ_damage(-healing_bonus * target_organ.maxHealth)
if(health_ratio > 0.8) // only heals minor physical damage
owner.adjustBruteLoss(-1 * healing, required_bodytype = BODYTYPE_ORGANIC)
owner.adjustFireLoss(-1 * healing, required_bodytype = BODYTYPE_ORGANIC)
owner.adjustToxLoss(-1 * healing * 0.5, TRUE, TRUE, required_biotype = MOB_ORGANIC)
owner.adjustStaminaLoss(min(-1 * healing, -1 * HEALING_SLEEP_DEFAULT))
// Drunkenness gets reduced by 0.3% per tick (6% per 2 seconds)
owner.set_drunk_effect(owner.get_drunk_amount() * 0.997)
@@ -217,8 +232,6 @@
if(prob(2) && owner.health > owner.crit_threshold)
owner.emote("snore")
#undef HEALING_SLEEP_DEFAULT
/atom/movable/screen/alert/status_effect/asleep
name = "Asleep"
desc = "You've fallen asleep. Wait a bit and you should wake up. Unless you don't, considering how helpless you are."
@@ -919,3 +932,6 @@
/datum/status_effect/teleport_madness/tick()
dump_in_space(owner)
#undef HEALING_SLEEP_DEFAULT
#undef HEALING_SLEEP_ORGAN_MULTIPLIER
+1 -1
View File
@@ -229,7 +229,7 @@ Most job-related exosuit clothing can fit job-related items into it, such as the
Most things have special interactions with right, alt, shift, and control click. Experiment!
On most clothing items that go in the exosuit slot, you can put certain small items into your suit storage, such as a spraycan, your emergency oxygen tank, or a flashlight.
Remote devices will work when used through cameras. For example: Bluespace RPEDs and door remotes.
Sleeping can be used to recover from minor injuries. Sanity, darkness, blindfolds, earmuffs, tables, beds, and bedsheets affect the healing rate.
Sleeping can be used to recover from minor injuries and organ damage. Sanity, darkness, blindfolds, earmuffs, tables, beds, and bedsheets affect the healing rate.
Some roles cannot be antagonists by default, but antag selection is decided first. For instance, you can set Security Officer to High without affecting your chances of becoming an antag -- the game will just select a different role.
Some weapons are better at taking down robots and structures than others. Don't try to break a window with a scalpel, try a toolbox.
Standard epipens contain a potent coagulant that not only slow bloodloss, but also help clot whichever of your wounds is bleeding the most! If you're suffering multiple bad bleeding wounds, make sure to seek out additional treatment ASAP!