From b9fa4330873fa154a3807a3fdf75de3ece25210b Mon Sep 17 00:00:00 2001 From: mwerezak Date: Sat, 21 Jun 2014 16:53:18 -0400 Subject: [PATCH] Adds suit cooling device Also: Breathing in hot/cold air will affect your body temperature. Fixes old body temperature stabilization code not working. Thermometer icon now adjusts based on species. Reduced BODYTEMP_AUTORECOVERY_MINIMUM to a less ridiculous value. --- baystation12.dme | 1 + code/game/gamemodes/cult/cult_items.dm | 2 +- .../objects/items/devices/suit_cooling.dm | 161 ++++++++++++++++++ .../game/objects/items/weapons/tanks/tanks.dm | 1 + code/modules/clothing/clothing.dm | 2 +- code/modules/clothing/spacesuits/ninja.dm | 2 +- code/modules/clothing/spacesuits/rig.dm | 8 +- code/modules/mob/living/carbon/human/life.dm | 158 +++++++++++------ .../xenoarchaeology/tools/anomaly_suit.dm | 2 +- code/setup.dm | 2 +- 10 files changed, 280 insertions(+), 59 deletions(-) create mode 100644 code/game/objects/items/devices/suit_cooling.dm diff --git a/baystation12.dme b/baystation12.dme index 43733732a07..6a75afbf289 100644 --- a/baystation12.dme +++ b/baystation12.dme @@ -487,6 +487,7 @@ #include "code\game\objects\items\devices\pipe_painter.dm" #include "code\game\objects\items\devices\powersink.dm" #include "code\game\objects\items\devices\scanners.dm" +#include "code\game\objects\items\devices\suit_cooling.dm" #include "code\game\objects\items\devices\taperecorder.dm" #include "code\game\objects\items\devices\traitordevices.dm" #include "code\game\objects\items\devices\transfer_valve.dm" diff --git a/code/game/gamemodes/cult/cult_items.dm b/code/game/gamemodes/cult/cult_items.dm index 4e38f4fe447..d55417c5f5e 100644 --- a/code/game/gamemodes/cult/cult_items.dm +++ b/code/game/gamemodes/cult/cult_items.dm @@ -98,7 +98,7 @@ item_state = "cult_armour" desc = "A bulky suit of armour, bristling with spikes. It looks space proof." w_class = 3 - allowed = list(/obj/item/weapon/tome,/obj/item/weapon/melee/cultblade,/obj/item/weapon/tank/emergency_oxygen) + allowed = list(/obj/item/weapon/tome,/obj/item/weapon/melee/cultblade,/obj/item/weapon/tank/emergency_oxygen,/obj/item/device/suit_cooling_unit) slowdown = 1 armor = list(melee = 60, bullet = 50, laser = 30,energy = 15, bomb = 30, bio = 30, rad = 30) siemens_coefficient = 0 \ No newline at end of file diff --git a/code/game/objects/items/devices/suit_cooling.dm b/code/game/objects/items/devices/suit_cooling.dm new file mode 100644 index 00000000000..4035ab3c0c3 --- /dev/null +++ b/code/game/objects/items/devices/suit_cooling.dm @@ -0,0 +1,161 @@ +/obj/item/device/suit_cooling_unit + name = "portable suit cooling unit" + desc = "A portable heat sink and liquid cooled radiator that can be hooked up to a space suit's existing temperature controls to provide industrial levels of cooling." + w_class = 4 + icon = 'icons/obj/power.dmi' //temporary, I hope + icon_state = "portgen0" + slot_flags = SLOT_BACK //you can carry it on your back if you want, but it won't do anything unless attached to suit storage + + var/on = 0 //is it turned on? + var/cover_open = 0 //is the cover open? + var/obj/item/weapon/cell/cell + var/max_cooling = 12 //in degrees per second - probably don't need to mess with heat capacity here + var/charge_consumption = 16.6 //charge per second at max_cooling + var/thermostat = T20C + + //TODO: make it heat up the surroundings when not in space + +/obj/item/device/suit_cooling_unit/proc/cool_mob(mob/M) + if (!on || !cell) return + + //make sure they have a suit and we are attached to it + if (!attached_to_suit(M)) + return + + var/mob/living/carbon/human/H = M + + var/efficiency = H.get_pressure_protection() //you need to have a good seal for effective cooling + var/env_temp = get_environment_temperature() //wont save you from a fire + var/temp_adj = min(H.bodytemperature - max(thermostat, env_temp), max_cooling) + + if (temp_adj < 0) //only cools, doesn't heat + return + + var/charge_usage = (temp_adj/max_cooling)*charge_consumption + + H.bodytemperature -= temp_adj*efficiency + + cell.use(charge_usage) + + if(cell.charge <= 0) + turn_off() + +/obj/item/device/suit_cooling_unit/proc/get_environment_temperature() + if (ishuman(loc)) + var/mob/living/carbon/human/H = loc + if(istype(H.loc, /obj/mecha)) + var/obj/mecha/M = loc + return M.return_temperature() + else if(istype(H.loc, /obj/machinery/atmospherics/unary/cryo_cell)) + return H.loc:air_contents.temperature + + var/turf/T = get_turf(src) + if(istype(T, /turf/space)) + return 0 //space has no temperature, this just makes sure the cooling unit works in space + + var/datum/gas_mixture/environment = T.return_air() + if (!environment) + return 0 + + return environment.temperature + +/obj/item/device/suit_cooling_unit/proc/attached_to_suit(mob/M) + if (!ishuman(M)) + return 0 + + var/mob/living/carbon/human/H = M + + if (!H.wear_suit || H.s_store != src) + return 0 + + return 1 + +/obj/item/device/suit_cooling_unit/proc/turn_on() + if(!cell) + return + if(cell.charge <= 0) + return + + on = 1 + updateicon() + +/obj/item/device/suit_cooling_unit/proc/turn_off() + if (ismob(src.loc)) + src.loc << "\The [src] clicks and whines as it powers down." //let them know + on = 0 + updateicon() + +/obj/item/device/suit_cooling_unit/attack_self(mob/user as mob) + if(cover_open && cell) + if(ishuman(user)) + user.put_in_hands(cell) + else + cell.loc = get_turf(loc) + + cell.add_fingerprint(user) + cell.updateicon() + + user << "You remove the [src.cell]." + src.cell = null + updateicon() + return + + //TODO use a UI like the air tanks + if(on) + turn_off() + else + turn_on() + if (on) + user << "You switch on the [src]." + +/obj/item/device/suit_cooling_unit/attackby(obj/item/weapon/W as obj, mob/user as mob) + if (istype(W, /obj/item/weapon/screwdriver)) + if(cover_open) + cover_open = 0 + user << "You screw the panel into place." + else + cover_open = 1 + user << "You unscrew the panel." + updateicon() + return + + if (istype(W, /obj/item/weapon/cell)) + if(cover_open) + if(cell) + user << "There is a [cell] already installed here." + else + user.drop_item() + W.loc = src + cell = W + user << "You insert the [cell]." + updateicon() + return + + return ..() + +/obj/item/device/suit_cooling_unit/proc/updateicon() + return 0 //TODO + +/obj/item/device/suit_cooling_unit/examine() + set src in view(1) + + ..() + + if (on) + if (attached_to_suit(src.loc)) + usr << "It's switched on and running." + else + usr << "It's switched on, but not attached to anything." + else + usr << "It is switched off." + + if (cover_open) + if(cell) + usr << "The panel is open, exposing the [cell]." + else + usr << "The panel is open." + + if (cell) + usr << "The charge meter reads [round(cell.percent())]%." + else + usr << "It doesn't have a power cell installed." \ No newline at end of file diff --git a/code/game/objects/items/weapons/tanks/tanks.dm b/code/game/objects/items/weapons/tanks/tanks.dm index 6623c99cb3e..8b883f818ac 100644 --- a/code/game/objects/items/weapons/tanks/tanks.dm +++ b/code/game/objects/items/weapons/tanks/tanks.dm @@ -6,6 +6,7 @@ icon = 'icons/obj/tank.dmi' flags = FPRINT | TABLEPASS | CONDUCT slot_flags = SLOT_BACK + w_class = 3 pressure_resistance = ONE_ATMOSPHERE*5 diff --git a/code/modules/clothing/clothing.dm b/code/modules/clothing/clothing.dm index 84acdb6acad..76e4bb01d29 100644 --- a/code/modules/clothing/clothing.dm +++ b/code/modules/clothing/clothing.dm @@ -220,7 +220,7 @@ BLIND // can't see anything permeability_coefficient = 0.02 flags = FPRINT | TABLEPASS | STOPSPRESSUREDMAGE | THICKMATERIAL body_parts_covered = UPPER_TORSO|LOWER_TORSO|LEGS|FEET|ARMS|HANDS - allowed = list(/obj/item/device/flashlight,/obj/item/weapon/tank/emergency_oxygen) + allowed = list(/obj/item/device/flashlight,/obj/item/weapon/tank/emergency_oxygen,/obj/item/device/suit_cooling_unit) slowdown = 3 armor = list(melee = 0, bullet = 0, laser = 0,energy = 0, bomb = 0, bio = 100, rad = 50) flags_inv = HIDEGLOVES|HIDESHOES|HIDEJUMPSUIT|HIDETAIL diff --git a/code/modules/clothing/spacesuits/ninja.dm b/code/modules/clothing/spacesuits/ninja.dm index c146bb21a50..c51594e0e69 100644 --- a/code/modules/clothing/spacesuits/ninja.dm +++ b/code/modules/clothing/spacesuits/ninja.dm @@ -13,7 +13,7 @@ desc = "A unique, vaccum-proof suit of nano-enhanced armor designed specifically for Spider Clan assassins." icon_state = "s-ninja" item_state = "s-ninja_suit" - allowed = list(/obj/item/weapon/gun,/obj/item/ammo_magazine,/obj/item/ammo_casing,/obj/item/weapon/melee/baton,/obj/item/weapon/handcuffs,/obj/item/weapon/tank,/obj/item/weapon/cell) + allowed = list(/obj/item/weapon/gun,/obj/item/ammo_magazine,/obj/item/ammo_casing,/obj/item/weapon/melee/baton,/obj/item/weapon/handcuffs,/obj/item/weapon/tank,/obj/item/device/suit_cooling_unit,/obj/item/weapon/cell) slowdown = 0 armor = list(melee = 60, bullet = 50, laser = 30,energy = 15, bomb = 30, bio = 30, rad = 30) siemens_coefficient = 0.2 diff --git a/code/modules/clothing/spacesuits/rig.dm b/code/modules/clothing/spacesuits/rig.dm index ab3f723674c..995e1167176 100644 --- a/code/modules/clothing/spacesuits/rig.dm +++ b/code/modules/clothing/spacesuits/rig.dm @@ -55,7 +55,7 @@ item_state = "eng_hardsuit" slowdown = 1 armor = list(melee = 40, bullet = 5, laser = 20,energy = 5, bomb = 35, bio = 100, rad = 80) - allowed = list(/obj/item/device/flashlight,/obj/item/weapon/tank,/obj/item/weapon/storage/bag/ore,/obj/item/device/t_scanner,/obj/item/weapon/pickaxe, /obj/item/weapon/rcd) + allowed = list(/obj/item/device/flashlight,/obj/item/weapon/tank,/obj/item/device/suit_cooling_unit,/obj/item/weapon/storage/bag/ore,/obj/item/device/t_scanner,/obj/item/weapon/pickaxe, /obj/item/weapon/rcd) heat_protection = UPPER_TORSO|LOWER_TORSO|LEGS|FEET|ARMS|HANDS max_heat_protection_temperature = SPACE_SUIT_MAX_HEAT_PROTECTION_TEMPERATURE @@ -359,7 +359,7 @@ slowdown = 1 w_class = 3 armor = list(melee = 60, bullet = 50, laser = 30, energy = 15, bomb = 35, bio = 100, rad = 60) - allowed = list(/obj/item/device/flashlight,/obj/item/weapon/tank,/obj/item/weapon/gun,/obj/item/ammo_magazine,/obj/item/ammo_casing,/obj/item/weapon/melee/baton,/obj/item/weapon/melee/energy/sword,/obj/item/weapon/handcuffs) + allowed = list(/obj/item/device/flashlight,/obj/item/weapon/tank,/obj/item/device/suit_cooling_unit,/obj/item/weapon/gun,/obj/item/ammo_magazine,/obj/item/ammo_casing,/obj/item/weapon/melee/baton,/obj/item/weapon/melee/energy/sword,/obj/item/weapon/handcuffs) siemens_coefficient = 0.6 species_restricted = list("exclude","Unathi","Tajaran","Skrell","Vox") @@ -402,7 +402,7 @@ name = "medical hardsuit" desc = "A special suit that protects against hazardous, low pressure environments. Has minor radiation shielding." item_state = "medical_hardsuit" - allowed = list(/obj/item/device/flashlight,/obj/item/weapon/tank,/obj/item/weapon/storage/firstaid,/obj/item/device/healthanalyzer,/obj/item/stack/medical) + allowed = list(/obj/item/device/flashlight,/obj/item/weapon/tank,/obj/item/device/suit_cooling_unit,/obj/item/weapon/storage/firstaid,/obj/item/device/healthanalyzer,/obj/item/stack/medical) armor = list(melee = 30, bullet = 5, laser = 20,energy = 5, bomb = 25, bio = 100, rad = 50) //Security @@ -421,7 +421,7 @@ desc = "A special suit that protects against hazardous, low pressure environments. Has an additional layer of armor." item_state = "sec_hardsuit" armor = list(melee = 60, bullet = 10, laser = 30, energy = 5, bomb = 45, bio = 100, rad = 10) - allowed = list(/obj/item/weapon/gun,/obj/item/device/flashlight,/obj/item/weapon/tank,/obj/item/weapon/melee/baton) + allowed = list(/obj/item/weapon/gun,/obj/item/device/flashlight,/obj/item/weapon/tank,/obj/item/device/suit_cooling_unit,/obj/item/weapon/melee/baton) siemens_coefficient = 0.7 diff --git a/code/modules/mob/living/carbon/human/life.dm b/code/modules/mob/living/carbon/human/life.dm index 5ef87cd1e21..04f49d78ce7 100644 --- a/code/modules/mob/living/carbon/human/life.dm +++ b/code/modules/mob/living/carbon/human/life.dm @@ -129,12 +129,10 @@ G.process() -/mob/living/carbon/human/calculate_affecting_pressure(var/pressure) - ..() - var/pressure_difference = abs( pressure - ONE_ATMOSPHERE ) - +//Much like get_heat_protection(), 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. +/mob/living/carbon/human/proc/get_pressure_protection() var/pressure_adjustment_coefficient = 1 //Determins how much the clothing you are wearing protects you in percent. - + if(head && (head.flags & STOPSPRESSUREDMAGE)) pressure_adjustment_coefficient -= PRESSURE_HEAD_REDUCTION_COEFFICIENT @@ -147,10 +145,16 @@ if(S.can_breach && S.damage) var/pressure_loss = S.damage * 0.1 pressure_adjustment_coefficient += pressure_loss - + pressure_adjustment_coefficient = min(1,max(pressure_adjustment_coefficient,0)) //So it isn't less than 0 or larger than 1. + + return 1 - pressure_adjustment_coefficient //want 0 to be bad protection, 1 to be good protection - pressure_difference = pressure_difference * pressure_adjustment_coefficient +/mob/living/carbon/human/calculate_affecting_pressure(var/pressure) + ..() + var/pressure_difference = abs( pressure - ONE_ATMOSPHERE ) + + pressure_difference = pressure_difference * (1 - get_pressure_protection()) if(pressure > ONE_ATMOSPHERE) return ONE_ATMOSPHERE + pressure_difference @@ -616,14 +620,14 @@ adjustOxyLoss(-5) // Hot air hurts :( - if( (abs(310.15 - breath.temperature) > 50) && !(COLD_RESISTANCE in mutations)) + if( (breath.temperature < species.cold_level_1 || breath.temperature > species.heat_level_1) && !(COLD_RESISTANCE in mutations)) if(status_flags & GODMODE) return 1 if(breath.temperature < species.cold_level_1) if(prob(20)) - src << "\red You feel your face freezing and an icicle forming in your lungs!" + src << "\red You feel your face freezing and icicles forming in your lungs!" else if(breath.temperature > species.heat_level_1) if(prob(20)) src << "\red You feel your face burning and a searing heat in your lungs!" @@ -647,9 +651,21 @@ if(species.heat_level_3 to INFINITY) apply_damage(HEAT_GAS_DAMAGE_LEVEL_3, BURN, "head", used_weapon = "Excessive Heat") fire_alert = max(fire_alert, 2) - - //Temporary fixes to the alerts. - + + //breathing in hot/cold air also heats/cools you a bit + var/temp_adj = breath.temperature - bodytemperature + if (temp_adj < 0) + temp_adj /= (BODYTEMP_COLD_DIVISOR * 5) //don't raise temperature as much as if we were directly exposed + else + temp_adj /= (BODYTEMP_HEAT_DIVISOR * 5) //don't raise temperature as much as if we were directly exposed + + var/relative_density = breath.total_moles() / (MOLES_CELLSTANDARD * BREATH_PERCENTAGE) + temp_adj *= relative_density + + if (temp_adj > BODYTEMP_HEATING_MAX) temp_adj = BODYTEMP_HEATING_MAX + if (temp_adj < BODYTEMP_COOLING_MAX) temp_adj = BODYTEMP_COOLING_MAX + //world << "Breath: [breath.temperature], [src]: [bodytemperature], Adjusting: [temp_adj]" + bodytemperature += temp_adj return 1 proc/handle_environment(datum/gas_mixture/environment) @@ -665,7 +681,6 @@ if(istype(loc, /obj/mecha)) var/obj/mecha/M = loc loc_temp = M.return_temperature() - else if(istype(get_turf(src), /turf/space)) else if(istype(loc, /obj/machinery/atmospherics/unary/cryo_cell)) loc_temp = loc:air_contents.temperature else @@ -691,6 +706,7 @@ if (temp_adj > BODYTEMP_HEATING_MAX) temp_adj = BODYTEMP_HEATING_MAX if (temp_adj < BODYTEMP_COOLING_MAX) temp_adj = BODYTEMP_COOLING_MAX + //world << "Environment: [loc_temp], [src]: [bodytemperature], Adjusting: [temp_adj]" bodytemperature += temp_adj // +/- 50 degrees from 310.15K is the 'safe' zone, where no damage is dealt. @@ -700,13 +716,17 @@ if(status_flags & GODMODE) return 1 //godmode switch(bodytemperature) if(species.heat_level_1 to species.heat_level_2) - apply_damage(HEAT_DAMAGE_LEVEL_1, BURN, used_weapon = "High Body Temperature") + //I'm thinking it might be better to use adjustFireloss here instead of apply_damage so that damage is spread evenly across organs, instead of being dealt mostly to the chest + //apply_damage(HEAT_DAMAGE_LEVEL_1, BURN, used_weapon = "High Body Temperature") + adjustFireloss(HEAT_DAMAGE_LEVEL_1) fire_alert = max(fire_alert, 2) if(species.heat_level_2 to species.heat_level_3) - apply_damage(HEAT_DAMAGE_LEVEL_2, BURN, used_weapon = "High Body Temperature") + //apply_damage(HEAT_DAMAGE_LEVEL_2, BURN, used_weapon = "High Body Temperature") + adjustFireloss(HEAT_DAMAGE_LEVEL_2) fire_alert = max(fire_alert, 2) if(species.heat_level_3 to INFINITY) - apply_damage(HEAT_DAMAGE_LEVEL_3, BURN, used_weapon = "High Body Temperature") + //apply_damage(HEAT_DAMAGE_LEVEL_3, BURN, used_weapon = "High Body Temperature") + adjustFireloss(HEAT_DAMAGE_LEVEL_3) fire_alert = max(fire_alert, 2) else if(bodytemperature < species.cold_level_1) @@ -715,13 +735,17 @@ if(!istype(loc, /obj/machinery/atmospherics/unary/cryo_cell)) switch(bodytemperature) if(species.cold_level_2 to species.cold_level_1) - apply_damage(COLD_DAMAGE_LEVEL_1, BURN, used_weapon = "Low Body Temperature") + //I'm thinking it might be better to use adjustFireloss here instead of apply_damage so that damage is spread evenly across organs, instead of being dealt mostly to the chest + //apply_damage(COLD_DAMAGE_LEVEL_1, BURN, used_weapon = "Low Body Temperature") + adjustFireloss(COLD_DAMAGE_LEVEL_1) fire_alert = max(fire_alert, 1) if(species.cold_level_3 to species.cold_level_2) - apply_damage(COLD_DAMAGE_LEVEL_2, BURN, used_weapon = "Low Body Temperature") + //apply_damage(COLD_DAMAGE_LEVEL_2, BURN, used_weapon = "Low Body Temperature") + adjustFireloss(COLD_DAMAGE_LEVEL_2) fire_alert = max(fire_alert, 1) if(-INFINITY to species.cold_level_3) - apply_damage(COLD_DAMAGE_LEVEL_3, BURN, used_weapon = "Low Body Temperature") + //apply_damage(COLD_DAMAGE_LEVEL_3, BURN, used_weapon = "Low Body Temperature") + adjustFireloss(COLD_DAMAGE_LEVEL_3) fire_alert = max(fire_alert, 1) // Account for massive pressure differences. Done by Polymorph @@ -729,7 +753,7 @@ if(status_flags & GODMODE) return 1 //godmode if(adjusted_pressure >= species.hazard_high_pressure) - adjustBruteLoss( min( ( (adjusted_pressure / species.hazard_high_pressure) -1 )*PRESSURE_DAMAGE_COEFFICIENT , MAX_HIGH_PRESSURE_DAMAGE) ) + adjustBruteLoss(min( ( (adjusted_pressure / species.hazard_high_pressure) -1 )*PRESSURE_DAMAGE_COEFFICIENT , MAX_HIGH_PRESSURE_DAMAGE)) pressure_alert = 2 else if(adjusted_pressure >= species.warning_high_pressure) pressure_alert = 1 @@ -737,13 +761,9 @@ pressure_alert = 0 else if(adjusted_pressure >= species.hazard_low_pressure) pressure_alert = -1 - - if(species && species.flags & IS_SYNTHETIC) - bodytemperature += 0.5 * TEMPERATURE_DAMAGE_COEFFICIENT //Synthetics suffer overheating in a vaccuum. ~Z - else if( !(COLD_RESISTANCE in mutations)) - apply_damage(LOW_PRESSURE_DAMAGE, BRUTE, used_weapon = "Low Pressure") + adjustBruteLoss(LOW_PRESSURE_DAMAGE) pressure_alert = -2 else pressure_alert = -1 @@ -772,29 +792,38 @@ */ proc/stabilize_body_temperature() - if (species && species.flags & IS_SYNTHETIC) + //TODO find a better place to put this + if (s_store && istype(s_store, /obj/item/device/suit_cooling_unit)) + var/obj/item/device/suit_cooling_unit/CU = s_store + CU.cool_mob(src) + + if (species.flags & IS_SYNTHETIC) bodytemperature += species.synth_temp_gain //that CPU/posibrain just keeps putting out heat. return var/body_temperature_difference = species.body_temperature - bodytemperature + if (abs(body_temperature_difference) < 0.5) return //fuck this precision - switch(bodytemperature) - if(-INFINITY to species.cold_level_1) //260.15 is 310.15 - 50, the temperature where you start to feel effects. - if(nutrition >= 2) //If we are very, very cold we'll use up quite a bit of nutriment to heat us up. - nutrition -= 2 - var/recovery_amt = max((body_temperature_difference / BODYTEMP_AUTORECOVERY_DIVISOR), BODYTEMP_AUTORECOVERY_MINIMUM) + + if(bodytemperature < species.cold_level_1) //260.15 is 310.15 - 50, the temperature where you start to feel effects. + if(nutrition >= 2) //If we are very, very cold we'll use up quite a bit of nutriment to heat us up. + nutrition -= 2 + var/recovery_amt = max((body_temperature_difference / BODYTEMP_AUTORECOVERY_DIVISOR), BODYTEMP_AUTORECOVERY_MINIMUM) + //world << "Cold. Difference = [body_temperature_difference]. Recovering [recovery_amt]" // log_debug("Cold. Difference = [body_temperature_difference]. Recovering [recovery_amt]") - bodytemperature += recovery_amt - if(species.cold_level_1 to species.heat_level_1) - var/recovery_amt = body_temperature_difference / BODYTEMP_AUTORECOVERY_DIVISOR + bodytemperature += recovery_amt + else if(species.cold_level_1 <= bodytemperature && bodytemperature <= species.heat_level_1) + var/recovery_amt = body_temperature_difference / BODYTEMP_AUTORECOVERY_DIVISOR + //world << "Norm. Difference = [body_temperature_difference]. Recovering [recovery_amt]" // log_debug("Norm. Difference = [body_temperature_difference]. Recovering [recovery_amt]") - bodytemperature += recovery_amt - if(species.heat_level_1 to INFINITY) //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...~ - var/recovery_amt = min((body_temperature_difference / BODYTEMP_AUTORECOVERY_DIVISOR), -BODYTEMP_AUTORECOVERY_MINIMUM) //We're dealing with negative numbers + bodytemperature += recovery_amt + else if(bodytemperature > 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...~ + var/recovery_amt = min((body_temperature_difference / BODYTEMP_AUTORECOVERY_DIVISOR), -BODYTEMP_AUTORECOVERY_MINIMUM) //We're dealing with negative numbers + //world << "Hot. Difference = [body_temperature_difference]. Recovering [recovery_amt]" // log_debug("Hot. Difference = [body_temperature_difference]. Recovering [recovery_amt]") - bodytemperature += recovery_amt + bodytemperature += recovery_amt //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) proc/get_heat_protection_flags(temperature) //Temperature is the temperature you're being exposed to. @@ -1441,17 +1470,46 @@ else fire.icon_state = "fire0" if(bodytemp) - switch(bodytemperature) //310.055 optimal body temp - if(370 to INFINITY) bodytemp.icon_state = "temp4" - if(350 to 370) bodytemp.icon_state = "temp3" - if(335 to 350) bodytemp.icon_state = "temp2" - if(320 to 335) bodytemp.icon_state = "temp1" - if(300 to 320) bodytemp.icon_state = "temp0" - if(295 to 300) bodytemp.icon_state = "temp-1" - if(280 to 295) bodytemp.icon_state = "temp-2" - if(260 to 280) bodytemp.icon_state = "temp-3" - else bodytemp.icon_state = "temp-4" - + if (!species) + switch(bodytemperature) //310.055 optimal body temp + if(370 to INFINITY) bodytemp.icon_state = "temp4" + if(350 to 370) bodytemp.icon_state = "temp3" + if(335 to 350) bodytemp.icon_state = "temp2" + if(320 to 335) bodytemp.icon_state = "temp1" + if(300 to 320) bodytemp.icon_state = "temp0" + if(295 to 300) bodytemp.icon_state = "temp-1" + if(280 to 295) bodytemp.icon_state = "temp-2" + if(260 to 280) bodytemp.icon_state = "temp-3" + else bodytemp.icon_state = "temp-4" + else + var/temp_step + if (bodytemperature >= species.body_temperature) + temp_step = (species.heat_level_1 - species.body_temperature)/4 + + if (bodytemperature >= species.heat_level_1) + bodytemp.icon_state = "temp4" + else if (bodytemperature >= species.body_temperature + temp_step*3) + bodytemp.icon_state = "temp3" + else if (bodytemperature >= species.body_temperature + temp_step*2) + bodytemp.icon_state = "temp2" + else if (bodytemperature >= species.body_temperature + temp_step*1) + bodytemp.icon_state = "temp1" + else + bodytemp.icon_state = "temp0" + + else if (bodytemperature < species.body_temperature) + temp_step = (species.body_temperature - species.cold_level_1)/4 + + if (bodytemperature <= species.cold_level_1) + bodytemp.icon_state = "temp-4" + else if (bodytemperature <= species.body_temperature - temp_step*3) + bodytemp.icon_state = "temp-3" + else if (bodytemperature <= species.body_temperature - temp_step*2) + bodytemp.icon_state = "temp-2" + else if (bodytemperature <= species.body_temperature - temp_step*1) + bodytemp.icon_state = "temp-1" + else + bodytemp.icon_state = "temp0" if(blind) if(blinded) blind.layer = 18 else blind.layer = 0 diff --git a/code/modules/research/xenoarchaeology/tools/anomaly_suit.dm b/code/modules/research/xenoarchaeology/tools/anomaly_suit.dm index 05e6d02d353..67ac1bd867f 100644 --- a/code/modules/research/xenoarchaeology/tools/anomaly_suit.dm +++ b/code/modules/research/xenoarchaeology/tools/anomaly_suit.dm @@ -20,7 +20,7 @@ icon_state = "cespace_suit" item_state = "cespace_suit" armor = list(melee = 0, bullet = 0, laser = 0,energy = 0, bomb = 0, bio = 100, rad = 100) - allowed = list(/obj/item/device/flashlight,/obj/item/weapon/tank) + allowed = list(/obj/item/device/flashlight,/obj/item/weapon/tank,/obj/item/device/suit_cooling_unit) /obj/item/clothing/head/helmet/space/anomaly name = "Excavation hood" diff --git a/code/setup.dm b/code/setup.dm index 520e83afc13..724a42c8bb0 100644 --- a/code/setup.dm +++ b/code/setup.dm @@ -35,7 +35,7 @@ #define TEMPERATURE_DAMAGE_COEFFICIENT 1.5 //This is used in handle_temperature_damage() for humans, and in reagents that affect body temperature. Temperature damage is multiplied by this amount. #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_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_AUTORECOVERY_MINIMUM 1 //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. #define BODYTEMP_COOLING_MAX -30 //The maximum number of degrees that your body can cool in 1 tick, when in a cold area.