diff --git a/code/__DEFINES/atmospherics.dm b/code/__DEFINES/atmospherics.dm index fe7e2b0067c..5997fa4999e 100644 --- a/code/__DEFINES/atmospherics.dm +++ b/code/__DEFINES/atmospherics.dm @@ -61,8 +61,8 @@ #define PLASMA_MINIMUM_OXYGEN_NEEDED 2 #define PLASMA_MINIMUM_OXYGEN_PLASMA_RATIO 30 #define PLASMA_OXYGEN_FULLBURN 10 -#define MIN_PLASMA_DAMAGE 1 -#define MAX_PLASMA_DAMAGE 10 +#define MIN_TOXIC_GAS_DAMAGE 1 +#define MAX_TOXIC_GAS_DAMAGE 10 #define MOLES_PLASMA_VISIBLE 0.5 //Moles in a standard cell after which plasma is visible // Pressure limits. diff --git a/code/__DEFINES/genetics.dm b/code/__DEFINES/genetics.dm index 6f8bd0feabf..222bc388f0a 100644 --- a/code/__DEFINES/genetics.dm +++ b/code/__DEFINES/genetics.dm @@ -20,7 +20,7 @@ // Generic mutations: #define TK 1 -#define RESIST_COLD 2 +#define COLDRES 2 #define XRAY 3 #define HULK 4 #define CLUMSY 5 @@ -37,13 +37,13 @@ #define PLANT 30 // Other Mutations: -#define NO_BREATH 100 // no need to breathe +#define BREATHLESS 100 // no breathing #define REMOTE_VIEW 101 // remote viewing #define REGEN 102 // health regen #define RUN 103 // no slowdown #define REMOTE_TALK 104 // remote talking #define MORPH 105 // changing appearance -#define RESIST_HEAT 106 // heat resistance +#define HEATRES 106 // heat resistance #define HALLUCINATE 107 // hallucinations #define FINGERPRINTS 108 // no fingerprints #define NO_SHOCK 109 // insulated hands @@ -134,4 +134,7 @@ #define RADIMMUNE 11 #define NOGUNS 12 #define NOTRANSSTING 13 -#define VIRUSIMMUNE 14 \ No newline at end of file +#define VIRUSIMMUNE 14 +#define NOCRITDAMAGE 15 +#define RESISTHOT 16 +#define RESISTCOLD 17 \ No newline at end of file diff --git a/code/_globalvars/genetics.dm b/code/_globalvars/genetics.dm index 116aa0797cb..6109d103a8e 100644 --- a/code/_globalvars/genetics.dm +++ b/code/_globalvars/genetics.dm @@ -18,7 +18,7 @@ var/MONKEYBLOCK = 50 // Monkey block will always be the DNA_SE_LENGTH var/BLOCKADD = 0 var/DIFFMUT = 0 -var/NOBREATHBLOCK = 0 +var/BREATHLESSBLOCK = 0 var/REMOTEVIEWBLOCK = 0 var/REGENERATEBLOCK = 0 var/INCREASERUNBLOCK = 0 diff --git a/code/_onclick/hud/alert.dm b/code/_onclick/hud/alert.dm index 1d5d419ba82..d41ccc823f6 100644 --- a/code/_onclick/hud/alert.dm +++ b/code/_onclick/hud/alert.dm @@ -105,21 +105,20 @@ //Gas alerts -/obj/screen/alert/oxy +/obj/screen/alert/not_enough_oxy name = "Choking (No O2)" - desc = "You're not getting enough oxygen. Find some good air before you pass out! \ -The box in your backpack has an oxygen tank and breath mask in it." - icon_state = "oxy" + desc = "You're not getting enough oxygen. Find some good air before you pass out! The box in your backpack has an oxygen tank and breath mask in it." + icon_state = "not_enough_oxy" /obj/screen/alert/too_much_oxy name = "Choking (O2)" desc = "There's too much oxygen in the air, and you're breathing it in! Find some good air before you pass out!" icon_state = "too_much_oxy" -/obj/screen/alert/nitro +/obj/screen/alert/not_enough_nitro name = "Choking (No N)" desc = "You're not getting enough nitrogen. Find some good air before you pass out!" - icon_state = "nitro" + icon_state = "not_enough_nitro" /obj/screen/alert/too_much_nitro name = "Choking (N)" @@ -141,11 +140,10 @@ The box in your backpack has an oxygen tank and breath mask in it." desc = "You're not getting enough plasma. Find some good air before you pass out!" icon_state = "not_enough_tox" -/obj/screen/alert/tox_in_air +/obj/screen/alert/too_much_tox name = "Choking (Plasma)" - desc = "There's highly flammable, toxic plasma in the air and you're breathing it in. Find some fresh air. \ -The box in your backpack has an oxygen tank and gas mask in it." - icon_state = "tox_in_air" + desc = "There's highly flammable, toxic plasma in the air and you're breathing it in. Find some fresh air. The box in your backpack has an oxygen tank and gas mask in it." + icon_state = "too_much_tox" //End gas alerts diff --git a/code/_onclick/hud/screen_objects.dm b/code/_onclick/hud/screen_objects.dm index d184f765eac..620e541af83 100644 --- a/code/_onclick/hud/screen_objects.dm +++ b/code/_onclick/hud/screen_objects.dm @@ -127,7 +127,7 @@ if(ishuman(C)) var/mob/living/carbon/human/H = C - breathes = H.species.breath_type + breathes = H.species.breathid nicename = list("suit", "back", "belt", "right hand", "left hand", "left pocket", "right pocket") tankcheck = list(H.s_store, C.back, H.belt, C.r_hand, C.l_hand, H.l_store, H.r_store) else @@ -146,22 +146,22 @@ if(istype(tankcheck[i], /obj/item/weapon/tank)) var/obj/item/weapon/tank/t = tankcheck[i] switch(breathes) - if("nitrogen") + if("n2") if(t.air_contents.nitrogen && !t.air_contents.oxygen) contents.Add(t.air_contents.nitrogen) else contents.Add(0) - if("oxygen") + if("o2") if(t.air_contents.oxygen && !t.air_contents.toxins) contents.Add(t.air_contents.oxygen) else contents.Add(0) - if("carbon dioxide") + if("co2") if(t.air_contents.carbon_dioxide && !t.air_contents.toxins) contents.Add(t.air_contents.carbon_dioxide) else contents.Add(0) - if("plasma") + if("toxin") if(t.air_contents.toxins) contents.Add(t.air_contents.toxins) else diff --git a/code/game/dna/genes/goon_powers.dm b/code/game/dna/genes/goon_powers.dm index d3625deab58..c5c5b6a21a5 100644 --- a/code/game/dna/genes/goon_powers.dm +++ b/code/game/dna/genes/goon_powers.dm @@ -154,7 +154,7 @@ to_chat(user, "This will only work on normal organic beings.") return - if(RESIST_COLD in C.mutations) + if(COLDRES in C.mutations) C.visible_message("A cloud of fine ice crystals engulfs [C.name], but disappears almost instantly!") return var/handle_suit = 0 diff --git a/code/game/dna/genes/powers.dm b/code/game/dna/genes/powers.dm index 27c82a1d20f..7f53d9df937 100644 --- a/code/game/dna/genes/powers.dm +++ b/code/game/dna/genes/powers.dm @@ -7,11 +7,11 @@ activation_messages=list("You feel no need to breathe.") deactivation_messages=list("You feel the need to breathe, once more.") instability = GENE_INSTABILITY_MODERATE - mutation=NO_BREATH + mutation = BREATHLESS activation_prob=25 /datum/dna/gene/basic/nobreath/New() - block=NOBREATHBLOCK + block= BREATHLESSBLOCK /datum/dna/gene/basic/regenerate @@ -48,7 +48,7 @@ activation_messages=list("Your skin is icy to the touch.") deactivation_messages=list("Your skin no longer feels icy to the touch.") instability = GENE_INSTABILITY_MODERATE - mutation=RESIST_HEAT + mutation = HEATRES /datum/dna/gene/basic/heat_resist/New() block=COLDBLOCK @@ -61,7 +61,7 @@ activation_messages=list("Your body is filled with warmth.") deactivation_messages=list("Your body is no longer filled with warmth.") instability = GENE_INSTABILITY_MODERATE - mutation=RESIST_COLD + mutation = COLDRES /datum/dna/gene/basic/cold_resist/New() block=FIREBLOCK diff --git a/code/game/gamemodes/setupgame.dm b/code/game/gamemodes/setupgame.dm index c785c511304..7c69b02eda1 100644 --- a/code/game/gamemodes/setupgame.dm +++ b/code/game/gamemodes/setupgame.dm @@ -50,7 +50,7 @@ NERVOUSBLOCK = getAssignedBlock("NERVOUS", numsToAssign) // Bay muts - NOBREATHBLOCK = getAssignedBlock("NOBREATH", numsToAssign, DNA_HARD_BOUNDS, good=1) + BREATHLESSBLOCK = getAssignedBlock("BREATHLESS", numsToAssign, DNA_HARD_BOUNDS, good=1) REMOTEVIEWBLOCK = getAssignedBlock("REMOTEVIEW", numsToAssign, DNA_HARDER_BOUNDS, good=1) REGENERATEBLOCK = getAssignedBlock("REGENERATE", numsToAssign, DNA_HARDER_BOUNDS, good=1) INCREASERUNBLOCK = getAssignedBlock("INCREASERUN", numsToAssign, DNA_HARDER_BOUNDS, good=1) diff --git a/code/game/gamemodes/shadowling/shadowling.dm b/code/game/gamemodes/shadowling/shadowling.dm index d250200236d..9271481c967 100644 --- a/code/game/gamemodes/shadowling/shadowling.dm +++ b/code/game/gamemodes/shadowling/shadowling.dm @@ -308,11 +308,15 @@ Made by Xhuis species_traits = list(NO_BLOOD, NO_BREATHE, RADIMMUNE, NOGUNS) //Can't use guns due to muzzle flash burn_mod = 1.5 //1.5x burn damage, 2x is excessive oxy_mod = 0 - hot_env_multiplier = 1.5 + heatmod = 1.5 silent_steps = 1 grant_vision_toggle = 0 + has_organ = list( + "brain" = /obj/item/organ/internal/brain, + "eyes" = /obj/item/organ/internal/eyes) + /datum/species/shadow/ling/handle_life(var/mob/living/carbon/human/H) if(!H.weakeyes) H.weakeyes = 1 //Makes them more vulnerable to flashes and flashbangs @@ -335,6 +339,7 @@ Made by Xhuis H.adjustCloneLoss(-1) H.SetWeakened(0) H.SetStunned(0) + ..() /datum/species/shadow/ling/lesser //Empowered thralls. Obvious, but powerful @@ -349,7 +354,7 @@ Made by Xhuis species_traits = list(NO_BLOOD, NO_BREATHE, RADIMMUNE) burn_mod = 1.1 oxy_mod = 0 - hot_env_multiplier = 1.1 + heatmod = 1.1 /datum/species/shadow/ling/lesser/handle_life(var/mob/living/carbon/human/H) if(!H.weakeyes) @@ -368,6 +373,7 @@ Made by Xhuis H.adjustToxLoss(-5) H.adjustBrainLoss(-25) H.adjustCloneLoss(-1) + ..() /datum/game_mode/proc/update_shadow_icons_added(datum/mind/shadow_mind) var/datum/atom_hud/antag/shadow_hud = huds[ANTAG_HUD_SHADOW] diff --git a/code/game/machinery/poolcontroller.dm b/code/game/machinery/poolcontroller.dm index 6e1e1c0e97a..01ae0546f19 100644 --- a/code/game/machinery/poolcontroller.dm +++ b/code/game/machinery/poolcontroller.dm @@ -93,7 +93,7 @@ if(drownee && (drownee.lying || deep_water)) //Mob lying down or water is deep (determined by controller) if(drownee.internal) return //Has internals, no drowning - if((NO_BREATHE in drownee.species.species_traits) || (NO_BREATHE in drownee.mutations)) + if((NO_BREATHE in drownee.species.species_traits) || (BREATHLESS in drownee.mutations)) return //doesn't breathe, no drowning if(drownee.get_species() == "Skrell" || drownee.get_species() == "Neara") return //fish things don't drown diff --git a/code/game/objects/items/weapons/dna_injector.dm b/code/game/objects/items/weapons/dna_injector.dm index 59b5f487044..fa8be176590 100644 --- a/code/game/objects/items/weapons/dna_injector.dm +++ b/code/game/objects/items/weapons/dna_injector.dm @@ -251,23 +251,23 @@ ..() /obj/item/weapon/dnainjector/nobreath - name = "DNA-Injector (No Breath)" + name = "DNA-Injector (Breathless)" desc = "Hold your breath and count to infinity." datatype = DNA2_BUF_SE value = 0xFFF //block = 2 New() - block = NOBREATHBLOCK + block = BREATHLESSBLOCK ..() /obj/item/weapon/dnainjector/antinobreath - name = "DNA-Injector (Anti-No Breath)" + name = "DNA-Injector (Anti-Breathless)" desc = "Hold your breath and count to 100." datatype = DNA2_BUF_SE value = 0x001 //block = 2 New() - block = NOBREATHBLOCK + block = BREATHLESSBLOCK ..() /obj/item/weapon/dnainjector/remoteview diff --git a/code/modules/admin/topic.dm b/code/modules/admin/topic.dm index 2279d45a8ed..a76a2bf3c85 100644 --- a/code/modules/admin/topic.dm +++ b/code/modules/admin/topic.dm @@ -1768,7 +1768,7 @@ H.update_mutations() logmsg = "permanent regeneration." if("Super Powers") - var/list/default_genes = list(REGENERATEBLOCK, NOBREATHBLOCK, COLDBLOCK) + var/list/default_genes = list(REGENERATEBLOCK, BREATHLESSBLOCK, COLDBLOCK) for(var/gene in default_genes) H.dna.SetSEState(gene, 1) genemutcheck(H, gene, null, MUTCHK_FORCED) diff --git a/code/modules/awaymissions/mission_code/wildwest.dm b/code/modules/awaymissions/mission_code/wildwest.dm index 0a2eaeef1bf..2362732f4e7 100644 --- a/code/modules/awaymissions/mission_code/wildwest.dm +++ b/code/modules/awaymissions/mission_code/wildwest.dm @@ -78,7 +78,7 @@ to_chat(user, "Your wish is granted, but at a terrible cost...") to_chat(user, "The Wish Granter punishes you for your selfishness, claiming your soul and warping your body to match the darkness in your heart.") user.mutations.Add(LASER) - user.mutations.Add(RESIST_COLD) + user.mutations.Add(COLDRES) user.mutations.Add(XRAY) if(ishuman(user)) var/mob/living/carbon/human/human = user diff --git a/code/modules/clothing/under/accessories/accessory.dm b/code/modules/clothing/under/accessories/accessory.dm index 1b9003fe880..8f1221fee04 100644 --- a/code/modules/clothing/under/accessories/accessory.dm +++ b/code/modules/clothing/under/accessories/accessory.dm @@ -136,7 +136,7 @@ user.visible_message("[user] places \the [src] against [M]'s chest and listens attentively.", "You place \the [src] against [M]'s chest...") var/obj/item/organ/internal/H = M.get_int_organ(/obj/item/organ/internal/heart) var/obj/item/organ/internal/L = M.get_int_organ(/obj/item/organ/internal/lungs) - if((H && M.pulse) || (L && !(NO_BREATH in M.mutations) && !(NO_BREATH in M.species.species_traits))) + if((H && M.pulse) || (L && !(BREATHLESS in M.mutations) && !(NO_BREATHE in M.species.species_traits))) var/color = "notice" if(H) var/heart_sound diff --git a/code/modules/flufftext/Hallucination.dm b/code/modules/flufftext/Hallucination.dm index 64bb91a9db4..d180bb9c2ac 100644 --- a/code/modules/flufftext/Hallucination.dm +++ b/code/modules/flufftext/Hallucination.dm @@ -149,7 +149,7 @@ Gunshots/explosions/opening doors/less rare audio (done) qdel(src) Expand() if((get_turf(target) in flood_turfs) && !target.internal) - target.hallucinate("fake_alert", "tox_in_air") + target.hallucinate("fake_alert", "too_much_tox") next_expand = world.time + FAKE_FLOOD_EXPAND_TIME /obj/effect/hallucination/fake_flood/proc/Expand() @@ -890,12 +890,12 @@ var/list/non_fakeattack_weapons = list(/obj/item/weapon/gun/projectile, /obj/ite sleep(rand(100,250)) hal_screwyhud = SCREWYHUD_NONE if("fake_alert") - var/alert_type = pick("oxy","not_enough_tox","not_enough_co2","too_much_oxy","too_much_co2","tox_in_air","newlaw","nutrition","charge","weightless","fire","locked","hacked","temp","pressure") + var/alert_type = pick("not_enough_oxy","not_enough_tox","not_enough_co2","too_much_oxy","too_much_co2","too_much_tox","newlaw","nutrition","charge","weightless","fire","locked","hacked","temp","pressure") if(specific) alert_type = specific switch(alert_type) - if("oxy") - throw_alert("oxy", /obj/screen/alert/oxy, override = TRUE) + if("not_enough_oxy") + throw_alert("not_enough_oxy", /obj/screen/alert/not_enough_oxy, override = TRUE) if("not_enough_tox") throw_alert("not_enough_tox", /obj/screen/alert/not_enough_tox, override = TRUE) if("not_enough_co2") @@ -904,8 +904,8 @@ var/list/non_fakeattack_weapons = list(/obj/item/weapon/gun/projectile, /obj/ite throw_alert("too_much_oxy", /obj/screen/alert/too_much_oxy, override = TRUE) if("too_much_co2") throw_alert("too_much_co2", /obj/screen/alert/too_much_co2, override = TRUE) - if("tox_in_air") - throw_alert("tox_in_air", /obj/screen/alert/tox_in_air, override = TRUE) + if("too_much_tox") + throw_alert("too_much_tox", /obj/screen/alert/too_much_tox, override = TRUE) if("nutrition") if(prob(50)) throw_alert("nutrition", /obj/screen/alert/fat, override = TRUE) diff --git a/code/modules/mob/living/carbon/alien/humanoid/humanoid.dm b/code/modules/mob/living/carbon/alien/humanoid/humanoid.dm index d37d83e8215..57d0d0814cc 100644 --- a/code/modules/mob/living/carbon/alien/humanoid/humanoid.dm +++ b/code/modules/mob/living/carbon/alien/humanoid/humanoid.dm @@ -13,6 +13,7 @@ var/leap_on_click = 0 var/custom_pixel_x_offset = 0 //for admin fuckery. var/custom_pixel_y_offset = 0 + pass_flags = PASSTABLE //This is fine right now, if we're adding organ specific damage this needs to be updated /mob/living/carbon/alien/humanoid/New() diff --git a/code/modules/mob/living/carbon/alien/humanoid/life.dm b/code/modules/mob/living/carbon/alien/humanoid/life.dm index 4be2cbdb390..a13fce956da 100644 --- a/code/modules/mob/living/carbon/alien/humanoid/life.dm +++ b/code/modules/mob/living/carbon/alien/humanoid/life.dm @@ -1,13 +1,3 @@ -//This file was auto-corrected by findeclaration.exe on 25.5.2012 20:42:32 - -/mob/living/carbon/alien/humanoid - oxygen_alert = 0 - toxins_alert = 0 - fire_alert = 0 - pass_flags = PASSTABLE - var/temperature_alert = 0 - - /mob/living/carbon/alien/humanoid/Life() . = ..() update_icons() diff --git a/code/modules/mob/living/carbon/alien/larva/life.dm b/code/modules/mob/living/carbon/alien/larva/life.dm index 8366a7d02a8..4faa957163c 100644 --- a/code/modules/mob/living/carbon/alien/larva/life.dm +++ b/code/modules/mob/living/carbon/alien/larva/life.dm @@ -1,8 +1,3 @@ -//This file was auto-corrected by findeclaration.exe on 25.5.2012 20:42:32 - -/mob/living/carbon/alien/larva - var/temperature_alert = 0 - /mob/living/carbon/alien/larva/Life() if(..()) //still breathing // GROW! diff --git a/code/modules/mob/living/carbon/alien/life.dm b/code/modules/mob/living/carbon/alien/life.dm index 80585fad863..d01defcc1cb 100644 --- a/code/modules/mob/living/carbon/alien/life.dm +++ b/code/modules/mob/living/carbon/alien/life.dm @@ -7,12 +7,13 @@ return 0 var/toxins_used = 0 + var/tox_detect_threshold = 0.02 var/breath_pressure = (breath.total_moles() * R_IDEAL_GAS_EQUATION * breath.temperature) / BREATH_VOLUME //Partial pressure of the toxins in our breath var/Toxins_pp = (breath.toxins / breath.total_moles()) * breath_pressure - if(Toxins_pp) // Detect toxins in air + if(Toxins_pp > tox_detect_threshold) // Detect toxins in air adjustPlasma(breath.toxins*250) throw_alert("alien_tox", /obj/screen/alert/alien_tox) @@ -28,8 +29,6 @@ //BREATH TEMPERATURE handle_breath_temperature(breath) - return 1 - /mob/living/carbon/alien/update_sight() if(!client) return diff --git a/code/modules/mob/living/carbon/carbon_defines.dm b/code/modules/mob/living/carbon/carbon_defines.dm index a409e8460db..e87ff9850df 100644 --- a/code/modules/mob/living/carbon/carbon_defines.dm +++ b/code/modules/mob/living/carbon/carbon_defines.dm @@ -23,12 +23,7 @@ var/wetlevel = 0 //how wet the mob is - var/oxygen_alert = 0 - var/toxins_alert = 0 - var/co2_alert = 0 - var/fire_alert = 0 - - 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. + var/failed_last_breath = FALSE //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. var/co2overloadtime = null blood_volume = BLOOD_VOLUME_NORMAL diff --git a/code/modules/mob/living/carbon/human/human.dm b/code/modules/mob/living/carbon/human/human.dm index fb472128004..1cd239c29f2 100644 --- a/code/modules/mob/living/carbon/human/human.dm +++ b/code/modules/mob/living/carbon/human/human.dm @@ -1291,36 +1291,6 @@ src.custom_pain("You feel a stabbing pain in your chest!", 1) L.damage = L.min_bruised_damage -/* -/mob/living/carbon/human/verb/simulate() - set name = "sim" - //set background = 1 - - var/damage = input("Wound damage","Wound damage") as num - - var/germs = 0 - var/tdamage = 0 - var/ticks = 0 - while(germs < 2501 && ticks < 100000 && round(damage/10)*20) - diary << "VIRUS TESTING: [ticks] : germs [germs] tdamage [tdamage] prob [round(damage/10)*20]" - ticks++ - if(prob(round(damage/10)*20)) - germs++ - if(germs == 100) - to_chat(world, "Reached stage 1 in [ticks] ticks") - if(germs > 100) - if(prob(10)) - damage++ - germs++ - if(germs == 1000) - to_chat(world, "Reached stage 2 in [ticks] ticks") - if(germs > 1000) - damage++ - germs++ - if(germs == 2500) - to_chat(world, "Reached stage 3 in [ticks] ticks") - to_chat(world, "Mob took [tdamage] tox damage") -*/ //returns 1 if made bloody, returns 0 otherwise /mob/living/carbon/human/clean_blood(var/clean_feet) @@ -1426,10 +1396,6 @@ maxHealth = species.total_health - toxins_alert = 0 - oxygen_alert = 0 - fire_alert = 0 - if(species.language) add_language(species.language) diff --git a/code/modules/mob/living/carbon/human/life.dm b/code/modules/mob/living/carbon/human/life.dm index ee5d773938c..b2b3aae3b8f 100644 --- a/code/modules/mob/living/carbon/human/life.dm +++ b/code/modules/mob/living/carbon/human/life.dm @@ -1,17 +1,10 @@ -//This file was auto-corrected by findeclaration.exe on 25.5.2012 20:42:32 - /mob/living/carbon/human - var/pressure_alert = 0 var/prev_gender = null // Debug for plural genders - var/temperature_alert = 0 var/in_stasis = 0 - var/exposedtimenow = 0 - var/firstexposed = 0 var/heartbeat = 0 /mob/living/carbon/human/Life() - fire_alert = 0 //Reset this here, because both breathe() and handle_environment() have a chance to set it. life_tick++ in_stasis = 0 @@ -253,61 +246,38 @@ chest.add_autopsy_data("Radiation Poisoning", autopsy_damage) /mob/living/carbon/human/breathe() + if(!species.breathe(src)) + ..() - if((NO_BREATH in mutations) || (NO_BREATHE in species.species_traits) || reagents.has_reagent("lexorin")) - adjustOxyLoss(-5) - oxygen_alert = 0 - toxins_alert = 0 - return - if(istype(loc, /obj/machinery/atmospherics/unary/cryo_cell)) - return +/mob/living/carbon/human/check_breath(datum/gas_mixture/breath) - var/datum/gas_mixture/environment - if(loc) - environment = loc.return_air() + var/obj/item/organ/internal/L = get_organ_slot("lungs") - var/datum/gas_mixture/breath + if(!L || L && (L.status & ORGAN_DEAD)) + if(health >= config.health_threshold_crit) + adjustOxyLoss(HUMAN_MAX_OXYLOSS + 1) + else if(!(NOCRITDAMAGE in species.species_traits)) + adjustOxyLoss(HUMAN_CRIT_MAX_OXYLOSS) - if(health <= config.health_threshold_crit) - AdjustLoseBreath(1) + failed_last_breath = TRUE - if(losebreath > 0) - AdjustLoseBreath(-1) - if(prob(10)) - emote("gasp") - if(istype(loc, /obj/)) - var/obj/loc_as_obj = loc - loc_as_obj.handle_internal_lifeform(src, 0) + if(species) + var/datum/species/S = species + + if(S.breathid == "o2") + throw_alert("not_enough_oxy", /obj/screen/alert/not_enough_oxy) + else if(S.breathid == "tox") + throw_alert("not_enough_tox", /obj/screen/alert/not_enough_tox) + else if(S.breathid == "co2") + throw_alert("not_enough_co2", /obj/screen/alert/not_enough_co2) + else if(S.breathid == "n2") + throw_alert("not_enough_nitro", /obj/screen/alert/not_enough_nitro) + + return FALSE else - breath = get_breath_from_internal(BREATH_VOLUME) - - if(!breath) - if(isobj(loc)) //Breathe from loc as object - var/obj/loc_as_obj = loc - breath = loc_as_obj.handle_internal_lifeform(src, BREATH_MOLES) - - else if(isturf(loc)) //Breathe from loc as turf - var/breath_moles = 0 - if(environment) - breath_moles = environment.total_moles()*BREATH_PERCENTAGE - - breath = loc.remove_air(breath_moles) - - if(!is_lung_ruptured()) // THIS FUCKING EXCERPT, THIS LITTLE FUCKING EXCERPT, SNOWFLAKED - if(!breath || breath.total_moles() < BREATH_MOLES / 5 || breath.total_moles() > BREATH_MOLES * 5) // RIGHT IN THE CENTER OF THE FUCKING BREATHE PROC - if(prob(5)) // IT IS THE ONLY FUCKING REASONS HUMAN OVERRIDE breathe() - rupture_lung() // GOD FUCKING DAMNIT - - else //Breathe from loc as obj again - if(istype(loc, /obj/)) - var/obj/loc_as_obj = loc - loc_as_obj.handle_internal_lifeform(src,0) - - check_breath(breath) - - if(breath) - loc.assume_air(breath) - + if(istype(L, /obj/item/organ/internal/lungs)) + var/obj/item/organ/internal/lungs/lun = L + lun.check_breath(breath, src) // USED IN DEATHWHISPERS /mob/living/carbon/human/proc/isInCrit() @@ -348,35 +318,6 @@ return null -/mob/living/carbon/human/check_breath(var/datum/gas_mixture/breath) - if(status_flags & GODMODE) - return 0 - - if(!breath || (breath.total_moles() == 0) || suiciding) - var/oxyloss = 0 - if(suiciding) - oxyloss = 2 - adjustOxyLoss(oxyloss)//If you are suiciding, you should die a little bit faster - failed_last_breath = 1 - oxygen_alert = max(oxygen_alert, 1) - return 0 - if(health > 0) - oxyloss = HUMAN_MAX_OXYLOSS - adjustOxyLoss(oxyloss) - failed_last_breath = 1 - else - oxyloss = HUMAN_CRIT_MAX_OXYLOSS - adjustOxyLoss(oxyloss) - failed_last_breath = 1 - - var/obj/item/organ/external/affected = get_organ("chest") - affected.add_autopsy_data("Suffocation", oxyloss) - throw_alert("oxy", /obj/screen/alert/oxy) - - return 0 - - return species.handle_breath(breath, src) - /mob/living/carbon/human/handle_environment(datum/gas_mixture/environment) if(!environment) return @@ -405,7 +346,7 @@ if(bodytemperature > species.heat_level_1) //Body temperature is too hot. if(status_flags & GODMODE) return 1 //godmode - var/mult = species.hot_env_multiplier + var/mult = species.heatmod if(bodytemperature >= species.heat_level_1 && bodytemperature <= species.heat_level_2) throw_alert("temp", /obj/screen/alert/hot, 1) @@ -427,7 +368,7 @@ return 1 if(!istype(loc, /obj/machinery/atmospherics/unary/cryo_cell)) - var/mult = species.cold_env_multiplier + var/mult = species.coldmod if(bodytemperature >= species.cold_level_2 && bodytemperature <= species.cold_level_1) throw_alert("temp", /obj/screen/alert/cold, 1) take_overall_damage(burn=mult*COLD_DAMAGE_LEVEL_1, used_weapon = "Low Body Temperature") @@ -450,7 +391,7 @@ if(status_flags & GODMODE) return 1 //godmode if(adjusted_pressure >= species.hazard_high_pressure) - if(!(RESIST_HEAT in mutations)) + if(!(HEATRES in mutations)) var/pressure_damage = min( ( (adjusted_pressure / species.hazard_high_pressure) -1 )*PRESSURE_DAMAGE_COEFFICIENT , MAX_HIGH_PRESSURE_DAMAGE) take_overall_damage(brute=pressure_damage, used_weapon = "High Pressure") throw_alert("pressure", /obj/screen/alert/highpressure, 2) @@ -463,7 +404,7 @@ else if(adjusted_pressure >= species.hazard_low_pressure) throw_alert("pressure", /obj/screen/alert/lowpressure, 1) else - if(RESIST_COLD in mutations) + if(COLDRES in mutations) clear_alert("pressure") else take_overall_damage(brute=LOW_PRESSURE_DAMAGE, used_weapon = "Low Pressure") @@ -474,7 +415,7 @@ /mob/living/carbon/human/handle_fire() if(..()) return - if(RESIST_HEAT in mutations) + if(HEATRES in mutations) return if(on_fire) var/thermal_protection = get_thermal_protection() @@ -538,7 +479,7 @@ /mob/living/carbon/human/proc/get_heat_protection(temperature) //Temperature is the temperature you're being exposed to. - if(RESIST_HEAT in mutations) + if(HEATRES in mutations) return 1 var/thermal_protection_flags = get_heat_protection_flags(temperature) @@ -599,7 +540,7 @@ /mob/living/carbon/human/proc/get_cold_protection(temperature) - if(RESIST_COLD in mutations) + if(COLDRES in mutations) return 1 //Fully protected from the cold. 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. diff --git a/code/modules/mob/living/carbon/human/species/abductor.dm b/code/modules/mob/living/carbon/human/species/abductor.dm index 75b19395dad..3e1bb968c81 100644 --- a/code/modules/mob/living/carbon/human/species/abductor.dm +++ b/code/modules/mob/living/carbon/human/species/abductor.dm @@ -10,7 +10,6 @@ eyes = "blank_eyes" has_organ = list( "heart" = /obj/item/organ/internal/heart, - "lungs" = /obj/item/organ/internal/lungs, "liver" = /obj/item/organ/internal/liver, "kidneys" = /obj/item/organ/internal/kidneys, "brain" = /obj/item/organ/internal/brain, diff --git a/code/modules/mob/living/carbon/human/species/golem.dm b/code/modules/mob/living/carbon/human/species/golem.dm index 3fbf0a4d8c1..c289ba3a19e 100644 --- a/code/modules/mob/living/carbon/human/species/golem.dm +++ b/code/modules/mob/living/carbon/human/species/golem.dm @@ -30,7 +30,6 @@ heat_level_1 = 999999999 heat_level_2 = 999999999 heat_level_3 = 999999999 - heat_level_3_breathe = 999999999 blood_color = "#515573" flesh_color = "#137E8F" diff --git a/code/modules/mob/living/carbon/human/species/plasmaman.dm b/code/modules/mob/living/carbon/human/species/plasmaman.dm index 9a5e05723a9..b57d1a83240 100644 --- a/code/modules/mob/living/carbon/human/species/plasmaman.dm +++ b/code/modules/mob/living/carbon/human/species/plasmaman.dm @@ -14,8 +14,7 @@ butt_sprite = "plasma" - breath_type = "plasma" - poison_type = null //Certainly isn't plasma. + breathid = "tox" heat_level_1 = 350 // Heat damage level 1 above this point. heat_level_2 = 400 // Heat damage level 2 above this point. @@ -29,6 +28,16 @@ "realizes the existential problem of being made out of plasma!", "shows their true colors, which happens to be the color of plasma!") + has_organ = list( + "heart" = /obj/item/organ/internal/heart, + "lungs" = /obj/item/organ/internal/lungs/plasmaman, + "liver" = /obj/item/organ/internal/liver, + "kidneys" = /obj/item/organ/internal/kidneys, + "brain" = /obj/item/organ/internal/brain, + "appendix" = /obj/item/organ/internal/appendix, + "eyes" = /obj/item/organ/internal/eyes + ) + /datum/species/plasmaman/say_filter(mob/M, message, datum/language/speaking) if(copytext(message, 1, 2) != "*") message = replacetext(message, "s", stutter("ss")) @@ -148,108 +157,6 @@ H.internal = H.get_item_by_slot(tank_slot) H.update_internals_hud_icon(1) -// Plasmamen are so fucking different that they need their own proc. -/datum/species/plasmaman/handle_breath(var/datum/gas_mixture/breath, var/mob/living/carbon/human/H) - var/safe_plasma_min = 16 // Minimum safe partial pressure of PLASMA, in kPa - //var/safe_oxygen_max = 140 // Maximum safe partial pressure of PLASMA, in kPa (Not used for now) - var/safe_co2_max = 10 // Yes it's an arbitrary value who cares? - var/SA_para_min = 1 - var/SA_sleep_min = 5 - var/plasma_used = 0 - var/nitrogen_used = 0 - var/breath_pressure = (breath.total_moles()*R_IDEAL_GAS_EQUATION*breath.temperature)/BREATH_VOLUME - - // Partial pressure of plasma - var/Toxins_pp = (breath.toxins/breath.total_moles())*breath_pressure - // And CO2, lets say a PP of more than 10 will be bad (It's a little less really, but eh, being passed out all round aint no fun) - var/CO2_pp = (breath.carbon_dioxide/breath.total_moles())*breath_pressure // Tweaking to fit the hacky bullshit I've done with atmo -- TLE - - if(Toxins_pp < safe_plasma_min) - if(prob(20)) - H.emote("gasp") - if(Toxins_pp > 0) - var/ratio = safe_plasma_min/Toxins_pp - H.adjustOxyLoss(min(5*ratio, HUMAN_MAX_OXYLOSS)) // Don't fuck them up too fast (space only does HUMAN_MAX_OXYLOSS after all!) - H.failed_last_breath = 1 - plasma_used = breath.toxins*ratio/6 - else - H.adjustOxyLoss(HUMAN_MAX_OXYLOSS) - H.failed_last_breath = 1 - H.oxygen_alert = max(H.oxygen_alert, 1) - - else // We're in safe limits - H.failed_last_breath = 0 - H.adjustOxyLoss(-5) - plasma_used = breath.toxins/6 - H.oxygen_alert = 0 - - breath.toxins -= plasma_used - breath.nitrogen -= nitrogen_used - breath.carbon_dioxide += plasma_used - - //CO2 does not affect failed_last_breath. So if there was enough oxygen in the air but too much co2, this will hurt you, but only once per 4 ticks, instead of once per tick. - if(CO2_pp > safe_co2_max) - if(!H.co2overloadtime) // If it's the first breath with too much CO2 in it, lets start a counter, then have them pass out after 12s or so. - H.co2overloadtime = world.time - else if(world.time - H.co2overloadtime > 120) - H.Paralyse(3) - H.adjustOxyLoss(3) // Lets hurt em a little, let them know we mean business - if(world.time - H.co2overloadtime > 300) // They've been in here 30s now, lets start to kill them for their own good! - H.adjustOxyLoss(8) - if(prob(20)) // Lets give them some chance to know somethings not right though I guess. - H.emote("cough") - - else - H.co2overloadtime = 0 - - if(breath.trace_gases.len) // If there's some other shit in the air lets deal with it here. - for(var/datum/gas/sleeping_agent/SA in breath.trace_gases) - var/SA_pp = (SA.moles/breath.total_moles())*breath_pressure - if(SA_pp > SA_para_min) // Enough to make us paralysed for a bit - H.Paralyse(3) // 3 gives them one second to wake up and run away a bit! - if(SA_pp > SA_sleep_min) // Enough to make us sleep as well - H.AdjustSleeping(8, bound_lower = 0, bound_upper = 10) - else if(SA_pp > 0.15) // There is sleeping gas in their lungs, but only a little, so give them a bit of a warning - if(prob(20)) - H.emote(pick("giggle", "laugh")) - SA.moles = 0 - - if(abs(310.15 - breath.temperature) > 50) // Hot air hurts :( - if(H.status_flags & GODMODE) - return 1 //godmode - if(breath.temperature < cold_level_1) - if(prob(20)) - to_chat(src, "You feel your face freezing and an icicle forming in your lungs!") - else if(breath.temperature > heat_level_1) - if(prob(20)) - to_chat(src, "You feel your face burning and a searing heat in your lungs!") - - switch(breath.temperature) - if(-INFINITY to cold_level_3) - H.apply_damage(COLD_GAS_DAMAGE_LEVEL_3, BURN, "head", used_weapon = "Excessive Cold") - H.fire_alert = max(H.fire_alert, 1) - - if(cold_level_3 to cold_level_2) - H.apply_damage(COLD_GAS_DAMAGE_LEVEL_2, BURN, "head", used_weapon = "Excessive Cold") - H.fire_alert = max(H.fire_alert, 1) - - if(cold_level_2 to cold_level_1) - H.apply_damage(COLD_GAS_DAMAGE_LEVEL_1, BURN, "head", used_weapon = "Excessive Cold") - H.fire_alert = max(H.fire_alert, 1) - - if(heat_level_1 to heat_level_2) - H.apply_damage(HEAT_GAS_DAMAGE_LEVEL_1, BURN, "head", used_weapon = "Excessive Heat") - H.fire_alert = max(H.fire_alert, 2) - - if(heat_level_2 to heat_level_3) - H.apply_damage(HEAT_GAS_DAMAGE_LEVEL_2, BURN, "head", used_weapon = "Excessive Heat") - H.fire_alert = max(H.fire_alert, 2) - - if(heat_level_3 to INFINITY) - H.apply_damage(HEAT_GAS_DAMAGE_LEVEL_3, BURN, "head", used_weapon = "Excessive Heat") - H.fire_alert = max(H.fire_alert, 2) - return 1 - /datum/species/plasmaman/handle_life(var/mob/living/carbon/human/H) if(!istype(H.wear_suit, /obj/item/clothing/suit/space/eva/plasmaman) || !istype(H.head, /obj/item/clothing/head/helmet/space/eva/plasmaman)) var/datum/gas_mixture/environment = H.loc.return_air() @@ -264,6 +171,7 @@ if(istype(P)) P.Extinguish(H) H.update_fire() + ..() /datum/species/plasmaman/handle_reagents(var/mob/living/carbon/human/H, var/datum/reagent/R) if(R.id == "plasma") diff --git a/code/modules/mob/living/carbon/human/species/shadow.dm b/code/modules/mob/living/carbon/human/species/shadow.dm index 6a48cda5811..7480d7e3a66 100644 --- a/code/modules/mob/living/carbon/human/species/shadow.dm +++ b/code/modules/mob/living/carbon/human/species/shadow.dm @@ -70,4 +70,5 @@ H.throw_alert("lightexposure", /obj/screen/alert/lightexposure) else if(light_amount < 2) //heal in the dark H.heal_overall_damage(1,1) - H.clear_alert("lightexposure") \ No newline at end of file + H.clear_alert("lightexposure") + ..() \ No newline at end of file diff --git a/code/modules/mob/living/carbon/human/species/skeleton.dm b/code/modules/mob/living/carbon/human/species/skeleton.dm index b8f4208df90..f36c19a57ec 100644 --- a/code/modules/mob/living/carbon/human/species/skeleton.dm +++ b/code/modules/mob/living/carbon/human/species/skeleton.dm @@ -32,7 +32,6 @@ heat_level_1 = 999999999 heat_level_2 = 999999999 heat_level_3 = 999999999 - heat_level_3_breathe = 999999999 suicide_messages = list( "is snapping their own bones!", diff --git a/code/modules/mob/living/carbon/human/species/species.dm b/code/modules/mob/living/carbon/human/species/species.dm index 8e45b0d7578..51f78c960cc 100644 --- a/code/modules/mob/living/carbon/human/species/species.dm +++ b/code/modules/mob/living/carbon/human/species/species.dm @@ -26,20 +26,15 @@ var/slowdown = 0 // Passive movement speed malus (or boost, if negative) var/silent_steps = 0 // Stops step noises - var/breath_type = "oxygen" // Non-oxygen gas breathed, if any. - var/poison_type = "plasma" // Poisonous air. - var/exhale_type = "carbon_dioxide" // Exhaled gas type. - var/cold_level_1 = 260 // Cold damage level 1 below this point. var/cold_level_2 = 200 // Cold damage level 2 below this point. var/cold_level_3 = 120 // Cold damage level 3 below this point. - var/cold_env_multiplier = 1 // Damage multiplier for being in a cold environment + var/coldmod = 1 // Damage multiplier for being in a cold environment var/heat_level_1 = 360 // Heat damage level 1 above this point. var/heat_level_2 = 400 // Heat damage level 2 above this point. var/heat_level_3 = 460 // Heat damage level 3 above this point; used for body temperature - var/hot_env_multiplier = 1 // Damage multiplier for being in a hot environment - var/heat_level_3_breathe = 1000 // Heat damage level 3 above this point; used for breathed air temperature + var/heatmod = 1 // Damage multiplier for being in a hot environment var/body_temperature = 310.15 //non-IS_SYNTHETIC species will try to stabilize at this temperature. (also affects temperature processing) var/reagent_tag //Used for metabolizing reagents. @@ -55,19 +50,6 @@ var/warning_low_pressure = WARNING_LOW_PRESSURE // Low pressure warning. var/hazard_low_pressure = HAZARD_LOW_PRESSURE // Dangerously low pressure. - var/list/atmos_requirements = list( - "min_oxy" = 16, - "max_oxy" = 0, - "min_nitro" = 0, - "max_nitro" = 0, - "min_tox" = 0, - "max_tox" = 0.005, - "min_co2" = 0, - "max_co2" = 10, - "sa_para" = 1, - "sa_sleep" = 5 - ) - var/brute_mod = 1 // Physical damage reduction/amplification var/burn_mod = 1 // Burn damage reduction/amplification var/tox_mod = 1 // Toxin damage reduction/amplification @@ -93,6 +75,8 @@ var/list/species_traits = list() + var/breathid = "o2" + var/clothing_flags = 0 // Underwear and socks. var/exotic_blood var/bodyflags = 0 @@ -210,171 +194,9 @@ for(var/obj/item/organ/external/O in H.bodyparts) O.owner = H -/datum/species/proc/handle_breath(var/datum/gas_mixture/breath, var/mob/living/carbon/human/H) - var/breath_pressure = (breath.total_moles()*R_IDEAL_GAS_EQUATION*breath.temperature)/BREATH_VOLUME - - var/O2_used = 0 - var/N2_used = 0 - var/Tox_used = 0 - var/CO2_used = 0 - - //Partial pressure of the O2 in our breath - var/O2_pp = (breath.oxygen/breath.total_moles()) * breath_pressure - // Partial pressure of Nitrogen - var/N2_pp = (breath.nitrogen/breath.total_moles()) * breath_pressure - // Partial pressure of plasma - var/Tox_pp = (breath.toxins/breath.total_moles()) * breath_pressure - // Partial pressure of CO2 - var/CO2_pp = (breath.carbon_dioxide/breath.total_moles()) * breath_pressure - - if(O2_pp < atmos_requirements["min_oxy"]) - if(prob(20)) - H.emote("gasp") - - H.failed_last_breath = 1 - if(O2_pp > 0) - var/ratio = atmos_requirements["min_oxy"] / O2_pp - H.adjustOxyLoss(min(5 * ratio, HUMAN_MAX_OXYLOSS)) - else - H.adjustOxyLoss(HUMAN_MAX_OXYLOSS) - H.throw_alert("oxy", /obj/screen/alert/oxy) - else if(atmos_requirements["max_oxy"] && O2_pp > atmos_requirements["max_oxy"]) - var/ratio = (breath.oxygen / atmos_requirements["max_oxy"]) * 1000 - H.adjustToxLoss(Clamp(ratio, MIN_PLASMA_DAMAGE, MAX_PLASMA_DAMAGE)) - H.throw_alert("oxy", /obj/screen/alert/too_much_oxy) - else - H.clear_alert("oxy") - if(atmos_requirements["min_oxy"]) //species breathes this gas, so, they got their air - H.failed_last_breath = 0 - H.adjustOxyLoss(-5) - O2_used = breath.oxygen / 6 - - if(N2_pp < atmos_requirements["min_nitro"]) - if(prob(20)) - H.emote("gasp") - - H.failed_last_breath = 1 - if(N2_pp > 0) - var/ratio = atmos_requirements["min_nitro"] / N2_pp - H.adjustOxyLoss(min(5 * ratio, HUMAN_MAX_OXYLOSS)) - else - H.adjustOxyLoss(HUMAN_MAX_OXYLOSS) - H.throw_alert("nitro", /obj/screen/alert/nitro) - else if(atmos_requirements["max_nitro"] && N2_pp > atmos_requirements["max_nitro"]) - var/ratio = (breath.nitrogen / atmos_requirements["max_nitro"]) * 1000 - H.adjustToxLoss(Clamp(ratio, MIN_PLASMA_DAMAGE, MAX_PLASMA_DAMAGE)) - H.throw_alert("nitro", /obj/screen/alert/too_much_nitro) - else - H.clear_alert("nitro") - if(atmos_requirements["min_nitro"]) //species breathes this gas, so they got their air - H.failed_last_breath = 0 - H.adjustOxyLoss(-5) - N2_used = breath.nitrogen / 6 - - if(Tox_pp < atmos_requirements["min_tox"]) - if(prob(20)) - H.emote("gasp") - - H.failed_last_breath = 1 - if(Tox_pp > 0) - var/ratio = atmos_requirements["min_tox"] / Tox_pp - H.adjustOxyLoss(min(5 * ratio, HUMAN_MAX_OXYLOSS)) - else - H.adjustOxyLoss(HUMAN_MAX_OXYLOSS) - H.throw_alert("tox_in_air", /obj/screen/alert/not_enough_tox) - else if(atmos_requirements["max_tox"] && Tox_pp > atmos_requirements["max_tox"]) - var/ratio = (breath.toxins / atmos_requirements["max_tox"]) * 10 - if(H.reagents) - H.reagents.add_reagent("plasma", Clamp(ratio, MIN_PLASMA_DAMAGE, MAX_PLASMA_DAMAGE)) - H.throw_alert("tox_in_air", /obj/screen/alert/tox_in_air) - else - H.clear_alert("tox_in_air") - if(atmos_requirements["min_tox"]) //species breathes this gas, so, they got their air - H.failed_last_breath = 0 - H.adjustOxyLoss(-5) - Tox_used = breath.toxins / 6 - - if(CO2_pp < atmos_requirements["min_co2"]) - if(prob(20)) - H.emote("gasp") - - H.failed_last_breath = 1 - if(CO2_pp) - var/ratio = atmos_requirements["min_co2"] / CO2_pp - H.adjustOxyLoss(min(5 * ratio, HUMAN_MAX_OXYLOSS)) - else - H.adjustOxyLoss(HUMAN_MAX_OXYLOSS) - H.throw_alert("co2", /obj/screen/alert/not_enough_co2) - else if(atmos_requirements["max_co2"] && CO2_pp > atmos_requirements["max_co2"]) - if(!H.co2overloadtime) // If it's the first breath with too much CO2 in it, lets start a counter, then have them pass out after 12s or so. - H.co2overloadtime = world.time - else if(world.time - H.co2overloadtime > 120) - H.Paralyse(5) - H.adjustOxyLoss(3) // Lets hurt em a little, let them know we mean business - if(world.time - H.co2overloadtime > 300) // They've been in here 30s now, lets start to kill them for their own good! - H.adjustOxyLoss(8) - if(prob(20)) // Lets give them some chance to know somethings not right though I guess. - H.emote("cough") - else - H.clear_alert("co2") - H.co2overloadtime = 0 - if(atmos_requirements["min_co2"]) //species breathes this gas, so they got their air - H.failed_last_breath = 0 - H.adjustOxyLoss(-5) - CO2_used = breath.carbon_dioxide / 6 - - breath.oxygen -= O2_used - breath.nitrogen -= N2_used - breath.toxins -= Tox_used - breath.carbon_dioxide -= CO2_used - breath.carbon_dioxide += O2_used - - - if(breath.trace_gases.len) // If there's some other shit in the air lets deal with it here. - for(var/datum/gas/sleeping_agent/SA in breath.trace_gases) - var/SA_pp = (SA.moles / breath.total_moles()) * breath_pressure - if(SA_pp > atmos_requirements["sa_para"]) // Enough to make us paralysed for a bit - H.Paralyse(3) // 3 gives them one second to wake up and run away a bit! - if(SA_pp > atmos_requirements["sa_sleep"]) // Enough to make us sleep as well - // This value is large because breaths are taken only once every 4 life ticks. - H.AdjustSleeping(8, bound_lower = 0, bound_upper = 10) - else if(SA_pp > 0.01) // There is sleeping gas in their lungs, but only a little, so give them a bit of a warning - if(prob(20)) - H.emote(pick("giggle", "laugh")) - - handle_temperature(breath, H) - return 1 - -/datum/species/proc/handle_temperature(datum/gas_mixture/breath, var/mob/living/carbon/human/H) // called by human/life, handles temperatures - if(abs(310.15 - breath.temperature) > 50) // Hot air hurts :( - if(H.status_flags & GODMODE) return 1 //godmode - if(breath.temperature < cold_level_1) - if(prob(20)) - to_chat(H, "You feel your face freezing and an icicle forming in your lungs!") - else if(breath.temperature > heat_level_1) - if(prob(20)) - to_chat(H, "You feel your face burning and a searing heat in your lungs!") - - - - switch(breath.temperature) - if(-INFINITY to cold_level_3) - H.apply_damage(cold_env_multiplier*COLD_GAS_DAMAGE_LEVEL_3, BURN, "head", used_weapon = "Excessive Cold") - - if(cold_level_3 to cold_level_2) - H.apply_damage(cold_env_multiplier*COLD_GAS_DAMAGE_LEVEL_2, BURN, "head", used_weapon = "Excessive Cold") - - if(cold_level_2 to cold_level_1) - H.apply_damage(cold_env_multiplier*COLD_GAS_DAMAGE_LEVEL_1, BURN, "head", used_weapon = "Excessive Cold") - - if(heat_level_1 to heat_level_2) - H.apply_damage(hot_env_multiplier*HEAT_GAS_DAMAGE_LEVEL_1, BURN, "head", used_weapon = "Excessive Heat") - - if(heat_level_2 to heat_level_3_breathe) - H.apply_damage(hot_env_multiplier*HEAT_GAS_DAMAGE_LEVEL_2, BURN, "head", used_weapon = "Excessive Heat") - - if(heat_level_3_breathe to INFINITY) - H.apply_damage(hot_env_multiplier*HEAT_GAS_DAMAGE_LEVEL_3, BURN, "head", used_weapon = "Excessive Heat") +/datum/species/proc/breathe(mob/living/carbon/human/H) + if((NO_BREATHE in species_traits) || (BREATHLESS in H.mutations)) + return TRUE //////////////// // MOVE SPEED // @@ -476,7 +298,13 @@ // For special snowflake species effects // (Slime People changing color based on the reagents they consume) /datum/species/proc/handle_life(var/mob/living/carbon/human/H) - return 1 + if((NO_BREATHE in species_traits) || (BREATHLESS in H.mutations)) + H.setOxyLoss(0) + H.SetLoseBreath(0) + + var/takes_crit_damage = (!(NOCRITDAMAGE in species_traits)) + if((H.health <= config.health_threshold_crit) && takes_crit_damage) + H.adjustBruteLoss(1) /datum/species/proc/handle_dna(var/mob/living/carbon/C, var/remove) //Handles DNA mutations, as that doesn't work at init. Make sure you call genemutcheck on any blocks changed here return diff --git a/code/modules/mob/living/carbon/human/species/station.dm b/code/modules/mob/living/carbon/human/species/station.dm index 7e7ddc1c5af..a04dd97c806 100644 --- a/code/modules/mob/living/carbon/human/species/station.dm +++ b/code/modules/mob/living/carbon/human/species/station.dm @@ -50,7 +50,6 @@ heat_level_1 = 380 //Default 360 - Higher is better heat_level_2 = 420 //Default 400 heat_level_3 = 480 //Default 460 - heat_level_3_breathe = 1100 //Default 1000 flesh_color = "#34AF10" reagent_tag = PROCESS_ORG @@ -106,7 +105,6 @@ heat_level_1 = 340 heat_level_2 = 380 heat_level_3 = 440 - heat_level_3_breathe = 900 primitive_form = "Farwa" @@ -273,24 +271,10 @@ cold_level_2 = 50 cold_level_3 = 0 - atmos_requirements = list( - "min_oxy" = 0, - "max_oxy" = 1, - "min_nitro" = 16, - "max_nitro" = 0, - "min_tox" = 0, - "max_tox" = 0.005, - "min_co2" = 0, - "max_co2" = 10, - "sa_para" = 1, - "sa_sleep" = 5 - ) + breathid = "n2" eyes = "vox_eyes_s" - breath_type = "nitrogen" - poison_type = "oxygen" - species_traits = list(NO_SCAN, IS_WHITELISTED, NOTRANSSTING) clothing_flags = HAS_SOCKS dietflags = DIET_OMNI @@ -323,7 +307,7 @@ has_organ = list( "heart" = /obj/item/organ/internal/heart, - "lungs" = /obj/item/organ/internal/lungs, + "lungs" = /obj/item/organ/internal/lungs/vox, "liver" = /obj/item/organ/internal/liver/vox, "kidneys" = /obj/item/organ/internal/kidneys, "brain" = /obj/item/organ/internal/brain, @@ -435,14 +419,11 @@ heat_level_1 = 2000 heat_level_2 = 3000 heat_level_3 = 4000 - heat_level_3_breathe = 4000 brute_mod = 0.2 burn_mod = 0.2 eyes = "blank_eyes" - breath_type = "nitrogen" - poison_type = "oxygen" species_traits = list(NO_SCAN, NO_BLOOD, NO_PAIN, IS_WHITELISTED) bodyflags = HAS_TAIL @@ -458,7 +439,7 @@ has_organ = list( "heart" = /obj/item/organ/internal/heart, - "lungs" = /obj/item/organ/internal/lungs, + "lungs" = /obj/item/organ/internal/lungs/vox, "liver" = /obj/item/organ/internal/liver, "kidneys" = /obj/item/organ/internal/kidneys, "brain" = /obj/item/organ/internal/brain, @@ -535,7 +516,7 @@ cold_level_1 = 280 cold_level_2 = 240 cold_level_3 = 200 - cold_env_multiplier = 3 + coldmod = 3 oxy_mod = 0 brain_mod = 2.5 @@ -593,7 +574,7 @@ E.sync_colour_to_human(H) H.update_hair(0) H.update_body() - return ..() + ..() #undef SLIMEPERSON_COLOR_SHIFT_TRIGGER #undef SLIMEPERSON_ICON_UPDATE_PERIOD @@ -791,7 +772,6 @@ heat_level_1 = 300 heat_level_2 = 340 heat_level_3 = 400 - heat_level_3_breathe = 700 blurb = "Commonly referred to (erroneously) as 'plant people', the Dionaea are a strange space-dwelling collective \ species hailing from Epsilon Ursae Minoris. Each 'diona' is a cluster of numerous cat-sized organisms called nymphs; \ @@ -880,6 +860,7 @@ if(H.nutrition < NUTRITION_LEVEL_STARVING+50) H.take_overall_damage(10,0) H.traumatic_shock++ + ..() /datum/species/machine name = "Machine" @@ -1014,13 +995,12 @@ cold_level_1 = -1 //Default 260 - Lower is better cold_level_2 = -1 //Default 200 cold_level_3 = -1 //Default 120 - cold_env_multiplier = -1 + coldmod = -1 heat_level_1 = 300 //Default 360 - Higher is better heat_level_2 = 340 //Default 400 heat_level_3 = 400 //Default 460 - heat_level_3_breathe = 600 //Default 1000 - hot_env_multiplier = 2 + heatmod = 2 flesh_color = "#a3d4eb" reagent_tag = PROCESS_ORG @@ -1034,40 +1014,4 @@ "metabolic strainer" = /obj/item/organ/internal/liver/drask, "eyes" = /obj/item/organ/internal/eyes/drask, //5 darksight. "brain" = /obj/item/organ/internal/brain/drask - ) - -/datum/species/drask/handle_temperature(datum/gas_mixture/breath, var/mob/living/carbon/human/H) - if( abs(310.15 - breath.temperature) > 50) - if(H.status_flags & GODMODE) return 1 //godmode - if(breath.temperature < 260) - if(prob(20)) - to_chat(H, " You feel an invigorating coldness in your lungs!") - if(breath.temperature > heat_level_1) - if(prob(20)) - to_chat(H, "You feel your face burning and a searing heat in your lungs!") - - switch(breath.temperature) - - if(-INFINITY to 60) - H.adjustFireLoss(cold_env_multiplier*COLD_GAS_DAMAGE_LEVEL_3*0.5) //3 points healed, applied every 4 ticks - H.adjustBruteLoss(cold_env_multiplier*COLD_GAS_DAMAGE_LEVEL_3) - H.throw_alert("temp", /obj/screen/alert/cold/drask, 3) - - if(61 to 200) - H.adjustFireLoss(cold_env_multiplier*COLD_GAS_DAMAGE_LEVEL_2*0.5) //1.5 healed every 4 ticks - H.adjustBruteLoss(cold_env_multiplier*COLD_GAS_DAMAGE_LEVEL_2) - H.throw_alert("temp", /obj/screen/alert/cold/drask, 2) - - if(201 to 260) - H.adjustFireLoss(cold_env_multiplier*COLD_GAS_DAMAGE_LEVEL_1*0.5) //0.5 healed every 4 ticks - H.adjustBruteLoss(cold_env_multiplier*COLD_GAS_DAMAGE_LEVEL_1) - H.throw_alert("temp", /obj/screen/alert/cold/drask, 1) - - if(heat_level_1 to heat_level_2) - H.apply_damage(hot_env_multiplier*HEAT_GAS_DAMAGE_LEVEL_1, BURN, "head", used_weapon = "Excessive Heat") - - if(heat_level_2 to heat_level_3_breathe) - H.apply_damage(hot_env_multiplier*HEAT_GAS_DAMAGE_LEVEL_2, BURN, "head", used_weapon = "Excessive Heat") - - if(heat_level_3_breathe to INFINITY) - H.apply_damage(hot_env_multiplier*HEAT_GAS_DAMAGE_LEVEL_3, BURN, "head", used_weapon = "Excessive Heat") + ) \ No newline at end of file diff --git a/code/modules/mob/living/carbon/human/update_icons.dm b/code/modules/mob/living/carbon/human/update_icons.dm index 31ce7f5b9e2..0d477bf5aa3 100644 --- a/code/modules/mob/living/carbon/human/update_icons.dm +++ b/code/modules/mob/living/carbon/human/update_icons.dm @@ -546,7 +546,7 @@ var/global/list/damage_icon_parts = list() if(LASER) standing.overlays += "lasereyes_s" add_image = 1 - if((RESIST_COLD in mutations) && (RESIST_HEAT in mutations)) + if((COLDRES in mutations) && (HEATRES in mutations)) standing.underlays -= "cold[fat]_s" standing.underlays -= "fire[fat]_s" standing.underlays += "coldfire[fat]_s" diff --git a/code/modules/mob/living/carbon/life.dm b/code/modules/mob/living/carbon/life.dm index 21f087eeeee..7ee55d7357a 100644 --- a/code/modules/mob/living/carbon/life.dm +++ b/code/modules/mob/living/carbon/life.dm @@ -27,7 +27,7 @@ //Start of a breath chain, calls breathe() /mob/living/carbon/handle_breathing() - if(mob_master.current_cycle%4==2 || failed_last_breath) + if(mob_master.current_cycle % 4 == 2 || failed_last_breath) breathe() //Breathe per 4 ticks, unless suffocating else if(istype(loc, /obj/)) @@ -40,8 +40,6 @@ return if(istype(loc, /obj/machinery/atmospherics/unary/cryo_cell)) return - if(NO_BREATH in mutations) - return // No breath mutation means no breathing. var/datum/gas_mixture/environment if(loc) @@ -52,6 +50,7 @@ if(health <= config.health_threshold_crit) AdjustLoseBreath(1) + //Suffocate if(losebreath > 0) AdjustLoseBreath(-1) if(prob(10)) @@ -75,7 +74,6 @@ breath_moles = environment.total_moles()*BREATH_PERCENTAGE breath = loc.remove_air(breath_moles) - else //Breathe from loc as obj again if(istype(loc, /obj/)) var/obj/loc_as_obj = loc @@ -90,13 +88,17 @@ //Third link in a breath chain, calls handle_breath_temperature() /mob/living/carbon/proc/check_breath(datum/gas_mixture/breath) if(status_flags & GODMODE) - return 0 + return FALSE + + var/lungs = get_organ_slot("lungs") + if(!lungs) + adjustOxyLoss(2) //CRIT - if(!breath || (breath.total_moles() == 0)) + if(!breath || (breath.total_moles() == 0) || !lungs) adjustOxyLoss(1) - failed_last_breath = 1 - throw_alert("oxy", /obj/screen/alert/oxy) + failed_last_breath = TRUE + throw_alert("not_enough_oxy", /obj/screen/alert/not_enough_oxy) return 0 var/safe_oxy_min = 16 @@ -117,20 +119,20 @@ if(prob(20)) emote("gasp") if(O2_partialpressure > 0) - var/ratio = safe_oxy_min/O2_partialpressure + var/ratio = 1 - O2_partialpressure/safe_oxy_min adjustOxyLoss(min(5*ratio, 3)) - failed_last_breath = 1 - oxygen_used = breath.oxygen*ratio/6 + failed_last_breath = TRUE + oxygen_used = breath.oxygen*ratio else adjustOxyLoss(3) - failed_last_breath = 1 - throw_alert("oxy", /obj/screen/alert/oxy) + failed_last_breath = TRUE + throw_alert("not_enough_oxy", /obj/screen/alert/not_enough_oxy) else //Enough oxygen - failed_last_breath = 0 + failed_last_breath = FALSE adjustOxyLoss(-5) - oxygen_used = breath.oxygen/6 - clear_alert("oxy") + oxygen_used = breath.oxygen + clear_alert("not_enough_oxy") breath.oxygen -= oxygen_used breath.carbon_dioxide += oxygen_used @@ -146,17 +148,17 @@ adjustOxyLoss(8) if(prob(20)) emote("cough") + else co2overloadtime = 0 //TOXINS/PLASMA if(Toxins_partialpressure > safe_tox_max) var/ratio = (breath.toxins/safe_tox_max) * 10 - if(reagents) - reagents.add_reagent("plasma", Clamp(ratio, MIN_PLASMA_DAMAGE, MAX_PLASMA_DAMAGE)) - throw_alert("tox_in_air", /obj/screen/alert/tox_in_air) + adjustToxLoss(Clamp(ratio, MIN_TOXIC_GAS_DAMAGE, MAX_TOXIC_GAS_DAMAGE)) + throw_alert("too_much_tox", /obj/screen/alert/too_much_tox) else - clear_alert("tox_in_air") + clear_alert("too_much_tox") //TRACE GASES if(breath.trace_gases.len) @@ -173,7 +175,7 @@ //BREATH TEMPERATURE handle_breath_temperature(breath) - return 1 + return TRUE //Fourth and final link in a breath chain /mob/living/carbon/proc/handle_breath_temperature(datum/gas_mixture/breath) diff --git a/code/modules/mob/living/carbon/superheroes.dm b/code/modules/mob/living/carbon/superheroes.dm index e5a9d73e402..d1eece0b69f 100644 --- a/code/modules/mob/living/carbon/superheroes.dm +++ b/code/modules/mob/living/carbon/superheroes.dm @@ -7,7 +7,7 @@ var/name var/desc var/class - var/list/default_genes = list(REGEN, NO_BREATH, RESIST_COLD) + var/list/default_genes = list(REGEN, BREATHLESS, COLDRES) var/list/default_spells = list() /datum/superheroes/proc/create(var/mob/living/carbon/human/H) diff --git a/code/modules/mob/living/simple_animal/friendly/cat.dm b/code/modules/mob/living/simple_animal/friendly/cat.dm index 5f977bfd508..501bfd1e798 100644 --- a/code/modules/mob/living/simple_animal/friendly/cat.dm +++ b/code/modules/mob/living/simple_animal/friendly/cat.dm @@ -169,7 +169,7 @@ icon_dead = "Syndicat_dead" icon_resting = "Syndicat_rest" gender = FEMALE - flags = NO_BREATHE + mutations = list(BREATHLESS) faction = list("syndicate") gold_core_spawnable = CHEM_MOB_SPAWN_INVALID eats_mice = 0 diff --git a/code/modules/mob/living/simple_animal/friendly/corgi.dm b/code/modules/mob/living/simple_animal/friendly/corgi.dm index bf4ac4a1664..d9ef25f4ca4 100644 --- a/code/modules/mob/living/simple_animal/friendly/corgi.dm +++ b/code/modules/mob/living/simple_animal/friendly/corgi.dm @@ -122,7 +122,7 @@ emote_see = list("shakes its head", "shivers") desc = "It's a corgi." set_light(0) - flags &= ~NO_BREATHE + mutations.Remove(BREATHLESS) atmos_requirements = default_atmos_requirements minbodytemp = initial(minbodytemp) inventory_head.loc = src.loc @@ -360,7 +360,7 @@ name = "Space Explorer [real_name]" desc = "That's one small step for a corgi. One giant yap for corgikind." valid = 1 - flags |= NO_BREATHE + mutations.Add(BREATHLESS) atmos_requirements = list("min_oxy" = 0, "max_oxy" = 0, "min_tox" = 0, "max_tox" = 0, "min_co2" = 0, "max_co2" = 0, "min_n2" = 0, "max_n2" = 0) minbodytemp = 0 diff --git a/code/modules/mob/living/simple_animal/friendly/fox.dm b/code/modules/mob/living/simple_animal/friendly/fox.dm index a31c1cb099f..6edfc6f42c9 100644 --- a/code/modules/mob/living/simple_animal/friendly/fox.dm +++ b/code/modules/mob/living/simple_animal/friendly/fox.dm @@ -33,7 +33,7 @@ icon_living = "Syndifox" icon_dead = "Syndifox_dead" icon_resting = "Syndifox_rest" - flags = NO_BREATHE + mutations = list(BREATHLESS) faction = list("syndicate") gold_core_spawnable = CHEM_MOB_SPAWN_INVALID atmos_requirements = list("min_oxy" = 0, "max_oxy" = 0, "min_tox" = 0, "max_tox" = 0, "min_co2" = 0, "max_co2" = 0, "min_n2" = 0, "max_n2" = 0) diff --git a/code/modules/mob/living/simple_animal/simple_animal.dm b/code/modules/mob/living/simple_animal/simple_animal.dm index fc331fb74b9..82a9778ab47 100644 --- a/code/modules/mob/living/simple_animal/simple_animal.dm +++ b/code/modules/mob/living/simple_animal/simple_animal.dm @@ -11,9 +11,6 @@ var/icon_resting = "" var/icon_gib = null //We only try to show a gibbing animation if this exists. - var/oxygen_alert = 0 - var/toxins_alert = 0 - var/fire_alert = 0 var/healable = 1 var/list/speak = list() @@ -201,7 +198,7 @@ var/areatemp = get_temperature(environment) - if(abs(areatemp - bodytemperature) > 40 && !(flags & NO_BREATHE)) + if(abs(areatemp - bodytemperature) > 40 && !(BREATHLESS in mutations)) var/diff = areatemp - bodytemperature diff = diff / 5 bodytemperature += diff @@ -213,21 +210,23 @@ if(atmos_requirements["min_oxy"] && oxy < atmos_requirements["min_oxy"]) atmos_suitable = 0 - throw_alert("oxy", /obj/screen/alert/oxy) + throw_alert("not_enough_oxy", /obj/screen/alert/not_enough_oxy) else if(atmos_requirements["max_oxy"] && oxy > atmos_requirements["max_oxy"]) atmos_suitable = 0 - throw_alert("oxy", /obj/screen/alert/too_much_oxy) + throw_alert("too_much_oxy", /obj/screen/alert/too_much_oxy) else - clear_alert("oxy") + clear_alert("not_enough_oxy") + clear_alert("too_much_oxy") if(atmos_requirements["min_tox"] && tox < atmos_requirements["min_tox"]) atmos_suitable = 0 - throw_alert("tox_in_air", /obj/screen/alert/not_enough_tox) + throw_alert("not_enough_tox", /obj/screen/alert/not_enough_tox) else if(atmos_requirements["max_tox"] && tox > atmos_requirements["max_tox"]) atmos_suitable = 0 - throw_alert("tox_in_air", /obj/screen/alert/tox_in_air) + throw_alert("too_much_tox", /obj/screen/alert/too_much_tox) else - clear_alert("tox_in_air") + clear_alert("too_much_tox") + clear_alert("not_enough_tox") if(atmos_requirements["min_n2"] && n2 < atmos_requirements["min_n2"]) atmos_suitable = 0 diff --git a/code/modules/power/lighting.dm b/code/modules/power/lighting.dm index 323d403d1cb..a6f5db34a7f 100644 --- a/code/modules/power/lighting.dm +++ b/code/modules/power/lighting.dm @@ -448,7 +448,7 @@ else prot = 1 - if(prot > 0 || (RESIST_HEAT in user.mutations)) + if(prot > 0 || (HEATRES in user.mutations)) to_chat(user, "You remove the light [fitting]") else if(TK in user.mutations) to_chat(user, "You telekinetically remove the light [fitting].") diff --git a/code/modules/station_goals/dna_vault.dm b/code/modules/station_goals/dna_vault.dm index 977899a3195..70a5d522678 100644 --- a/code/modules/station_goals/dna_vault.dm +++ b/code/modules/station_goals/dna_vault.dm @@ -278,8 +278,8 @@ var/list/non_simple_animals = typecacheof(list(/mob/living/carbon/human/monkey,/ switch(upgrade_type) if(VAULT_SPACEIMMUNE) to_chat(H, "You suddenly don't feel the need to breathe anymore. You also don't feel any cold anymore.") - grant_power(H, NOBREATHBLOCK, NO_BREATH) - grant_power(H, FIREBLOCK, RESIST_COLD) + grant_power(H, BREATHLESSBLOCK, BREATHLESS) + grant_power(H, FIREBLOCK, COLDRES) if(VAULT_XRAY) to_chat(H, "You can suddenly see through walls.") grant_power(H, XRAYBLOCK, XRAY) diff --git a/code/modules/surgery/organs/lungs.dm b/code/modules/surgery/organs/lungs.dm new file mode 100644 index 00000000000..be52c7c3a0d --- /dev/null +++ b/code/modules/surgery/organs/lungs.dm @@ -0,0 +1,309 @@ +/obj/item/organ/internal/lungs + name = "lungs" + icon_state = "lungs" + parent_organ = "chest" + slot = "lungs" + organ_tag = "lungs" + gender = PLURAL + w_class = WEIGHT_CLASS_NORMAL + + //Breath damage + + var/safe_oxygen_min = 16 // Minimum safe partial pressure of O2, in kPa + var/safe_oxygen_max = 0 + var/safe_nitro_min = 0 + var/safe_nitro_max = 0 + var/safe_co2_min = 0 + var/safe_co2_max = 10 // Yes it's an arbitrary value who cares? + var/safe_toxins_min = 0 + var/safe_toxins_max = 0.05 + var/SA_para_min = 1 //Sleeping agent + var/SA_sleep_min = 5 //Sleeping agent + + var/oxy_breath_dam_min = MIN_TOXIC_GAS_DAMAGE + var/oxy_breath_dam_max = MAX_TOXIC_GAS_DAMAGE + var/oxy_damage_type = OXY + var/nitro_breath_dam_min = MIN_TOXIC_GAS_DAMAGE + var/nitro_breath_dam_max = MAX_TOXIC_GAS_DAMAGE + var/nitro_damage_type = OXY + var/co2_breath_dam_min = MIN_TOXIC_GAS_DAMAGE + var/co2_breath_dam_max = MAX_TOXIC_GAS_DAMAGE + var/co2_damage_type = OXY + var/tox_breath_dam_min = MIN_TOXIC_GAS_DAMAGE + var/tox_breath_dam_max = MAX_TOXIC_GAS_DAMAGE + var/tox_damage_type = TOX + + var/cold_message = "your face freezing and an icicle forming" + var/cold_level_1_threshold = 260 + var/cold_level_2_threshold = 200 + var/cold_level_3_threshold = 120 + var/cold_level_1_damage = COLD_GAS_DAMAGE_LEVEL_1 //Keep in mind with gas damage levels, you can set these to be negative, if you want someone to heal, instead. + var/cold_level_2_damage = COLD_GAS_DAMAGE_LEVEL_2 + var/cold_level_3_damage = COLD_GAS_DAMAGE_LEVEL_3 + var/cold_damage_type = BURN + + var/hot_message = "your face burning and a searing heat" + var/heat_level_1_threshold = 360 + var/heat_level_2_threshold = 400 + var/heat_level_3_threshold = 1000 + var/heat_level_1_damage = HEAT_GAS_DAMAGE_LEVEL_1 + var/heat_level_2_damage = HEAT_GAS_DAMAGE_LEVEL_2 + var/heat_level_3_damage = HEAT_GAS_DAMAGE_LEVEL_3 + var/heat_damage_type = BURN + + +/obj/item/organ/internal/lungs/proc/check_breath(datum/gas_mixture/breath, mob/living/carbon/human/H) + if((H.status_flags & GODMODE)) + return + + var/species_traits = list() + if(H && H.species && H.species.species_traits) + species_traits = H.species.species_traits + + if(!breath || (breath.total_moles() == 0)) + if(H.health >= config.health_threshold_crit) + H.adjustOxyLoss(HUMAN_MAX_OXYLOSS) + else if(!(NOCRITDAMAGE in species_traits)) + H.adjustOxyLoss(HUMAN_CRIT_MAX_OXYLOSS) + + H.failed_last_breath = TRUE + if(safe_oxygen_min) + H.throw_alert("not_enough_oxy", /obj/screen/alert/not_enough_oxy) + else if(safe_toxins_min) + H.throw_alert("not_enough_tox", /obj/screen/alert/not_enough_tox) + else if(safe_co2_min) + H.throw_alert("not_enough_co2", /obj/screen/alert/not_enough_co2) + else if(safe_nitro_min) + H.throw_alert("not_enough_nitro", /obj/screen/alert/not_enough_nitro) + return FALSE + + var/gas_breathed = 0 + + //Partial pressures in our breath + var/O2_pp = breath.get_breath_partial_pressure(breath.oxygen) + var/N2_pp = breath.get_breath_partial_pressure(breath.nitrogen) + var/Toxins_pp = breath.get_breath_partial_pressure(breath.toxins) + var/CO2_pp = breath.get_breath_partial_pressure(breath.carbon_dioxide) + + + //-- OXY --// + + //Too much oxygen! //Yes, some species may not like it. + if(safe_oxygen_max) + if(O2_pp > safe_oxygen_max) + var/ratio = (breath.oxygen/safe_oxygen_max) * 10 + H.apply_damage_type(Clamp(ratio, oxy_breath_dam_min, oxy_breath_dam_max), oxy_damage_type) + H.throw_alert("too_much_oxy", /obj/screen/alert/too_much_oxy) + else + H.clear_alert("too_much_oxy") + + //Too little oxygen! + if(safe_oxygen_min) + if(O2_pp < safe_oxygen_min) + gas_breathed = handle_too_little_breath(H, O2_pp, safe_oxygen_min, breath.oxygen) + H.throw_alert("not_enough_oxy", /obj/screen/alert/not_enough_oxy) + else + H.failed_last_breath = FALSE + H.adjustOxyLoss(-5) + gas_breathed = breath.oxygen + H.clear_alert("not_enough_oxy") + + //Exhale + breath.oxygen -= gas_breathed + breath.carbon_dioxide += gas_breathed + gas_breathed = 0 + + //-- Nitrogen --// + + //Too much nitrogen! + if(safe_nitro_max) + if(N2_pp > safe_nitro_max) + var/ratio = (breath.nitrogen/safe_nitro_max) * 10 + H.apply_damage_type(Clamp(ratio, nitro_breath_dam_min, nitro_breath_dam_max), nitro_damage_type) + H.throw_alert("too_much_nitro", /obj/screen/alert/too_much_nitro) + else + H.clear_alert("too_much_nitro") + + //Too little nitrogen! + if(safe_nitro_min) + if(N2_pp < safe_nitro_min) + gas_breathed = handle_too_little_breath(H, N2_pp, safe_nitro_min, breath.nitrogen) + H.throw_alert("nitro", /obj/screen/alert/not_enough_nitro) + else + H.failed_last_breath = FALSE + H.adjustOxyLoss(-5) + gas_breathed = breath.nitrogen + H.clear_alert("nitro") + + //Exhale + breath.nitrogen -= gas_breathed + breath.carbon_dioxide += gas_breathed + gas_breathed = 0 + + //-- CO2 --// + + //CO2 does not affect failed_last_breath. So if there was enough oxygen in the air but too much co2, this will hurt you, but only once per 4 ticks, instead of once per tick. + if(safe_co2_max) + if(CO2_pp > safe_co2_max) + if(!H.co2overloadtime) // If it's the first breath with too much CO2 in it, lets start a counter, then have them pass out after 12s or so. + H.co2overloadtime = world.time + else if(world.time - H.co2overloadtime > 120) + H.Paralyse(3) + H.apply_damage_type(3, co2_damage_type) // Lets hurt em a little, let them know we mean business + if(world.time - H.co2overloadtime > 300) // They've been in here 30s now, lets start to kill them for their own good! + H.apply_damage_type(8, co2_damage_type) + H.throw_alert("too_much_co2", /obj/screen/alert/too_much_co2) + if(prob(20)) // Lets give them some chance to know somethings not right though I guess. + H.emote("cough") + + else + H.co2overloadtime = 0 + H.clear_alert("too_much_co2") + + //Too little CO2! + if(safe_co2_min) + if(CO2_pp < safe_co2_min) + gas_breathed = handle_too_little_breath(H, CO2_pp, safe_co2_min, breath.carbon_dioxide) + H.throw_alert("not_enough_co2", /obj/screen/alert/not_enough_co2) + else + H.failed_last_breath = FALSE + H.adjustOxyLoss(-5) + gas_breathed = breath.carbon_dioxide + H.clear_alert("not_enough_co2") + + //Exhale + breath.carbon_dioxide -= gas_breathed + breath.oxygen += gas_breathed + gas_breathed = 0 + + + //-- TOX --// + + //Too much toxins! + if(safe_toxins_max) + if(Toxins_pp > safe_toxins_max) + var/ratio = (breath.toxins/safe_toxins_max) * 10 + H.apply_damage_type(Clamp(ratio, tox_breath_dam_min, tox_breath_dam_max), tox_damage_type) + H.throw_alert("too_much_tox", /obj/screen/alert/too_much_tox) + else + H.clear_alert("too_much_tox") + + + //Too little toxins! + if(safe_toxins_min) + if(Toxins_pp < safe_toxins_min) + gas_breathed = handle_too_little_breath(H, Toxins_pp, safe_toxins_min, breath.toxins) + H.throw_alert("not_enough_tox", /obj/screen/alert/not_enough_tox) + else + H.failed_last_breath = FALSE + H.adjustOxyLoss(-5) + gas_breathed = breath.toxins + H.clear_alert("not_enough_tox") + + //Exhale + breath.toxins -= gas_breathed + breath.carbon_dioxide += gas_breathed + gas_breathed = 0 + + + //-- TRACES --// + + if(breath.trace_gases.len) // If there's some other shit in the air lets deal with it here. + for(var/datum/gas/sleeping_agent/SA in breath.trace_gases) + var/SA_pp = breath.get_breath_partial_pressure(SA.moles) + if(SA_pp > SA_para_min) + H.Paralyse(3) // 3 gives them one second to wake up and run away a bit! + if(SA_pp > SA_sleep_min) // Enough to make us sleep as well + H.AdjustSleeping(8, bound_lower = 0, bound_upper = 10) + else if(SA_pp > 0.01) // There is sleeping gas in their lungs, but only a little, so give them a bit of a warning + if(prob(20)) + H.emote(pick("giggle", "laugh")) + + handle_breath_temperature(breath, H) + + return TRUE + + +/obj/item/organ/internal/lungs/proc/handle_too_little_breath(mob/living/carbon/human/H = null, breath_pp = 0, safe_breath_min = 0, true_pp = 0) + . = 0 + if(!H || !safe_breath_min) //the other args are either: Ok being 0 or Specifically handled. + return FALSE + + if(prob(20)) + H.emote("gasp") + if(breath_pp > 0) + var/ratio = safe_breath_min/breath_pp + H.adjustOxyLoss(min(5*ratio, HUMAN_MAX_OXYLOSS)) // Don't fuck them up too fast (space only does HUMAN_MAX_OXYLOSS after all! + H.failed_last_breath = TRUE + . = true_pp*ratio/6 + else + H.adjustOxyLoss(HUMAN_MAX_OXYLOSS) + H.failed_last_breath = TRUE + + +/obj/item/organ/internal/lungs/proc/handle_breath_temperature(datum/gas_mixture/breath, mob/living/carbon/human/H) // called by human/life, handles temperatures + var/breath_temperature = breath.temperature + + var/species_traits = list() + if(H && H.species && H.species.species_traits) + species_traits = H.species.species_traits + + if(!(COLDRES in H.mutations) && !(RESISTCOLD in species_traits)) // COLD DAMAGE + var/cold_modifier = H.species.coldmod + if(breath_temperature < cold_level_3_threshold) + H.apply_damage_type(cold_level_3_damage*cold_modifier, cold_damage_type) + if(breath_temperature > cold_level_3_threshold && breath_temperature < cold_level_2_threshold) + H.apply_damage_type(cold_level_2_damage*cold_modifier, cold_damage_type) + if(breath_temperature > cold_level_2_threshold && breath_temperature < cold_level_1_threshold) + H.apply_damage_type(cold_level_1_damage*cold_modifier, cold_damage_type) + if(breath_temperature < cold_level_1_threshold) + if(prob(20)) + to_chat(H, "You feel [cold_message] in your [name]!") + + if(!(HEATRES in H.mutations) && !(RESISTHOT in species_traits)) // HEAT DAMAGE + var/heat_modifier = H.species.heatmod + if(breath_temperature > heat_level_1_threshold && breath_temperature < heat_level_2_threshold) + H.apply_damage_type(heat_level_1_damage*heat_modifier, heat_damage_type) + if(breath_temperature > heat_level_2_threshold && breath_temperature < heat_level_3_threshold) + H.apply_damage_type(heat_level_2_damage*heat_modifier, heat_damage_type) + if(breath_temperature > heat_level_3_threshold) + H.apply_damage_type(heat_level_3_damage*heat_modifier, heat_damage_type) + if(breath_temperature > heat_level_1_threshold) + if(prob(20)) + to_chat(H, "You feel [hot_message] in your [name]!") + +/obj/item/organ/internal/lungs/prepare_eat() + var/obj/S = ..() + S.reagents.add_reagent("salbutamol", 5) + return S + +/obj/item/organ/internal/lungs/plasmaman + name = "plasma filter" + desc = "A spongy rib-shaped mass for filtering plasma from the air." + icon_state = "lungs-plasma" + species = "Plasmaman" + + safe_oxygen_min = 0 //We don't breath this + safe_toxins_min = 16 //We breath THIS! + safe_toxins_max = 0 + +/obj/item/organ/internal/lungs/vox + name = "Vox lungs" + desc = "They're filled with dust....wow." + species = "Vox" + + safe_oxygen_min = 0 + safe_oxygen_max = 1 + safe_nitro_min = 16 + oxy_damage_type = TOX + +/obj/item/organ/internal/lungs/drask + icon = 'icons/obj/surgery_drask.dmi' + species = "Drask" + + cold_message = "an invigorating coldness" + cold_level_3_threshold = 60 + cold_level_1_damage = -COLD_GAS_DAMAGE_LEVEL_1 //They heal brute when the air is cold + cold_level_2_damage = -COLD_GAS_DAMAGE_LEVEL_2 + cold_level_3_damage = -COLD_GAS_DAMAGE_LEVEL_3 + cold_damage_type = BRUTE \ No newline at end of file diff --git a/code/modules/surgery/organs/organ_internal.dm b/code/modules/surgery/organs/organ_internal.dm index c791dd581de..16889a036a9 100644 --- a/code/modules/surgery/organs/organ_internal.dm +++ b/code/modules/surgery/organs/organ_internal.dm @@ -266,36 +266,6 @@ H.adjustFireLoss(-cursed_heart.heal_burn) H.adjustOxyLoss(-cursed_heart.heal_oxy) -/obj/item/organ/internal/lungs - name = "lungs" - icon_state = "lungs" - gender = PLURAL - organ_tag = "lungs" - parent_organ = "chest" - slot = "lungs" - vital = 1 - -//Insert something neat here. -///obj/item/organ/internal/lungs/remove(mob/living/carbon/M, special = 0) -// owner.losebreath += 10 - //insert oxy damage extream here. -// . = ..() - - -/obj/item/organ/internal/lungs/on_life() - ..() - if(germ_level > INFECTION_LEVEL_ONE) - if(prob(5)) - owner.emote("cough") //respitory tract infection - - if(is_bruised()) - if(prob(2)) - owner.custom_emote(1, "coughs up blood!") - owner.bleed(1) - if(prob(4)) - owner.custom_emote(1, "gasps for air!") - owner.AdjustLoseBreath(5) - /obj/item/organ/internal/kidneys name = "kidneys" icon_state = "kidneys" diff --git a/code/modules/surgery/organs/subtypes/drask.dm b/code/modules/surgery/organs/subtypes/drask.dm index 6e1e6662d0a..9c204cd92f3 100644 --- a/code/modules/surgery/organs/subtypes/drask.dm +++ b/code/modules/surgery/organs/subtypes/drask.dm @@ -12,10 +12,6 @@ parent_organ = "head" species = "Drask" -/obj/item/organ/internal/lungs/drask - icon = 'icons/obj/surgery_drask.dmi' - species = "Drask" - /obj/item/organ/internal/liver/drask name = "metabolic strainer" icon = 'icons/obj/surgery_drask.dmi' diff --git a/code/modules/surgery/surgery.dm b/code/modules/surgery/surgery.dm index a11be40d395..4475a4cfe30 100644 --- a/code/modules/surgery/surgery.dm +++ b/code/modules/surgery/surgery.dm @@ -201,7 +201,7 @@ for(var/mob/living/carbon/human/H in view(2, E.loc))//germs from people if(AStar(E.loc, H.loc, /turf/proc/Distance, 2, simulated_only = 0)) - if((!(NO_BREATH in H.mutations) || !(NO_BREATH in H.species.species_traits)) && !H.wear_mask) //wearing a mask helps preventing people from breathing cooties into open incisions + if((!(BREATHLESS in H.mutations) || !(NO_BREATHE in H.species.species_traits)) && !H.wear_mask) //wearing a mask helps preventing people from breathing cooties into open incisions germs+=H.germ_level/4 for(var/obj/effect/decal/cleanable/M in view(2, E.loc))//germs from messes diff --git a/icons/mob/screen_alert.dmi b/icons/mob/screen_alert.dmi index 297f9a9aae2..aa3916b07d6 100644 Binary files a/icons/mob/screen_alert.dmi and b/icons/mob/screen_alert.dmi differ diff --git a/icons/obj/surgery.dmi b/icons/obj/surgery.dmi index cccdb4d16fb..a47c56cba87 100644 Binary files a/icons/obj/surgery.dmi and b/icons/obj/surgery.dmi differ diff --git a/paradise.dme b/paradise.dme index 30b34017bcc..88f7d05be0b 100644 --- a/paradise.dme +++ b/paradise.dme @@ -2157,6 +2157,7 @@ #include "code\modules\surgery\organs\blood.dm" #include "code\modules\surgery\organs\body_egg.dm" #include "code\modules\surgery\organs\helpers.dm" +#include "code\modules\surgery\organs\lungs.dm" #include "code\modules\surgery\organs\organ.dm" #include "code\modules\surgery\organs\organ_external.dm" #include "code\modules\surgery\organs\organ_icon.dm"