mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-01-25 08:34:23 +00:00
## About The Pull Request Fixes #73276 This is a followup PR from my series of biotype updates. Changed oxyloss to default to ignoring biotype requirements. Fixes a bug in lung code that was preventing mobs from suffocating under certain conditions. ~~Now biotype requirements for oxyloss are respected only when `forced` is set to `FALSE`, which I have done for all applicable reagents. This is more of a temporary fix for until the damage system gets a refactor to better accommodate biotypes. @Time-Green and @LemonInTheDark would know what I mean, we were just talking about this. There is a problem with `MOB_ORGANIC` being the deafult and this is the ugly workaround.~~ Edit: I felt that oxyloss (which should be renamed to something else at this point) should have its own flag to check what type of respiration the mob's lungs can do. Because you can have organic mobs that breathe different gases. It gets messy when you try to use the same flag for everything. So I refactored oxyloss to use a new lung flag, `respiration_type`, which is automatically set based on the `safe_min_oxygen`, `safe_min_plasma` etc variables within the lung code. This will allow for individual lung types to dynamically determine whether they can take oxyloss from reagents, or any other sources that pass the `respiration_type` in the `adjustOxyLoss` proc. ## Why It's Good For The Game Plasmamen can't breathe without plasma anymore. Humans can't breathe without oxygen anymore. Etc. Adds better handling for dealing with the 'oxyloss' damage type, allowing it to be applied based on the type of gas being breathed by the specific lung. The argumentless default is to apply it regardless of respiration_type e.g. it behaves exactly as it did before. ## Changelog 🆑 fix: fixes oxyloss not being applied when there is a partial pressure of 0 (no more being able to breathe in space) code: fixes any lingering damage-application issues related to non MOB_ORGANIC biotypes refactor: refactored lungs to have a respiration_type flag which is then used by adjustOxyloss/setOxyloss to determine whether to take 'oxygen' damage. /🆑
58 lines
2.7 KiB
Plaintext
58 lines
2.7 KiB
Plaintext
/**
|
|
* Adjusts the health of a simple mob by a set amount and wakes AI if its idle to react
|
|
*
|
|
* Arguments:
|
|
* * amount The amount that will be used to adjust the mob's health
|
|
* * updating_health If the mob's health should be immediately updated to the new value
|
|
* * forced If we should force update the adjustment of the mob's health no matter the restrictions, like GODMODE
|
|
*/
|
|
/mob/living/basic/proc/adjust_health(amount, updating_health = TRUE, forced = FALSE)
|
|
. = FALSE
|
|
if(forced || !(status_flags & GODMODE))
|
|
bruteloss = round(clamp(bruteloss + amount, 0, maxHealth * 2), DAMAGE_PRECISION)
|
|
if(updating_health)
|
|
updatehealth()
|
|
. = amount
|
|
if(ckey || stat)
|
|
return
|
|
//if(AIStatus == AI_IDLE)
|
|
// toggle_ai(AI_ON)
|
|
|
|
/mob/living/basic/adjustBruteLoss(amount, updating_health = TRUE, forced = FALSE, required_bodytype)
|
|
if(forced)
|
|
. = adjust_health(amount * CONFIG_GET(number/damage_multiplier), updating_health, forced)
|
|
else if(damage_coeff[BRUTE])
|
|
. = adjust_health(amount * damage_coeff[BRUTE] * CONFIG_GET(number/damage_multiplier), updating_health, forced)
|
|
|
|
/mob/living/basic/adjustFireLoss(amount, updating_health = TRUE, forced = FALSE, required_bodytype)
|
|
if(forced)
|
|
. = adjust_health(amount * CONFIG_GET(number/damage_multiplier), updating_health, forced)
|
|
else if(damage_coeff[BURN])
|
|
. = adjust_health(amount * damage_coeff[BURN] * CONFIG_GET(number/damage_multiplier), updating_health, forced)
|
|
|
|
/mob/living/basic/adjustOxyLoss(amount, updating_health = TRUE, forced = FALSE, required_biotype, required_respiration_type)
|
|
if(forced)
|
|
. = adjust_health(amount * CONFIG_GET(number/damage_multiplier), updating_health, forced)
|
|
else if(damage_coeff[OXY])
|
|
. = adjust_health(amount * damage_coeff[OXY] * CONFIG_GET(number/damage_multiplier), updating_health, forced)
|
|
|
|
/mob/living/basic/adjustToxLoss(amount, updating_health = TRUE, forced = FALSE, required_biotype)
|
|
if(forced)
|
|
. = adjust_health(amount * CONFIG_GET(number/damage_multiplier), updating_health, forced)
|
|
else if(damage_coeff[TOX])
|
|
. = adjust_health(amount * damage_coeff[TOX] * CONFIG_GET(number/damage_multiplier), updating_health, forced)
|
|
|
|
/mob/living/basic/adjustCloneLoss(amount, updating_health = TRUE, forced = FALSE)
|
|
if(forced)
|
|
. = adjust_health(amount * CONFIG_GET(number/damage_multiplier), updating_health, forced)
|
|
else if(damage_coeff[CLONE])
|
|
. = adjust_health(amount * damage_coeff[CLONE] * CONFIG_GET(number/damage_multiplier), updating_health, forced)
|
|
|
|
/mob/living/basic/adjustStaminaLoss(amount, updating_stamina = TRUE, forced = FALSE, required_biotype)
|
|
if(forced)
|
|
staminaloss = max(0, min(BASIC_MOB_MAX_STAMINALOSS, staminaloss + amount))
|
|
else
|
|
staminaloss = max(0, min(BASIC_MOB_MAX_STAMINALOSS, staminaloss + (amount * damage_coeff[STAMINA])))
|
|
if(updating_stamina)
|
|
update_stamina()
|