From 3b44e84ef41387cdd1c389bfa7df94e4d9a441d6 Mon Sep 17 00:00:00 2001 From: Jordan Brown Date: Wed, 1 Jan 2020 13:40:30 -0500 Subject: [PATCH 01/18] Revert "Better species environment handlers, and custom race body temperature (#48321)" This reverts commit e7ea043712dd25d1bd2de4fafa86d6d31e696616. --- code/__DEFINES/atmospherics.dm | 14 +- code/modules/mob/living/carbon/alien/alien.dm | 22 +- .../mob/living/carbon/carbon_defines.dm | 10 +- code/modules/mob/living/carbon/human/life.dm | 31 +-- .../mob/living/carbon/human/species.dm | 205 ++++-------------- .../carbon/human/species_types/ethereal.dm | 7 +- .../human/species_types/lizardpeople.dm | 9 - .../carbon/human/species_types/plasmamen.dm | 11 - .../carbon/human/species_types/zombies.dm | 12 +- code/modules/mob/living/carbon/life.dm | 87 +------- code/modules/mob/living/carbon/monkey/life.dm | 17 +- code/modules/mob/living/life.dm | 16 +- .../mob/living/simple_animal/slime/life.dm | 37 ++-- .../mob/living/simple_animal/status_procs.dm | 4 + 14 files changed, 131 insertions(+), 351 deletions(-) diff --git a/code/__DEFINES/atmospherics.dm b/code/__DEFINES/atmospherics.dm index 1a2ed41c69e..61198aa0ae8 100644 --- a/code/__DEFINES/atmospherics.dm +++ b/code/__DEFINES/atmospherics.dm @@ -131,14 +131,12 @@ #define BODYTEMP_COOLING_MAX -100 /// The maximum number of degrees that your body can heat up in 1 tick, due to the environment, when in a hot area. #define BODYTEMP_HEATING_MAX 30 -/// The body temperature limit the human body can take before it starts taking damage from heat. -/// This also affects how fast the body normalises it's temperature when hot. -/// 340k is about 66c, and rather high for a human. -#define BODYTEMP_HEAT_DAMAGE_LIMIT (BODYTEMP_NORMAL + 30) -/// The body temperature limit the human body can take before it starts taking damage from cold. -/// This also affects how fast the body normalises it's temperature when cold. -/// 270k is about -3c, that is below freezing and would hurt over time. -#define BODYTEMP_COLD_DAMAGE_LIMIT (BODYTEMP_NORMAL - 40) + +/// The limit the human body can take before it starts taking damage from heat. +#define BODYTEMP_HEAT_DAMAGE_LIMIT (BODYTEMP_NORMAL + 50) +/// The limit the human body can take before it starts taking damage from coldness. +#define BODYTEMP_COLD_DAMAGE_LIMIT (BODYTEMP_NORMAL - 50) + /// what min_cold_protection_temperature is set to for space-helmet quality headwear. MUST NOT BE 0. #define SPACE_HELM_MIN_TEMP_PROTECT 2.0 diff --git a/code/modules/mob/living/carbon/alien/alien.dm b/code/modules/mob/living/carbon/alien/alien.dm index 8a21dd28e58..87501bc44f8 100644 --- a/code/modules/mob/living/carbon/alien/alien.dm +++ b/code/modules/mob/living/carbon/alien/alien.dm @@ -18,8 +18,7 @@ status_flags = CANUNCONSCIOUS|CANPUSH - heat_protection = 0.5 // minor heat insulation - + var/heat_protection = 0.5 var/leaping = 0 gib_type = /obj/effect/decal/cleanable/xenoblood/xgibs unique_name = 1 @@ -49,9 +48,22 @@ return -10 /mob/living/carbon/alien/handle_environment(datum/gas_mixture/environment) - // Run base mob body temperature proc before taking damage - // this balances body temp to the enviroment and natural stabilization - . = ..() + if(!environment) + return + + var/loc_temp = get_temperature(environment) + + // Aliens are now weak to fire. + + //After then, it reacts to the surrounding atmosphere based on your thermal protection + if(!on_fire) // If you're on fire, ignore local air temperature + if(loc_temp > bodytemperature) + //Place is hotter than we are + var/thermal_protection = heat_protection //This returns a 0 - 1 value, which corresponds to the percentage of heat protection. + if(thermal_protection < 1) + adjust_bodytemperature((1-thermal_protection) * ((loc_temp - bodytemperature) / BODYTEMP_HEAT_DIVISOR)) + else + adjust_bodytemperature(1 * ((loc_temp - bodytemperature) / BODYTEMP_HEAT_DIVISOR)) if(bodytemperature > BODYTEMP_HEAT_DAMAGE_LIMIT) //Body temperature is too hot. diff --git a/code/modules/mob/living/carbon/carbon_defines.dm b/code/modules/mob/living/carbon/carbon_defines.dm index a343ccae1eb..6862d7ce05d 100644 --- a/code/modules/mob/living/carbon/carbon_defines.dm +++ b/code/modules/mob/living/carbon/carbon_defines.dm @@ -16,7 +16,7 @@ var/disgust = 0 - //inventory slots +//inventory slots var/obj/item/back = null var/obj/item/clothing/mask/wear_mask = null var/obj/item/clothing/neck/wear_neck = null @@ -28,7 +28,7 @@ var/obj/item/clothing/glasses/glasses = null //only used by humans. var/obj/item/clothing/ears = null //only used by humans. - var/datum/dna/dna = null // Carbon + var/datum/dna/dna = null//Carbon var/datum/mind/last_mind = null //last mind to control this mob, for blood-based cloning var/failed_last_breath = 0 //This is used to determine if the mob failed a breath. If they did fail a brath, they will attempt to breathe each tick, otherwise just once per 4 ticks. @@ -64,9 +64,3 @@ var/drunkenness = 0 //Overall drunkenness - check handle_alcohol() in life.dm for effects var/stam_regen_start_time = 0 //used to halt stamina regen temporarily var/stam_paralyzed = FALSE //knocks you down - - // Protection from the elements - // This is insulation against increasing or decreasing body temperature - // 0 - 1 value which corresponds to the percentage of protection - var/heat_protection = 0 // No heat protection - var/cold_protection = 0 // No cold protection diff --git a/code/modules/mob/living/carbon/human/life.dm b/code/modules/mob/living/carbon/human/life.dm index ec2e3ee98c5..62d3321206d 100644 --- a/code/modules/mob/living/carbon/human/life.dm +++ b/code/modules/mob/living/carbon/human/life.dm @@ -106,14 +106,7 @@ lun.check_breath(breath,src) /mob/living/carbon/human/handle_environment(datum/gas_mixture/environment) - // If we are in a cryo bed do not process life functions - if(istype(loc, /obj/machinery/atmospherics/components/unary/cryo_cell)) - return - - // hand off to the species handlers dna.species.handle_environment(environment, src) - dna.species.handle_environment_pressure(environment, src) - dna.species.handle_body_temperature(src) ///FIRE CODE /mob/living/carbon/human/handle_fire() @@ -181,15 +174,10 @@ return thermal_protection_flags -// Temperature is the temperature you're being exposed to. -// This returns a 0 - 1 value which corresponds to the percentage of protection -/mob/living/carbon/human/get_heat_protection(temperature) +/mob/living/carbon/human/proc/get_heat_protection(temperature) //Temperature is the temperature you're being exposed to. var/thermal_protection_flags = get_heat_protection_flags(temperature) - // Apply the mobs base protection - var/thermal_protection = heat_protection - - // Apply clothing items protection + var/thermal_protection = 0 if(thermal_protection_flags) if(thermal_protection_flags & HEAD) thermal_protection += THERMAL_PROTECTION_HEAD @@ -214,6 +202,7 @@ if(thermal_protection_flags & HAND_RIGHT) thermal_protection += THERMAL_PROTECTION_HAND_RIGHT + return min(1,thermal_protection) //See proc/get_heat_protection_flags(temperature) for the description of this proc. @@ -242,19 +231,11 @@ return thermal_protection_flags -// Temperature is the temperature you're being exposed to. -// This returns a 0 - 1 value which corresponds to the percentage of protection -/mob/living/carbon/human/get_cold_protection(temperature) - // There is an occasional bug where the temperature is miscalculated in ares with a small amount of gas on them. - // This is necessary to ensure that does not affect this calculation. - // Space's temperature is 2.7K and most suits that are intended to protect against any cold, protect down to 2.0K. - temperature = max(temperature, 2.7) +/mob/living/carbon/human/proc/get_cold_protection(temperature) + temperature = max(temperature, 2.7) //There is an occasional bug where the temperature is miscalculated in ares with a small amount of gas on them, so this is necessary to ensure that that bug does not affect this calculation. Space's temperature is 2.7K and most suits that are intended to protect against any cold, protect down to 2.0K. var/thermal_protection_flags = get_cold_protection_flags(temperature) - // Apply the mobs base protection - var/thermal_protection = cold_protection - - // Apply clothing items protection + var/thermal_protection = 0 if(thermal_protection_flags) if(thermal_protection_flags & HEAD) thermal_protection += THERMAL_PROTECTION_HEAD diff --git a/code/modules/mob/living/carbon/human/species.dm b/code/modules/mob/living/carbon/human/species.dm index fa2b988d0e2..6ae31b7febd 100644 --- a/code/modules/mob/living/carbon/human/species.dm +++ b/code/modules/mob/living/carbon/human/species.dm @@ -54,13 +54,6 @@ GLOBAL_LIST_EMPTY(roundstart_races) var/datum/action/innate/flight/fly //the actual flying ability given to flying species var/wings_icon = "Angel" //the icon used for the wings - // Body temperature defaults - // this enables different species to have different body temperature settings - var/bodytemp_normal = BODYTEMP_NORMAL - var/bodytemp_autorecovery_min = BODYTEMP_AUTORECOVERY_MINIMUM - var/bodytemp_heat_damage_limit = BODYTEMP_HEAT_DAMAGE_LIMIT - var/bodytemp_cold_damage_limit = BODYTEMP_COLD_DAMAGE_LIMIT - // species-only traits. Can be found in DNA.dm var/list/species_traits = list() // generic traits tied to having the species @@ -93,7 +86,6 @@ GLOBAL_LIST_EMPTY(roundstart_races) //Think magic mirror and pride mirror, slime extract, ERT etc, see defines //in __DEFINES/mobs.dm, defaults to NONE, so people actually have to think about it var/changesource_flags = NONE - /////////// // PROCS // /////////// @@ -1613,91 +1605,55 @@ GLOBAL_LIST_EMPTY(roundstart_races) if(HAS_TRAIT(H, TRAIT_NOBREATH)) return TRUE -////////////////////////// -// ENVIRONMENT HANDLERS // -////////////////////////// -/// Handle the environment for the species /datum/species/proc/handle_environment(datum/gas_mixture/environment, mob/living/carbon/human/H) - // Get the temperature of the current area - var/areatemp = H.get_temperature(environment) + if(!environment) + return + if(istype(H.loc, /obj/machinery/atmospherics/components/unary/cryo_cell)) + return - // Part one of body temperature stability have the body try and normalize on it's own - var/natural = 0 - // If you are dead your body does not stabilize naturally - if(H.stat != DEAD) - // Get the amount of change in temp the body will apply on it's own - natural = natural_bodytemperature_stabilization(H) + var/loc_temp = H.get_temperature(environment) - // Get the mobs thermal protection and environmental change - var/thermal_protection = 1 // The inverse of the amount of protection - var/environment_change = 0 // The amount of change the enviroment is causing - var/natural_change = 0 // the amount of change from natural stabilization after thermal protection + //Body temperature is adjusted in two parts: first there your body tries to naturally preserve homeostasis (shivering/sweating), then it reacts to the surrounding environment + //Thermal protection (insulation) has mixed benefits in two situations (hot in hot places, cold in hot places) + if(!H.on_fire) //If you're on fire, you do not heat up or cool down based on surrounding gases + var/natural = 0 + if(H.stat != DEAD) + natural = H.natural_bodytemperature_stabilization() + var/thermal_protection = 1 + if(loc_temp < H.bodytemperature) //Place is colder than we are + thermal_protection -= H.get_cold_protection(loc_temp) //This returns a 0 - 1 value, which corresponds to the percentage of protection based on what you're wearing and what you're exposed to. + if(H.bodytemperature < BODYTEMP_NORMAL) //we're cold, insulation helps us retain body heat and will reduce the heat we lose to the environment + H.adjust_bodytemperature((thermal_protection+1)*natural + max(thermal_protection * (loc_temp - H.bodytemperature) / BODYTEMP_COLD_DIVISOR, BODYTEMP_COOLING_MAX)) + else //we're sweating, insulation hinders our ability to reduce heat - and it will reduce the amount of cooling you get from the environment + H.adjust_bodytemperature(natural*(1/(thermal_protection+1)) + max((thermal_protection * (loc_temp - H.bodytemperature) + BODYTEMP_NORMAL - H.bodytemperature) / BODYTEMP_COLD_DIVISOR , BODYTEMP_COOLING_MAX)) //Extra calculation for hardsuits to bleed off heat + if (loc_temp > H.bodytemperature) //Place is hotter than we are + var/natural = 0 + if(H.stat != DEAD) + natural = H.natural_bodytemperature_stabilization() + var/thermal_protection = 1 + thermal_protection -= H.get_heat_protection(loc_temp) //This returns a 0 - 1 value, which corresponds to the percentage of protection based on what you're wearing and what you're exposed to. + if(H.bodytemperature < BODYTEMP_NORMAL) //and we're cold, insulation enhances our ability to retain body heat but reduces the heat we get from the environment + H.adjust_bodytemperature((thermal_protection+1)*natural + min(thermal_protection * (loc_temp - H.bodytemperature) / BODYTEMP_HEAT_DIVISOR, BODYTEMP_HEATING_MAX)) + else //we're sweating, insulation hinders out ability to reduce heat - but will reduce the amount of heat we get from the environment + H.adjust_bodytemperature(natural*(1/(thermal_protection+1)) + min(thermal_protection * (loc_temp - H.bodytemperature) / BODYTEMP_HEAT_DIVISOR, BODYTEMP_HEATING_MAX)) - if(areatemp > H.bodytemperature) // It is hot here - // Get the thermal protection of the mob - // This returns a 0 - 1 value which corresponds to the percentage of protection - thermal_protection -= H.get_heat_protection(areatemp) - // How much the environment heats the mob with thermal protection - environment_change = min(thermal_protection * (areatemp - H.bodytemperature) / BODYTEMP_HEAT_DIVISOR, \ - BODYTEMP_HEATING_MAX) + // +/- 50 degrees from 310K is the 'safe' zone, where no damage is dealt. + if(H.bodytemperature > BODYTEMP_HEAT_DAMAGE_LIMIT && !HAS_TRAIT(H, TRAIT_RESISTHEAT)) + //Body temperature is too hot. - if(H.bodytemperature < bodytemp_normal) - // Our bodytemp is below normal, insulation helps us retain body heat - // and will reduce the heat we lose to the environment - natural_change = (thermal_protection + 1) * natural - else - // Our bodytemp is above normal and sweating, insulation hinders out ability to reduce heat - // but will reduce the amount of heat we get from the environment - natural_change = (1 / (thermal_protection + 1)) * natural - - else // It is cold here - // Get the thermal protection of the mob, this returns a 0 - 1 value - // which corresponds to the percentage of protection - thermal_protection -= H.get_cold_protection(areatemp) - - if(!H.on_fire) // If we are on fire ignore local temperature in cold areas - if(H.bodytemperature < bodytemp_normal) - // Our bodytemp is below normal, insulation helps us retain body heat - // and will reduce the heat we lose to the environment - natural_change = (thermal_protection + 1) * natural - // How much the environment cools the mob with thermal protection - environment_change = max(thermal_protection * (areatemp - H.bodytemperature) / BODYTEMP_COLD_DIVISOR, \ - BODYTEMP_COOLING_MAX) - else - // Our bodytemp is above normal and sweating, insulation hinders out ability to reduce heat - // but will reduce the amount of heat we get from the environment - natural_change = (1 / (thermal_protection + 1)) * natural - // How much the environment cools the mob with thermal protection - // Extra calculation for hardsuits to bleed off heat - environment_change = max((thermal_protection * (areatemp - H.bodytemperature) + bodytemp_normal - \ - H.bodytemperature) / BODYTEMP_COLD_DIVISOR, BODYTEMP_COOLING_MAX) - - // Apply the temperature changes, combining natual and enviromental changes - H.adjust_bodytemperature(natural_change + environment_change) - -/// Handle the body temperature status effects for the species -/datum/species/proc/handle_body_temperature(mob/living/carbon/human/H) - // +30, -40 degrees from 310K is the 'safe' zone for humans, where no damage is dealt. - // Traits for resitance to heat or cold are handled here. - - // Body temperature is too hot, and we do not have resist traits - if(H.bodytemperature > bodytemp_heat_damage_limit && !HAS_TRAIT(H, TRAIT_RESISTHEAT)) - // Clear cold mood and apply hot mood SEND_SIGNAL(H, COMSIG_CLEAR_MOOD_EVENT, "cold") SEND_SIGNAL(H, COMSIG_ADD_MOOD_EVENT, "hot", /datum/mood_event/hot) - // Remove any slow down from the cold H.remove_movespeed_modifier(MOVESPEED_ID_COLD) - var/burn_damage = 0 + var/burn_damage var/firemodifier = H.fire_stacks / 50 - if (!H.on_fire) // We are not on fire, reduce the modifier + if (H.on_fire) + burn_damage = max(log(2-firemodifier,(H.bodytemperature-BODYTEMP_NORMAL))-5,0) + else firemodifier = min(firemodifier, 0) - // this can go below 5 at log 2.5 - burn_damage = max(log(2 - firemodifier, (H.bodytemperature - bodytemp_normal)) - 5,0) - - // Display alerts based on the amount of fire damage being taken + burn_damage = max(log(2-firemodifier,(H.bodytemperature-BODYTEMP_NORMAL))-5,0) // this can go below 5 at log 2.5 if (burn_damage) switch(burn_damage) if(0 to 2) @@ -1706,122 +1662,55 @@ GLOBAL_LIST_EMPTY(roundstart_races) H.throw_alert("temp", /obj/screen/alert/hot, 2) else H.throw_alert("temp", /obj/screen/alert/hot, 3) - - // Apply species and physiology modifiers to heat damage burn_damage = burn_damage * heatmod * H.physiology.heat_mod - - // 40% for level 3 damage on humans to scream in pain - if (H.stat < UNCONSCIOUS && (prob(burn_damage) * 10) / 4) + if (H.stat < UNCONSCIOUS && (prob(burn_damage) * 10) / 4) //40% for level 3 damage on humans H.emote("scream") - - // Apply the damage to all body parts H.apply_damage(burn_damage, BURN, spread_damage = TRUE) - // Body temperature is too cold, and we do not have resist traits - else if(H.bodytemperature < bodytemp_cold_damage_limit && !HAS_TRAIT(H, TRAIT_RESISTCOLD)) - // clear any hot moods and apply cold mood + else if(H.bodytemperature < BODYTEMP_COLD_DAMAGE_LIMIT && !HAS_TRAIT(H, TRAIT_RESISTCOLD)) SEND_SIGNAL(H, COMSIG_CLEAR_MOOD_EVENT, "hot") SEND_SIGNAL(H, COMSIG_ADD_MOOD_EVENT, "cold", /datum/mood_event/cold) - - // Apply cold slow down - H.add_movespeed_modifier(MOVESPEED_ID_COLD, override = TRUE, \ - multiplicative_slowdown = ((bodytemp_cold_damage_limit - H.bodytemperature) / COLD_SLOWDOWN_FACTOR), \ - blacklisted_movetypes = FLOATING) - - // Display alerts based on the amount of cold damage being taken - // Apply more damage based on how cold you are + //Sorry for the nasty oneline but I don't want to assign a variable on something run pretty frequently + H.add_movespeed_modifier(MOVESPEED_ID_COLD, override = TRUE, multiplicative_slowdown = ((BODYTEMP_COLD_DAMAGE_LIMIT - H.bodytemperature) / COLD_SLOWDOWN_FACTOR), blacklisted_movetypes = FLOATING) switch(H.bodytemperature) - if(200 to bodytemp_cold_damage_limit) + if(200 to BODYTEMP_COLD_DAMAGE_LIMIT) H.throw_alert("temp", /obj/screen/alert/cold, 1) - H.apply_damage(COLD_DAMAGE_LEVEL_1 * coldmod * H.physiology.cold_mod, BURN) + H.apply_damage(COLD_DAMAGE_LEVEL_1*coldmod*H.physiology.cold_mod, BURN) if(120 to 200) H.throw_alert("temp", /obj/screen/alert/cold, 2) - H.apply_damage(COLD_DAMAGE_LEVEL_2 * coldmod * H.physiology.cold_mod, BURN) + H.apply_damage(COLD_DAMAGE_LEVEL_2*coldmod*H.physiology.cold_mod, BURN) else H.throw_alert("temp", /obj/screen/alert/cold, 3) - H.apply_damage(COLD_DAMAGE_LEVEL_3 * coldmod * H.physiology.cold_mod, BURN) + H.apply_damage(COLD_DAMAGE_LEVEL_3*coldmod*H.physiology.cold_mod, BURN) - // We are not to hot or cold, remove status and moods else H.clear_alert("temp") H.remove_movespeed_modifier(MOVESPEED_ID_COLD) SEND_SIGNAL(H, COMSIG_CLEAR_MOOD_EVENT, "cold") SEND_SIGNAL(H, COMSIG_CLEAR_MOOD_EVENT, "hot") -// Handle the air pressure of the environment -// This allows for species overrides -/datum/species/proc/handle_environment_pressure(datum/gas_mixture/environment, mob/living/carbon/human/H) - // Get the current pressure for the area var/pressure = environment.return_pressure() - // Returns how much pressure actually affects the mob. - var/adjusted_pressure = H.calculate_affecting_pressure(pressure) - - // Set alerts and apply damage based on the amount of pressure + var/adjusted_pressure = H.calculate_affecting_pressure(pressure) //Returns how much pressure actually affects the mob. switch(adjusted_pressure) - - // Very high pressure, show an alert and take damage if(HAZARD_HIGH_PRESSURE to INFINITY) if(!HAS_TRAIT(H, TRAIT_RESISTHIGHPRESSURE)) - H.adjustBruteLoss(min(((adjusted_pressure / HAZARD_HIGH_PRESSURE) -1 ) * \ - PRESSURE_DAMAGE_COEFFICIENT, MAX_HIGH_PRESSURE_DAMAGE) * H.physiology.pressure_mod) + H.adjustBruteLoss(min(((adjusted_pressure / HAZARD_HIGH_PRESSURE) -1 ) * PRESSURE_DAMAGE_COEFFICIENT, MAX_HIGH_PRESSURE_DAMAGE) * H.physiology.pressure_mod) H.throw_alert("pressure", /obj/screen/alert/highpressure, 2) else H.clear_alert("pressure") - - // High pressure, show an alert if(WARNING_HIGH_PRESSURE to HAZARD_HIGH_PRESSURE) H.throw_alert("pressure", /obj/screen/alert/highpressure, 1) - - // No pressure issues here clear pressure alerts if(WARNING_LOW_PRESSURE to WARNING_HIGH_PRESSURE) H.clear_alert("pressure") - - // Low pressure here, show an alert if(HAZARD_LOW_PRESSURE to WARNING_LOW_PRESSURE) - // We have low pressure resit trait, clear alerts - if(HAS_TRAIT(H, TRAIT_RESISTLOWPRESSURE)) - H.clear_alert("pressure") - else - H.throw_alert("pressure", /obj/screen/alert/lowpressure, 1) - - // Very low pressure, show an alert and take damage + H.throw_alert("pressure", /obj/screen/alert/lowpressure, 1) else - // We have low pressure resit trait, clear alerts if(HAS_TRAIT(H, TRAIT_RESISTLOWPRESSURE)) H.clear_alert("pressure") else H.adjustBruteLoss(LOW_PRESSURE_DAMAGE * H.physiology.pressure_mod) H.throw_alert("pressure", /obj/screen/alert/lowpressure, 2) -// Used to stabilize the normal body temperature on living mobs -// returns the amount of change to body temperature -/datum/species/proc/natural_bodytemperature_stabilization(mob/living/carbon/human/H) - // Get the difference between our current body temp and what is a normal body temp - var/body_temperature_difference = bodytemp_normal - H.bodytemperature - - switch(H.bodytemperature) - - // When below the cold damage limit body temp raises faster - if(-INFINITY to bodytemp_cold_damage_limit) - return max((body_temperature_difference * H.metabolism_efficiency / BODYTEMP_AUTORECOVERY_DIVISOR), \ - bodytemp_autorecovery_min) - - // When above the cold damage limit the body temp raises slower - if(bodytemp_cold_damage_limit to bodytemp_normal) - return max(body_temperature_difference * H.metabolism_efficiency / BODYTEMP_AUTORECOVERY_DIVISOR, \ - min(body_temperature_difference, bodytemp_autorecovery_min / 4)) - - // When below the heat damage limit the body temp lowers slower - if(bodytemp_normal to bodytemp_heat_damage_limit) - return min(body_temperature_difference * H.metabolism_efficiency / BODYTEMP_AUTORECOVERY_DIVISOR, \ - max(body_temperature_difference, -bodytemp_autorecovery_min / 4)) - - // When above the heat damage limit bring the body temp down faster - // We're dealing with negative numbers - if(bodytemp_heat_damage_limit to INFINITY) - return min((body_temperature_difference / BODYTEMP_AUTORECOVERY_DIVISOR), -bodytemp_autorecovery_min) - - ////////// // FIRE // ////////// diff --git a/code/modules/mob/living/carbon/human/species_types/ethereal.dm b/code/modules/mob/living/carbon/human/species_types/ethereal.dm index e83667baea0..51635af5016 100644 --- a/code/modules/mob/living/carbon/human/species_types/ethereal.dm +++ b/code/modules/mob/living/carbon/human/species_types/ethereal.dm @@ -20,12 +20,6 @@ inherent_traits = list(TRAIT_NOHUNGER) sexes = FALSE //no fetish content allowed toxic_food = NONE - // Body temperature for ethereals is much higher - // they can handle hotter environments - // but they are hurt at cold temps faster as it is harder to move with out the heat energy - bodytemp_normal = (BODYTEMP_NORMAL + 50) - bodytemp_heat_damage_limit = FIRE_MINIMUM_TEMPERATURE_TO_SPREAD // about 150C - bodytemp_cold_damage_limit = (T20C - 10) // about 10c var/current_color var/EMPeffect = FALSE var/emageffect = FALSE @@ -37,6 +31,7 @@ var/static/b2 = 149 //this is shit but how do i fix it? no clue. + /datum/species/ethereal/on_species_gain(mob/living/carbon/C, datum/species/old_species, pref_load) .=..() if(ishuman(C)) diff --git a/code/modules/mob/living/carbon/human/species_types/lizardpeople.dm b/code/modules/mob/living/carbon/human/species_types/lizardpeople.dm index c6d6cf8fad5..56bf72b996e 100644 --- a/code/modules/mob/living/carbon/human/species_types/lizardpeople.dm +++ b/code/modules/mob/living/carbon/human/species_types/lizardpeople.dm @@ -25,15 +25,6 @@ deathsound = 'sound/voice/lizard/deathsound.ogg' wings_icon = "Dragon" species_language_holder = /datum/language_holder/lizard - // lizards are coldblooded - // and can stand a higher temperature range by a few points - bodytemp_heat_damage_limit = (BODYTEMP_HEAT_DAMAGE_LIMIT + 10) - bodytemp_cold_damage_limit = (BODYTEMP_COLD_DAMAGE_LIMIT - 10) - -// Lizards are cold blooded and do not stabilize body temperature naturally -// Return the the amount of change in temperature -/datum/species/lizard/natural_bodytemperature_stabilization(mob/living/carbon/human/H) - return 0 // No natural temperature change, only enviromental /datum/species/lizard/random_name(gender,unique,lastname) if(unique) diff --git a/code/modules/mob/living/carbon/human/species_types/plasmamen.dm b/code/modules/mob/living/carbon/human/species_types/plasmamen.dm index 8a3392df3ae..65484b964c3 100644 --- a/code/modules/mob/living/carbon/human/species_types/plasmamen.dm +++ b/code/modules/mob/living/carbon/human/species_types/plasmamen.dm @@ -23,17 +23,6 @@ outfit_important_for_life = /datum/outfit/plasmaman species_language_holder = /datum/language_holder/skeleton - // Body temperature for Plasmen is much lower - // they can handle colder environments - // but they are hurt at hot temps faster as it is harder to hold their form - // and they will regain temperature more slowly in some situations - bodytemp_normal = (BODYTEMP_NORMAL - 40) - bodytemp_autorecovery_min = 2 - bodytemp_heat_damage_limit = (BODYTEMP_HEAT_DAMAGE_LIMIT - 20) // about 40C - // In the event they loss the cold resit trait - // This also has an effect on how fast they stabilize body temp - bodytemp_cold_damage_limit = (BODYTEMP_COLD_DAMAGE_LIMIT - 50) // about -50c - /datum/species/plasmaman/spec_life(mob/living/carbon/human/H) var/datum/gas_mixture/environment = H.loc.return_air() var/atmos_sealed = FALSE diff --git a/code/modules/mob/living/carbon/human/species_types/zombies.dm b/code/modules/mob/living/carbon/human/species_types/zombies.dm index 9bdd890d4e9..ef5f8546502 100644 --- a/code/modules/mob/living/carbon/human/species_types/zombies.dm +++ b/code/modules/mob/living/carbon/human/species_types/zombies.dm @@ -15,11 +15,6 @@ disliked_food = NONE liked_food = GROSS | MEAT | RAW changesource_flags = MIRROR_BADMIN | WABBAJACK | MIRROR_PRIDE | ERT_SPAWN - // zombies have no body heat unless the environment gives it to them - // they will take damage when things catch fire, or when it is to cold to move - bodytemp_normal = T0C - bodytemp_heat_damage_limit = FIRE_MINIMUM_TEMPERATURE_TO_EXIST - bodytemp_cold_damage_limit = MINIMUM_TEMPERATURE_TO_MOVE /datum/species/zombie/check_roundstart_eligible() if(SSevents.holidays && SSevents.holidays[HALLOWEEN]) @@ -38,14 +33,10 @@ var/regen_cooldown = 0 changesource_flags = MIRROR_BADMIN | WABBAJACK | ERT_SPAWN -// Zombies do not stabilize body temperature they are the walking dead and are cold blooded -// Return the the amount of change in temperature -/datum/species/zombie/natural_bodytemperature_stabilization(mob/living/carbon/human/H) - return 0 // No natural temperature change, only enviromental - /datum/species/zombie/infectious/check_roundstart_eligible() return FALSE + /datum/species/zombie/infectious/spec_stun(mob/living/carbon/human/H,amount) . = min(20, amount) @@ -89,6 +80,7 @@ infection = new() infection.Insert(C) + // Your skin falls off /datum/species/krokodil_addict name = "Human" diff --git a/code/modules/mob/living/carbon/life.dm b/code/modules/mob/living/carbon/life.dm index 40be2346c87..72200d457e6 100644 --- a/code/modules/mob/living/carbon/life.dm +++ b/code/modules/mob/living/carbon/life.dm @@ -567,91 +567,18 @@ GLOBAL_LIST_INIT(ballmer_windows_me_msg, list("Yo man, what if, we like, uh, put if(drunkenness >= 101) adjustToxLoss(2) //Let's be honest you shouldn't be alive by now -// Base carbon environment handler -/mob/living/carbon/handle_environment(datum/gas_mixture/environment) - // Get the curent temperature of the area - var/areatemp = get_temperature(environment) - - // Have the body regulate it's own temperature - var/natural = 0 - if(stat != DEAD) - natural = natural_bodytemperature_stabilization() - - // Get the mobs thermal protection and environmental change - var/thermal_protection = 1 - var/environment_change = 0 - var/natural_change = 0 - if(areatemp > bodytemperature) // It is hot here - // Get the thermal protection of the mob, - // This returns a 0 - 1 value which corresponds to the percentage of protection - thermal_protection -= get_heat_protection(areatemp) - // How much the environment heats the mob - // with thermal protection - environment_change = min(thermal_protection * (areatemp - bodytemperature) / BODYTEMP_HEAT_DIVISOR, BODYTEMP_HEATING_MAX) - if(bodytemperature < BODYTEMP_NORMAL) - // Our bodytemp is below normal we are cold, insulation helps us retain body heat - // and will reduce the heat we lose to the environment - natural_change = (thermal_protection + 1) * natural - else - // Our bodytemp is above normal and sweating, insulation hinders out ability to reduce heat - // but will reduce the amount of heat we get from the environment - natural_change = (1 / (thermal_protection + 1)) * natural - else // It is cold here - // Get the thermal protection of the mob, this returns a 0 - 1 value - // which corresponds to the percentage of protection - thermal_protection -= get_cold_protection(areatemp) - if(!on_fire) // If on fire ignore ignore local temperature in cold areas - // How much the environment cools the mob - // with thermal protection - environment_change = max(thermal_protection * (areatemp - bodytemperature) / BODYTEMP_COLD_DIVISOR, BODYTEMP_COOLING_MAX) - if(bodytemperature < BODYTEMP_NORMAL) - // Our bodytemp is below normal, insulation helps us retain body heat - // and will reduce the heat we lose to the environment - natural_change = (thermal_protection + 1) * natural - else - // Our bodytemp is above normal and sweating, insulation hinders out ability to reduce heat - // but will reduce the amount of heat we get from the environment - natural_change = (1 / (thermal_protection + 1)) * natural - - // Apply the temperature changes - adjust_bodytemperature(natural_change + environment_change) - -// Used to stabilize the normal body temperature on living mobs +//used in human and monkey handle_environment() /mob/living/carbon/proc/natural_bodytemperature_stabilization() - // Get the difference between our current body temp and what is a normal body temp var/body_temperature_difference = BODYTEMP_NORMAL - bodytemperature - switch(bodytemperature) - - // When below the cold damage limit body temp raises faster - if(-INFINITY to BODYTEMP_COLD_DAMAGE_LIMIT) - return max((body_temperature_difference * metabolism_efficiency / BODYTEMP_AUTORECOVERY_DIVISOR), \ - BODYTEMP_AUTORECOVERY_MINIMUM) - - // When above the cold damage limit the body temp raises slower + if(-INFINITY to BODYTEMP_COLD_DAMAGE_LIMIT) //Cold damage limit is 50 below the default, the temperature where you start to feel effects. + return max((body_temperature_difference * metabolism_efficiency / BODYTEMP_AUTORECOVERY_DIVISOR), BODYTEMP_AUTORECOVERY_MINIMUM) if(BODYTEMP_COLD_DAMAGE_LIMIT to BODYTEMP_NORMAL) - return max(body_temperature_difference * metabolism_efficiency / BODYTEMP_AUTORECOVERY_DIVISOR, \ - min(body_temperature_difference, BODYTEMP_AUTORECOVERY_MINIMUM / 4)) - - // When below the heat damage limit the body temp lowers slower - if(BODYTEMP_NORMAL to BODYTEMP_HEAT_DAMAGE_LIMIT) - return min(body_temperature_difference * metabolism_efficiency / BODYTEMP_AUTORECOVERY_DIVISOR, \ - max(body_temperature_difference, -BODYTEMP_AUTORECOVERY_MINIMUM / 4)) - - // When above the heat damage limit bring the body temp down faster - // We're dealing with negative numbers + return max(body_temperature_difference * metabolism_efficiency / BODYTEMP_AUTORECOVERY_DIVISOR, min(body_temperature_difference, BODYTEMP_AUTORECOVERY_MINIMUM/4)) + if(BODYTEMP_NORMAL to BODYTEMP_HEAT_DAMAGE_LIMIT) // Heat damage limit is 50 above the default, the temperature where you start to feel effects. + return min(body_temperature_difference * metabolism_efficiency / BODYTEMP_AUTORECOVERY_DIVISOR, max(body_temperature_difference, -BODYTEMP_AUTORECOVERY_MINIMUM/4)) if(BODYTEMP_HEAT_DAMAGE_LIMIT to INFINITY) - return min((body_temperature_difference / BODYTEMP_AUTORECOVERY_DIVISOR), -BODYTEMP_AUTORECOVERY_MINIMUM) - -// Temperature is the temperature you're being exposed to. -// This returns a 0 - 1 value which corresponds to the percentage of protection -/mob/living/carbon/proc/get_heat_protection(temperature) - return heat_protection - -// Temperature is the temperature you're being exposed to. -// This returns a 0 - 1 value which corresponds to the percentage of protection -/mob/living/carbon/proc/get_cold_protection(temperature) - return cold_protection + return min((body_temperature_difference / BODYTEMP_AUTORECOVERY_DIVISOR), -BODYTEMP_AUTORECOVERY_MINIMUM) //We're dealing with negative numbers ///////// //LIVER// diff --git a/code/modules/mob/living/carbon/monkey/life.dm b/code/modules/mob/living/carbon/monkey/life.dm index f9a0f9443ef..ad54eb08a19 100644 --- a/code/modules/mob/living/carbon/monkey/life.dm +++ b/code/modules/mob/living/carbon/monkey/life.dm @@ -68,9 +68,20 @@ . = ..() // interact with body heat after dealing with the hot air /mob/living/carbon/monkey/handle_environment(datum/gas_mixture/environment) - // Run base mob body temperature proc before taking damage - // this balances body temp to the enviroment and natural stabilization - . = ..() + if(!environment) + return + + var/loc_temp = get_temperature(environment) + + if(stat != DEAD) + adjust_bodytemperature(natural_bodytemperature_stabilization()) + + if(!on_fire) //If you're on fire, you do not heat up or cool down based on surrounding gases + if(loc_temp < bodytemperature) + adjust_bodytemperature(max((loc_temp - bodytemperature) / BODYTEMP_COLD_DIVISOR, BODYTEMP_COOLING_MAX)) + else + adjust_bodytemperature(min((loc_temp - bodytemperature) / BODYTEMP_HEAT_DIVISOR, BODYTEMP_HEATING_MAX)) + if(bodytemperature > BODYTEMP_HEAT_DAMAGE_LIMIT && !HAS_TRAIT(src, TRAIT_RESISTHEAT)) switch(bodytemperature) diff --git a/code/modules/mob/living/life.dm b/code/modules/mob/living/life.dm index ea64a99d237..b1c48aa8c90 100644 --- a/code/modules/mob/living/life.dm +++ b/code/modules/mob/living/life.dm @@ -1,7 +1,3 @@ -// This is the divisor which comes into play when the mob's loc temperature is different than their body temperature. -// Make this lower to change body temp faster. -#define BODYTEMP_DIVISOR 8 - /mob/living/proc/Life(seconds, times_fired) set waitfor = FALSE set invisibility = 0 @@ -88,15 +84,7 @@ return /mob/living/proc/handle_environment(datum/gas_mixture/environment) - // Get the current air temperature - var/loc_temp = get_temperature(environment) - - // Update the body temperature - if(loc_temp < bodytemperature) // it is cold here - if(!on_fire) // do not reduce body temp when on fire - adjust_bodytemperature(max((loc_temp - bodytemperature) / BODYTEMP_DIVISOR, BODYTEMP_COOLING_MAX)) - else // this is a hot place - adjust_bodytemperature(min((loc_temp - bodytemperature) / BODYTEMP_DIVISOR, BODYTEMP_HEATING_MAX)) + return /mob/living/proc/handle_fire() if(fire_stacks < 0) //If we've doused ourselves in water to avoid fire, dry off slowly @@ -155,5 +143,3 @@ if(gravity >= GRAVITY_DAMAGE_TRESHOLD) //Aka gravity values of 3 or more var/grav_stregth = gravity - GRAVITY_DAMAGE_TRESHOLD adjustBruteLoss(min(grav_stregth,3)) - -#undef BODYTEMP_DIVISOR diff --git a/code/modules/mob/living/simple_animal/slime/life.dm b/code/modules/mob/living/simple_animal/slime/life.dm index 3086e0ae094..88589b550b8 100644 --- a/code/modules/mob/living/simple_animal/slime/life.dm +++ b/code/modules/mob/living/simple_animal/slime/life.dm @@ -108,22 +108,14 @@ AIproc = 0 /mob/living/simple_animal/slime/handle_environment(datum/gas_mixture/environment) - // Get the current air temperature + if(!environment) + return + var/loc_temp = get_temperature(environment) - // This divisor controls how fast body temperature changes - // lowering this number changes body temp faster - var/divisor = 10 - // If the difference is great then reduce the divisor to stabilize faster - if(abs(loc_temp - bodytemperature) > 50) - divisor = 5 + adjust_bodytemperature(adjust_body_temperature(bodytemperature, loc_temp, 1)) - // Update the body temperature - if(loc_temp < bodytemperature) // It is cold here - if(!on_fire) // Do not reduce body temp when on fire - adjust_bodytemperature((loc_temp - bodytemperature) / divisor) - else // This is a hot place - adjust_bodytemperature((loc_temp - bodytemperature) / divisor) + //Account for massive pressure differences if(bodytemperature < (T0C + 5)) // start calculating temperature damage etc if(bodytemperature <= (T0C - 40)) // stun temperature @@ -134,6 +126,7 @@ adjustBruteLoss(200) else adjustBruteLoss(round(sqrt(bodytemperature)) * 2) + else Tempstun = 0 @@ -158,8 +151,26 @@ updatehealth() + return //TODO: DEFERRED +/mob/living/simple_animal/slime/proc/adjust_body_temperature(current, loc_temp, boost) + var/temperature = current + var/difference = abs(current-loc_temp) //get difference + var/increments// = difference/10 //find how many increments apart they are + if(difference > 50) + increments = difference/5 + else + increments = difference/10 + var/change = increments*boost // Get the amount to change by (x per increment) + var/temp_change + if(current < loc_temp) + temperature = min(loc_temp, temperature+change) + else if(current > loc_temp) + temperature = max(loc_temp, temperature-change) + temp_change = (temperature - current) + return temp_change + /mob/living/simple_animal/slime/handle_status_effects() ..() if(prob(30) && !stat) diff --git a/code/modules/mob/living/simple_animal/status_procs.dm b/code/modules/mob/living/simple_animal/status_procs.dm index c5f0c8cb4b9..62a262f9e60 100644 --- a/code/modules/mob/living/simple_animal/status_procs.dm +++ b/code/modules/mob/living/simple_animal/status_procs.dm @@ -8,6 +8,8 @@ /mob/living/simple_animal/set_blindness() return + + /mob/living/simple_animal/blur_eyes() return @@ -17,5 +19,7 @@ /mob/living/simple_animal/set_blurriness() return + + /mob/living/simple_animal/become_blind() return From 7ac5690cb9c8c2bad2acefa656c5195f6ab4f285 Mon Sep 17 00:00:00 2001 From: tgstation-server Date: Wed, 1 Jan 2020 22:01:35 +0000 Subject: [PATCH 02/18] Automatic changelog compile, [ci skip] --- html/changelog.html | 60 ++++++++++++++++++++++ html/changelogs/.all_changelog.yml | 48 +++++++++++++++++ html/changelogs/AutoChangeLog-pr-48271.yml | 4 -- html/changelogs/AutoChangeLog-pr-48321.yml | 6 --- html/changelogs/AutoChangeLog-pr-48410.yml | 4 -- html/changelogs/AutoChangeLog-pr-48454.yml | 4 -- html/changelogs/AutoChangeLog-pr-48461.yml | 4 -- html/changelogs/AutoChangeLog-pr-48465.yml | 5 -- html/changelogs/AutoChangeLog-pr-48467.yml | 4 -- html/changelogs/AutoChangeLog-pr-48468.yml | 4 -- html/changelogs/AutoChangeLog-pr-48471.yml | 4 -- html/changelogs/AutoChangeLog-pr-48477.yml | 4 -- html/changelogs/AutoChangeLog-pr-48479.yml | 4 -- html/changelogs/AutoChangeLog-pr-48480.yml | 5 -- html/changelogs/AutoChangeLog-pr-48481.yml | 4 -- html/changelogs/AutoChangeLog-pr-48486.yml | 4 -- html/changelogs/AutoChangeLog-pr-48488.yml | 4 -- html/changelogs/AutoChangeLog-pr-48490.yml | 6 --- html/changelogs/AutoChangeLog-pr-48492.yml | 4 -- html/changelogs/AutoChangeLog-pr-48501.yml | 4 -- html/changelogs/AutoChangeLog-pr-48502.yml | 4 -- 21 files changed, 108 insertions(+), 82 deletions(-) delete mode 100644 html/changelogs/AutoChangeLog-pr-48271.yml delete mode 100644 html/changelogs/AutoChangeLog-pr-48321.yml delete mode 100644 html/changelogs/AutoChangeLog-pr-48410.yml delete mode 100644 html/changelogs/AutoChangeLog-pr-48454.yml delete mode 100644 html/changelogs/AutoChangeLog-pr-48461.yml delete mode 100644 html/changelogs/AutoChangeLog-pr-48465.yml delete mode 100644 html/changelogs/AutoChangeLog-pr-48467.yml delete mode 100644 html/changelogs/AutoChangeLog-pr-48468.yml delete mode 100644 html/changelogs/AutoChangeLog-pr-48471.yml delete mode 100644 html/changelogs/AutoChangeLog-pr-48477.yml delete mode 100644 html/changelogs/AutoChangeLog-pr-48479.yml delete mode 100644 html/changelogs/AutoChangeLog-pr-48480.yml delete mode 100644 html/changelogs/AutoChangeLog-pr-48481.yml delete mode 100644 html/changelogs/AutoChangeLog-pr-48486.yml delete mode 100644 html/changelogs/AutoChangeLog-pr-48488.yml delete mode 100644 html/changelogs/AutoChangeLog-pr-48490.yml delete mode 100644 html/changelogs/AutoChangeLog-pr-48492.yml delete mode 100644 html/changelogs/AutoChangeLog-pr-48501.yml delete mode 100644 html/changelogs/AutoChangeLog-pr-48502.yml diff --git a/html/changelog.html b/html/changelog.html index a29be0d1545..773a94c87fc 100644 --- a/html/changelog.html +++ b/html/changelog.html @@ -51,6 +51,66 @@ -->
+

01 January 2020

+

Cyberboss updated:

+
    +
  • Fixed crafting not working in most scenarios
  • +
+

Fikou updated:

+
    +
  • the debug outfit now has an omnitool
  • +
  • Adjusted hypertool sprite.
  • +
+

Krysonism updated:

+
    +
  • A set of amputation shears have been added to the medivend.
  • +
  • Added sparklers and firecrackers to the HoP's office during new years eve.
  • +
  • Ian can now wear the festive hat, one is provided to him at the end of the year.
  • +
+

ShizCalev updated:

+
    +
  • Fixed firing pins not dropping while being replaced when the gun containing it is held by a mob.
  • +
  • Hacking a firing pin out of a gun is no longer done via a crafting menu - you can now do it by simply holding the gun in your hand and clicking it with a welder/screwdriver/wirecutters.
  • +
+

Skoglol updated:

+
    +
  • Orion trail will no longer give you a radio for winning. Arcades have vending sound.
  • +
  • Syndicate codewords can now be locations.
  • +
  • Voice of god no longer causes you to get muted.
  • +
  • Blood contract can no longer target someone on the centcom z-level.
  • +
+

StonebayKyle updated:

+
    +
  • Plumbing-surgery connection on Meta is now not considered maintenance.
  • +
  • Viro-medbay connection on Delta is now not considered maintenance.
  • +
  • Nanotrasen has removed expensive maintenance-exclusive radiation shields in specific areas on two of their research stations.
  • +
+

WarlockD updated:

+
    +
  • Crafting recipe for construction bags.
  • +
+

actioninja updated:

+
    +
  • Offstation vending machines are free again
  • +
  • Cargo ui has tooltip descriptions again
  • +
+

cacogen updated:

+
    +
  • Ian's birthday is now the date of his creation in 2011, not the date he was given age
  • +
  • Adds a couple of relevant station prefixes to Ian's birthday holiday
  • +
  • MetaStation and KiloStation doctors can turn on and modify behaviour of Scrubs, MD
  • +
+

iain0 updated:

+
    +
  • MetaStation Port Aft Solar Control SMES input isolated from main power line, like all other solar control rooms.
  • +
+

nightred updated:

+
    +
  • Species body temperature handling
  • +
  • Plasmamen, Lizardpeople, Ethereal have custom body temperatures to deal with
  • +
  • clean up of the environment handles for mobs and species
  • +
+

31 December 2019

AnturK updated: