diff --git a/code/modules/clothing/hardhat.dm b/code/modules/clothing/hardhat.dm index c43dd598204..0cc9afa8b9b 100644 --- a/code/modules/clothing/hardhat.dm +++ b/code/modules/clothing/hardhat.dm @@ -19,11 +19,14 @@ icon_state = "hardhat0_red" item_state = "hardhat0_red" color = "red" + name = "firefighter helmet" + flags = FPRINT | TABLEPASS | SUITSPACE | STOPSPRESSUREDMAGE /obj/item/clothing/head/helmet/hardhat/white icon_state = "hardhat0_white" item_state = "hardhat0_white" color = "white" + flags = FPRINT | TABLEPASS | SUITSPACE | STOPSPRESSUREDMAGE /obj/item/clothing/head/helmet/hardhat/dblue icon_state = "hardhat0_dblue" diff --git a/code/modules/clothing/suits/fire.dm b/code/modules/clothing/suits/fire.dm index 61559789af6..05732fd6d18 100644 --- a/code/modules/clothing/suits/fire.dm +++ b/code/modules/clothing/suits/fire.dm @@ -12,6 +12,7 @@ allowed = list(/obj/item/device/flashlight,/obj/item/weapon/tank/emergency_oxygen,/obj/item/weapon/extinguisher) slowdown = 1.0 flags_inv = HIDEGLOVES|HIDESHOES|HIDEJUMPSUIT + flags = FPRINT | TABLEPASS | ONESIZEFITSALL | STOPSPRESSUREDMAGE /obj/item/clothing/suit/fire/firefighter diff --git a/code/modules/detectivework/detective_work.dm b/code/modules/detectivework/detective_work.dm index d4ab96bb212..7b0eda82d87 100644 --- a/code/modules/detectivework/detective_work.dm +++ b/code/modules/detectivework/detective_work.dm @@ -54,11 +54,10 @@ var/const/FINGERPRINT_COMPLETE = 6 //This is the output of the stringpercent(pri obj/machinery/computer/forensic_scanning name = "\improper High-Res Forensic Scanning Computer" icon_state = "forensic" - var - obj/item/scanning - temp = "" - canclear = 1 - authenticated = 0 + var/obj/item/scanning + var/temp = "" + var/canclear = 1 + var/authenticated = 0 //Here's the structure for files: each entry is a list, and entry one in that list is the string of their //full and scrambled fingerprint. This acts as the method to arrange evidence. Each subsequent entry is list @@ -68,14 +67,14 @@ obj/machinery/computer/forensic_scanning // 3: All fibers on the object // 4: All blood on the object //This is then used to show what objects were used to "find" the full print, as well as the fibers on it. - list/files + var/list/files //This holds objects (1) without prints, and their fibers(2) and blood(3). - list/misc - obj/item/weapon/f_card/card + var/list/misc + var/obj/item/weapon/f_card/card - scan_data = "" - scan_name = "" - scan_process = 0 + var/scan_data = "" + var/scan_name = "" + var/scan_process = 0 req_access = list(access_forensics_lockers) diff --git a/code/modules/mob/living/carbon/human/life.dm b/code/modules/mob/living/carbon/human/life.dm index c184668c217..5e14d998ddb 100644 --- a/code/modules/mob/living/carbon/human/life.dm +++ b/code/modules/mob/living/carbon/human/life.dm @@ -99,1148 +99,1090 @@ if(!currentTurf.sd_lumcount) playsound_local(src,pick(scarySounds),50, 1, -1) +/mob/living/carbon/human/calculate_affecting_pressure(var/pressure) + ..() + var/pressure_difference = abs( pressure - ONE_ATMOSPHERE ) + + var/pressure_adjustment_coefficient = 1 //Determins how much the clothing you are wearing protects you in percent. + if(wear_suit && (wear_suit.flags & STOPSPRESSUREDMAGE)) + pressure_adjustment_coefficient -= PRESSURE_SUIT_REDUCTION_COEFFICIENT + if(head && (head.flags & STOPSPRESSUREDMAGE)) + pressure_adjustment_coefficient -= PRESSURE_HEAD_REDUCTION_COEFFICIENT + pressure_adjustment_coefficient = max(pressure_adjustment_coefficient,0) //So it isn't less than 0 + pressure_difference = pressure_difference * pressure_adjustment_coefficient + if(pressure > ONE_ATMOSPHERE) + return ONE_ATMOSPHERE + pressure_difference + else + return ONE_ATMOSPHERE - pressure_difference + /mob/living/carbon/human - proc - //I've rewritten this to do what it was intended to do. - //This can probably be removed like Rockdtben suggested, but I'd like to go over the damage procs first just to be safe. - //Perhaps code view-vars to be unable to directly edit the damagevariables without using procs - clamp_values() - stunned = max( min(stunned,20), 0 ) // positive and under 20 - paralysis = max( min(paralysis,20), 0 ) // positive and under 20 - weakened = max( min(weakened,20), 0 ) // positive and under 20 - sleeping = max( min(sleeping, 20), 0 ) // positive and under 20 - oxyloss = max(oxyloss,0) // positive - toxloss = max(toxloss,0) // positive -// bruteloss = max(bruteloss,0) // positive -// fireloss = max(fireloss,0) // positive - update_mind() - if(!mind && client) - mind = new - mind.current = src - mind.assigned_role = job - if(!mind.assigned_role) - mind.assigned_role = "Assistant" - mind.key = key + //I've rewritten this to do what it was intended to do. + //This can probably be removed like Rockdtben suggested, but I'd like to go over the damage procs first just to be safe. + //Perhaps code view-vars to be unable to directly edit the damagevariables without using procs + proc/clamp_values() + stunned = max( min(stunned,20), 0 ) // positive and under 20 + paralysis = max( min(paralysis,20), 0 ) // positive and under 20 + weakened = max( min(weakened,20), 0 ) // positive and under 20 + sleeping = max( min(sleeping, 20), 0 ) // positive and under 20 + oxyloss = max(oxyloss,0) // positive + toxloss = max(toxloss,0) // positive +// bruteloss = max(bruteloss,0) // positive +// fireloss = max(fireloss,0) // positive + + proc/update_mind() + if(!mind && client) + mind = new + mind.current = src + mind.assigned_role = job + if(!mind.assigned_role) + mind.assigned_role = "Assistant" + mind.key = key - handle_disabilities() - if(hallucination > 0) - if(hallucination >= 20 && health > 0) - if(prob(3)) - fake_attack(src) - //for(var/atom/a in hallucinations) - // a.hallucinate(src) - if(!handling_hal && hallucination > 20) - spawn handle_hallucinations() //The not boring kind! + proc/handle_disabilities() + if(hallucination > 0) + if(hallucination >= 20 && health > 0) + if(prob(3)) + fake_attack(src) + //for(var/atom/a in hallucinations) + // a.hallucinate(src) + if(!handling_hal && hallucination > 20) + spawn handle_hallucinations() //The not boring kind! - if(hallucination <= 2) - halloss = 0 - hallucination = 0 - else - hallucination -= 2 - //if(health < 0) - // for(var/obj/a in hallucinations) - // del a + if(hallucination <= 2) + halloss = 0 + hallucination = 0 else - //halloss = 0 - for(var/atom/a in hallucinations) - del a + hallucination -= 2 + //if(health < 0) + // for(var/obj/a in hallucinations) + // del a + else + //halloss = 0 + for(var/atom/a in hallucinations) + del a - if(halloss > 100) - src << "You're too tired to keep going..." - for(var/mob/O in viewers(src, null)) - if(O == src) - continue - O.show_message(text("\red [src] slumps to the ground panting, too weak to continue fighting."), 1) - Paralyse(15) - setHalLoss(99) + if(halloss > 100) + src << "You're too tired to keep going..." + for(var/mob/O in viewers(src, null)) + if(O == src) + continue + O.show_message(text("\red [src] slumps to the ground panting, too weak to continue fighting."), 1) + Paralyse(15) + setHalLoss(99) - if (disabilities & 2) - if ((prob(1) && paralysis < 1 && r_epil < 1)) - src << "\red You have a seizure!" - for(var/mob/O in viewers(src, null)) - if(O == src) - continue - O.show_message(text("\red [src] starts having a seizure!"), 1) - Paralyse(10) - make_jittery(1000) - if (disabilities & 4) - if ((prob(5) && paralysis <= 1 && r_ch_cou < 1)) - drop_item() - spawn( 0 ) - emote("cough") - return - if (disabilities & 8) - if ((prob(10) && paralysis <= 1 && r_Tourette < 1)) - Stun(10) - spawn( 0 ) - switch(rand(1, 3)) - if(1) - emote("twitch") - if(2 to 3) - say("[prob(50) ? ";" : ""][pick("SHIT", "PISS", "FUCK", "CUNT", "COCKSUCKER", "MOTHERFUCKER", "TITS")]") - var/old_x = pixel_x - var/old_y = pixel_y - pixel_x += rand(-2,2) - pixel_y += rand(-1,1) - sleep(2) - pixel_x = old_x - pixel_y = old_y - return - if (disabilities & 16) - if (prob(10)) - stuttering = max(10, stuttering) - if (getBrainLoss() >= 60 && stat != 2) - if (prob(7)) - switch(pick(1,2,3)) + if (disabilities & 2) + if ((prob(1) && paralysis < 1 && r_epil < 1)) + src << "\red You have a seizure!" + for(var/mob/O in viewers(src, null)) + if(O == src) + continue + O.show_message(text("\red [src] starts having a seizure!"), 1) + Paralyse(10) + make_jittery(1000) + if (disabilities & 4) + if ((prob(5) && paralysis <= 1 && r_ch_cou < 1)) + drop_item() + spawn( 0 ) + emote("cough") + return + if (disabilities & 8) + if ((prob(10) && paralysis <= 1 && r_Tourette < 1)) + Stun(10) + spawn( 0 ) + switch(rand(1, 3)) if(1) - say(pick("IM A PONY NEEEEEEIIIIIIIIIGH", "without oxigen blob don't evoluate?", "CAPTAINS A COMDOM", "[pick("", "that faggot traitor")] [pick("joerge", "george", "gorge", "gdoruge")] [pick("mellens", "melons", "mwrlins")] is grifing me HAL;P!!!", "can u give me [pick("telikesis","halk","eppilapse")]?", "THe saiyans screwed", "Bi is THE BEST OF BOTH WORLDS>", "I WANNA PET TEH monkeyS", "stop grifing me!!!!", "SOTP IT#")) - if(2) - say(pick("FUS RO DAH","fucking 4rries!", "stat me", ">my face", "roll it easy!", "waaaaaagh!!!", "red wonz go fasta", "FOR TEH EMPRAH", "lol2cat", "dem dwarfs man, dem dwarfs", "SPESS MAHREENS", "hwee did eet fhor khayosss", "lifelike texture ;_;", "luv can bloooom")) - if(3) - emote("drool") + emote("twitch") + if(2 to 3) + say("[prob(50) ? ";" : ""][pick("SHIT", "PISS", "FUCK", "CUNT", "COCKSUCKER", "MOTHERFUCKER", "TITS")]") + var/old_x = pixel_x + var/old_y = pixel_y + pixel_x += rand(-2,2) + pixel_y += rand(-1,1) + sleep(2) + pixel_x = old_x + pixel_y = old_y + return + if (disabilities & 16) + if (prob(10)) + stuttering = max(10, stuttering) + if (getBrainLoss() >= 60 && stat != 2) + if (prob(7)) + switch(pick(1,2,3)) + if(1) + say(pick("IM A PONY NEEEEEEIIIIIIIIIGH", "without oxigen blob don't evoluate?", "CAPTAINS A COMDOM", "[pick("", "that faggot traitor")] [pick("joerge", "george", "gorge", "gdoruge")] [pick("mellens", "melons", "mwrlins")] is grifing me HAL;P!!!", "can u give me [pick("telikesis","halk","eppilapse")]?", "THe saiyans screwed", "Bi is THE BEST OF BOTH WORLDS>", "I WANNA PET TEH monkeyS", "stop grifing me!!!!", "SOTP IT#")) + if(2) + say(pick("FUS RO DAH","fucking 4rries!", "stat me", ">my face", "roll it easy!", "waaaaaagh!!!", "red wonz go fasta", "FOR TEH EMPRAH", "lol2cat", "dem dwarfs man, dem dwarfs", "SPESS MAHREENS", "hwee did eet fhor khayosss", "lifelike texture ;_;", "luv can bloooom")) + if(3) + emote("drool") - handle_mutations_and_radiation() + proc/handle_mutations_and_radiation() + if(getFireLoss()) + if((COLD_RESISTANCE in mutations) || (prob(1) && prob(75))) + heal_organ_damage(0,1) + + // Make nanoregen heal youu, -3 all damage types + if(NANOREGEN in augmentations) + var/healed = 0 + if(getToxLoss()) + adjustToxLoss(-3) + healed = 1 + if(getOxyLoss()) + adjustOxyLoss(-3) + healed = 1 + if(getCloneLoss()) + adjustCloneLoss(-3) + healed = 1 + if(getBruteLoss()) + heal_organ_damage(3,0) + healed = 1 if(getFireLoss()) - if((COLD_RESISTANCE in mutations) || (prob(1) && prob(75))) - heal_organ_damage(0,1) + heal_organ_damage(0,3) + healed = 1 + if(halloss > 0) + halloss -= 3 + if(halloss < 0) halloss = 0 + healed = 1 + if(healed) + if(prob(5)) + src << "\blue You feel your wounds mending..." - // Make nanoregen heal youu, -3 all damage types - if(NANOREGEN in augmentations) - var/healed = 0 - if(getToxLoss()) - adjustToxLoss(-3) - healed = 1 - if(getOxyLoss()) - adjustOxyLoss(-3) - healed = 1 - if(getCloneLoss()) - adjustCloneLoss(-3) - healed = 1 - if(getBruteLoss()) - heal_organ_damage(3,0) - healed = 1 - if(getFireLoss()) - heal_organ_damage(0,3) - healed = 1 - if(halloss > 0) - halloss -= 3 - if(halloss < 0) halloss = 0 - healed = 1 - if(healed) - if(prob(5)) - src << "\blue You feel your wounds mending..." + if ((HULK in mutations) && health <= 25) + mutations.Remove(HULK) + update_mutations() //update our mutation overlays + src << "\red You suddenly feel very weak." + Weaken(3) + emote("collapse") - if ((HULK in mutations) && health <= 25) - mutations.Remove(HULK) - update_mutations() //update our mutation overlays - src << "\red You suddenly feel very weak." - Weaken(3) + if (radiation) + if (radiation > 100) + radiation = 100 + Weaken(10) + src << "\red You feel weak." emote("collapse") - if (radiation) - if (radiation > 100) - radiation = 100 - Weaken(10) - src << "\red You feel weak." - emote("collapse") + if (radiation < 0) + radiation = 0 - if (radiation < 0) - radiation = 0 - - switch(radiation) - if(1 to 49) - radiation-- - if(prob(25)) - adjustToxLoss(1) - updatehealth() - - if(50 to 74) - radiation -= 2 + switch(radiation) + if(1 to 49) + radiation-- + if(prob(25)) adjustToxLoss(1) - if(prob(5)) - radiation -= 5 - Weaken(3) - src << "\red You feel weak." - emote("collapse") updatehealth() - if(75 to 100) - radiation -= 3 - adjustToxLoss(3) - if(prob(1)) - src << "\red You mutate!" - randmutb(src) - domutcheck(src,null) - emote("gasp") - updatehealth() + if(50 to 74) + radiation -= 2 + adjustToxLoss(1) + if(prob(5)) + radiation -= 5 + Weaken(3) + src << "\red You feel weak." + emote("collapse") + updatehealth() + + if(75 to 100) + radiation -= 3 + adjustToxLoss(3) + if(prob(1)) + src << "\red You mutate!" + randmutb(src) + domutcheck(src,null) + emote("gasp") + updatehealth() - breathe() + proc/breathe() - if(reagents.has_reagent("lexorin")) return - if(istype(loc, /obj/machinery/atmospherics/unary/cryo_cell)) return + if(reagents.has_reagent("lexorin")) return + if(istype(loc, /obj/machinery/atmospherics/unary/cryo_cell)) return - var/datum/gas_mixture/environment = loc.return_air() - var/datum/air_group/breath - // HACK NEED CHANGING LATER - if(health < 0) - losebreath++ + var/datum/gas_mixture/environment = loc.return_air() + var/datum/air_group/breath + // HACK NEED CHANGING LATER + if(health < 0) + losebreath++ - if(losebreath>0) //Suffocating so do not take a breath - losebreath-- - if (prob(75)) //High chance of gasping for air - spawn emote("gasp") + if(losebreath>0) //Suffocating so do not take a breath + losebreath-- + if (prob(75)) //High chance of gasping for air + spawn emote("gasp") + if(istype(loc, /obj/)) + var/obj/location_as_object = loc + location_as_object.handle_internal_lifeform(src, 0) + else + //First, check for air from internal atmosphere (using an air tank and mask generally) + breath = get_breath_from_internal(BREATH_VOLUME) // Super hacky -- TLE + //breath = get_breath_from_internal(0.5) // Manually setting to old BREATH_VOLUME amount -- TLE + + //No breath from internal atmosphere so get breath from location + if(!breath) + if(istype(loc, /obj/)) + var/obj/location_as_object = loc + breath = location_as_object.handle_internal_lifeform(src, BREATH_VOLUME) + else if(istype(loc, /turf/)) + var/breath_moles = 0 + /*if(environment.return_pressure() > ONE_ATMOSPHERE) + // Loads of air around (pressure effect will be handled elsewhere), so lets just take a enough to fill our lungs at normal atmos pressure (using n = Pv/RT) + breath_moles = (ONE_ATMOSPHERE*BREATH_VOLUME/R_IDEAL_GAS_EQUATION*environment.temperature) + else*/ + // Not enough air around, take a percentage of what's there to model this properly + breath_moles = environment.total_moles()*BREATH_PERCENTAGE + + breath = loc.remove_air(breath_moles) + + // Handle chem smoke effect -- Doohl + + var/block = 0 + if(wear_mask) + if(istype(wear_mask, /obj/item/clothing/mask/gas)) + block = 1 + + if(!block) + + for(var/obj/effect/effect/chem_smoke/smoke in view(1, src)) + if(smoke.reagents.total_volume) + smoke.reagents.reaction(src, INGEST) + spawn(5) + if(smoke) + smoke.reagents.copy_to(src, 10) // I dunno, maybe the reagents enter the blood stream through the lungs? + break // If they breathe in the nasty stuff once, no need to continue checking + + else //Still give containing object the chance to interact if(istype(loc, /obj/)) var/obj/location_as_object = loc location_as_object.handle_internal_lifeform(src, 0) - else - //First, check for air from internal atmosphere (using an air tank and mask generally) - breath = get_breath_from_internal(BREATH_VOLUME) // Super hacky -- TLE - //breath = get_breath_from_internal(0.5) // Manually setting to old BREATH_VOLUME amount -- TLE - //No breath from internal atmosphere so get breath from location - if(!breath) - if(istype(loc, /obj/)) - var/obj/location_as_object = loc - breath = location_as_object.handle_internal_lifeform(src, BREATH_VOLUME) - else if(istype(loc, /turf/)) - var/breath_moles = 0 - /*if(environment.return_pressure() > ONE_ATMOSPHERE) - // Loads of air around (pressure effect will be handled elsewhere), so lets just take a enough to fill our lungs at normal atmos pressure (using n = Pv/RT) - breath_moles = (ONE_ATMOSPHERE*BREATH_VOLUME/R_IDEAL_GAS_EQUATION*environment.temperature) - else*/ - // Not enough air around, take a percentage of what's there to model this properly - breath_moles = environment.total_moles()*BREATH_PERCENTAGE + handle_breath(breath) - breath = loc.remove_air(breath_moles) - - // Handle chem smoke effect -- Doohl - - var/block = 0 - if(wear_mask) - if(istype(wear_mask, /obj/item/clothing/mask/gas)) - block = 1 - - if(!block) - - for(var/obj/effect/effect/chem_smoke/smoke in view(1, src)) - if(smoke.reagents.total_volume) - smoke.reagents.reaction(src, INGEST) - spawn(5) - if(smoke) - smoke.reagents.copy_to(src, 10) // I dunno, maybe the reagents enter the blood stream through the lungs? - break // If they breathe in the nasty stuff once, no need to continue checking - - else //Still give containing object the chance to interact - if(istype(loc, /obj/)) - var/obj/location_as_object = loc - location_as_object.handle_internal_lifeform(src, 0) - - handle_breath(breath) - - if(breath) - loc.assume_air(breath) + if(breath) + loc.assume_air(breath) - get_breath_from_internal(volume_needed) + proc/get_breath_from_internal(volume_needed) + if(internal) + if (!contents.Find(internal)) + internal = null + if (!wear_mask || !(wear_mask.flags & MASKINTERNALS) ) + internal = null if(internal) - if (!contents.Find(internal)) - internal = null - if (!wear_mask || !(wear_mask.flags & MASKINTERNALS) ) - internal = null - if(internal) - //if (internals) //should be unnecessary, uncomment if it isn't. -raftaf0 - // internals.icon_state = "internal1" - return internal.remove_air_volume(volume_needed) - else if(internals) - internals.icon_state = "internal0" - return null + //if (internals) //should be unnecessary, uncomment if it isn't. -raftaf0 + // internals.icon_state = "internal1" + return internal.remove_air_volume(volume_needed) + else if(internals) + internals.icon_state = "internal0" + return null - update_canmove() - if(stat || sleeping || paralysis || stunned || weakened || resting || buckled || (changeling && changeling.changeling_fakedeath)) - canmove = 0 + proc/update_canmove() + if(stat || sleeping || paralysis || stunned || weakened || resting || buckled || (changeling && changeling.changeling_fakedeath)) + canmove = 0 - else - lying = 0 - canmove = 1 - /* for(var/obj/effect/stop/S in geaslist) - if(S.victim == src) - geaslist -= S - del(S) + else + lying = 0 + canmove = 1 +/* for(var/obj/effect/stop/S in geaslist) + if(S.victim == src) + geaslist -= S + del(S) */ - handle_breath(datum/gas_mixture/breath) - if(nodamage || REBREATHER in augmentations) + proc/handle_breath(datum/gas_mixture/breath) + if(nodamage || REBREATHER in augmentations) + return + + if(!breath || (breath.total_moles() == 0)) + if(reagents.has_reagent("inaprovaline")) return + adjustOxyLoss(HUMAN_MAX_OXYLOSS) - if(!breath || (breath.total_moles() == 0)) - if(reagents.has_reagent("inaprovaline")) - return - adjustOxyLoss(HUMAN_MAX_OXYLOSS) + oxygen_alert = max(oxygen_alert, 1) - oxygen_alert = max(oxygen_alert, 1) + return 0 - return 0 + var/safe_oxygen_min = 16 // Minimum safe partial pressure of O2, in kPa + //var/safe_oxygen_max = 140 // Maximum safe partial pressure of O2, in kPa (Not used for now) + var/safe_co2_max = 10 // Yes it's an arbitrary value who cares? + var/safe_toxins_max = 0.005 + var/SA_para_min = 1 + var/SA_sleep_min = 5 + var/oxygen_used = 0 + var/breath_pressure = (breath.total_moles()*R_IDEAL_GAS_EQUATION*breath.temperature)/BREATH_VOLUME - var/safe_oxygen_min = 16 // Minimum safe partial pressure of O2, in kPa - //var/safe_oxygen_max = 140 // Maximum safe partial pressure of O2, in kPa (Not used for now) - var/safe_co2_max = 10 // Yes it's an arbitrary value who cares? - var/safe_toxins_max = 0.005 - var/SA_para_min = 1 - var/SA_sleep_min = 5 - var/oxygen_used = 0 - var/breath_pressure = (breath.total_moles()*R_IDEAL_GAS_EQUATION*breath.temperature)/BREATH_VOLUME + //Partial pressure of the O2 in our breath + var/O2_pp = (breath.oxygen/breath.total_moles())*breath_pressure + // Same, but for the toxins + 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 + //var/CO2_pp = (breath.carbon_dioxide/breath.total_moles())*0.5 // The default pressure value - //Partial pressure of the O2 in our breath - var/O2_pp = (breath.oxygen/breath.total_moles())*breath_pressure - // Same, but for the toxins - 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 - //var/CO2_pp = (breath.carbon_dioxide/breath.total_moles())*0.5 // The default pressure value - - if(O2_pp < safe_oxygen_min) // Too little oxygen - if(prob(20)) - spawn(0) emote("gasp") - if(O2_pp > 0) - var/ratio = safe_oxygen_min/O2_pp - adjustOxyLoss(min(5*ratio, HUMAN_MAX_OXYLOSS)) // Don't fuck them up too fast (space only does HUMAN_MAX_OXYLOSS after all!) - oxygen_used = breath.oxygen*ratio/6 - else - adjustOxyLoss(HUMAN_MAX_OXYLOSS) - oxygen_alert = max(oxygen_alert, 1) - /*else if (O2_pp > safe_oxygen_max) // Too much oxygen (commented this out for now, I'll deal with pressure damage elsewhere I suppose) - spawn(0) emote("cough") - var/ratio = O2_pp/safe_oxygen_max - oxyloss += 5*ratio + if(O2_pp < safe_oxygen_min) // Too little oxygen + if(prob(20)) + spawn(0) emote("gasp") + if(O2_pp > 0) + var/ratio = safe_oxygen_min/O2_pp + adjustOxyLoss(min(5*ratio, HUMAN_MAX_OXYLOSS)) // Don't fuck them up too fast (space only does HUMAN_MAX_OXYLOSS after all!) oxygen_used = breath.oxygen*ratio/6 - oxygen_alert = max(oxygen_alert, 1)*/ - else // We're in safe limits - adjustOxyLoss(-5) - oxygen_used = breath.oxygen/6 - oxygen_alert = 0 - - breath.oxygen -= oxygen_used - breath.carbon_dioxide += oxygen_used - - if(CO2_pp > safe_co2_max) - if(!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. - co2overloadtime = world.time - else if(world.time - co2overloadtime > 120) - Paralyse(3) - adjustOxyLoss(3) // Lets hurt em a little, let them know we mean business - if(world.time - co2overloadtime > 300) // They've been in here 30s now, lets start to kill them for their own good! - adjustOxyLoss(8) - if(prob(20)) // Lets give them some chance to know somethings not right though I guess. - spawn(0) emote("cough") - else - co2overloadtime = 0 + adjustOxyLoss(HUMAN_MAX_OXYLOSS) + oxygen_alert = max(oxygen_alert, 1) + /*else if (O2_pp > safe_oxygen_max) // Too much oxygen (commented this out for now, I'll deal with pressure damage elsewhere I suppose) + spawn(0) emote("cough") + var/ratio = O2_pp/safe_oxygen_max + oxyloss += 5*ratio + oxygen_used = breath.oxygen*ratio/6 + oxygen_alert = max(oxygen_alert, 1)*/ + else // We're in safe limits + adjustOxyLoss(-5) + oxygen_used = breath.oxygen/6 + oxygen_alert = 0 - if(Toxins_pp > safe_toxins_max) // Too much toxins - var/ratio = breath.toxins/safe_toxins_max - adjustToxLoss(min(ratio, 10)) //Limit amount of damage toxin exposure can do per second - toxins_alert = max(toxins_alert, 1) - else - toxins_alert = 0 + breath.oxygen -= oxygen_used + breath.carbon_dioxide += oxygen_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 > SA_para_min) // Enough to make us paralysed for a bit - 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 - sleeping = max(src.sleeping+2, 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)) - spawn(0) emote(pick("giggle", "laugh")) + if(CO2_pp > safe_co2_max) + if(!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. + co2overloadtime = world.time + else if(world.time - co2overloadtime > 120) + Paralyse(3) + adjustOxyLoss(3) // Lets hurt em a little, let them know we mean business + if(world.time - co2overloadtime > 300) // They've been in here 30s now, lets start to kill them for their own good! + adjustOxyLoss(8) + if(prob(20)) // Lets give them some chance to know somethings not right though I guess. + spawn(0) emote("cough") + + else + co2overloadtime = 0 + + if(Toxins_pp > safe_toxins_max) // Too much toxins + var/ratio = breath.toxins/safe_toxins_max + adjustToxLoss(min(ratio, 10)) //Limit amount of damage toxin exposure can do per second + toxins_alert = max(toxins_alert, 1) + else + toxins_alert = 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 + 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 + sleeping = max(src.sleeping+2, 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)) + spawn(0) emote(pick("giggle", "laugh")) - if(breath.temperature > (T0C+66) && !(COLD_RESISTANCE in mutations)) // Hot air hurts :( - if(prob(20)) - src << "\red You feel a searing heat in your lungs!" - fire_alert = max(fire_alert, 1) - else - fire_alert = 0 + if(breath.temperature > (T0C+66) && !(COLD_RESISTANCE in mutations)) // Hot air hurts :( + if(prob(20)) + src << "\red You feel a searing heat in your lungs!" + fire_alert = max(fire_alert, 1) + else + fire_alert = 0 - //Temporary fixes to the alerts. + //Temporary fixes to the alerts. - return 1 + return 1 - handle_environment(datum/gas_mixture/environment) - if(!environment) - return - var/environment_heat_capacity = environment.heat_capacity() - var/loc_temp = T0C - if(istype(loc, /turf/space)) - environment_heat_capacity = loc:heat_capacity - loc_temp = 2.7 - else if(istype(loc, /obj/machinery/atmospherics/unary/cryo_cell)) - loc_temp = loc:air_contents.temperature - else - loc_temp = environment.temperature + proc/handle_environment(datum/gas_mixture/environment) + if(!environment) + return + var/environment_heat_capacity = environment.heat_capacity() + var/loc_temp = T0C + if(istype(loc, /turf/space)) + environment_heat_capacity = loc:heat_capacity + loc_temp = 2.7 + else if(istype(loc, /obj/machinery/atmospherics/unary/cryo_cell)) + loc_temp = loc:air_contents.temperature + else + loc_temp = environment.temperature - var/thermal_protection = get_thermal_protection() + var/thermal_protection = get_thermal_protection() - //world << "Loc temp: [loc_temp] - Body temp: [bodytemperature] - Fireloss: [getFireLoss()] - Thermal protection: [get_thermal_protection()] - Fire protection: [thermal_protection + add_fire_protection(loc_temp)]" + //world << "Loc temp: [loc_temp] - Body temp: [bodytemperature] - Fireloss: [getFireLoss()] - Thermal protection: [get_thermal_protection()] - Fire protection: [thermal_protection + add_fire_protection(loc_temp)]" - if(stat != 2 && abs(bodytemperature - 310.15) < 50) - bodytemperature += adjust_body_temperature(bodytemperature, 310.15, thermal_protection) - if(loc_temp < 310.15) // a cold place -> add in cold protection - bodytemperature += adjust_body_temperature(bodytemperature, loc_temp, 1/thermal_protection) - else // a hot place -> add in heat protection - thermal_protection += add_fire_protection(loc_temp) - bodytemperature += adjust_body_temperature(bodytemperature, loc_temp, 1/thermal_protection) + if(stat != 2 && abs(bodytemperature - 310.15) < 50) + bodytemperature += adjust_body_temperature(bodytemperature, 310.15, thermal_protection) + if(loc_temp < 310.15) // a cold place -> add in cold protection + bodytemperature += adjust_body_temperature(bodytemperature, loc_temp, 1/thermal_protection) + else // a hot place -> add in heat protection + thermal_protection += add_fire_protection(loc_temp) + bodytemperature += adjust_body_temperature(bodytemperature, loc_temp, 1/thermal_protection) - // lets give them a fair bit of leeway so they don't just start dying - //as that may be realistic but it's no fun - if((bodytemperature > (T0C + 50)) || (bodytemperature < (T0C + 10)) && (!istype(loc, /obj/machinery/atmospherics/unary/cryo_cell))) // Last bit is just disgusting, i know - if(environment.temperature > (T0C + 50) || (environment.temperature < (T0C + 10))) - var/transfer_coefficient + // lets give them a fair bit of leeway so they don't just start dying + //as that may be realistic but it's no fun + if((bodytemperature > (T0C + 50)) || (bodytemperature < (T0C + 10)) && (!istype(loc, /obj/machinery/atmospherics/unary/cryo_cell))) // Last bit is just disgusting, i know + if(environment.temperature > (T0C + 50) || (environment.temperature < (T0C + 10))) + var/transfer_coefficient - transfer_coefficient = 1 - if(head && (head.body_parts_covered & HEAD) && (environment.temperature < head.protective_temperature) && !istype(head, /obj/item/weapon/paper)) - transfer_coefficient *= head.heat_transfer_coefficient - if(wear_mask && (wear_mask.body_parts_covered & HEAD) && (environment.temperature < wear_mask.protective_temperature)) - transfer_coefficient *= wear_mask.heat_transfer_coefficient - if(wear_suit && (wear_suit.body_parts_covered & HEAD) && (environment.temperature < wear_suit.protective_temperature)) - transfer_coefficient *= wear_suit.heat_transfer_coefficient + transfer_coefficient = 1 + if(head && (head.body_parts_covered & HEAD) && (environment.temperature < head.protective_temperature) && !istype(head, /obj/item/weapon/paper)) + transfer_coefficient *= head.heat_transfer_coefficient + if(wear_mask && (wear_mask.body_parts_covered & HEAD) && (environment.temperature < wear_mask.protective_temperature)) + transfer_coefficient *= wear_mask.heat_transfer_coefficient + if(wear_suit && (wear_suit.body_parts_covered & HEAD) && (environment.temperature < wear_suit.protective_temperature)) + transfer_coefficient *= wear_suit.heat_transfer_coefficient - handle_temperature_damage(HEAD, environment.temperature, environment_heat_capacity*transfer_coefficient) + handle_temperature_damage(HEAD, environment.temperature, environment_heat_capacity*transfer_coefficient) - transfer_coefficient = 1 - if(wear_suit && (wear_suit.body_parts_covered & UPPER_TORSO) && (environment.temperature < wear_suit.protective_temperature)) - transfer_coefficient *= wear_suit.heat_transfer_coefficient - if(w_uniform && (w_uniform.body_parts_covered & UPPER_TORSO) && (environment.temperature < w_uniform.protective_temperature)) - transfer_coefficient *= w_uniform.heat_transfer_coefficient + transfer_coefficient = 1 + if(wear_suit && (wear_suit.body_parts_covered & UPPER_TORSO) && (environment.temperature < wear_suit.protective_temperature)) + transfer_coefficient *= wear_suit.heat_transfer_coefficient + if(w_uniform && (w_uniform.body_parts_covered & UPPER_TORSO) && (environment.temperature < w_uniform.protective_temperature)) + transfer_coefficient *= w_uniform.heat_transfer_coefficient - handle_temperature_damage(UPPER_TORSO, environment.temperature, environment_heat_capacity*transfer_coefficient) + handle_temperature_damage(UPPER_TORSO, environment.temperature, environment_heat_capacity*transfer_coefficient) - transfer_coefficient = 1 - if(wear_suit && (wear_suit.body_parts_covered & LOWER_TORSO) && (environment.temperature < wear_suit.protective_temperature)) - transfer_coefficient *= wear_suit.heat_transfer_coefficient - if(w_uniform && (w_uniform.body_parts_covered & LOWER_TORSO) && (environment.temperature < w_uniform.protective_temperature)) - transfer_coefficient *= w_uniform.heat_transfer_coefficient + transfer_coefficient = 1 + if(wear_suit && (wear_suit.body_parts_covered & LOWER_TORSO) && (environment.temperature < wear_suit.protective_temperature)) + transfer_coefficient *= wear_suit.heat_transfer_coefficient + if(w_uniform && (w_uniform.body_parts_covered & LOWER_TORSO) && (environment.temperature < w_uniform.protective_temperature)) + transfer_coefficient *= w_uniform.heat_transfer_coefficient - handle_temperature_damage(LOWER_TORSO, environment.temperature, environment_heat_capacity*transfer_coefficient) + handle_temperature_damage(LOWER_TORSO, environment.temperature, environment_heat_capacity*transfer_coefficient) - transfer_coefficient = 1 - if(wear_suit && (wear_suit.body_parts_covered & LEGS) && (environment.temperature < wear_suit.protective_temperature)) - transfer_coefficient *= wear_suit.heat_transfer_coefficient - if(w_uniform && (w_uniform.body_parts_covered & LEGS) && (environment.temperature < w_uniform.protective_temperature)) - transfer_coefficient *= w_uniform.heat_transfer_coefficient + transfer_coefficient = 1 + if(wear_suit && (wear_suit.body_parts_covered & LEGS) && (environment.temperature < wear_suit.protective_temperature)) + transfer_coefficient *= wear_suit.heat_transfer_coefficient + if(w_uniform && (w_uniform.body_parts_covered & LEGS) && (environment.temperature < w_uniform.protective_temperature)) + transfer_coefficient *= w_uniform.heat_transfer_coefficient - handle_temperature_damage(LEGS, environment.temperature, environment_heat_capacity*transfer_coefficient) + handle_temperature_damage(LEGS, environment.temperature, environment_heat_capacity*transfer_coefficient) - transfer_coefficient = 1 - if(wear_suit && (wear_suit.body_parts_covered & ARMS) && (environment.temperature < wear_suit.protective_temperature)) - transfer_coefficient *= wear_suit.heat_transfer_coefficient - if(w_uniform && (w_uniform.body_parts_covered & ARMS) && (environment.temperature < w_uniform.protective_temperature)) - transfer_coefficient *= w_uniform.heat_transfer_coefficient + transfer_coefficient = 1 + if(wear_suit && (wear_suit.body_parts_covered & ARMS) && (environment.temperature < wear_suit.protective_temperature)) + transfer_coefficient *= wear_suit.heat_transfer_coefficient + if(w_uniform && (w_uniform.body_parts_covered & ARMS) && (environment.temperature < w_uniform.protective_temperature)) + transfer_coefficient *= w_uniform.heat_transfer_coefficient - handle_temperature_damage(ARMS, environment.temperature, environment_heat_capacity*transfer_coefficient) + handle_temperature_damage(ARMS, environment.temperature, environment_heat_capacity*transfer_coefficient) - transfer_coefficient = 1 - if(wear_suit && (wear_suit.body_parts_covered & HANDS) && (environment.temperature < wear_suit.protective_temperature)) - transfer_coefficient *= wear_suit.heat_transfer_coefficient - if(gloves && (gloves.body_parts_covered & HANDS) && (environment.temperature < gloves.protective_temperature)) - transfer_coefficient *= gloves.heat_transfer_coefficient + transfer_coefficient = 1 + if(wear_suit && (wear_suit.body_parts_covered & HANDS) && (environment.temperature < wear_suit.protective_temperature)) + transfer_coefficient *= wear_suit.heat_transfer_coefficient + if(gloves && (gloves.body_parts_covered & HANDS) && (environment.temperature < gloves.protective_temperature)) + transfer_coefficient *= gloves.heat_transfer_coefficient - handle_temperature_damage(HANDS, environment.temperature, environment_heat_capacity*transfer_coefficient) + handle_temperature_damage(HANDS, environment.temperature, environment_heat_capacity*transfer_coefficient) - transfer_coefficient = 1 - if(wear_suit && (wear_suit.body_parts_covered & FEET) && (environment.temperature < wear_suit.protective_temperature)) - transfer_coefficient *= wear_suit.heat_transfer_coefficient - if(shoes && (shoes.body_parts_covered & FEET) && (environment.temperature < shoes.protective_temperature)) - transfer_coefficient *= shoes.heat_transfer_coefficient + transfer_coefficient = 1 + if(wear_suit && (wear_suit.body_parts_covered & FEET) && (environment.temperature < wear_suit.protective_temperature)) + transfer_coefficient *= wear_suit.heat_transfer_coefficient + if(shoes && (shoes.body_parts_covered & FEET) && (environment.temperature < shoes.protective_temperature)) + transfer_coefficient *= shoes.heat_transfer_coefficient - handle_temperature_damage(FEET, environment.temperature, environment_heat_capacity*transfer_coefficient) + handle_temperature_damage(FEET, environment.temperature, environment_heat_capacity*transfer_coefficient) - /*if(stat==2) //Why only change body temp when they're dead? That makes no sense!!!!!! - bodytemperature += 0.8*(environment.temperature - bodytemperature)*environment_heat_capacity/(environment_heat_capacity + 270000) - */ + //Account for massive pressure differences. Done by Polymorph + // Made it possible to actually have something that can protect against high pressure... Done by Errorage. Polymorph now has an axe sticking from his head for his previous hardcoded nonsense! - //Account for massive pressure differences. Done by Polymorph + var/pressure = environment.return_pressure() + if(pressure > HAZARD_HIGH_PRESSURE) + var/adjusted_pressure = calculate_affecting_pressure(pressure) //Returns how much pressure actually affects the mob. + if(adjusted_pressure > HAZARD_HIGH_PRESSURE) + adjustBruteLoss( min( (adjusted_pressure / HAZARD_HIGH_PRESSURE)*PRESSURE_DAMAGE_COEFFICIENT , MAX_PRESSURE_DAMAGE) ) + return //TODO: DEFERRED + proc/adjust_body_temperature(current, loc_temp, boost) + var/temperature = current + var/difference = abs(current-loc_temp) //get difference + var/increments// = difference/10 //find how many increments apart they are + if(difference > 50) + increments = difference/5 + else + increments = difference/10 + var/change = increments*boost // Get the amount to change by (x per increment) + var/temp_change + if(current < loc_temp) + temperature = min(loc_temp, temperature+change) + else if(current > loc_temp) + temperature = max(loc_temp, temperature-change) + temp_change = (temperature - current) + return temp_change - var/pressure = environment.return_pressure() - if(!istype(wear_suit, /obj/item/clothing/suit/space)&&!istype(wear_suit, /obj/item/clothing/suit/armor/captain)) - /*if(pressure < 20) - if(prob(25)) - src << "You feel the splittle on your lips and the fluid on your eyes boiling away, the capillteries in your skin breaking." - adjustBruteLoss(5) - */ - if(pressure > HAZARD_HIGH_PRESSURE) - adjustBruteLoss(min((10+(round(pressure/(HIGH_STEP_PRESSURE)-2)*5)),MAX_PRESSURE_DAMAGE)) + proc/get_thermal_protection() + var/thermal_protection = 1.0 + //Handle normal clothing + if(head && (head.body_parts_covered & HEAD)) + thermal_protection += 0.5 + if(wear_suit && (wear_suit.body_parts_covered & UPPER_TORSO)) + thermal_protection += 0.5 + if(w_uniform && (w_uniform.body_parts_covered & UPPER_TORSO)) + thermal_protection += 0.5 + if(wear_suit && (wear_suit.body_parts_covered & LEGS)) + thermal_protection += 0.2 + if(wear_suit && (wear_suit.body_parts_covered & ARMS)) + thermal_protection += 0.2 + if(wear_suit && (wear_suit.body_parts_covered & HANDS)) + thermal_protection += 0.2 + if(shoes && (shoes.body_parts_covered & FEET)) + thermal_protection += 0.2 + if(wear_suit && (wear_suit.flags & SUITSPACE)) + thermal_protection += 3 + if(w_uniform && (w_uniform.flags & SUITSPACE)) + thermal_protection += 3 + if(head && (head.flags & HEADSPACE)) + thermal_protection += 1 + if(COLD_RESISTANCE in mutations) + thermal_protection += 5 - return //TODO: DEFERRED + return thermal_protection - adjust_body_temperature(current, loc_temp, boost) - var/temperature = current - var/difference = abs(current-loc_temp) //get difference - var/increments// = difference/10 //find how many increments apart they are - if(difference > 50) - increments = difference/5 - else - increments = difference/10 - var/change = increments*boost // Get the amount to change by (x per increment) - var/temp_change - if(current < loc_temp) - temperature = min(loc_temp, temperature+change) - else if(current > loc_temp) - temperature = max(loc_temp, temperature-change) - temp_change = (temperature - current) - return temp_change + proc/add_fire_protection(var/temp) + var/fire_prot = 0 + if(head) + if(head.protective_temperature > temp) + fire_prot += (head.protective_temperature/10) + if(wear_mask) + if(wear_mask.protective_temperature > temp) + fire_prot += (wear_mask.protective_temperature/10) + if(glasses) + if(glasses.protective_temperature > temp) + fire_prot += (glasses.protective_temperature/10) + if(ears) + if(ears.protective_temperature > temp) + fire_prot += (ears.protective_temperature/10) + if(wear_suit) + if(wear_suit.protective_temperature > temp) + fire_prot += (wear_suit.protective_temperature/10) + if(w_uniform) + if(w_uniform.protective_temperature > temp) + fire_prot += (w_uniform.protective_temperature/10) + if(gloves) + if(gloves.protective_temperature > temp) + fire_prot += (gloves.protective_temperature/10) + if(shoes) + if(shoes.protective_temperature > temp) + fire_prot += (shoes.protective_temperature/10) - get_thermal_protection() - var/thermal_protection = 1.0 - //Handle normal clothing - if(head && (head.body_parts_covered & HEAD)) - thermal_protection += 0.5 - if(wear_suit && (wear_suit.body_parts_covered & UPPER_TORSO)) - thermal_protection += 0.5 - if(w_uniform && (w_uniform.body_parts_covered & UPPER_TORSO)) - thermal_protection += 0.5 - if(wear_suit && (wear_suit.body_parts_covered & LEGS)) - thermal_protection += 0.2 - if(wear_suit && (wear_suit.body_parts_covered & ARMS)) - thermal_protection += 0.2 - if(wear_suit && (wear_suit.body_parts_covered & HANDS)) - thermal_protection += 0.2 - if(shoes && (shoes.body_parts_covered & FEET)) - thermal_protection += 0.2 - if(wear_suit && (wear_suit.flags & SUITSPACE)) - thermal_protection += 3 - if(w_uniform && (w_uniform.flags & SUITSPACE)) - thermal_protection += 3 - if(head && (head.flags & HEADSPACE)) - thermal_protection += 1 - if(COLD_RESISTANCE in mutations) - thermal_protection += 5 + return fire_prot - return thermal_protection + proc/handle_temperature_damage(body_part, exposed_temperature, exposed_intensity) + if(nodamage) + return - add_fire_protection(var/temp) - var/fire_prot = 0 - if(head) - if(head.protective_temperature > temp) - fire_prot += (head.protective_temperature/10) - if(wear_mask) - if(wear_mask.protective_temperature > temp) - fire_prot += (wear_mask.protective_temperature/10) - if(glasses) - if(glasses.protective_temperature > temp) - fire_prot += (glasses.protective_temperature/10) - if(ears) - if(ears.protective_temperature > temp) - fire_prot += (ears.protective_temperature/10) - if(wear_suit) - if(wear_suit.protective_temperature > temp) - fire_prot += (wear_suit.protective_temperature/10) - if(w_uniform) - if(w_uniform.protective_temperature > temp) - fire_prot += (w_uniform.protective_temperature/10) - if(gloves) - if(gloves.protective_temperature > temp) - fire_prot += (gloves.protective_temperature/10) - if(shoes) - if(shoes.protective_temperature > temp) - fire_prot += (shoes.protective_temperature/10) + var/discomfort = min(abs(exposed_temperature - bodytemperature)*(exposed_intensity)/2000000, 1.0) - return fire_prot + if(exposed_temperature > bodytemperature) + discomfort *= 4 - handle_temperature_damage(body_part, exposed_temperature, exposed_intensity) - if(nodamage) - return + if(mutantrace == "plant") + discomfort *= 3 //I don't like magic numbers. I'll make mutantraces a datum with vars sometime later. -- Urist + else + discomfort *= 1.5 //Dangercon 2011 - Upping damage by use of magic numbers - Errorage - var/discomfort = min(abs(exposed_temperature - bodytemperature)*(exposed_intensity)/2000000, 1.0) + switch(body_part) + if(HEAD) + apply_damage(2.5*discomfort, BURN, "head") + if(UPPER_TORSO) + apply_damage(2.5*discomfort, BURN, "chest") + if(LEGS) + apply_damage(0.6*discomfort, BURN, "l_leg") + apply_damage(0.6*discomfort, BURN, "r_leg") + if(ARMS) + apply_damage(0.4*discomfort, BURN, "l_arm") + apply_damage(0.4*discomfort, BURN, "r_arm") - if(exposed_temperature > bodytemperature) - discomfort *= 4 + proc/handle_chemicals_in_body() + if(reagents) reagents.metabolize(src) - if(mutantrace == "plant") - discomfort *= 3 //I don't like magic numbers. I'll make mutantraces a datum with vars sometime later. -- Urist - else - discomfort *= 1.5 //Dangercon 2011 - Upping damage by use of magic numbers - Errorage + if(mutantrace == "plant") //couldn't think of a better place to place it, since it handles nutrition -- Urist + var/light_amount = 0 //how much light there is in the place, affects receiving nutrition and healing + if(istype(loc,/turf)) //else, there's considered to be no light + light_amount = min(10,loc:sd_lumcount) - 5 //hardcapped so it's not abused by having a ton of flashlights + if(istype(loc,/turf/simulated/shuttle))//Now not only will potatomen not starve on the shuttle, they will actually be fed + light_amount = 5 + if(nutrition < 500) //so they can't store nutrition to survive without light forever + nutrition += light_amount + if(light_amount > 0) //if there's enough light, heal + heal_overall_damage(1,1) + adjustToxLoss(-1) + adjustOxyLoss(-1) - switch(body_part) - if(HEAD) - apply_damage(2.5*discomfort, BURN, "head") - if(UPPER_TORSO) - apply_damage(2.5*discomfort, BURN, "chest") - if(LEGS) - apply_damage(0.6*discomfort, BURN, "l_leg") - apply_damage(0.6*discomfort, BURN, "r_leg") - if(ARMS) - apply_damage(0.4*discomfort, BURN, "l_arm") - apply_damage(0.4*discomfort, BURN, "r_arm") + //The fucking FAT mutation is the dumbest shit ever. It makes the code so difficult to work with + if(FAT in mutations) + if(overeatduration < 100) + src << "\blue You feel fit again!" + mutations.Remove(FAT) + update_mutantrace(0) + update_mutations(0) + update_inv_w_uniform(0) + update_inv_wear_suit() + else + if(overeatduration > 500) + src << "\red You suddenly feel blubbery!" + mutations.Add(FAT) + update_mutantrace(0) + update_mutations(0) + update_inv_w_uniform(0) + update_inv_wear_suit() - handle_chemicals_in_body() - if(reagents) reagents.metabolize(src) + // nutrition decrease + if (nutrition > 0 && stat != 2) + nutrition = max (0, nutrition - HUNGER_FACTOR) - if(mutantrace == "plant") //couldn't think of a better place to place it, since it handles nutrition -- Urist - var/light_amount = 0 //how much light there is in the place, affects receiving nutrition and healing - if(istype(loc,/turf)) //else, there's considered to be no light - light_amount = min(10,loc:sd_lumcount) - 5 //hardcapped so it's not abused by having a ton of flashlights - if(istype(loc,/turf/simulated/shuttle))//Now not only will potatomen not starve on the shuttle, they will actually be fed - light_amount = 5 - if(nutrition < 500) //so they can't store nutrition to survive without light forever - nutrition += light_amount - if(light_amount > 0) //if there's enough light, heal - heal_overall_damage(1,1) - adjustToxLoss(-1) - adjustOxyLoss(-1) + if (nutrition > 450) + if(overeatduration < 600) //capped so people don't take forever to unfat + overeatduration++ + else + if(overeatduration > 1) + overeatduration -= 2 //doubled the unfat rate - //The fucking FAT mutation is the dumbest shit ever. It makes the code so difficult to work with - if(FAT in mutations) - if(overeatduration < 100) - src << "\blue You feel fit again!" - mutations.Remove(FAT) - update_mutantrace(0) - update_mutations(0) - update_inv_w_uniform(0) - update_inv_wear_suit() - else - if(overeatduration > 500) - src << "\red You suddenly feel blubbery!" - mutations.Add(FAT) - update_mutantrace(0) - update_mutations(0) - update_inv_w_uniform(0) - update_inv_wear_suit() + if(mutantrace == "plant") + if(nutrition < 200) + take_overall_damage(2,0) - // nutrition decrease - if (nutrition > 0 && stat != 2) - nutrition = max (0, nutrition - HUNGER_FACTOR) - - if (nutrition > 450) - if(overeatduration < 600) //capped so people don't take forever to unfat - overeatduration++ - else - if(overeatduration > 1) - overeatduration -= 2 //doubled the unfat rate - - if(mutantrace == "plant") - if(nutrition < 200) - take_overall_damage(2,0) - - if (drowsyness) - drowsyness-- - eye_blurry = max(2, eye_blurry) - if (prob(5)) - sleeping += 1 - Paralyse(5) - - confused = max(0, confused - 1) - // decrement dizziness counter, clamped to 0 - if(resting) - dizziness = max(0, dizziness - 15) - jitteriness = max(0, jitteriness - 15) - else - dizziness = max(0, dizziness - 3) - jitteriness = max(0, jitteriness - 3) - - updatehealth() - - return //TODO: DEFERRED - - handle_regular_status_updates() - - // health = 100 - (getOxyLoss() + getToxLoss() + getFireLoss() + getBruteLoss() + getCloneLoss()) - - if(getOxyLoss() > 50) Paralyse(3) - - if(health < config.health_threshold_dead || brain_op_stage == 4.0) - death() - else if(health < config.health_threshold_crit) - if(health <= 20 && prob(1)) spawn(0) emote("gasp") - - //if(!rejuv) oxyloss++ - if(!reagents.has_reagent("inaprovaline")) adjustOxyLoss(1) - - if(stat != DEAD) stat = UNCONSCIOUS + if (drowsyness) + drowsyness-- + eye_blurry = max(2, eye_blurry) + if (prob(5)) + sleeping += 1 Paralyse(5) - if (stat != DEAD) //Alive. - if (silent) - silent-- + confused = max(0, confused - 1) + // decrement dizziness counter, clamped to 0 + if(resting) + dizziness = max(0, dizziness - 15) + jitteriness = max(0, jitteriness - 15) + else + dizziness = max(0, dizziness - 3) + jitteriness = max(0, jitteriness - 3) - if (resting || sleeping || paralysis || stunned || weakened || (changeling && changeling.changeling_fakedeath)) //Stunned etc. - if (stunned > 0) - AdjustStunned(-1) - stat = CONSCIOUS - if (weakened > 0) - AdjustWeakened(-1) - lying = 1 - stat = CONSCIOUS - if (paralysis > 0) - AdjustParalysis(-1) - blinded = 1 - lying = 1 - stat = UNCONSCIOUS + updatehealth() - if (sleeping > 0) - handle_dreams() - adjustHalLoss(-5) - blinded = 1 - lying = 1 - stat = UNCONSCIOUS - if (prob(10) && health && !hal_crit) - spawn(0) - emote("snore") - sleeping-- + return //TODO: DEFERRED - if(resting) - lying = 1 - stat = CONSCIOUS + proc/handle_regular_status_updates() - var/h = hand - hand = 0 - drop_item() - hand = 1 - drop_item() - hand = h + // health = 100 - (getOxyLoss() + getToxLoss() + getFireLoss() + getBruteLoss() + getCloneLoss()) - else //Not stunned. - lying = 0 + if(getOxyLoss() > 50) Paralyse(3) + + if(health < config.health_threshold_dead || brain_op_stage == 4.0) + death() + else if(health < config.health_threshold_crit) + if(health <= 20 && prob(1)) spawn(0) emote("gasp") + + //if(!rejuv) oxyloss++ + if(!reagents.has_reagent("inaprovaline")) adjustOxyLoss(1) + + if(stat != DEAD) stat = UNCONSCIOUS + Paralyse(5) + + if (stat != DEAD) //Alive. + if (silent) + silent-- + + if (resting || sleeping || paralysis || stunned || weakened || (changeling && changeling.changeling_fakedeath)) //Stunned etc. + if (stunned > 0) + AdjustStunned(-1) + stat = CONSCIOUS + if (weakened > 0) + AdjustWeakened(-1) + lying = 1 + stat = CONSCIOUS + if (paralysis > 0) + AdjustParalysis(-1) + blinded = 1 + lying = 1 + stat = UNCONSCIOUS + + if (sleeping > 0) + handle_dreams() + adjustHalLoss(-5) + blinded = 1 + lying = 1 + stat = UNCONSCIOUS + if (prob(10) && health && !hal_crit) + spawn(0) + emote("snore") + sleeping-- + + if(resting) + lying = 1 stat = CONSCIOUS - else //Dead. - lying = 1 - blinded = 1 - stat = DEAD - silent = 0 + var/h = hand + hand = 0 + drop_item() + hand = 1 + drop_item() + hand = h - if (stuttering) stuttering-- + else //Not stunned. + lying = 0 + stat = CONSCIOUS - if (eye_blind) - eye_blind-- - blinded = 1 + else //Dead. + lying = 1 + blinded = 1 + stat = DEAD + silent = 0 - if (ear_deaf > 0) ear_deaf-- - if (ear_damage < 25) - ear_damage -= 0.05 - ear_damage = max(ear_damage, 0) + if (stuttering) stuttering-- - density = !( lying ) + if (eye_blind) + eye_blind-- + blinded = 1 - if ((sdisabilities & 1 || istype(glasses, /obj/item/clothing/glasses/blindfold))) - blinded = 1 - if ((sdisabilities & 4 || istype(ears, /obj/item/clothing/ears/earmuffs))) - ear_deaf = 1 + if (ear_deaf > 0) ear_deaf-- + if (ear_damage < 25) + ear_damage -= 0.05 + ear_damage = max(ear_damage, 0) - if (eye_blurry > 0) - eye_blurry-- - eye_blurry = max(0, eye_blurry) + density = !( lying ) - if (druggy > 0) - druggy-- - druggy = max(0, druggy) + if ((sdisabilities & 1 || istype(glasses, /obj/item/clothing/glasses/blindfold))) + blinded = 1 + if ((sdisabilities & 4 || istype(ears, /obj/item/clothing/ears/earmuffs))) + ear_deaf = 1 - return 1 + if (eye_blurry > 0) + eye_blurry-- + eye_blurry = max(0, eye_blurry) - handle_regular_hud_updates() + if (druggy > 0) + druggy-- + druggy = max(0, druggy) - if(!client) return 0 + return 1 - for(var/image/hud in client.images) - if(copytext(hud.icon_state,1,4) == "hud") //ugly, but icon comparison is worse, I believe - del(hud) + proc/handle_regular_hud_updates() - if (stat == 2 || (XRAY in mutations)) - sight |= SEE_TURFS - sight |= SEE_MOBS - sight |= SEE_OBJS - see_in_dark = 8 - if(!druggy) - see_invisible = 2 + if(!client) return 0 - else if (seer) - var/obj/effect/rune/R = locate() in loc - if (istype(R) && R.word1 == wordsee && R.word2 == wordhell && R.word3 == wordjoin) - see_invisible = 15 - else - seer = 0 - see_invisible = 0 - else if (istype(wear_mask, /obj/item/clothing/mask/gas/voice/space_ninja)) - switch(wear_mask:mode) - if(0) - if(client) - var/target_list[] = list() - for(var/mob/living/target in oview(src)) - if( target.mind&&(target.mind.special_role||issilicon(target)) )//They need to have a mind. - target_list += target - if(target_list.len)//Everything else is handled by the ninja mask proc. - wear_mask:assess_targets(target_list, src) - if (!druggy) - see_invisible = 0 - if(1) - see_in_dark = 5 - if(!druggy) - see_invisible = 0 - if(2) - sight |= SEE_MOBS - if(!druggy) - see_invisible = 2 - if(3) - sight |= SEE_TURFS - if(!druggy) - see_invisible = 0 + for(var/image/hud in client.images) + if(copytext(hud.icon_state,1,4) == "hud") //ugly, but icon comparison is worse, I believe + del(hud) - else if(istype(glasses, /obj/item/clothing/glasses/meson)) - sight |= SEE_TURFS - if(!druggy) - see_invisible = 0 - else if(istype(glasses, /obj/item/clothing/glasses/night)) - see_in_dark = 5 - if(!druggy) - see_invisible = 0 - else if(istype(glasses, /obj/item/clothing/glasses/thermal)) - sight |= SEE_MOBS - if(!druggy) - see_invisible = 2 - else if(istype(glasses, /obj/item/clothing/glasses/material)) - sight |= SEE_OBJS - if (!druggy) - see_invisible = 0 + if (stat == 2 || (XRAY in mutations)) + sight |= SEE_TURFS + sight |= SEE_MOBS + sight |= SEE_OBJS + see_in_dark = 8 + if(!druggy) + see_invisible = 2 - else if(stat != 2) - sight &= ~SEE_TURFS - sight &= ~SEE_MOBS - sight &= ~SEE_OBJS - if (mutantrace == "lizard" || mutantrace == "metroid") - see_in_dark = 3 - see_invisible = 1 - else if (druggy) // If drugged~ - see_in_dark = 2 - //see_invisible regulated by drugs themselves. - else - see_in_dark = 2 - - var/seer = 0 - var/obj/effect/rune/R = locate() in loc - if (istype(R) && R.word1 == wordsee && R.word2 == wordhell && R.word3 == wordjoin) - seer = 1 - if(!seer) - see_invisible = 0 - - - - - - - - else if(istype(head, /obj/item/clothing/head/helmet/welding)) // wat. This is never fucking called. - if(!head:up && tinted_weldhelh) - see_in_dark = 1 - - - - - - - - - - /* HUD shit goes here, as long as it doesn't modify src.sight flags */ - // The purpose of this is to stop xray and w/e from preventing you from using huds -- Love, Doohl - if(istype(glasses, /obj/item/clothing/glasses/hud/health)) - if(client) - glasses:process_hud(src) - if (!druggy) - see_invisible = 0 - - if(istype(glasses, /obj/item/clothing/glasses/hud/security)) - if(client) - glasses:process_hud(src) - if (!druggy) - see_invisible = 0 - - if(istype(glasses, /obj/item/clothing/glasses/sunglasses)) - see_in_dark = 1 - if(istype(glasses, /obj/item/clothing/glasses/sunglasses/sechud)) + else if (seer) + var/obj/effect/rune/R = locate() in loc + if (istype(R) && R.word1 == wordsee && R.word2 == wordhell && R.word3 == wordjoin) + see_invisible = 15 + else + seer = 0 + see_invisible = 0 + else if (istype(wear_mask, /obj/item/clothing/mask/gas/voice/space_ninja)) + switch(wear_mask:mode) + if(0) if(client) - if(glasses:hud) - glasses:hud:process_hud(src) - if (!druggy) - see_invisible = 0 + var/target_list[] = list() + for(var/mob/living/target in oview(src)) + if( target.mind&&(target.mind.special_role||issilicon(target)) )//They need to have a mind. + target_list += target + if(target_list.len)//Everything else is handled by the ninja mask proc. + wear_mask:assess_targets(target_list, src) + if (!druggy) + see_invisible = 0 + if(1) + see_in_dark = 5 + if(!druggy) + see_invisible = 0 + if(2) + sight |= SEE_MOBS + if(!druggy) + see_invisible = 2 + if(3) + sight |= SEE_TURFS + if(!druggy) + see_invisible = 0 + + else if(istype(glasses, /obj/item/clothing/glasses/meson)) + sight |= SEE_TURFS + if(!druggy) + see_invisible = 0 + else if(istype(glasses, /obj/item/clothing/glasses/night)) + see_in_dark = 5 + if(!druggy) + see_invisible = 0 + else if(istype(glasses, /obj/item/clothing/glasses/thermal)) + sight |= SEE_MOBS + if(!druggy) + see_invisible = 2 + else if(istype(glasses, /obj/item/clothing/glasses/material)) + sight |= SEE_OBJS + if (!druggy) + see_invisible = 0 + + else if(stat != 2) + sight &= ~SEE_TURFS + sight &= ~SEE_MOBS + sight &= ~SEE_OBJS + if (mutantrace == "lizard" || mutantrace == "metroid") + see_in_dark = 3 + see_invisible = 1 + else if (druggy) // If drugged~ + see_in_dark = 2 + //see_invisible regulated by drugs themselves. + else + see_in_dark = 2 + + var/seer = 0 + var/obj/effect/rune/R = locate() in loc + if (istype(R) && R.word1 == wordsee && R.word2 == wordhell && R.word3 == wordjoin) + seer = 1 + if(!seer) + see_invisible = 0 + + + + + + + + else if(istype(head, /obj/item/clothing/head/helmet/welding)) // wat. This is never fucking called. + if(!head:up && tinted_weldhelh) + see_in_dark = 1 + + + + + + + + + + /* HUD shit goes here, as long as it doesn't modify src.sight flags */ + // The purpose of this is to stop xray and w/e from preventing you from using huds -- Love, Doohl + if(istype(glasses, /obj/item/clothing/glasses/hud/health)) + if(client) + glasses:process_hud(src) + if (!druggy) + see_invisible = 0 + + if(istype(glasses, /obj/item/clothing/glasses/hud/security)) + if(client) + glasses:process_hud(src) + if (!druggy) + see_invisible = 0 + + if(istype(glasses, /obj/item/clothing/glasses/sunglasses)) + see_in_dark = 1 + if(istype(glasses, /obj/item/clothing/glasses/sunglasses/sechud)) + if(client) + if(glasses:hud) + glasses:hud:process_hud(src) + if (!druggy) + see_invisible = 0 /* - if (istype(glasses, /obj/item/clothing/glasses)) - sight = glasses.vision_flags - see_in_dark = 2 + glasses.darkness_view - see_invisible = invisa_view + if (istype(glasses, /obj/item/clothing/glasses)) + sight = glasses.vision_flags + see_in_dark = 2 + glasses.darkness_view + see_invisible = invisa_view - if(istype(glasses, /obj/item/clothing/glasses/hud)) - if(client) - glasses:process_hud(src) + if(istype(glasses, /obj/item/clothing/glasses/hud)) + if(client) + glasses:process_hud(src) */ //Should finish this up later - if (sleep && !hal_crit) sleep.icon_state = text("sleep[]", sleeping) - if (rest) rest.icon_state = text("rest[]", resting) + if (sleep && !hal_crit) sleep.icon_state = text("sleep[]", sleeping) + if (rest) rest.icon_state = text("rest[]", resting) - if (healths) - if (stat != 2) - switch(health - halloss) - if(100 to INFINITY) - healths.icon_state = "health0" - if(80 to 100) - healths.icon_state = "health1" - if(60 to 80) - healths.icon_state = "health2" - if(40 to 60) - healths.icon_state = "health3" - if(20 to 40) - healths.icon_state = "health4" - if(0 to 20) - healths.icon_state = "health5" + if (healths) + if (stat != 2) + switch(health - halloss) + if(100 to INFINITY) + healths.icon_state = "health0" + if(80 to 100) + healths.icon_state = "health1" + if(60 to 80) + healths.icon_state = "health2" + if(40 to 60) + healths.icon_state = "health3" + if(20 to 40) + healths.icon_state = "health4" + if(0 to 20) + healths.icon_state = "health5" + else + healths.icon_state = "health6" + else + healths.icon_state = "health7" + if(hal_screwyhud == 1) + healths.icon_state = "health6" + if(hal_screwyhud == 2) + healths.icon_state = "health7" + + if (nutrition_icon) + switch(nutrition) + if(450 to INFINITY) + nutrition_icon.icon_state = "nutrition0" + if(350 to 450) + nutrition_icon.icon_state = "nutrition1" + if(250 to 350) + nutrition_icon.icon_state = "nutrition2" + if(150 to 250) + nutrition_icon.icon_state = "nutrition3" + else + nutrition_icon.icon_state = "nutrition4" + + if (pressure) + + if(istype(wear_suit, /obj/item/clothing/suit/space)||istype(wear_suit, /obj/item/clothing/suit/armor/captain)) + pressure.icon_state = "pressure0" + + else + var/datum/gas_mixture/environment = loc.return_air() + if(environment) + switch(environment.return_pressure()) + if(HAZARD_HIGH_PRESSURE to INFINITY) + pressure.icon_state = "pressure2" + if(WARNING_HIGH_PRESSURE to HAZARD_HIGH_PRESSURE) + pressure.icon_state = "pressure1" + if(WARNING_LOW_PRESSURE to WARNING_HIGH_PRESSURE) + pressure.icon_state = "pressure0" + if(HAZARD_LOW_PRESSURE to WARNING_LOW_PRESSURE) + pressure.icon_state = "pressure-1" else - healths.icon_state = "health6" - else - healths.icon_state = "health7" - if(hal_screwyhud == 1) - healths.icon_state = "health6" - if(hal_screwyhud == 2) - healths.icon_state = "health7" + pressure.icon_state = "pressure-2" - if (nutrition_icon) - switch(nutrition) - if(450 to INFINITY) - nutrition_icon.icon_state = "nutrition0" - if(350 to 450) - nutrition_icon.icon_state = "nutrition1" - if(250 to 350) - nutrition_icon.icon_state = "nutrition2" - if(150 to 250) - nutrition_icon.icon_state = "nutrition3" + if(pullin) pullin.icon_state = "pull[pulling ? 1 : 0]" + + if(rest) rest.icon_state = "rest[(resting || lying || sleeping) ? 1 : 0]" + + + if (toxin || hal_screwyhud == 4) toxin.icon_state = "tox[toxins_alert ? 1 : 0]" + if (oxygen || hal_screwyhud == 3) oxygen.icon_state = "oxy[oxygen_alert ? 1 : 0]" + if (fire) fire.icon_state = "fire[fire_alert ? 1 : 0]" //NOTE: INVESTIGATE NUKE BURNINGS + //NOTE: the alerts dont reset when youre out of danger. dont blame me, + //blame the person who coded them. Temporary fix added. + + 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(!client) return 0 //Wish we did not need these + client.screen -= hud_used.blurry + client.screen -= hud_used.druggy + client.screen -= hud_used.vimpaired + client.screen -= hud_used.darkMask + + if ((blind && stat != 2)) + if ((blinded)) + blind.layer = 18 + else + blind.layer = 0 + + if (disabilities & 1 && !istype(glasses, /obj/item/clothing/glasses/regular) ) + client.screen += hud_used.vimpaired + + if (eye_blurry) + client.screen += hud_used.blurry + + if (druggy) + client.screen += hud_used.druggy + + if ((istype(head, /obj/item/clothing/head/helmet/welding)) ) + if(!head:up && tinted_weldhelh) + client.screen += hud_used.darkMask + + if(eye_stat > 20) + if((eye_stat > 30)) + client.screen += hud_used.darkMask else - nutrition_icon.icon_state = "nutrition4" - - if (pressure) - - if(istype(wear_suit, /obj/item/clothing/suit/space)||istype(wear_suit, /obj/item/clothing/suit/armor/captain)) - pressure.icon_state = "pressure0" - - else - var/datum/gas_mixture/environment = loc.return_air() - if(environment) - switch(environment.return_pressure()) - if(HAZARD_HIGH_PRESSURE to INFINITY) - pressure.icon_state = "pressure2" - if(WARNING_HIGH_PRESSURE to HAZARD_HIGH_PRESSURE) - pressure.icon_state = "pressure1" - if(WARNING_LOW_PRESSURE to WARNING_HIGH_PRESSURE) - pressure.icon_state = "pressure0" - if(HAZARD_LOW_PRESSURE to WARNING_LOW_PRESSURE) - pressure.icon_state = "pressure-1" - else - pressure.icon_state = "pressure-2" - - if(pullin) pullin.icon_state = "pull[pulling ? 1 : 0]" - - if(rest) rest.icon_state = "rest[(resting || lying || sleeping) ? 1 : 0]" - - - if (toxin || hal_screwyhud == 4) toxin.icon_state = "tox[toxins_alert ? 1 : 0]" - if (oxygen || hal_screwyhud == 3) oxygen.icon_state = "oxy[oxygen_alert ? 1 : 0]" - if (fire) fire.icon_state = "fire[fire_alert ? 1 : 0]" //NOTE: INVESTIGATE NUKE BURNINGS - //NOTE: the alerts dont reset when youre out of danger. dont blame me, - //blame the person who coded them. Temporary fix added. - - 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(!client) return 0 //Wish we did not need these - client.screen -= hud_used.blurry - client.screen -= hud_used.druggy - client.screen -= hud_used.vimpaired - client.screen -= hud_used.darkMask - - if ((blind && stat != 2)) - if ((blinded)) - blind.layer = 18 - else - blind.layer = 0 - - if (disabilities & 1 && !istype(glasses, /obj/item/clothing/glasses/regular) ) client.screen += hud_used.vimpaired - if (eye_blurry) - client.screen += hud_used.blurry - - if (druggy) - client.screen += hud_used.druggy - - if ((istype(head, /obj/item/clothing/head/helmet/welding)) ) - if(!head:up && tinted_weldhelh) - client.screen += hud_used.darkMask - - if(eye_stat > 20) - if((eye_stat > 30)) - client.screen += hud_used.darkMask - else - client.screen += hud_used.vimpaired + if (stat != 2) + if (machine) + if (!( machine.check_eye(src) )) + reset_view(null) + else + if(!client.adminobs) + reset_view(null) - if (stat != 2) - if (machine) - if (!( machine.check_eye(src) )) - reset_view(null) - else - if(!client.adminobs) - reset_view(null) + return 1 - return 1 - - handle_random_events() - /* // probably stupid -- Doohl - if (prob(1) && prob(2)) - spawn(0) - emote("sneeze") - return - */ - - // Puke if toxloss is too high - if(!stat) - if (getToxLoss() >= 45 && nutrition > 20) - lastpuke ++ - if(lastpuke >= 25) // about 25 second delay I guess - Stun(5) - - for(var/mob/O in viewers(world.view, src)) - O.show_message(text("\red [] throws up!", src), 1) - playsound(src.loc, 'splat.ogg', 50, 1) - - var/turf/location = loc - if (istype(location, /turf/simulated)) - location.add_vomit_floor(src, 1) - - nutrition -= 20 - adjustToxLoss(-3) - - // make it so you can only puke so fast - lastpuke = 0 - - handle_virus_updates() - if(bodytemperature > 406) - for(var/datum/disease/D in viruses) - D.cure() - return - - handle_stomach() + proc/handle_random_events() + /* // probably stupid -- Doohl + if (prob(1) && prob(2)) spawn(0) - for(var/mob/M in stomach_contents) - if(M.loc != src) + emote("sneeze") + return + */ + + // Puke if toxloss is too high + if(!stat) + if (getToxLoss() >= 45 && nutrition > 20) + lastpuke ++ + if(lastpuke >= 25) // about 25 second delay I guess + Stun(5) + + for(var/mob/O in viewers(world.view, src)) + O.show_message(text("\red [] throws up!", src), 1) + playsound(src.loc, 'splat.ogg', 50, 1) + + var/turf/location = loc + if (istype(location, /turf/simulated)) + location.add_vomit_floor(src, 1) + + nutrition -= 20 + adjustToxLoss(-3) + + // make it so you can only puke so fast + lastpuke = 0 + + proc/handle_virus_updates() + if(bodytemperature > 406) + for(var/datum/disease/D in viruses) + D.cure() + return + + proc/handle_stomach() + spawn(0) + for(var/mob/M in stomach_contents) + if(M.loc != src) + stomach_contents.Remove(M) + continue + if(istype(M, /mob/living/carbon) && stat != 2) + if(M.stat == 2) + M.death(1) stomach_contents.Remove(M) + del(M) continue - if(istype(M, /mob/living/carbon) && stat != 2) - if(M.stat == 2) - M.death(1) - stomach_contents.Remove(M) - del(M) - continue - if(air_master.current_cycle%3==1) - if(!M.nodamage) - M.adjustBruteLoss(5) - nutrition += 10 -/* One day. - if(nutrition <= 100) - if (prob (1)) - src << "\red Your stomach rumbles." - if(nutrition <= 50) - if (prob (25)) - bruteloss++ - if (prob (5)) - src << "You feel very weak." - weakened += rand(2, 3) -*/ - handle_changeling() - if (mind) - if (mind.special_role == "Changeling" && changeling) - changeling.chem_charges = between(0, ((max((0.9 - (changeling.chem_charges / 50)), 0.1)*changeling.chem_recharge_multiplier) + changeling.chem_charges), changeling.chem_storage) - if ((changeling.geneticdamage > 0)) - changeling.geneticdamage = changeling.geneticdamage-1 + if(air_master.current_cycle%3==1) + if(!M.nodamage) + M.adjustBruteLoss(5) + nutrition += 10 -/* - // Commented out so hunger system won't be such shock - // Damage and effect from not eating + proc/handle_changeling() + if (mind) + if (mind.special_role == "Changeling" && changeling) + changeling.chem_charges = between(0, ((max((0.9 - (changeling.chem_charges / 50)), 0.1)*changeling.chem_recharge_multiplier) + changeling.chem_charges), changeling.chem_storage) + if ((changeling.geneticdamage > 0)) + changeling.geneticdamage = changeling.geneticdamage-1 -*/ -/* -snippets - - if (mach) - if (machine) - mach.icon_state = "mach1" - else - mach.icon_state = null - - if (!m_flag) - moved_recently = 0 - m_flag = null - - - - if ((istype(loc, /turf/space) && !( locate(/obj/movable, loc) ))) - var/layers = 20 - // ******* Check - if (((istype(head, /obj/item/clothing/head) && head.flags & 4) || (istype(wear_mask, /obj/item/clothing/mask) && (!( wear_mask.flags & 4 ) && wear_mask.flags & 8)))) - layers -= 5 - if (istype(w_uniform, /obj/item/clothing/under)) - layers -= 5 - if ((istype(wear_suit, /obj/item/clothing/suit) && wear_suit.flags & 8)) - layers -= 10 - if (layers > oxcheck) - oxcheck = layers - - - if(bodytemperature < 282.591 && (!firemut)) - if(bodytemperature < 250) - adjustFireLoss(4) - updatehealth() - if(paralysis <= 2) paralysis += 2 - else if(prob(1) && !paralysis) - if(paralysis <= 5) paralysis += 5 - emote("collapse") - src << "\red You collapse from the cold!" - if(bodytemperature > 327.444 && (!firemut)) - if(bodytemperature > 345.444) - if(!eye_blurry) src << "\red The heat blurs your vision!" - eye_blurry = max(4, eye_blurry) - if(prob(3)) adjustFireLoss(rand(1,2)) - else if(prob(3) && !paralysis) - paralysis += 2 - emote("collapse") - src << "\red You collapse from heat exaustion!" - plcheck = t_plasma - oxcheck = t_oxygen - G.turf_add(T, G.total_moles()) -*/ diff --git a/code/modules/mob/living/carbon/monkey/life.dm b/code/modules/mob/living/carbon/monkey/life.dm index 15fe43e4b40..fd6acbd0bc6 100644 --- a/code/modules/mob/living/carbon/monkey/life.dm +++ b/code/modules/mob/living/carbon/monkey/life.dm @@ -85,551 +85,555 @@ if(prob(1)) emote(pick("scratch","jump","roll","tail")) +/mob/living/carbon/monkey/calculate_affecting_pressure(var/pressure) + ..() + return pressure + /mob/living/carbon/monkey - proc - clamp_values() - AdjustStunned(0) - AdjustParalysis(0) - AdjustWeakened(0) + proc/clamp_values() - handle_disabilities() + AdjustStunned(0) + AdjustParalysis(0) + AdjustWeakened(0) - if (src.disabilities & 2) - if ((prob(1) && src.paralysis < 10 && src.r_epil < 1)) - src << "\red You have a seizure!" - Paralyse(10) - if (src.disabilities & 4) - if ((prob(5) && src.paralysis <= 1 && src.r_ch_cou < 1)) - src.drop_item() - spawn( 0 ) - emote("cough") - return - if (src.disabilities & 8) - if ((prob(10) && src.paralysis <= 1 && src.r_Tourette < 1)) - Stun(10) - spawn( 0 ) - emote("twitch") - return - if (src.disabilities & 16) - if (prob(10)) - src.stuttering = max(10, src.stuttering) + proc/handle_disabilities() - update_mind() - if(!mind && client) - mind = new - mind.current = src - mind.key = key + if (src.disabilities & 2) + if ((prob(1) && src.paralysis < 10 && src.r_epil < 1)) + src << "\red You have a seizure!" + Paralyse(10) + if (src.disabilities & 4) + if ((prob(5) && src.paralysis <= 1 && src.r_ch_cou < 1)) + src.drop_item() + spawn( 0 ) + emote("cough") + return + if (src.disabilities & 8) + if ((prob(10) && src.paralysis <= 1 && src.r_Tourette < 1)) + Stun(10) + spawn( 0 ) + emote("twitch") + return + if (src.disabilities & 16) + if (prob(10)) + src.stuttering = max(10, src.stuttering) - handle_mutations_and_radiation() + proc/update_mind() + if(!mind && client) + mind = new + mind.current = src + mind.key = key - if(src.getFireLoss()) - if((COLD_RESISTANCE in mutations) || prob(50)) - switch(src.getFireLoss()) - if(1 to 50) - src.adjustFireLoss(-1) - if(51 to 100) - src.adjustFireLoss(-5) + proc/handle_mutations_and_radiation() - if ((HULK in mutations) && src.health <= 25) - src.mutations.Remove(HULK) - src << "\red You suddenly feel very weak." - Weaken(3) + if(src.getFireLoss()) + if((COLD_RESISTANCE in mutations) || prob(50)) + switch(src.getFireLoss()) + if(1 to 50) + src.adjustFireLoss(-1) + if(51 to 100) + src.adjustFireLoss(-5) + + if ((HULK in mutations) && src.health <= 25) + src.mutations.Remove(HULK) + src << "\red You suddenly feel very weak." + Weaken(3) + emote("collapse") + + if (src.radiation) + if (src.radiation > 100) + src.radiation = 100 + Weaken(10) + src << "\red You feel weak." emote("collapse") - if (src.radiation) - if (src.radiation > 100) - src.radiation = 100 - Weaken(10) - src << "\red You feel weak." - emote("collapse") - - switch(src.radiation) - if(1 to 49) - src.radiation-- - if(prob(25)) - src.adjustToxLoss(1) - src.updatehealth() - - if(50 to 74) - src.radiation -= 2 + switch(src.radiation) + if(1 to 49) + src.radiation-- + if(prob(25)) src.adjustToxLoss(1) - if(prob(5)) - src.radiation -= 5 - Weaken(3) - src << "\red You feel weak." - emote("collapse") src.updatehealth() - if(75 to 100) - src.radiation -= 3 - src.adjustToxLoss(3) - if(prob(1)) - src << "\red You mutate!" - randmutb(src) - domutcheck(src,null) - emote("gasp") - src.updatehealth() + if(50 to 74) + src.radiation -= 2 + src.adjustToxLoss(1) + if(prob(5)) + src.radiation -= 5 + Weaken(3) + src << "\red You feel weak." + emote("collapse") + src.updatehealth() + + if(75 to 100) + src.radiation -= 3 + src.adjustToxLoss(3) + if(prob(1)) + src << "\red You mutate!" + randmutb(src) + domutcheck(src,null) + emote("gasp") + src.updatehealth() - breathe() - if(src.reagents) + proc/breathe() + if(src.reagents) - if(src.reagents.has_reagent("lexorin")) return + if(src.reagents.has_reagent("lexorin")) return - if(!loc) return //probably ought to make a proper fix for this, but :effort: --NeoFite + if(!loc) return //probably ought to make a proper fix for this, but :effort: --NeoFite - var/datum/gas_mixture/environment = loc.return_air() - var/datum/air_group/breath + var/datum/gas_mixture/environment = loc.return_air() + var/datum/air_group/breath - if(losebreath>0) //Suffocating so do not take a breath - src.losebreath-- - if (prob(75)) //High chance of gasping for air - spawn emote("gasp") + if(losebreath>0) //Suffocating so do not take a breath + src.losebreath-- + if (prob(75)) //High chance of gasping for air + spawn emote("gasp") + if(istype(loc, /obj/)) + var/obj/location_as_object = loc + location_as_object.handle_internal_lifeform(src, 0) + else + //First, check for air from internal atmosphere (using an air tank and mask generally) + breath = get_breath_from_internal(BREATH_VOLUME) + + //No breath from internal atmosphere so get breath from location + if(!breath) + if(istype(loc, /obj/)) + var/obj/location_as_object = loc + breath = location_as_object.handle_internal_lifeform(src, BREATH_VOLUME) + else if(istype(loc, /turf/)) + var/breath_moles = environment.total_moles()*BREATH_PERCENTAGE + breath = loc.remove_air(breath_moles) + + // Handle chem smoke effect -- Doohl + var/block = 0 + if(wear_mask) + if(istype(wear_mask, /obj/item/clothing/mask/gas)) + block = 1 + + if(!block) + + for(var/obj/effect/effect/chem_smoke/smoke in view(1, src)) + if(smoke.reagents.total_volume) + smoke.reagents.reaction(src, INGEST) + spawn(5) + if(smoke) + smoke.reagents.copy_to(src, 10) // I dunno, maybe the reagents enter the blood stream through the lungs? + break // If they breathe in the nasty stuff once, no need to continue checking + + + else //Still give containing object the chance to interact if(istype(loc, /obj/)) var/obj/location_as_object = loc location_as_object.handle_internal_lifeform(src, 0) - else - //First, check for air from internal atmosphere (using an air tank and mask generally) - breath = get_breath_from_internal(BREATH_VOLUME) - //No breath from internal atmosphere so get breath from location - if(!breath) - if(istype(loc, /obj/)) - var/obj/location_as_object = loc - breath = location_as_object.handle_internal_lifeform(src, BREATH_VOLUME) - else if(istype(loc, /turf/)) - var/breath_moles = environment.total_moles()*BREATH_PERCENTAGE - breath = loc.remove_air(breath_moles) + handle_breath(breath) - // Handle chem smoke effect -- Doohl - var/block = 0 - if(wear_mask) - if(istype(wear_mask, /obj/item/clothing/mask/gas)) - block = 1 - - if(!block) - - for(var/obj/effect/effect/chem_smoke/smoke in view(1, src)) - if(smoke.reagents.total_volume) - smoke.reagents.reaction(src, INGEST) - spawn(5) - if(smoke) - smoke.reagents.copy_to(src, 10) // I dunno, maybe the reagents enter the blood stream through the lungs? - break // If they breathe in the nasty stuff once, no need to continue checking + if(breath) + loc.assume_air(breath) - else //Still give containing object the chance to interact - if(istype(loc, /obj/)) - var/obj/location_as_object = loc - location_as_object.handle_internal_lifeform(src, 0) - - handle_breath(breath) - - if(breath) - loc.assume_air(breath) - - - get_breath_from_internal(volume_needed) + proc/get_breath_from_internal(volume_needed) + if(internal) + if (!contents.Find(src.internal)) + internal = null + if (!wear_mask || !(wear_mask.flags|MASKINTERNALS) ) + internal = null if(internal) - if (!contents.Find(src.internal)) - internal = null - if (!wear_mask || !(wear_mask.flags|MASKINTERNALS) ) - internal = null - if(internal) - if (src.internals) - src.internals.icon_state = "internal1" - return internal.remove_air_volume(volume_needed) - else - if (src.internals) - src.internals.icon_state = "internal0" - return null - - update_canmove() - if(paralysis || stunned || weakened || buckled || (changeling && changeling.changeling_fakedeath)) canmove = 0 - else canmove = 1 - - handle_breath(datum/gas_mixture/breath) - if(src.nodamage) - return - - if(!breath || (breath.total_moles() == 0)) - adjustOxyLoss(7) - - oxygen_alert = max(oxygen_alert, 1) - - return 0 - - var/safe_oxygen_min = 16 // Minimum safe partial pressure of O2, in kPa - //var/safe_oxygen_max = 140 // Maximum safe partial pressure of O2, in kPa (Not used for now) - var/safe_co2_max = 10 // Yes it's an arbitrary value who cares? - var/safe_toxins_max = 0.5 - var/SA_para_min = 0.5 - var/SA_sleep_min = 5 - var/oxygen_used = 0 - var/breath_pressure = (breath.total_moles()*R_IDEAL_GAS_EQUATION*breath.temperature)/BREATH_VOLUME - - //Partial pressure of the O2 in our breath - var/O2_pp = (breath.oxygen/breath.total_moles())*breath_pressure - // Same, but for the toxins - 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 - - if(O2_pp < safe_oxygen_min) // Too little oxygen - if(prob(20)) - spawn(0) emote("gasp") - if (O2_pp == 0) - O2_pp = 0.01 - var/ratio = safe_oxygen_min/O2_pp - adjustOxyLoss(min(5*ratio, 7)) // Don't fuck them up too fast (space only does 7 after all!) - oxygen_used = breath.oxygen*ratio/6 - oxygen_alert = max(oxygen_alert, 1) - /*else if (O2_pp > safe_oxygen_max) // Too much oxygen (commented this out for now, I'll deal with pressure damage elsewhere I suppose) - spawn(0) emote("cough") - var/ratio = O2_pp/safe_oxygen_max - oxyloss += 5*ratio - oxygen_used = breath.oxygen*ratio/6 - oxygen_alert = max(oxygen_alert, 1)*/ - else // We're in safe limits - adjustOxyLoss(-5) - oxygen_used = breath.oxygen/6 - oxygen_alert = 0 - - breath.oxygen -= oxygen_used - breath.carbon_dioxide += oxygen_used - - if(CO2_pp > safe_co2_max) - if(!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. - co2overloadtime = world.time - else if(world.time - co2overloadtime > 120) - Paralyse(3) - adjustOxyLoss(3) // Lets hurt em a little, let them know we mean business - if(world.time - co2overloadtime > 300) // They've been in here 30s now, lets start to kill them for their own good! - adjustOxyLoss(8) - if(prob(20)) // Lets give them some chance to know somethings not right though I guess. - spawn(0) emote("cough") - + if (src.internals) + src.internals.icon_state = "internal1" + return internal.remove_air_volume(volume_needed) else - co2overloadtime = 0 + if (src.internals) + src.internals.icon_state = "internal0" + return null - if(Toxins_pp > safe_toxins_max) // Too much toxins - var/ratio = breath.toxins/safe_toxins_max - adjustToxLoss(min(ratio, 10)) //Limit amount of damage toxin exposure can do per second - toxins_alert = max(toxins_alert, 1) - else - toxins_alert = 0 + proc/update_canmove() + if(paralysis || stunned || weakened || buckled || (changeling && changeling.changeling_fakedeath)) canmove = 0 + else canmove = 1 - 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 - 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 - src.sleeping = max(src.sleeping+2, 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)) - spawn(0) emote(pick("giggle", "laugh")) - - - if(breath.temperature > (T0C+66)) // Hot air hurts :( - if(prob(20)) - src << "\red You feel a searing heat in your lungs!" - fire_alert = max(fire_alert, 1) - else - fire_alert = 0 - - - //Temporary fixes to the alerts. - - return 1 - - handle_environment(datum/gas_mixture/environment) - if(!environment) - return - var/environment_heat_capacity = environment.heat_capacity() - if(istype(loc, /turf/space)) - environment_heat_capacity = loc:heat_capacity - - if((environment.temperature > (T0C + 50)) || (environment.temperature < (T0C + 10))) - var/transfer_coefficient - - transfer_coefficient = 1 - if(wear_mask && (wear_mask.body_parts_covered & HEAD) && (environment.temperature < wear_mask.protective_temperature)) - transfer_coefficient *= wear_mask.heat_transfer_coefficient - - handle_temperature_damage(HEAD, environment.temperature, environment_heat_capacity*transfer_coefficient) - - if(stat==2) - bodytemperature += 0.1*(environment.temperature - bodytemperature)*environment_heat_capacity/(environment_heat_capacity + 270000) - - //Account for massive pressure differences - - - var/pressure = environment.return_pressure() - - // if(!wear_suit) Monkies cannot into space. - // if(!istype(wear_suit, /obj/item/clothing/suit/space)) - - /*if(pressure < 20) - if(prob(25)) - src << "You feel the splittle on your lips and the fluid on your eyes boiling away, the capillteries in your skin breaking." - adjustBruteLoss(5) - */ - - if(pressure > HAZARD_HIGH_PRESSURE) - - adjustBruteLoss(min((10+(round(pressure/(HIGH_STEP_PRESSURE)-2)*5)),MAX_PRESSURE_DAMAGE)) - - - - return //TODO: DEFERRED - - handle_temperature_damage(body_part, exposed_temperature, exposed_intensity) - if(src.nodamage) return - var/discomfort = min( abs(exposed_temperature - bodytemperature)*(exposed_intensity)/2000000, 1.0) - //adjustFireLoss(2.5*discomfort) - - if(exposed_temperature > bodytemperature) - adjustFireLoss(20.0*discomfort) - - else - adjustFireLoss(5.0*discomfort) - - handle_chemicals_in_body() - - if(reagents) reagents.metabolize(src) - - if (src.drowsyness) - src.drowsyness-- - src.eye_blurry = max(2, src.eye_blurry) - if (prob(5)) - src.sleeping += 1 - Paralyse(5) - - confused = max(0, confused - 1) - // decrement dizziness counter, clamped to 0 - if(resting) - dizziness = max(0, dizziness - 5) - else - dizziness = max(0, dizziness - 1) - - src.updatehealth() - - return //TODO: DEFERRED - - handle_regular_status_updates() - - health = 100 - (getOxyLoss() + getToxLoss() + getFireLoss() + getBruteLoss() + getCloneLoss()) - - if(getOxyLoss() > 25) Paralyse(3) - - if(src.sleeping) - Paralyse(5) - if (prob(1) && health) spawn(0) emote("snore") - - if(src.resting) - Weaken(5) - - if(health < config.health_threshold_dead && stat != 2) - death() - else if(src.health < config.health_threshold_crit) - if(src.health <= 20 && prob(1)) spawn(0) emote("gasp") - - //if(!src.rejuv) src.oxyloss++ //-Nodrak (I can't believe I thought this should be commented back in) - if(!src.reagents.has_reagent("inaprovaline") && src.stat != 2) src.adjustOxyLoss(2) - - if(src.stat != 2) src.stat = 1 - Paralyse(5) - - if (src.stat != 2) //Alive. - - if (src.paralysis || src.stunned || src.weakened || (changeling && changeling.changeling_fakedeath)) //Stunned etc. - if (src.stunned > 0) - AdjustStunned(-1) - src.stat = 0 - if (src.weakened > 0) - AdjustWeakened(-1) - src.lying = 1 - src.stat = 0 - if (src.paralysis > 0) - AdjustParalysis(-1) - src.blinded = 1 - src.lying = 1 - src.stat = 1 - var/h = src.hand - src.hand = 0 - drop_item() - src.hand = 1 - drop_item() - src.hand = h - - else //Not stunned. - src.lying = 0 - src.stat = 0 - - else //Dead. - src.lying = 1 - src.blinded = 1 - src.stat = 2 - - if (src.stuttering) src.stuttering-- - - if (src.eye_blind) - src.eye_blind-- - src.blinded = 1 - - if (src.ear_deaf > 0) src.ear_deaf-- - if (src.ear_damage < 25) - src.ear_damage -= 0.05 - src.ear_damage = max(src.ear_damage, 0) - - src.density = !( src.lying ) - - if (src.sdisabilities & 1) - src.blinded = 1 - if (src.sdisabilities & 4) - src.ear_deaf = 1 - - if (src.eye_blurry > 0) - src.eye_blurry-- - src.eye_blurry = max(0, src.eye_blurry) - - if (src.druggy > 0) - src.druggy-- - src.druggy = max(0, src.druggy) - - return 1 - - handle_regular_hud_updates() - - if (src.stat == 2 || (XRAY in mutations)) - src.sight |= SEE_TURFS - src.sight |= SEE_MOBS - src.sight |= SEE_OBJS - src.see_in_dark = 8 - src.see_invisible = 2 - else if (src.stat != 2) - src.sight &= ~SEE_TURFS - src.sight &= ~SEE_MOBS - src.sight &= ~SEE_OBJS - src.see_in_dark = 2 - src.see_invisible = 0 - - if (src.sleep) src.sleep.icon_state = text("sleep[]", src.sleeping) - if (src.rest) src.rest.icon_state = text("rest[]", src.resting) - - if (src.healths) - if (src.stat != 2) - switch(health) - if(100 to INFINITY) - src.healths.icon_state = "health0" - if(80 to 100) - src.healths.icon_state = "health1" - if(60 to 80) - src.healths.icon_state = "health2" - if(40 to 60) - src.healths.icon_state = "health3" - if(20 to 40) - src.healths.icon_state = "health4" - if(0 to 20) - src.healths.icon_state = "health5" - else - src.healths.icon_state = "health6" - else - src.healths.icon_state = "health7" - - if (pressure) - var/datum/gas_mixture/environment = loc.return_air() - if(environment) - switch(environment.return_pressure()) - - if(HAZARD_HIGH_PRESSURE to INFINITY) - pressure.icon_state = "pressure2" - if(WARNING_HIGH_PRESSURE to HAZARD_HIGH_PRESSURE) - pressure.icon_state = "pressure1" - if(WARNING_LOW_PRESSURE to WARNING_HIGH_PRESSURE) - pressure.icon_state = "pressure0" - if(HAZARD_LOW_PRESSURE to WARNING_LOW_PRESSURE) - pressure.icon_state = "pressure-1" - else - pressure.icon_state = "pressure-2" - - if(src.pullin) src.pullin.icon_state = "pull[src.pulling ? 1 : 0]" - - - if (src.toxin) src.toxin.icon_state = "tox[src.toxins_alert ? 1 : 0]" - if (src.oxygen) src.oxygen.icon_state = "oxy[src.oxygen_alert ? 1 : 0]" - if (src.fire) src.fire.icon_state = "fire[src.fire_alert ? 1 : 0]" - //NOTE: the alerts dont reset when youre out of danger. dont blame me, - //blame the person who coded them. Temporary fix added. - - if(bodytemp) - switch(src.bodytemperature) //310.055 optimal body temp - if(345 to INFINITY) - src.bodytemp.icon_state = "temp4" - if(335 to 345) - src.bodytemp.icon_state = "temp3" - if(327 to 335) - src.bodytemp.icon_state = "temp2" - if(316 to 327) - src.bodytemp.icon_state = "temp1" - if(300 to 316) - src.bodytemp.icon_state = "temp0" - if(295 to 300) - src.bodytemp.icon_state = "temp-1" - if(280 to 295) - src.bodytemp.icon_state = "temp-2" - if(260 to 280) - src.bodytemp.icon_state = "temp-3" - else - src.bodytemp.icon_state = "temp-4" - - src.client.screen -= src.hud_used.blurry - src.client.screen -= src.hud_used.druggy - src.client.screen -= src.hud_used.vimpaired - - if ((src.blind && src.stat != 2)) - if ((src.blinded)) - src.blind.layer = 18 - else - src.blind.layer = 0 - - if (src.disabilities & 1) - src.client.screen += src.hud_used.vimpaired - - if (src.eye_blurry) - src.client.screen += src.hud_used.blurry - - if (src.druggy) - src.client.screen += src.hud_used.druggy - - if (src.stat != 2) - if (src.machine) - if (!( src.machine.check_eye(src) )) - src.reset_view(null) - else - if(!client.adminobs) - reset_view(null) - - return 1 - - handle_random_events() - if (prob(1) && prob(2)) - spawn(0) - emote("scratch") - return - - handle_virus_updates() - if(src.bodytemperature > 406) - for(var/datum/disease/D in viruses) - D.cure() + proc/handle_breath(datum/gas_mixture/breath) + if(src.nodamage) return - handle_changeling() - if (mind) - if (mind.special_role == "Changeling" && changeling) - changeling.chem_charges = between(0, ((max((0.9 - (changeling.chem_charges / 50)), 0.1)*changeling.chem_recharge_multiplier) + changeling.chem_charges), changeling.chem_storage) - if ((changeling.geneticdamage > 0)) - changeling.geneticdamage = changeling.geneticdamage-1 + if(!breath || (breath.total_moles() == 0)) + adjustOxyLoss(7) + + oxygen_alert = max(oxygen_alert, 1) + + return 0 + + var/safe_oxygen_min = 16 // Minimum safe partial pressure of O2, in kPa + //var/safe_oxygen_max = 140 // Maximum safe partial pressure of O2, in kPa (Not used for now) + var/safe_co2_max = 10 // Yes it's an arbitrary value who cares? + var/safe_toxins_max = 0.5 + var/SA_para_min = 0.5 + var/SA_sleep_min = 5 + var/oxygen_used = 0 + var/breath_pressure = (breath.total_moles()*R_IDEAL_GAS_EQUATION*breath.temperature)/BREATH_VOLUME + + //Partial pressure of the O2 in our breath + var/O2_pp = (breath.oxygen/breath.total_moles())*breath_pressure + // Same, but for the toxins + 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 + + if(O2_pp < safe_oxygen_min) // Too little oxygen + if(prob(20)) + spawn(0) emote("gasp") + if (O2_pp == 0) + O2_pp = 0.01 + var/ratio = safe_oxygen_min/O2_pp + adjustOxyLoss(min(5*ratio, 7)) // Don't fuck them up too fast (space only does 7 after all!) + oxygen_used = breath.oxygen*ratio/6 + oxygen_alert = max(oxygen_alert, 1) + /*else if (O2_pp > safe_oxygen_max) // Too much oxygen (commented this out for now, I'll deal with pressure damage elsewhere I suppose) + spawn(0) emote("cough") + var/ratio = O2_pp/safe_oxygen_max + oxyloss += 5*ratio + oxygen_used = breath.oxygen*ratio/6 + oxygen_alert = max(oxygen_alert, 1)*/ + else // We're in safe limits + adjustOxyLoss(-5) + oxygen_used = breath.oxygen/6 + oxygen_alert = 0 + + breath.oxygen -= oxygen_used + breath.carbon_dioxide += oxygen_used + + if(CO2_pp > safe_co2_max) + if(!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. + co2overloadtime = world.time + else if(world.time - co2overloadtime > 120) + Paralyse(3) + adjustOxyLoss(3) // Lets hurt em a little, let them know we mean business + if(world.time - co2overloadtime > 300) // They've been in here 30s now, lets start to kill them for their own good! + adjustOxyLoss(8) + if(prob(20)) // Lets give them some chance to know somethings not right though I guess. + spawn(0) emote("cough") + + else + co2overloadtime = 0 + + if(Toxins_pp > safe_toxins_max) // Too much toxins + var/ratio = breath.toxins/safe_toxins_max + adjustToxLoss(min(ratio, 10)) //Limit amount of damage toxin exposure can do per second + toxins_alert = max(toxins_alert, 1) + else + toxins_alert = 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 + 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 + src.sleeping = max(src.sleeping+2, 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)) + spawn(0) emote(pick("giggle", "laugh")) + + + if(breath.temperature > (T0C+66)) // Hot air hurts :( + if(prob(20)) + src << "\red You feel a searing heat in your lungs!" + fire_alert = max(fire_alert, 1) + else + fire_alert = 0 + + + //Temporary fixes to the alerts. + + return 1 + + proc/handle_environment(datum/gas_mixture/environment) + if(!environment) + return + var/environment_heat_capacity = environment.heat_capacity() + if(istype(loc, /turf/space)) + environment_heat_capacity = loc:heat_capacity + + if((environment.temperature > (T0C + 50)) || (environment.temperature < (T0C + 10))) + var/transfer_coefficient + + transfer_coefficient = 1 + if(wear_mask && (wear_mask.body_parts_covered & HEAD) && (environment.temperature < wear_mask.protective_temperature)) + transfer_coefficient *= wear_mask.heat_transfer_coefficient + + handle_temperature_damage(HEAD, environment.temperature, environment_heat_capacity*transfer_coefficient) + + if(stat==2) + bodytemperature += 0.1*(environment.temperature - bodytemperature)*environment_heat_capacity/(environment_heat_capacity + 270000) + + //Account for massive pressure differences + + + var/pressure = environment.return_pressure() + + // if(!wear_suit) Monkies cannot into space. + // if(!istype(wear_suit, /obj/item/clothing/suit/space)) + + /*if(pressure < 20) + if(prob(25)) + src << "You feel the splittle on your lips and the fluid on your eyes boiling away, the capillteries in your skin breaking." + adjustBruteLoss(5) + */ + + if(pressure > HAZARD_HIGH_PRESSURE) + + adjustBruteLoss(min((10+(round(pressure/(HIGH_STEP_PRESSURE)-2)*5)),MAX_PRESSURE_DAMAGE)) + + + + return //TODO: DEFERRED + + proc/handle_temperature_damage(body_part, exposed_temperature, exposed_intensity) + if(src.nodamage) return + var/discomfort = min( abs(exposed_temperature - bodytemperature)*(exposed_intensity)/2000000, 1.0) + //adjustFireLoss(2.5*discomfort) + + if(exposed_temperature > bodytemperature) + adjustFireLoss(20.0*discomfort) + + else + adjustFireLoss(5.0*discomfort) + + proc/handle_chemicals_in_body() + + if(reagents) reagents.metabolize(src) + + if (src.drowsyness) + src.drowsyness-- + src.eye_blurry = max(2, src.eye_blurry) + if (prob(5)) + src.sleeping += 1 + Paralyse(5) + + confused = max(0, confused - 1) + // decrement dizziness counter, clamped to 0 + if(resting) + dizziness = max(0, dizziness - 5) + else + dizziness = max(0, dizziness - 1) + + src.updatehealth() + + return //TODO: DEFERRED + + proc/handle_regular_status_updates() + + health = 100 - (getOxyLoss() + getToxLoss() + getFireLoss() + getBruteLoss() + getCloneLoss()) + + if(getOxyLoss() > 25) Paralyse(3) + + if(src.sleeping) + Paralyse(5) + if (prob(1) && health) spawn(0) emote("snore") + + if(src.resting) + Weaken(5) + + if(health < config.health_threshold_dead && stat != 2) + death() + else if(src.health < config.health_threshold_crit) + if(src.health <= 20 && prob(1)) spawn(0) emote("gasp") + + //if(!src.rejuv) src.oxyloss++ //-Nodrak (I can't believe I thought this should be commented back in) + if(!src.reagents.has_reagent("inaprovaline") && src.stat != 2) src.adjustOxyLoss(2) + + if(src.stat != 2) src.stat = 1 + Paralyse(5) + + if (src.stat != 2) //Alive. + + if (src.paralysis || src.stunned || src.weakened || (changeling && changeling.changeling_fakedeath)) //Stunned etc. + if (src.stunned > 0) + AdjustStunned(-1) + src.stat = 0 + if (src.weakened > 0) + AdjustWeakened(-1) + src.lying = 1 + src.stat = 0 + if (src.paralysis > 0) + AdjustParalysis(-1) + src.blinded = 1 + src.lying = 1 + src.stat = 1 + var/h = src.hand + src.hand = 0 + drop_item() + src.hand = 1 + drop_item() + src.hand = h + + else //Not stunned. + src.lying = 0 + src.stat = 0 + + else //Dead. + src.lying = 1 + src.blinded = 1 + src.stat = 2 + + if (src.stuttering) src.stuttering-- + + if (src.eye_blind) + src.eye_blind-- + src.blinded = 1 + + if (src.ear_deaf > 0) src.ear_deaf-- + if (src.ear_damage < 25) + src.ear_damage -= 0.05 + src.ear_damage = max(src.ear_damage, 0) + + src.density = !( src.lying ) + + if (src.sdisabilities & 1) + src.blinded = 1 + if (src.sdisabilities & 4) + src.ear_deaf = 1 + + if (src.eye_blurry > 0) + src.eye_blurry-- + src.eye_blurry = max(0, src.eye_blurry) + + if (src.druggy > 0) + src.druggy-- + src.druggy = max(0, src.druggy) + + return 1 + + proc/handle_regular_hud_updates() + + if (src.stat == 2 || (XRAY in mutations)) + src.sight |= SEE_TURFS + src.sight |= SEE_MOBS + src.sight |= SEE_OBJS + src.see_in_dark = 8 + src.see_invisible = 2 + else if (src.stat != 2) + src.sight &= ~SEE_TURFS + src.sight &= ~SEE_MOBS + src.sight &= ~SEE_OBJS + src.see_in_dark = 2 + src.see_invisible = 0 + + if (src.sleep) src.sleep.icon_state = text("sleep[]", src.sleeping) + if (src.rest) src.rest.icon_state = text("rest[]", src.resting) + + if (src.healths) + if (src.stat != 2) + switch(health) + if(100 to INFINITY) + src.healths.icon_state = "health0" + if(80 to 100) + src.healths.icon_state = "health1" + if(60 to 80) + src.healths.icon_state = "health2" + if(40 to 60) + src.healths.icon_state = "health3" + if(20 to 40) + src.healths.icon_state = "health4" + if(0 to 20) + src.healths.icon_state = "health5" + else + src.healths.icon_state = "health6" + else + src.healths.icon_state = "health7" + + if (pressure) + var/datum/gas_mixture/environment = loc.return_air() + if(environment) + switch(environment.return_pressure()) + + if(HAZARD_HIGH_PRESSURE to INFINITY) + pressure.icon_state = "pressure2" + if(WARNING_HIGH_PRESSURE to HAZARD_HIGH_PRESSURE) + pressure.icon_state = "pressure1" + if(WARNING_LOW_PRESSURE to WARNING_HIGH_PRESSURE) + pressure.icon_state = "pressure0" + if(HAZARD_LOW_PRESSURE to WARNING_LOW_PRESSURE) + pressure.icon_state = "pressure-1" + else + pressure.icon_state = "pressure-2" + + if(src.pullin) src.pullin.icon_state = "pull[src.pulling ? 1 : 0]" + + + if (src.toxin) src.toxin.icon_state = "tox[src.toxins_alert ? 1 : 0]" + if (src.oxygen) src.oxygen.icon_state = "oxy[src.oxygen_alert ? 1 : 0]" + if (src.fire) src.fire.icon_state = "fire[src.fire_alert ? 1 : 0]" + //NOTE: the alerts dont reset when youre out of danger. dont blame me, + //blame the person who coded them. Temporary fix added. + + if(bodytemp) + switch(src.bodytemperature) //310.055 optimal body temp + if(345 to INFINITY) + src.bodytemp.icon_state = "temp4" + if(335 to 345) + src.bodytemp.icon_state = "temp3" + if(327 to 335) + src.bodytemp.icon_state = "temp2" + if(316 to 327) + src.bodytemp.icon_state = "temp1" + if(300 to 316) + src.bodytemp.icon_state = "temp0" + if(295 to 300) + src.bodytemp.icon_state = "temp-1" + if(280 to 295) + src.bodytemp.icon_state = "temp-2" + if(260 to 280) + src.bodytemp.icon_state = "temp-3" + else + src.bodytemp.icon_state = "temp-4" + + src.client.screen -= src.hud_used.blurry + src.client.screen -= src.hud_used.druggy + src.client.screen -= src.hud_used.vimpaired + + if ((src.blind && src.stat != 2)) + if ((src.blinded)) + src.blind.layer = 18 + else + src.blind.layer = 0 + + if (src.disabilities & 1) + src.client.screen += src.hud_used.vimpaired + + if (src.eye_blurry) + src.client.screen += src.hud_used.blurry + + if (src.druggy) + src.client.screen += src.hud_used.druggy + + if (src.stat != 2) + if (src.machine) + if (!( src.machine.check_eye(src) )) + src.reset_view(null) + else + if(!client.adminobs) + reset_view(null) + + return 1 + + proc/handle_random_events() + if (prob(1) && prob(2)) + spawn(0) + emote("scratch") + return + + proc/handle_virus_updates() + if(src.bodytemperature > 406) + for(var/datum/disease/D in viruses) + D.cure() + return + + proc/handle_changeling() + if (mind) + if (mind.special_role == "Changeling" && changeling) + changeling.chem_charges = between(0, ((max((0.9 - (changeling.chem_charges / 50)), 0.1)*changeling.chem_recharge_multiplier) + changeling.chem_charges), changeling.chem_storage) + if ((changeling.geneticdamage > 0)) + changeling.geneticdamage = changeling.geneticdamage-1 diff --git a/code/modules/mob/living/living.dm b/code/modules/mob/living/living.dm index 9b173ad669d..5e192c29963 100644 --- a/code/modules/mob/living/living.dm +++ b/code/modules/mob/living/living.dm @@ -29,6 +29,11 @@ src.health = 100 src.stat = 0 +//This proc is used for mobs which are affected by pressure to calculate the amount of pressure that actually +//affects them once clothing is factored in. ~Errorage +/mob/living/proc/calculate_affecting_pressure(var/pressure) + return 0 + //sort of a legacy burn method for /electrocute, /shock, and the e_chair /mob/living/proc/burn_skin(burn_amount) diff --git a/code/setup.dm b/code/setup.dm index f8b07822935..889878a2ad0 100644 --- a/code/setup.dm +++ b/code/setup.dm @@ -23,12 +23,16 @@ //Amount of air needed before pass out/suffocation commences // Pressure limits. -#define HAZARD_HIGH_PRESSURE 750 -#define HIGH_STEP_PRESSURE HAZARD_HIGH_PRESSURE/2 -#define WARNING_HIGH_PRESSURE HAZARD_HIGH_PRESSURE*0.7 -#define HAZARD_LOW_PRESSURE 20 -#define WARNING_LOW_PRESSURE HAZARD_LOW_PRESSURE*2.5 -#define MAX_PRESSURE_DAMAGE 20 +#define HAZARD_HIGH_PRESSURE 750 //This determins at what pressure the ultra-high pressure red icon is displayed. (This one is set as a constant) +#define WARNING_HIGH_PRESSURE 525 //This determins when the orange pressure icon is displayed (it is 0.7 * HAZARD_HIGH_PRESSURE) +#define WARNING_LOW_PRESSURE 50 //This is when the gray low pressure icon is displayed. (it is 2.5 * HAZARD_LOW_PRESSURE) +#define HAZARD_LOW_PRESSURE 20 //This is when the black ultra-low pressure icon is displayed. (This one is set as a constant) + +#define PRESSURE_DAMAGE_COEFFICIENT 5 //The amount of pressure damage someone takes is equal to (pressure / HAZARD_HIGH_PRESSURE)*PRESSURE_DAMAGE_COEFFICIENT, with the maximum of MAX_PRESSURE_DAMAGE +#define MAX_PRESSURE_DAMAGE 7 //This used to be 20... I got this much random rage for some retarded decision by polymorph?! Polymorph now lies in a pool of blood with a katana jammed in his spleen. ~Errorage --PS: The katana did less than 20 damage to him :( + +#define PRESSURE_SUIT_REDUCTION_COEFFICIENT 0.8 //This is how much (percentual) a suit with the flag STOPSPRESSUREDMAGE reduces pressure. +#define PRESSURE_HEAD_REDUCTION_COEFFICIENT 0.4 //This is how much (percentual) a helmet/hat with the flag STOPSPRESSUREDMAGE reduces pressure. // Doors! #define DOOR_CRUSH_DAMAGE 10 @@ -100,7 +104,7 @@ var/MAX_EXPLOSION_RANGE = 14 #define SHOES_SLOWDOWN -1.0 // How much shoes slow you down by default. Negative values speed you up -//ITEM INVENTORY SLOT BITMASKS: (HUMANS ONLY!) +//ITEM INVENTORY SLOT BITMASKS #define SLOT_OCLOTHING 1 #define SLOT_ICLOTHING 2 #define SLOT_GLOVES 4 @@ -117,14 +121,10 @@ var/MAX_EXPLOSION_RANGE = 14 //FLAGS BITMASK +#define STOPSPRESSUREDMAGE 1 //This flag is used on the flags variable for SUIT and HEAD items which stop pressure damage. Note that the flag 1 was previous used as ONBACK, so it is possible for some code to use (flags & 1) when checking if something can be put on your back. Replace this code with (inv_flags & SLOT_BACK) if you see it anywhere +//To successfully stop you taking all pressure damage you must have both a suit and head item with this flag. + #define TABLEPASS 2 // can pass by a table or rack - -/******************************************************************************** -* WOO WOO WOO THIS IS UNUSED WOO WOO WOO * -* #define HALFMASK 4 // mask only gets 1/2 of air supply from internals * -* WOO WOO WOO THIS IS UNUSED WOO WOO WOO * -********************************************************************************/ - #define HEADSPACE 4 // head wear protects against space #define MASKINTERNALS 8 // mask allows internals diff --git a/html/changelog.html b/html/changelog.html index 5f175014d72..1fa7daf2792 100644 --- a/html/changelog.html +++ b/html/changelog.html @@ -47,13 +47,24 @@ should be listed in the changelog upon commit tho. Thanks. --> +
+

Friday, June 15th

+
+

15 June 2012

Carnwennan updated:

  • First update for update_icons stuffs:
    Fixed husking and fatties
    Fixed floor tiles still appearing in hand when laying them
    Fixed runtimes with fatties.
  • Fixes for pre-existing bugs:
    Fixed being unable to put belts & backpacks on other people
    nodamage (godmode) now prevents all organ damage. It does not stop healing however.
    Nerd stuff...
  • -
  • Dear god people. Use the fucking issue tracker you lazy shits. If you don't fill it out properly you have absolutely no right to complain about TGstation ever.
  • + +
+

Errorage updated:

+
    +
  • Greatly reduced the amount of damage high pressure does.
  • +
  • Fire suits, firefighting helmets (red harhats) and the chief engineer's white hardhat now protect against high pressure.
@@ -99,7 +110,6 @@ should be listed in the changelog upon commit tho. Thanks. --> -

Sunday, June 10th

Agouri updated: