From b50d42d80c66c0ac1f7c4a9213458dc5b5658aa7 Mon Sep 17 00:00:00 2001 From: Zuhayr Date: Mon, 30 Jun 2014 22:48:05 +0930 Subject: [PATCH] Cleaned up some reagent stuff, made Skrell alcoholics a legit issue, fixed IPC getting phoron contamination from clothing. --- code/modules/mob/living/carbon/human/life.dm | 69 ++++++++++---------- code/modules/mob/living/carbon/species.dm | 11 ++++ code/modules/reagents/Chemistry-Reagents.dm | 9 ++- code/setup.dm | 14 ++-- 4 files changed, 58 insertions(+), 45 deletions(-) diff --git a/code/modules/mob/living/carbon/human/life.dm b/code/modules/mob/living/carbon/human/life.dm index 5b0e7a0f6eb..92c489743b0 100644 --- a/code/modules/mob/living/carbon/human/life.dm +++ b/code/modules/mob/living/carbon/human/life.dm @@ -132,7 +132,7 @@ //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 @@ -145,9 +145,9 @@ 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 /mob/living/carbon/human/calculate_affecting_pressure(var/pressure) @@ -464,7 +464,7 @@ var/exhaling var/poison var/no_exhale - + var/failed_inhale = 0 var/failed_exhale = 0 @@ -555,30 +555,30 @@ if (!co2_alert|| prob(15)) var/word = pick("extremely dizzy","short of breath","faint","confused") src << "\red You feel [word]." - + adjustOxyLoss(HUMAN_MAX_OXYLOSS) co2_alert = 1 failed_exhale = 1 - + else if(exhaled_pp > safe_exhaled_max * 0.7) if (!co2_alert || prob(1)) var/word = pick("dizzy","short of breath","faint","momentarily confused") src << "\red You feel [word]." - + //scale linearly from 0 to 1 between safe_exhaled_max and safe_exhaled_max*0.7 var/ratio = 1.0 - (safe_exhaled_max - exhaled_pp)/(safe_exhaled_max*0.3) - + //give them some oxyloss, up to the limit - we don't want people falling unconcious due to CO2 alone until they're pretty close to safe_exhaled_max. if (getOxyLoss() < 50*ratio) adjustOxyLoss(HUMAN_MAX_OXYLOSS) co2_alert = 1 failed_exhale = 1 - + else if(exhaled_pp > safe_exhaled_max * 0.6) if (prob(0.3)) var/word = pick("a little dizzy","short of breath") src << "\red You feel [word]." - + else co2_alert = 0 @@ -611,16 +611,16 @@ if(prob(20)) spawn(0) emote(pick("giggle", "laugh")) SA.moles = 0 - + // Were we able to breathe? if (failed_inhale || failed_exhale) failed_last_breath = 1 else failed_last_breath = 0 adjustOxyLoss(-5) - + // Hot air hurts :( - if( (breath.temperature < species.cold_level_1 || breath.temperature > species.heat_level_1) && !(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 @@ -651,17 +651,17 @@ 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) - + //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]" @@ -699,11 +699,11 @@ var/thermal_protection = 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(thermal_protection < 1) temp_adj = (1-thermal_protection) * ((loc_temp - bodytemperature) / BODYTEMP_HEAT_DIVISOR) - + //Use heat transfer as proportional to the gas density. However, we only care about the relative density vs standard 101 kPa/20 C air. Therefore we can use mole ratios var/relative_density = environment.total_moles() / MOLES_CELLSTANDARD 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 << "Environment: [loc_temp], [src]: [bodytemperature], Adjusting: [temp_adj]" @@ -783,17 +783,17 @@ temp_change = (temperature - current) return temp_change */ - + proc/stabilize_body_temperature() if (species.flags & IS_SYNTHETIC) bodytemperature += species.synth_temp_gain //just keep putting out heat. return - + var/body_temperature_difference = species.body_temperature - bodytemperature - + if (abs(body_temperature_difference) < 0.5) return //fuck this precision - + 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 @@ -991,19 +991,18 @@ proc/handle_chemicals_in_body() if(reagents && !(species.flags & IS_SYNTHETIC)) //Synths don't process reagents. - var/alien = 0 //Not the best way to handle it, but neater than checking this for every single reagent proc. - if(species && species.name == "Diona") - alien = 1 - else if(species && species.name == "Vox") - alien = 2 + var/alien = 0 + if(species && species.reagent_tag) + alien = species.reagent_tag reagents.metabolize(src,alien) - var/total_phoronloss = 0 - for(var/obj/item/I in src) - if(I.contaminated) - total_phoronloss += vsc.plc.CONTAMINATION_LOSS + var/total_phoronloss = 0 + for(var/obj/item/I in src) + if(I.contaminated) + total_phoronloss += vsc.plc.CONTAMINATION_LOSS + if(!(status_flags & GODMODE)) adjustToxLoss(total_phoronloss) + if(status_flags & GODMODE) return 0 //godmode - adjustToxLoss(total_phoronloss) if(species.flags & REQUIRE_LIGHT) var/light_amount = 0 //how much light there is in the place, affects receiving nutrition and healing @@ -1473,7 +1472,7 @@ 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) @@ -1484,10 +1483,10 @@ 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) diff --git a/code/modules/mob/living/carbon/species.dm b/code/modules/mob/living/carbon/species.dm index 99c165f3d19..9636b58188d 100644 --- a/code/modules/mob/living/carbon/species.dm +++ b/code/modules/mob/living/carbon/species.dm @@ -31,6 +31,7 @@ var/body_temperature = 310.15 //non-IS_SYNTHETIC species will try to stabilize at this temperature. (also affects temperature processing) var/synth_temp_gain = 0 //IS_SYNTHETIC species will gain this much temperature every second + var/reagent_tag //Used for metabolizing reagents. var/darksight = 2 var/hazard_high_pressure = HAZARD_HIGH_PRESSURE // Dangerously high pressure. @@ -137,6 +138,8 @@ flesh_color = "#34AF10" + reagent_tag = IS_UNATHI + /datum/species/tajaran name = "Tajaran" icobase = 'icons/mob/human_races/r_tajaran.dmi' @@ -173,6 +176,8 @@ flesh_color = "#8CD7A3" + reagent_tag = IS_SKRELL + /datum/species/vox name = "Vox" icobase = 'icons/mob/human_races/r_vox.dmi' @@ -197,6 +202,8 @@ blood_color = "#2299FC" flesh_color = "#808D11" + reagent_tag = IS_VOX + /datum/species/vox/handle_post_spawn(var/mob/living/carbon/human/H) H.verbs += /mob/living/carbon/human/proc/leap @@ -240,6 +247,8 @@ tail = "armalis_tail" icon_template = 'icons/mob/human_races/r_armalis.dmi' + reagent_tag = IS_VOX + /datum/species/diona name = "Diona" icobase = 'icons/mob/human_races/r_diona.dmi' @@ -266,6 +275,8 @@ blood_color = "#004400" flesh_color = "#907E4A" + reagent_tag = IS_DIONA + /datum/species/diona/handle_post_spawn(var/mob/living/carbon/human/H) H.gender = NEUTER diff --git a/code/modules/reagents/Chemistry-Reagents.dm b/code/modules/reagents/Chemistry-Reagents.dm index 46aafda18b2..94caf959814 100644 --- a/code/modules/reagents/Chemistry-Reagents.dm +++ b/code/modules/reagents/Chemistry-Reagents.dm @@ -5,10 +5,6 @@ #define REAGENTS_OVERDOSE 30 #define REM REAGENTS_EFFECT_MULTIPLIER -//Some on_mob_life() procs check for alien races. -#define IS_DIONA 1 -#define IS_VOX 2 - //The reaction procs must ALWAYS set src = null, this detaches the proc from the object (the reagent) //so that it can continue working when the reagent is deleted while the proc is still active. @@ -2970,7 +2966,7 @@ datum var/blur_start = 300 //amount absorbed after which mob starts getting blurred vision var/pass_out = 400 //amount absorbed after which mob starts passing out - on_mob_life(var/mob/living/M as mob) + on_mob_life(var/mob/living/M as mob, var/alien) M:nutrition += nutriment_factor holder.remove_reagent(src.id, FOOD_METABOLISM) @@ -2986,6 +2982,9 @@ datum for(var/datum/reagent/ethanol/A in holder.reagent_list) if(isnum(A.data)) d += A.data + if(alien && alien == IS_SKRELL) //Skrell get very drunk very quickly. + d*=5 + M.dizziness += dizzy_adj. if(d >= slur_start && d < pass_out) if (!M:slurring) M:slurring = 1 diff --git a/code/setup.dm b/code/setup.dm index 5dcf7e8fe13..be0ecd1bfbf 100644 --- a/code/setup.dm +++ b/code/setup.dm @@ -746,7 +746,7 @@ var/list/RESTRICTED_CAMERA_NETWORKS = list( //Those networks can only be accesse //Language flags. #define WHITELISTED 1 // Language is available if the speaker is whitelisted. #define RESTRICTED 2 // Language can only be accquired by spawning or an admin. -#define NONVERBAL 4 // Language has a significant non-verbal component. Speech is garbled without line-of-sight +#define NONVERBAL 4 // Language has a significant non-verbal component. Speech is garbled without line-of-sight #define SIGNLANG 8 // Language is completely non-verbal. Speech is displayed through emotes for those who can understand. //Flags for zone sleeping @@ -797,14 +797,18 @@ var/list/RESTRICTED_CAMERA_NETWORKS = list( //Those networks can only be accesse #define IDLE_STATE 0 #define WAIT_LAUNCH 1 #define WAIT_ARRIVE 2 -#define WAIT_FINISH 3 +#define WAIT_FINISH 3 - //computer3 error codes, move lower in the file when it passes dev -Sayu #define PROG_CRASH 1 // Generic crash #define MISSING_PERIPHERAL 2 // Missing hardware #define BUSTED_ASS_COMPUTER 4 // Self-perpetuating error. BAC will continue to crash forever. #define MISSING_PROGRAM 8 // Some files try to automatically launch a program. This is that failing. #define FILE_DRM 16 // Some files want to not be copied/moved. This is them complaining that you tried. - #define NETWORK_FAILURE 32 - + #define NETWORK_FAILURE 32 + +//Some on_mob_life() procs check for alien races. +#define IS_DIONA 1 +#define IS_VOX 2 +#define IS_SKRELL 3 +#define IS_UNATHI 4 \ No newline at end of file