From 537c5b2819108259ad8e2ed6ce47f5ea135de388 Mon Sep 17 00:00:00 2001 From: DGamerL <108773801+DGamerL@users.noreply.github.com> Date: Sun, 14 Jan 2024 13:25:20 +0100 Subject: [PATCH] Nudges bodytemperature to your desired temperature (#23467) * FINALLY * m a t h --- code/__DEFINES/atmospherics_defines.dm | 1 + code/modules/mob/living/autohiss.dm | 5 ----- code/modules/mob/living/carbon/human/human_life.dm | 12 +++++++----- .../mob/living/carbon/human/species/_species.dm | 4 ++++ 4 files changed, 12 insertions(+), 10 deletions(-) diff --git a/code/__DEFINES/atmospherics_defines.dm b/code/__DEFINES/atmospherics_defines.dm index 6ebab8f8b26..24f271ed8c4 100644 --- a/code/__DEFINES/atmospherics_defines.dm +++ b/code/__DEFINES/atmospherics_defines.dm @@ -82,6 +82,7 @@ #define BODYTEMP_NORMAL 310.15 //The natural temperature for a body #define BODYTEMP_AUTORECOVERY_DIVISOR 12 //This is the divisor which handles how much of the temperature difference between the current body temperature and 310.15K (optimal temperature) humans auto-regenerate each tick. The higher the number, the slower the recovery. This is applied each tick, so long as the mob is alive. +#define BODYTEMP_AUTORECOVERY_LOW 2 //This is the divisor that handles how much you go back to your preferred body temperature, between the cold and hot damaging limits. The higher the number, the slower the recovery. #define BODYTEMP_AUTORECOVERY_MINIMUM 10 //Minimum amount of kelvin moved toward 310.15K per tick. So long as abs(310.15 - bodytemp) is more than 50. #define BODYTEMP_COLD_DIVISOR 6 //Similar to the BODYTEMP_AUTORECOVERY_DIVISOR, but this is the divisor which is applied at the stage that follows autorecovery. This is the divisor which comes into play when the human's loc temperature is lower than their body temperature. Make it lower to lose bodytemp faster. #define BODYTEMP_HEAT_DIVISOR 6 //Similar to the BODYTEMP_AUTORECOVERY_DIVISOR, but this is the divisor which is applied at the stage that follows autorecovery. This is the divisor which comes into play when the human's loc temperature is higher than their body temperature. Make it lower to gain bodytemp faster. diff --git a/code/modules/mob/living/autohiss.dm b/code/modules/mob/living/autohiss.dm index 03c5c355d44..f6e8e266728 100644 --- a/code/modules/mob/living/autohiss.dm +++ b/code/modules/mob/living/autohiss.dm @@ -23,11 +23,6 @@ prefs.active_character.autohiss_mode = AUTOHISS_OFF to_chat(src, "Auto-hiss is now OFF.") -/datum/species - var/list/autohiss_basic_map = null - var/list/autohiss_extra_map = null - var/list/autohiss_exempt = null - /datum/species/unathi autohiss_basic_map = list( "s" = list("ss", "sss", "ssss") diff --git a/code/modules/mob/living/carbon/human/human_life.dm b/code/modules/mob/living/carbon/human/human_life.dm index 5cec1660572..484bf057e6f 100644 --- a/code/modules/mob/living/carbon/human/human_life.dm +++ b/code/modules/mob/living/carbon/human/human_life.dm @@ -212,7 +212,8 @@ // +/- 50 degrees from 310.15K is the 'safe' zone, where no damage is dealt. if(bodytemperature > dna.species.heat_level_1) //Body temperature is too hot. - if(status_flags & GODMODE) return 1 //godmode + if(status_flags & GODMODE) + return TRUE var/mult = dna.species.heatmod * physiology.heat_mod if(bodytemperature >= dna.species.heat_level_1 && bodytemperature <= dna.species.heat_level_2) @@ -318,12 +319,15 @@ if(bodytemperature <= dna.species.cold_level_1) //260.15 is 310.15 - 50, the temperature where you start to feel effects. bodytemperature += max((body_temperature_difference * metabolism_efficiency / BODYTEMP_AUTORECOVERY_DIVISOR), BODYTEMP_AUTORECOVERY_MINIMUM) - if(bodytemperature >= dna.species.cold_level_1 && bodytemperature <= dna.species.heat_level_1) - bodytemperature += body_temperature_difference * metabolism_efficiency / BODYTEMP_AUTORECOVERY_DIVISOR + return + if(bodytemperature >= dna.species.heat_level_1) //360.15 is 310.15 + 50, the temperature where you start to feel effects. //We totally need a sweat system cause it totally makes sense...~ bodytemperature += min((body_temperature_difference / BODYTEMP_AUTORECOVERY_DIVISOR), -BODYTEMP_AUTORECOVERY_MINIMUM) //We're dealing with negative numbers + return + // Our bodytemperature is +-50 degrees of our wanted body temperature + bodytemperature += ((body_temperature_difference * metabolism_efficiency) / max((BODYTEMP_AUTORECOVERY_LOW * (modulus(body_temperature_difference)) / 10), 2)) // We get back to safe our preferred bodytemp a lot faster, but slower when we are colder or hotter //This proc returns a number made up of the flags for body parts which you are protected on. (such as HEAD, UPPER_TORSO, LOWER_TORSO, etc. See setup.dm for the full list) /mob/living/carbon/human/proc/get_heat_protection_flags(temperature) //Temperature is the temperature you're being exposed to. @@ -874,8 +878,6 @@ AdjustLoseBreath(40 SECONDS, bound_lower = 0, bound_upper = 50 SECONDS) adjustOxyLoss(20) - - // Need this in species. //#undef HUMAN_MAX_OXYLOSS //#undef HUMAN_CRIT_MAX_OXYLOSS diff --git a/code/modules/mob/living/carbon/human/species/_species.dm b/code/modules/mob/living/carbon/human/species/_species.dm index 33f874ff10b..be5d63bde72 100644 --- a/code/modules/mob/living/carbon/human/species/_species.dm +++ b/code/modules/mob/living/carbon/human/species/_species.dm @@ -195,6 +195,10 @@ /// Whether the presence of a body accessory on this species is optional or not. var/optional_body_accessory = TRUE + var/list/autohiss_basic_map = null + var/list/autohiss_extra_map = null + var/list/autohiss_exempt = null + /datum/species/New() unarmed = new unarmed_type() if(!sprite_sheet_name)