Skip to content

Commit

Permalink
TGS Test Merge (#6938)
Browse files Browse the repository at this point in the history
  • Loading branch information
lordme authored and lordme committed Dec 29, 2024
2 parents 954b8ba + a118271 commit 1578220
Show file tree
Hide file tree
Showing 22 changed files with 56 additions and 27 deletions.
7 changes: 7 additions & 0 deletions code/__DEFINES/mobs/life.dm
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,10 @@
#define ORGAN_DECAY_PER_SECOND_BRAIN (60 / (60 * 10)) // brain decays entirely over 10 minutes, or to lethal degrees in 5


//? Health - General
/** Store the default minimum health, crit health, soft crit health
* These are currently only respected by carbons
*/
#define MOB_MINIMUM_HEALTH -100
#define MOB_CRITICAL_HEALTH -50
#define MOB_SOFT_CRITICAL_HEALTH 0
2 changes: 1 addition & 1 deletion code/game/dna/dna_modifier.dm
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,7 @@
occupantData["isViableSubject"] = 0
occupantData["health"] = connected.occupant.health
occupantData["maxHealth"] = connected.occupant.maxHealth
occupantData["minHealth"] = config_legacy.health_threshold_dead
occupantData["minHealth"] = connected.occupant.getMinHealth()
occupantData["uniqueEnzymes"] = connected.occupant.dna.unique_enzymes
occupantData["uniqueIdentity"] = connected.occupant.dna.uni_identity
occupantData["structuralEnzymes"] = connected.occupant.dna.struc_enzymes
Expand Down
2 changes: 1 addition & 1 deletion code/game/gamemodes/cult/soulstone.dm
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@
if(src.imprinted != "empty")
to_chat(U, "<span class='danger'>Capture failed!</span>: The soul stone has already been imprinted with [src.imprinted]'s mind!")
return
if ((T.health + T.halloss) > config_legacy.health_threshold_crit && T.stat != DEAD)
if ((T.health + T.halloss) > T.getCritHealth() && T.stat != DEAD)
to_chat(U, "<span class='danger'>Capture failed!</span>: Kill or maim the victim first!")
return
if(T.client == null)
Expand Down
2 changes: 1 addition & 1 deletion code/game/machinery/computer/Operating.dm
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
occupantData["stat"] = occupant.stat
occupantData["health"] = occupant.health
occupantData["maxHealth"] = occupant.maxHealth
occupantData["minHealth"] = config_legacy.health_threshold_dead
occupantData["minHealth"] = occupant.getMinHealth()
occupantData["bruteLoss"] = occupant.getBruteLoss()
occupantData["oxyLoss"] = occupant.getOxyLoss()
occupantData["toxLoss"] = occupant.getToxLoss()
Expand Down
2 changes: 1 addition & 1 deletion code/game/machinery/cryo.dm
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@
occupantData["stat"] = occupant.stat
occupantData["health"] = occupant.health
occupantData["maxHealth"] = occupant.getMaxHealth()
occupantData["minHealth"] = config_legacy.health_threshold_dead
occupantData["minHealth"] = occupant.getMinHealth()
occupantData["bruteLoss"] = occupant.getBruteLoss()
occupantData["oxyLoss"] = occupant.getOxyLoss()
occupantData["toxLoss"] = occupant.getToxLoss()
Expand Down
6 changes: 3 additions & 3 deletions code/game/objects/items/defib/shockpaddles.dm
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,10 @@
H.update_health()

if(H.isSynthetic())
if(H.health + H.getOxyLoss() + H.getToxLoss() <= config_legacy.health_threshold_dead)
if(H.health + H.getOxyLoss() + H.getToxLoss() <= H.getMinHealth())
return "buzzes, \"Resuscitation failed - Severe damage detected. Begin manual repair.\""

else if(H.health + H.getOxyLoss() <= config_legacy.health_threshold_dead || (MUTATION_HUSK in H.mutations) || !H.can_defib)
else if(H.health + H.getOxyLoss() <= H.getMinHealth() || (MUTATION_HUSK in H.mutations) || !H.can_defib)
// TODO: REFACTOR DEFIBS AND HEALTH
return "buzzes, \"Resuscitation failed - Severe tissue damage makes recovery of patient impossible via defibrillator.\""

Expand Down Expand Up @@ -223,7 +223,7 @@
H.apply_damage(burn_damage_amt, DAMAGE_TYPE_BURN, BP_TORSO)

//set oxyloss so that the patient is just barely in crit, if possible
var/barely_in_crit = config_legacy.health_threshold_crit - 1
var/barely_in_crit = H.getCritHealth() - 1
var/adjust_health = barely_in_crit - H.health //need to increase health by this much
H.adjustOxyLoss(-adjust_health)

Expand Down
2 changes: 1 addition & 1 deletion code/game/rendering/atom_huds/atom_hud_provider.dm
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ GLOBAL_LIST_INIT(atom_hud_providers, initialize_atom_hud_providers())
if(M.stat == DEAD)
I.icon_state = "-100"
else
I.icon_state = RoundHealth((M.health-config_legacy.health_threshold_crit)/(M.getMaxHealth()-config_legacy.health_threshold_crit)*100)
I.icon_state = RoundHealth((M.health-M.getCritHealth())/(M.getMaxHealth()-M.getCritHealth())*100)

/datum/atom_hud_provider/security_implant
icon = 'icons/screen/atom_hud/implant.dmi'
Expand Down
6 changes: 3 additions & 3 deletions code/modules/admin/verbs/debug.dm
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,9 @@
to_chat(user, "<span class='notice'>\The [I] does <b>[DPS]</b> damage per second.</span>")
if(DPS > 0)
to_chat(user, "<span class='notice'>At your maximum health ([user.getMaxHealth()]), it would take approximately;</span>")
to_chat(user, "<span class='notice'>[(user.getMaxHealth() - config_legacy.health_threshold_softcrit) / DPS] seconds to softcrit you. ([config_legacy.health_threshold_softcrit] health)</span>")
to_chat(user, "<span class='notice'>[(user.getMaxHealth() - config_legacy.health_threshold_crit) / DPS] seconds to hardcrit you. ([config_legacy.health_threshold_crit] health)</span>")
to_chat(user, "<span class='notice'>[(user.getMaxHealth() - config_legacy.health_threshold_dead) / DPS] seconds to kill you. ([config_legacy.health_threshold_dead] health)</span>")
to_chat(user, "<span class='notice'>[(user.getMaxHealth() - user.getCritHealth()) / DPS] seconds to softcrit you. ([user.getSoftCritHealth()] health)</span>")
to_chat(user, "<span class='notice'>[(user.getMaxHealth() - user.getCritHealth()) / DPS] seconds to hardcrit you. ([user.getCritHealth()] health)</span>")
to_chat(user, "<span class='notice'>[(user.getMaxHealth() - user.getMinHealth()) / DPS] seconds to kill you. ([user.getMinHealth()] health)</span>")

else
to_chat(user, "<span class='warning'>You need to be a living mob, with hands, and for an object to be in your active hand, to use this verb.</span>")
Expand Down
2 changes: 1 addition & 1 deletion code/modules/mob/living/carbon/brain/life.dm
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@
src.apply_status_effect(/datum/status_effect/sight/blindness, 5 SECONDS)//60 seconds is just a randomly picked number, the modifier does not expire as long as the holder is dead
silent = 0
else //ALIVE. LIGHTS ARE ON
if( !container && (health < config_legacy.health_threshold_dead || ((world.time - timeofhostdeath) > config_legacy.revival_brain_life)) )
if( !container && (health < getMinHealth() || ((world.time - timeofhostdeath) > config_legacy.revival_brain_life)) )
death()
src.apply_status_effect(/datum/status_effect/sight/blindness, 5 SECONDS)
silent = 0
Expand Down
4 changes: 2 additions & 2 deletions code/modules/mob/living/carbon/breathe.dm
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

//Start of a breath chain, calls breathe()
/mob/living/carbon/handle_breathing()
if(SSair.current_cycle%4==2 || failed_last_breath || (health < config_legacy.health_threshold_crit)) //First, resolve location and get a breath
if(SSair.current_cycle%4==2 || failed_last_breath || (health < getCritHealth())) //First, resolve location and get a breath
breathe()

/mob/living/carbon/proc/breathe()
Expand All @@ -16,7 +16,7 @@

//First, check if we can breathe at all
// cpr completely nullifies brainstem requirement
if(health < config_legacy.health_threshold_crit && !(CE_STABLE in chem_effects) && !stabilization) //crit aka circulatory shock
if(health < getCritHealth() && !(CE_STABLE in chem_effects) && !stabilization) //crit aka circulatory shock
AdjustLosebreath(1)

if(losebreath>0) //Suffocating so do not take a breath
Expand Down
2 changes: 1 addition & 1 deletion code/modules/mob/living/carbon/carbon.dm
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
return ..()

/mob/living/carbon/proc/help_shake_act(mob/living/carbon/M)
if(src.health >= config_legacy.health_threshold_crit)
if(src.health >= getCritHealth())
if(src == M && istype(src, /mob/living/carbon/human))

var/mob/living/carbon/human/H = src
Expand Down
2 changes: 1 addition & 1 deletion code/modules/mob/living/carbon/health.dm
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/mob/living/carbon/is_in_critical()
return !IS_DEAD(src) && (health < config_legacy.health_threshold_crit)
return !IS_DEAD(src) && (health < getCritHealth())

/mob/living/carbon/rejuvenate(fix_missing, reset_to_slot)
. = ..()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
health = getMaxHealth() - getOxyLoss() - getToxLoss() - getCloneLoss() - total_burn - total_brute

//TODO: fix husking
if( ((getMaxHealth() - total_burn) < config_legacy.health_threshold_dead) && stat == DEAD)
if( ((getMaxHealth() - total_burn) < getMinHealth()) && stat == DEAD)
ChangeToHusk()

if(old != health)
Expand Down
8 changes: 4 additions & 4 deletions code/modules/mob/living/carbon/human/life.dm
Original file line number Diff line number Diff line change
Expand Up @@ -1123,14 +1123,14 @@
else //ALIVE. LIGHTS ARE ON
update_health() //TODO

if(health <= config_legacy.health_threshold_dead || (should_have_organ("brain") && !has_brain()))
if(health <= getMinHealth() || (should_have_organ("brain") && !has_brain()))
death()
apply_status_effect(/datum/status_effect/sight/blindness, 5 SECOND)
silent = 0
return 1

//UNCONSCIOUS. NO-ONE IS HOME
if((getOxyLoss() > (species.total_health/2)) || (health <= config_legacy.health_threshold_crit))
if((getOxyLoss() > (species.total_health/2)) || (health <= getCritHealth()))
afflict_unconscious(20 * 3)

if(hallucination)
Expand Down Expand Up @@ -1696,12 +1696,12 @@
if(!can_feel_pain())
return

if(health < config_legacy.health_threshold_softcrit)// health 0 makes you immediately collapse
if(health < getSoftCritHealth())// health 0 makes you immediately collapse
shock_stage = max(shock_stage, 61)

if(traumatic_shock >= 80)
shock_stage += 1
else if(health < config_legacy.health_threshold_softcrit)
else if(health < getSoftCritHealth())
shock_stage = max(shock_stage, 61)
else
shock_stage = min(shock_stage, 160)
Expand Down
9 changes: 9 additions & 0 deletions code/modules/mob/living/living.dm
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,15 @@ default behaviour is:
health = (health/maxHealth) * (newMaxHealth) // Adjust existing health
maxHealth = newMaxHealth

// Use this to get a mob's min health whenever possible. (modifiers for minHealth don't exist currently!)
/mob/living/proc/getMinHealth()
return minHealth

/mob/living/proc/getCritHealth()
return critHealth

/mob/living/proc/getSoftCritHealth()
return softCritHealth

/mob/living/Confuse(amount)
for(var/datum/modifier/M in modifiers)
Expand Down
4 changes: 4 additions & 0 deletions code/modules/mob/living/living_defines.dm
Original file line number Diff line number Diff line change
Expand Up @@ -167,3 +167,7 @@
var/list/datum/disease2/disease/virus2 = list()
var/image/pathogen
var/datum/immune_system/immune_system

var/minHealth = MOB_MINIMUM_HEALTH
var/softCritHealth = MOB_SOFT_CRITICAL_HEALTH
var/critHealth = MOB_CRITICAL_HEALTH
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
if (has_polaris_AI() && friend)
var/friend_dist = get_dist(src,friend)
if (friend_dist <= 1)
if (friend.stat >= DEAD || friend.health <= config_legacy.health_threshold_softcrit)
if (friend.stat >= DEAD || friend.health <= getSoftCritHealth())
if (prob((friend.stat < DEAD)? 50 : 15))
var/verb = pick("meows", "mews", "mrowls")
audible_emote(pick("[verb] in distress.", "[verb] anxiously."))
Expand Down
2 changes: 1 addition & 1 deletion code/modules/mob/mob.dm
Original file line number Diff line number Diff line change
Expand Up @@ -712,7 +712,7 @@ GLOBAL_VAR_INIT(exploit_warn_spam_prevention, 0)
/mob/proc/pull_damage()
if(ishuman(src))
var/mob/living/carbon/human/H = src
if(H.health - H.halloss <= config_legacy.health_threshold_softcrit)
if(H.health - H.halloss <= H.getSoftCritHealth())
for(var/name in H.organs_by_name)
var/obj/item/organ/external/e = H.organs_by_name[name]
if(e && H.lying)
Expand Down
2 changes: 1 addition & 1 deletion code/modules/organs/external/wound.dm
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
//Burn damage can cause fluid loss due to blistering and cook-off

if((damage > 5 || damage + burn_dam >= 15) && type == WOUND_TYPE_BURN && (robotic < ORGAN_ROBOT) && !(species.species_flags & NO_BLOOD))
var/fluid_loss = 0.4 * (damage/(owner.getMaxHealth() - config_legacy.health_threshold_dead)) * owner.species.blood_volume*(1 - owner.species.blood_level_fatal)
var/fluid_loss = 0.4 * (damage/(owner.getMaxHealth() - owner.getMinHealth())) * owner.species.blood_volume*(1 - owner.species.blood_level_fatal)
owner.remove_blood(fluid_loss)

// first check whether we can widen an existing wound
Expand Down
2 changes: 1 addition & 1 deletion code/modules/resleeving/machines.dm
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@
H.add_modifier(modifier_type)

//Apply damage
H.adjustCloneLoss((H.getMaxHealth() - config_legacy.health_threshold_dead)*-0.75)
H.adjustCloneLoss((H.getMaxHealth() - H.getMinHealth())*-0.75)
H.afflict_unconscious(20 * 4)
H.update_health()

Expand Down
11 changes: 10 additions & 1 deletion code/modules/species/species.dm
Original file line number Diff line number Diff line change
Expand Up @@ -270,8 +270,14 @@
var/pass_flags = 0

//? Stats
/// Point at which the mob will enter crit.
/// Total health the mob has
var/total_health = 100
/// Point at which the mob will die
var/death_health = MOB_MINIMUM_HEALTH
/// Point at which the mob will enter crit
var/crit_health = MOB_CRITICAL_HEALTH
/// Point at which the mob will enter soft crit
var/soft_crit_health = MOB_SOFT_CRITICAL_HEALTH
/// Physical damage multiplier.
var/brute_mod = 1
/// Burn damage multiplier.
Expand Down Expand Up @@ -575,6 +581,9 @@
H.gender = genders[1]

H.maxHealth = total_health
H.minHealth = death_health
H.critHealth = crit_health
H.softCritHealth = soft_crit_health

if(!isnull(mob_physiology_modifier))
H.add_physiology_modifier(mob_physiology_modifier)
Expand Down
2 changes: 1 addition & 1 deletion code/modules/species/station/alraune.dm
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@

if(!breath || (breath.total_moles == 0))
H.failed_last_breath = 1
if(H.health > config_legacy.health_threshold_crit)
if(H.health > H.getCritHealth())
H.adjustOxyLoss(ALRAUNE_MAX_OXYLOSS)
else
H.adjustOxyLoss(ALRAUNE_CRIT_MAX_OXYLOSS)
Expand Down

0 comments on commit 1578220

Please sign in to comment.