diff --git a/code/modules/mob/living/carbon/human/life.dm b/code/modules/mob/living/carbon/human/life.dm index 1f153a2e4be..613f0ad99b3 100644 --- a/code/modules/mob/living/carbon/human/life.dm +++ b/code/modules/mob/living/carbon/human/life.dm @@ -64,17 +64,20 @@ var/global/list/brutefireloss_overlays = list("1" = image("icon" = 'icons/mob/sc life_tick++ var/datum/gas_mixture/environment = loc.return_air() - in_stasis = istype(loc, /obj/structure/closet/body_bag/cryobag) && loc:opened == 0 - if(in_stasis) loc:used++ + if(istype(loc, /obj/structure/closet/body_bag/cryobag)) + var/obj/structure/closet/body_bag/cryobag/loc_as_cryobag = loc + if(!loc_as_cryobag.opened) + loc_as_cryobag.used++ + in_stasis = 1 - if(life_tick%30==15) + if(life_tick % 30 == 15) hud_updateflag = 1022 voice = GetVoice() //No need to update all of these procs if the guy is dead. if(stat != DEAD && !in_stasis) - if(mob_master.current_cycle%4==2 || failed_last_breath) //First, resolve location and get a breath + if(mob_master.current_cycle % 4 == 2 || failed_last_breath) //First, resolve location and get a breath breathe() //Only try to take a breath every 4 ticks, unless suffocating else //Still give containing object the chance to interact @@ -174,845 +177,847 @@ var/global/list/brutefireloss_overlays = list("1" = image("icon" = 'icons/mob/sc return ONE_ATMOSPHERE - pressure_difference -/mob/living/carbon/human +/mob/living/carbon/human/proc/handle_disabilities() + if (disabilities & EPILEPSY) + if ((prob(1) && paralysis < 1)) + visible_message("[src] starts having a seizure!","You have a seizure!") + Paralyse(10) + Jitter(1000) - proc/handle_disabilities() - if (disabilities & EPILEPSY) - if ((prob(1) && paralysis < 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) - Jitter(1000) + // If we have the gene for being crazy, have random events. + if(dna.GetSEState(HALLUCINATIONBLOCK)) + if(prob(1) && hallucination < 1) + hallucination += 20 - // If we have the gene for being crazy, have random events. - if(dna.GetSEState(HALLUCINATIONBLOCK)) - if(prob(1) && hallucination < 1) - hallucination += 20 + if (disabilities & COUGHING) + if ((prob(5) && paralysis <= 1)) + drop_item() + emote("cough") + if (disabilities & TOURETTES) + speech_problem_flag = 1 + if ((prob(10) && paralysis <= 1)) + Stun(10) + switch(rand(1, 3)) + if(1) + emote("twitch") + if(2 to 3) + var/tourettes = pick("SHIT", "PISS", "FUCK", "CUNT", "COCKSUCKER", "MOTHERFUCKER", "TITS") + say("[prob(50) ? ";" : ""][tourettes]") + var/x_offset = pixel_x + rand(-2,2) //Should probably be moved into the twitch emote at some point. + var/y_offset = pixel_y + rand(-1,1) + animate(src, pixel_x = pixel_x + x_offset, pixel_y = pixel_y + y_offset, time = 1) + animate(pixel_x = initial(pixel_x) , pixel_y = initial(pixel_y), time = 1) + if (disabilities & NERVOUS) + speech_problem_flag = 1 + if (prob(10)) + stuttering = max(10, stuttering) - if (disabilities & COUGHING) - if ((prob(5) && paralysis <= 1)) - drop_item() - emote("cough") - if (disabilities & TOURETTES) + if (getBrainLoss() >= 60 && stat != 2) + speech_problem_flag = 1 + if (prob(3)) + switch(pick(1,2,3)) + if(1) + say(pick("IM A PONY NEEEEEEIIIIIIIIIGH", "without oxigen blob don't evoluate?", "CAPTAINS A COMDOM", "[pick("", "that damn 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", "PACKETS!!!")) + if(3) + emote("drool") + + if(getBrainLoss() >= 100 && stat != 2) //you lapse into a coma and die without immediate aid; RIP. -Fox + Weaken(20) + losebreath += 10 + silent += 2 + + if(getBrainLoss() >= 120 && stat != 2) //they died from stupidity--literally. -Fox + visible_message("[src] goes limp, their facial expression utterly blank.") + death() + +/mob/living/carbon/human/proc/handle_stasis_bag() + // Handle side effects from stasis bag + if(in_stasis) + // First off, there's no oxygen supply, so the mob will slowly take brain damage + adjustBrainLoss(0.1) + + // Next, the method to induce stasis has some adverse side-effects, manifesting + // as cloneloss + adjustCloneLoss(0.1) + +/mob/living/carbon/human/proc/handle_mutations_and_radiation() + + if(species.flags & IS_SYNTHETIC) //Robots don't suffer from mutations or radloss. + return + + if(getFireLoss()) + if((RESIST_HEAT in mutations) || (prob(1))) + heal_organ_damage(0,1) + + + for(var/datum/dna/gene/gene in dna_genes) + if(!gene.block) + continue + if(gene.is_active(src)) + /* if (prob(10) && prob(gene.instability)) + adjustCloneLoss(1) */ speech_problem_flag = 1 - if ((prob(10) && paralysis <= 1)) - Stun(10) - switch(rand(1, 3)) - if(1) - emote("twitch") - if(2 to 3) - var/tourettes = pick("SHIT", "PISS", "FUCK", "CUNT", "COCKSUCKER", "MOTHERFUCKER", "TITS") - say("[prob(50) ? ";" : ""][tourettes]") - var/x_offset = pixel_x + rand(-2,2) //Should probably be moved into the twitch emote at some point. - var/y_offset = pixel_y + rand(-1,1) - animate(src, pixel_x = pixel_x + x_offset, pixel_y = pixel_y + y_offset, time = 1) - animate(pixel_x = initial(pixel_x) , pixel_y = initial(pixel_y), time = 1) - if (disabilities & NERVOUS) - speech_problem_flag = 1 - if (prob(10)) - stuttering = max(10, stuttering) + gene.OnMobLife(src) - if (getBrainLoss() >= 60 && stat != 2) - speech_problem_flag = 1 - if (prob(3)) - switch(pick(1,2,3)) - if(1) - say(pick("IM A PONY NEEEEEEIIIIIIIIIGH", "without oxigen blob don't evoluate?", "CAPTAINS A COMDOM", "[pick("", "that damn 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", "PACKETS!!!")) - if(3) - emote("drool") + if (radiation) - if(getBrainLoss() >= 100 && stat != 2) //you lapse into a coma and die without immediate aid; RIP. -Fox - Weaken(20) - losebreath += 10 - silent += 2 - - if(getBrainLoss() >= 120 && stat != 2) //they died from stupidity--literally. -Fox - visible_message("[src] goes limp, their facial expression utterly blank.") - death() - - proc/handle_stasis_bag() - // Handle side effects from stasis bag - if(in_stasis) - // First off, there's no oxygen supply, so the mob will slowly take brain damage - adjustBrainLoss(0.1) - - // Next, the method to induce stasis has some adverse side-effects, manifesting - // as cloneloss - adjustCloneLoss(0.1) - - proc/handle_mutations_and_radiation() - - if(species.flags & IS_SYNTHETIC) //Robots don't suffer from mutations or radloss. + if((locate(src.internal_organs_by_name["resonant crystal"]) in src.internal_organs)) + var/rads = radiation/25 + radiation -= rads + radiation -= 0.1 + reagents.add_reagent("radium", rads/10) + if( prob(10) ) + src << "You feel relaxed." return - if(getFireLoss()) - if((RESIST_HEAT in mutations) || (prob(1))) - heal_organ_damage(0,1) + if (radiation > 100) + radiation = 100 + if(!(species.flags & RAD_ABSORB)) + Weaken(10) + if(!lying) + src << "You feel weak." + emote("collapse") + if (radiation < 0) + radiation = 0 - for(var/datum/dna/gene/gene in dna_genes) - if(!gene.block) - continue - if(gene.is_active(src)) - /* if (prob(10) && prob(gene.instability)) - adjustCloneLoss(1) */ - speech_problem_flag = 1 - gene.OnMobLife(src) - - if (radiation) - - if((locate(src.internal_organs_by_name["resonant crystal"]) in src.internal_organs)) + else + if(species.flags & RAD_ABSORB) var/rads = radiation/25 radiation -= rads - radiation -= 0.1 - reagents.add_reagent("radium", rads/10) - if( prob(10) ) - src << "\blue You feel relaxed." + nutrition += rads + adjustBruteLoss(-(rads)) + adjustOxyLoss(-(rads)) + adjustToxLoss(-(rads)) + updatehealth() return - if (radiation > 100) - radiation = 100 - if(!(species.flags & RAD_ABSORB)) - Weaken(10) - if(!lying) - src << "\red You feel weak." - emote("collapse") - - if (radiation < 0) - radiation = 0 - - else - if(species.flags & RAD_ABSORB) - var/rads = radiation/25 - radiation -= rads - nutrition += rads - adjustBruteLoss(-(rads)) - adjustOxyLoss(-(rads)) - adjustToxLoss(-(rads)) - updatehealth() - return - - var/damage = 0 - switch(radiation) - if(0 to 49) - radiation-- - if(prob(25)) - adjustToxLoss(1) - damage = 1 - updatehealth() - - if(50 to 74) - radiation -= 2 - damage = 1 + var/damage = 0 + switch(radiation) + if(0 to 49) + radiation-- + if(prob(25)) adjustToxLoss(1) - if(prob(5)) - radiation -= 5 - Weaken(3) - if(!lying) - src << "\red You feel weak." - emote("collapse") + damage = 1 updatehealth() - if(75 to 100) - radiation -= 3 - adjustToxLoss(3) - damage = 3 - if(prob(1)) - src << "\red You mutate!" - randmutb(src) - domutcheck(src,null) - emote("gasp") - updatehealth() - - else + if(50 to 74) + radiation -= 2 + damage = 1 + adjustToxLoss(1) + if(prob(5)) radiation -= 5 - adjustToxLoss(5) - damage = 5 - if(prob(1)) - src << "\red You mutate!" - randmutb(src) - domutcheck(src,null) - emote("gasp") - updatehealth() + Weaken(3) + if(!lying) + src << "You feel weak." + emote("collapse") + updatehealth() - if(damage && organs.len) - var/obj/item/organ/external/O = pick(organs) - if(istype(O)) O.add_autopsy_data("Radiation Poisoning", damage) + if(75 to 100) + radiation -= 3 + adjustToxLoss(3) + damage = 3 + if(prob(1)) + src << "You mutate!" + randmutb(src) + domutcheck(src,null) + emote("gasp") + updatehealth() - proc/breathe() - if(reagents.has_reagent("lexorin")) return - if(NO_BREATH in mutations) return // No breath mutation means no breathing. - if(istype(loc, /obj/machinery/atmospherics/unary/cryo_cell)) return - if(species && (species.flags & NO_BREATHE)) return + else + radiation -= 5 + adjustToxLoss(5) + damage = 5 + if(prob(1)) + src << "You mutate!" + randmutb(src) + domutcheck(src,null) + emote("gasp") + updatehealth() - var/datum/gas_mixture/environment = loc.return_air() - var/datum/gas_mixture/breath + if(damage && organs.len) + var/obj/item/organ/external/O = pick(organs) + if(istype(O)) O.add_autopsy_data("Radiation Poisoning", damage) - // HACK NEED CHANGING LATER - if(health <= config.health_threshold_crit) - losebreath++ +/mob/living/carbon/human/proc/breathe() + if(reagents.has_reagent("lexorin")) return + if(NO_BREATH in mutations) return // No breath mutation means no breathing. + if(istype(loc, /obj/machinery/atmospherics/unary/cryo_cell)) return + if(species && (species.flags & NO_BREATHE)) return - if(losebreath>0) //Suffocating so do not take a breath - losebreath-- - if (prob(10)) //Gasp per 10 ticks? Sounds about right. - spawn emote("gasp") + var/datum/gas_mixture/environment = loc.return_air() + var/datum/gas_mixture/breath + + // HACK NEED CHANGING LATER + if(health <= config.health_threshold_crit) + losebreath++ + + if(losebreath>0) //Suffocating so do not take a breath + losebreath-- + if (prob(10)) //Gasp per 10 ticks? Sounds about right. + 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(isobj(loc)) + var/obj/location_as_object = loc + breath = location_as_object.handle_internal_lifeform(src, BREATH_MOLES) + else if(isturf(loc)) + 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) + + if(!is_lung_ruptured()) + if(!breath || breath.total_moles() < BREATH_MOLES / 5 || breath.total_moles() > BREATH_MOLES * 5) + if(prob(5)) + rupture_lung() + + 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 + handle_breath(breath) - //No breath from internal atmosphere so get breath from location - if(!breath) - if(isobj(loc)) - var/obj/location_as_object = loc - breath = location_as_object.handle_internal_lifeform(src, BREATH_MOLES) - else if(isturf(loc)) - 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 + if(species.name=="Plasmaman") //this is stupid as fuck + // Check if we're wearing our biosuit and mask. + if (!istype(wear_suit,/obj/item/clothing/suit/space/eva/plasmaman) || !istype(head,/obj/item/clothing/head/helmet/space/eva/plasmaman)) + //testing("Plasmaman [src] leakin'. coverflags=[cover_flags]") + // OH FUCK HE LEAKIN'. + // This was OP. + //environment.adjust(tx = environment.total_moles()*BREATH_PERCENTAGE) // About one breath's worth. (I know we aren't breathing it out, but this should be about the right amount) + src << "Your body reacts with the atmosphere and bursts into flame!" + adjust_fire_stacks(0.5) + IgniteMob() - breath = loc.remove_air(breath_moles) + if(breath) + loc.assume_air(breath) - if(!is_lung_ruptured()) - if(!breath || breath.total_moles() < BREATH_MOLES / 5 || breath.total_moles() > BREATH_MOLES * 5) - if(prob(5)) - rupture_lung() - - 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(species.name=="Plasmaman") //this is stupid as fuck - // Check if we're wearing our biosuit and mask. - if (!istype(wear_suit,/obj/item/clothing/suit/space/eva/plasmaman) || !istype(head,/obj/item/clothing/head/helmet/space/eva/plasmaman)) - //testing("Plasmaman [src] leakin'. coverflags=[cover_flags]") - // OH FUCK HE LEAKIN'. - // This was OP. - //environment.adjust(tx = environment.total_moles()*BREATH_PERCENTAGE) // About one breath's worth. (I know we aren't breathing it out, but this should be about the right amount) - src << "Your body reacts with the atmosphere and bursts into flame!" - adjust_fire_stacks(0.5) - IgniteMob() - - if(breath) - loc.assume_air(breath) - - //spread some viruses while we are at it - if (virus2.len > 0) - if (prob(10) && get_infection_chance(src)) + //spread some viruses while we are at it + if (virus2.len > 0) + if (prob(10) && get_infection_chance(src)) // log_debug("[src] : Exhaling some viruses") - for(var/mob/living/carbon/M in view(1,src)) - src.spread_disease_to(M) + for(var/mob/living/carbon/M in view(1,src)) + src.spread_disease_to(M) // USED IN DEATHWHISPERS - proc/isInCrit() - // Health is in deep shit and we're not already dead - return health <= 0 && stat != 2 +/mob/living/carbon/human/proc/isInCrit() + // Health is in deep shit and we're not already dead + return health <= 0 && stat != 2 - proc/handle_breath(var/datum/gas_mixture/breath) - if(status_flags & GODMODE) - return 0 - - if(!breath || (breath.total_moles() == 0) || suiciding) - var/oxyloss = 0 - if(suiciding) - oxyloss = 2 - adjustOxyLoss(oxyloss)//If you are suiciding, you should die a little bit faster - failed_last_breath = 1 - oxygen_alert = max(oxygen_alert, 1) - return 0 - if(health > 0) - oxyloss = HUMAN_MAX_OXYLOSS - adjustOxyLoss(oxyloss) - failed_last_breath = 1 - else - oxyloss = HUMAN_CRIT_MAX_OXYLOSS - adjustOxyLoss(oxyloss) - failed_last_breath = 1 - - var/obj/item/organ/external/affected = get_organ("chest") - affected.add_autopsy_data("Suffocation", oxyloss) +/mob/living/carbon/human/proc/handle_breath(var/datum/gas_mixture/breath) + if(status_flags & GODMODE) + return 0 + if(!breath || (breath.total_moles() == 0) || suiciding) + var/oxyloss = 0 + if(suiciding) + oxyloss = 2 + adjustOxyLoss(oxyloss)//If you are suiciding, you should die a little bit faster + failed_last_breath = 1 oxygen_alert = max(oxygen_alert, 1) - return 0 + if(health > 0) + oxyloss = HUMAN_MAX_OXYLOSS + adjustOxyLoss(oxyloss) + failed_last_breath = 1 + else + oxyloss = HUMAN_CRIT_MAX_OXYLOSS + adjustOxyLoss(oxyloss) + failed_last_breath = 1 - return species.handle_breath(breath, src) + var/obj/item/organ/external/affected = get_organ("chest") + affected.add_autopsy_data("Suffocation", oxyloss) - proc/handle_environment(datum/gas_mixture/environment) - if(!environment) - return + oxygen_alert = max(oxygen_alert, 1) - var/loc_temp = get_temperature(environment) - //world << "Loc temp: [loc_temp] - Body temp: [bodytemperature] - Fireloss: [getFireLoss()] - Thermal protection: [get_thermal_protection()] - Fire protection: [thermal_protection + add_fire_protection(loc_temp)] - Heat capacity: [environment_heat_capacity] - Location: [loc] - src: [src]" + return 0 - //Body temperature is adjusted in two steps. Firstly your body tries to stabilize itself a bit. - if(stat != 2) - stabilize_temperature_from_calories() + return species.handle_breath(breath, src) - //After then, it reacts to the surrounding atmosphere based on your thermal protection - if(!on_fire) //If you're on fire, you do not heat up or cool down based on surrounding gases - if(loc_temp < bodytemperature) - //Place is colder than we are - var/thermal_protection = get_cold_protection(loc_temp) //This returns a 0 - 1 value, which corresponds to the percentage of protection based on what you're wearing and what you're exposed to. - if(thermal_protection < 1) - bodytemperature += min((1-thermal_protection) * ((loc_temp - bodytemperature) / BODYTEMP_COLD_DIVISOR), BODYTEMP_COOLING_MAX) - else - //Place is hotter than we are - var/thermal_protection = get_heat_protection(loc_temp) //This returns a 0 - 1 value, which corresponds to the percentage of protection based on what you're wearing and what you're exposed to. - if(thermal_protection < 1) - bodytemperature += min((1-thermal_protection) * ((loc_temp - bodytemperature) / BODYTEMP_HEAT_DIVISOR), BODYTEMP_HEATING_MAX) +/mob/living/carbon/human/proc/handle_environment(datum/gas_mixture/environment) + if(!environment) + return - // +/- 50 degrees from 310.15K is the 'safe' zone, where no damage is dealt. - if(bodytemperature > species.heat_level_1) - //Body temperature is too hot. - fire_alert = max(fire_alert, 1) - if(status_flags & GODMODE) return 1 //godmode + var/loc_temp = get_temperature(environment) + //world << "Loc temp: [loc_temp] - Body temp: [bodytemperature] - Fireloss: [getFireLoss()] - Thermal protection: [get_thermal_protection()] - Fire protection: [thermal_protection + add_fire_protection(loc_temp)] - Heat capacity: [environment_heat_capacity] - Location: [loc] - src: [src]" - if(bodytemperature >= species.heat_level_1 && bodytemperature <= species.heat_level_2) - take_overall_damage(burn=HEAT_DAMAGE_LEVEL_1, used_weapon = "High Body Temperature") - fire_alert = max(fire_alert, 2) - if(bodytemperature > species.heat_level_2 && bodytemperature <= species.heat_level_3) - take_overall_damage(burn=HEAT_DAMAGE_LEVEL_2, used_weapon = "High Body Temperature") - fire_alert = max(fire_alert, 2) - if(bodytemperature > species.heat_level_3 && bodytemperature < INFINITY) - if(on_fire) - take_overall_damage(burn=HEAT_DAMAGE_LEVEL_3, used_weapon = "Fire") - fire_alert = max(fire_alert, 2) - else - take_overall_damage(burn=HEAT_DAMAGE_LEVEL_2, used_weapon = "High Body Temperature") - fire_alert = max(fire_alert, 2) + //Body temperature is adjusted in two steps. Firstly your body tries to stabilize itself a bit. + if(stat != 2) + stabilize_temperature_from_calories() - else if(bodytemperature < species.cold_level_1) - fire_alert = max(fire_alert, 1) - if(status_flags & GODMODE) return 1 //godmode + //After then, it reacts to the surrounding atmosphere based on your thermal protection + if(!on_fire) //If you're on fire, you do not heat up or cool down based on surrounding gases + if(loc_temp < bodytemperature) + //Place is colder than we are + var/thermal_protection = get_cold_protection(loc_temp) //This returns a 0 - 1 value, which corresponds to the percentage of protection based on what you're wearing and what you're exposed to. + if(thermal_protection < 1) + bodytemperature += min((1-thermal_protection) * ((loc_temp - bodytemperature) / BODYTEMP_COLD_DIVISOR), BODYTEMP_COOLING_MAX) + else + //Place is hotter than we are + var/thermal_protection = get_heat_protection(loc_temp) //This returns a 0 - 1 value, which corresponds to the percentage of protection based on what you're wearing and what you're exposed to. + if(thermal_protection < 1) + bodytemperature += min((1-thermal_protection) * ((loc_temp - bodytemperature) / BODYTEMP_HEAT_DIVISOR), BODYTEMP_HEATING_MAX) - if(stat == DEAD) return 1 //ZomgPonies -- No need for cold burn damage if dead - - if(!istype(loc, /obj/machinery/atmospherics/unary/cryo_cell)) - if(bodytemperature >= species.cold_level_2 && bodytemperature <= species.cold_level_1) - take_overall_damage(burn=COLD_DAMAGE_LEVEL_1, used_weapon = "Low Body Temperature") - fire_alert = max(fire_alert, 1) - if(bodytemperature >= species.cold_level_3 && bodytemperature < species.cold_level_2) - take_overall_damage(burn=COLD_DAMAGE_LEVEL_2, used_weapon = "Low Body Temperature") - fire_alert = max(fire_alert, 1) - if(bodytemperature > -INFINITY && bodytemperature < species.cold_level_3) - take_overall_damage(burn=COLD_DAMAGE_LEVEL_3, used_weapon = "Low Body Temperature") - fire_alert = max(fire_alert, 1) - - // 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! - - var/pressure = environment.return_pressure() - var/adjusted_pressure = calculate_affecting_pressure(pressure) //Returns how much pressure actually affects the mob. + // +/- 50 degrees from 310.15K is the 'safe' zone, where no damage is dealt. + if(bodytemperature > species.heat_level_1) + //Body temperature is too hot. + fire_alert = max(fire_alert, 1) if(status_flags & GODMODE) return 1 //godmode - if(adjusted_pressure >= species.hazard_high_pressure) - var/pressure_damage = min( ( (adjusted_pressure / species.hazard_high_pressure) -1 )*PRESSURE_DAMAGE_COEFFICIENT , MAX_HIGH_PRESSURE_DAMAGE) - take_overall_damage(brute=pressure_damage, used_weapon = "High Pressure") - pressure_alert = 2 - else if(adjusted_pressure >= species.warning_high_pressure) - pressure_alert = 1 - else if(adjusted_pressure >= species.warning_low_pressure) - pressure_alert = 0 - else if(adjusted_pressure >= species.hazard_low_pressure) + if(bodytemperature >= species.heat_level_1 && bodytemperature <= species.heat_level_2) + take_overall_damage(burn=HEAT_DAMAGE_LEVEL_1, used_weapon = "High Body Temperature") + fire_alert = max(fire_alert, 2) + if(bodytemperature > species.heat_level_2 && bodytemperature <= species.heat_level_3) + take_overall_damage(burn=HEAT_DAMAGE_LEVEL_2, used_weapon = "High Body Temperature") + fire_alert = max(fire_alert, 2) + if(bodytemperature > species.heat_level_3 && bodytemperature < INFINITY) + if(on_fire) + take_overall_damage(burn=HEAT_DAMAGE_LEVEL_3, used_weapon = "Fire") + fire_alert = max(fire_alert, 2) + else + take_overall_damage(burn=HEAT_DAMAGE_LEVEL_2, used_weapon = "High Body Temperature") + fire_alert = max(fire_alert, 2) + + else if(bodytemperature < species.cold_level_1) + fire_alert = max(fire_alert, 1) + if(status_flags & GODMODE) return 1 //godmode + + if(stat == DEAD) return 1 //ZomgPonies -- No need for cold burn damage if dead + + if(!istype(loc, /obj/machinery/atmospherics/unary/cryo_cell)) + if(bodytemperature >= species.cold_level_2 && bodytemperature <= species.cold_level_1) + take_overall_damage(burn=COLD_DAMAGE_LEVEL_1, used_weapon = "Low Body Temperature") + fire_alert = max(fire_alert, 1) + if(bodytemperature >= species.cold_level_3 && bodytemperature < species.cold_level_2) + take_overall_damage(burn=COLD_DAMAGE_LEVEL_2, used_weapon = "Low Body Temperature") + fire_alert = max(fire_alert, 1) + if(bodytemperature > -INFINITY && bodytemperature < species.cold_level_3) + take_overall_damage(burn=COLD_DAMAGE_LEVEL_3, used_weapon = "Low Body Temperature") + fire_alert = max(fire_alert, 1) + + // 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! + + var/pressure = environment.return_pressure() + var/adjusted_pressure = calculate_affecting_pressure(pressure) //Returns how much pressure actually affects the mob. + if(status_flags & GODMODE) return 1 //godmode + + if(adjusted_pressure >= species.hazard_high_pressure) + var/pressure_damage = min( ( (adjusted_pressure / species.hazard_high_pressure) -1 )*PRESSURE_DAMAGE_COEFFICIENT , MAX_HIGH_PRESSURE_DAMAGE) + take_overall_damage(brute=pressure_damage, used_weapon = "High Pressure") + pressure_alert = 2 + else if(adjusted_pressure >= species.warning_high_pressure) + pressure_alert = 1 + else if(adjusted_pressure >= species.warning_low_pressure) + pressure_alert = 0 + else if(adjusted_pressure >= species.hazard_low_pressure) + pressure_alert = -1 + else + if(RESIST_COLD in mutations) pressure_alert = -1 else - if(RESIST_COLD in mutations) - pressure_alert = -1 - else - take_overall_damage(brute=LOW_PRESSURE_DAMAGE, used_weapon = "Low Pressure") - pressure_alert = -2 + take_overall_damage(brute=LOW_PRESSURE_DAMAGE, used_weapon = "Low Pressure") + pressure_alert = -2 - return + return - ///FIRE CODE - handle_fire() - if(..()) - return - var/thermal_protection = 0 //Simple check to estimate how protected we are against multiple temperatures - if(wear_suit) - if(wear_suit.max_heat_protection_temperature >= FIRE_SUIT_MAX_TEMP_PROTECT) - thermal_protection += (wear_suit.max_heat_protection_temperature*0.7) - if(head) - if(head.max_heat_protection_temperature >= FIRE_HELM_MAX_TEMP_PROTECT) - thermal_protection += (head.max_heat_protection_temperature*THERMAL_PROTECTION_HEAD) - thermal_protection = round(thermal_protection) - if(thermal_protection >= FIRE_IMMUNITY_SUIT_MAX_TEMP_PROTECT) - return - if(thermal_protection >= FIRE_SUIT_MAX_TEMP_PROTECT) - bodytemperature += 11 - return - else - bodytemperature += BODYTEMP_HEATING_MAX +///FIRE CODE +/mob/living/carbon/human/handle_fire() + if(..()) return - //END FIRE CODE + var/thermal_protection = 0 //Simple check to estimate how protected we are against multiple temperatures + if(wear_suit) + if(wear_suit.max_heat_protection_temperature >= FIRE_SUIT_MAX_TEMP_PROTECT) + thermal_protection += (wear_suit.max_heat_protection_temperature*0.7) + if(head) + if(head.max_heat_protection_temperature >= FIRE_HELM_MAX_TEMP_PROTECT) + thermal_protection += (head.max_heat_protection_temperature*THERMAL_PROTECTION_HEAD) + thermal_protection = round(thermal_protection) + if(thermal_protection >= FIRE_IMMUNITY_SUIT_MAX_TEMP_PROTECT) + return + if(thermal_protection >= FIRE_SUIT_MAX_TEMP_PROTECT) + bodytemperature += 11 + return + else + bodytemperature += BODYTEMP_HEATING_MAX + return +//END FIRE CODE - proc/handle_wetness() - if(mob_master.current_cycle%20==2) //dry off a bit once every 20 ticks or so - wetlevel = max(wetlevel - 1,0) - return +/mob/living/carbon/human/proc/handle_wetness() + if(mob_master.current_cycle%20==2) //dry off a bit once every 20 ticks or so + wetlevel = max(wetlevel - 1,0) + return /* - proc/adjust_body_temperature(current, loc_temp, boost) - var/temperature = current - var/difference = abs(current-loc_temp) //get difference - var/increments// = difference/10 //find how many increments apart they are - if(difference > 50) - increments = difference/5 - else - increments = difference/10 - var/change = increments*boost // Get the amount to change by (x per increment) - var/temp_change - if(current < loc_temp) - temperature = min(loc_temp, temperature+change) - else if(current > loc_temp) - temperature = max(loc_temp, temperature-change) - temp_change = (temperature - current) - return temp_change +/mob/living/carbon/human/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 */ - proc/stabilize_temperature_from_calories() - if(bodytemperature <= species.cold_level_1) //260.15 is 310.15 - 50, the temperature where you start to feel effects. - if(nutrition >= 2) //If we are very, very cold we'll use up quite a bit of nutriment to heat us up. - nutrition -= 2 - var/body_temperature_difference = species.body_temperature - bodytemperature - bodytemperature += max((body_temperature_difference / BODYTEMP_AUTORECOVERY_DIVISOR), BODYTEMP_AUTORECOVERY_MINIMUM) - if(bodytemperature >= species.cold_level_1 && bodytemperature <= species.heat_level_1) - var/body_temperature_difference = species.body_temperature - bodytemperature - bodytemperature += body_temperature_difference / BODYTEMP_AUTORECOVERY_DIVISOR - if(bodytemperature >= species.heat_level_1) //360.15 is 310.15 + 50, the temperature where you start to feel effects. - //We totally need a sweat system cause it totally makes sense...~ - var/body_temperature_difference = species.body_temperature - bodytemperature - bodytemperature += min((body_temperature_difference / BODYTEMP_AUTORECOVERY_DIVISOR), -BODYTEMP_AUTORECOVERY_MINIMUM) //We're dealing with negative numbers +/mob/living/carbon/human/proc/stabilize_temperature_from_calories() + if(bodytemperature <= species.cold_level_1) //260.15 is 310.15 - 50, the temperature where you start to feel effects. + if(nutrition >= 2) //If we are very, very cold we'll use up quite a bit of nutriment to heat us up. + nutrition -= 2 + var/body_temperature_difference = species.body_temperature - bodytemperature + bodytemperature += max((body_temperature_difference / BODYTEMP_AUTORECOVERY_DIVISOR), BODYTEMP_AUTORECOVERY_MINIMUM) + if(bodytemperature >= species.cold_level_1 && bodytemperature <= species.heat_level_1) + var/body_temperature_difference = species.body_temperature - bodytemperature + bodytemperature += body_temperature_difference / BODYTEMP_AUTORECOVERY_DIVISOR + if(bodytemperature >= species.heat_level_1) //360.15 is 310.15 + 50, the temperature where you start to feel effects. + //We totally need a sweat system cause it totally makes sense...~ + var/body_temperature_difference = species.body_temperature - bodytemperature + bodytemperature += min((body_temperature_difference / BODYTEMP_AUTORECOVERY_DIVISOR), -BODYTEMP_AUTORECOVERY_MINIMUM) //We're dealing with negative numbers //This proc returns a number made up of the flags for body parts which you are protected on. (such as HEAD, UPPER_TORSO, LOWER_TORSO, etc. See setup.dm for the full list) - proc/get_heat_protection_flags(temperature) //Temperature is the temperature you're being exposed to. - var/thermal_protection_flags = 0 - //Handle normal clothing - if(head) - if(head.max_heat_protection_temperature && head.max_heat_protection_temperature >= temperature) - thermal_protection_flags |= head.heat_protection - if(wear_suit) - if(wear_suit.max_heat_protection_temperature && wear_suit.max_heat_protection_temperature >= temperature) - thermal_protection_flags |= wear_suit.heat_protection - if(w_uniform) - if(w_uniform.max_heat_protection_temperature && w_uniform.max_heat_protection_temperature >= temperature) - thermal_protection_flags |= w_uniform.heat_protection - if(shoes) - if(shoes.max_heat_protection_temperature && shoes.max_heat_protection_temperature >= temperature) - thermal_protection_flags |= shoes.heat_protection - if(gloves) - if(gloves.max_heat_protection_temperature && gloves.max_heat_protection_temperature >= temperature) - thermal_protection_flags |= gloves.heat_protection - if(wear_mask) - if(wear_mask.max_heat_protection_temperature && wear_mask.max_heat_protection_temperature >= temperature) - thermal_protection_flags |= wear_mask.heat_protection +/mob/living/carbon/human/proc/get_heat_protection_flags(temperature) //Temperature is the temperature you're being exposed to. + var/thermal_protection_flags = 0 + //Handle normal clothing + if(head) + if(head.max_heat_protection_temperature && head.max_heat_protection_temperature >= temperature) + thermal_protection_flags |= head.heat_protection + if(wear_suit) + if(wear_suit.max_heat_protection_temperature && wear_suit.max_heat_protection_temperature >= temperature) + thermal_protection_flags |= wear_suit.heat_protection + if(w_uniform) + if(w_uniform.max_heat_protection_temperature && w_uniform.max_heat_protection_temperature >= temperature) + thermal_protection_flags |= w_uniform.heat_protection + if(shoes) + if(shoes.max_heat_protection_temperature && shoes.max_heat_protection_temperature >= temperature) + thermal_protection_flags |= shoes.heat_protection + if(gloves) + if(gloves.max_heat_protection_temperature && gloves.max_heat_protection_temperature >= temperature) + thermal_protection_flags |= gloves.heat_protection + if(wear_mask) + if(wear_mask.max_heat_protection_temperature && wear_mask.max_heat_protection_temperature >= temperature) + thermal_protection_flags |= wear_mask.heat_protection - return thermal_protection_flags + return thermal_protection_flags - proc/get_heat_protection(temperature) //Temperature is the temperature you're being exposed to. - var/thermal_protection_flags = get_heat_protection_flags(temperature) +/mob/living/carbon/human/proc/get_heat_protection(temperature) //Temperature is the temperature you're being exposed to. + var/thermal_protection_flags = get_heat_protection_flags(temperature) - var/thermal_protection = 0.0 - if(RESIST_HEAT in mutations) - return 1 - if(thermal_protection_flags) - if(thermal_protection_flags & HEAD) - thermal_protection += THERMAL_PROTECTION_HEAD - if(thermal_protection_flags & UPPER_TORSO) - thermal_protection += THERMAL_PROTECTION_UPPER_TORSO - if(thermal_protection_flags & LOWER_TORSO) - thermal_protection += THERMAL_PROTECTION_LOWER_TORSO - if(thermal_protection_flags & LEG_LEFT) - thermal_protection += THERMAL_PROTECTION_LEG_LEFT - if(thermal_protection_flags & LEG_RIGHT) - thermal_protection += THERMAL_PROTECTION_LEG_RIGHT - if(thermal_protection_flags & FOOT_LEFT) - thermal_protection += THERMAL_PROTECTION_FOOT_LEFT - if(thermal_protection_flags & FOOT_RIGHT) - thermal_protection += THERMAL_PROTECTION_FOOT_RIGHT - if(thermal_protection_flags & ARM_LEFT) - thermal_protection += THERMAL_PROTECTION_ARM_LEFT - if(thermal_protection_flags & ARM_RIGHT) - thermal_protection += THERMAL_PROTECTION_ARM_RIGHT - if(thermal_protection_flags & HAND_LEFT) - thermal_protection += THERMAL_PROTECTION_HAND_LEFT - if(thermal_protection_flags & HAND_RIGHT) - thermal_protection += THERMAL_PROTECTION_HAND_RIGHT + var/thermal_protection = 0.0 + if(RESIST_HEAT in mutations) + return 1 + if(thermal_protection_flags) + if(thermal_protection_flags & HEAD) + thermal_protection += THERMAL_PROTECTION_HEAD + if(thermal_protection_flags & UPPER_TORSO) + thermal_protection += THERMAL_PROTECTION_UPPER_TORSO + if(thermal_protection_flags & LOWER_TORSO) + thermal_protection += THERMAL_PROTECTION_LOWER_TORSO + if(thermal_protection_flags & LEG_LEFT) + thermal_protection += THERMAL_PROTECTION_LEG_LEFT + if(thermal_protection_flags & LEG_RIGHT) + thermal_protection += THERMAL_PROTECTION_LEG_RIGHT + if(thermal_protection_flags & FOOT_LEFT) + thermal_protection += THERMAL_PROTECTION_FOOT_LEFT + if(thermal_protection_flags & FOOT_RIGHT) + thermal_protection += THERMAL_PROTECTION_FOOT_RIGHT + if(thermal_protection_flags & ARM_LEFT) + thermal_protection += THERMAL_PROTECTION_ARM_LEFT + if(thermal_protection_flags & ARM_RIGHT) + thermal_protection += THERMAL_PROTECTION_ARM_RIGHT + if(thermal_protection_flags & HAND_LEFT) + thermal_protection += THERMAL_PROTECTION_HAND_LEFT + if(thermal_protection_flags & HAND_RIGHT) + thermal_protection += THERMAL_PROTECTION_HAND_RIGHT - return min(1,thermal_protection) + return min(1,thermal_protection) //See proc/get_heat_protection_flags(temperature) for the description of this proc. - proc/get_cold_protection_flags(temperature) - var/thermal_protection_flags = 0 - //Handle normal clothing +/mob/living/carbon/human/proc/get_cold_protection_flags(temperature) + var/thermal_protection_flags = 0 + //Handle normal clothing - if(head) - if(head.min_cold_protection_temperature && head.min_cold_protection_temperature <= temperature) - thermal_protection_flags |= head.cold_protection - if(wear_suit) - if(wear_suit.min_cold_protection_temperature && wear_suit.min_cold_protection_temperature <= temperature) - thermal_protection_flags |= wear_suit.cold_protection - if(w_uniform) - if(w_uniform.min_cold_protection_temperature && w_uniform.min_cold_protection_temperature <= temperature) - thermal_protection_flags |= w_uniform.cold_protection - if(shoes) - if(shoes.min_cold_protection_temperature && shoes.min_cold_protection_temperature <= temperature) - thermal_protection_flags |= shoes.cold_protection - if(gloves) - if(gloves.min_cold_protection_temperature && gloves.min_cold_protection_temperature <= temperature) - thermal_protection_flags |= gloves.cold_protection - if(wear_mask) - if(wear_mask.min_cold_protection_temperature && wear_mask.min_cold_protection_temperature <= temperature) - thermal_protection_flags |= wear_mask.cold_protection + if(head) + if(head.min_cold_protection_temperature && head.min_cold_protection_temperature <= temperature) + thermal_protection_flags |= head.cold_protection + if(wear_suit) + if(wear_suit.min_cold_protection_temperature && wear_suit.min_cold_protection_temperature <= temperature) + thermal_protection_flags |= wear_suit.cold_protection + if(w_uniform) + if(w_uniform.min_cold_protection_temperature && w_uniform.min_cold_protection_temperature <= temperature) + thermal_protection_flags |= w_uniform.cold_protection + if(shoes) + if(shoes.min_cold_protection_temperature && shoes.min_cold_protection_temperature <= temperature) + thermal_protection_flags |= shoes.cold_protection + if(gloves) + if(gloves.min_cold_protection_temperature && gloves.min_cold_protection_temperature <= temperature) + thermal_protection_flags |= gloves.cold_protection + if(wear_mask) + if(wear_mask.min_cold_protection_temperature && wear_mask.min_cold_protection_temperature <= temperature) + thermal_protection_flags |= wear_mask.cold_protection - return thermal_protection_flags + return thermal_protection_flags - proc/get_cold_protection(temperature) +/mob/living/carbon/human/proc/get_cold_protection(temperature) - if(RESIST_COLD in mutations) - return 1 //Fully protected from the cold. + if(RESIST_COLD in mutations) + return 1 //Fully protected from the cold. - temperature = max(temperature, 2.7) //There is an occasional bug where the temperature is miscalculated in ares with a small amount of gas on them, so this is necessary to ensure that that bug does not affect this calculation. Space's temperature is 2.7K and most suits that are intended to protect against any cold, protect down to 2.0K. - var/thermal_protection_flags = get_cold_protection_flags(temperature) + temperature = max(temperature, 2.7) //There is an occasional bug where the temperature is miscalculated in ares with a small amount of gas on them, so this is necessary to ensure that that bug does not affect this calculation. Space's temperature is 2.7K and most suits that are intended to protect against any cold, protect down to 2.0K. + var/thermal_protection_flags = get_cold_protection_flags(temperature) - var/thermal_protection = 0.0 - if(thermal_protection_flags) - if(thermal_protection_flags & HEAD) - thermal_protection += THERMAL_PROTECTION_HEAD - if(thermal_protection_flags & UPPER_TORSO) - thermal_protection += THERMAL_PROTECTION_UPPER_TORSO - if(thermal_protection_flags & LOWER_TORSO) - thermal_protection += THERMAL_PROTECTION_LOWER_TORSO - if(thermal_protection_flags & LEG_LEFT) - thermal_protection += THERMAL_PROTECTION_LEG_LEFT - if(thermal_protection_flags & LEG_RIGHT) - thermal_protection += THERMAL_PROTECTION_LEG_RIGHT - if(thermal_protection_flags & FOOT_LEFT) - thermal_protection += THERMAL_PROTECTION_FOOT_LEFT - if(thermal_protection_flags & FOOT_RIGHT) - thermal_protection += THERMAL_PROTECTION_FOOT_RIGHT - if(thermal_protection_flags & ARM_LEFT) - thermal_protection += THERMAL_PROTECTION_ARM_LEFT - if(thermal_protection_flags & ARM_RIGHT) - thermal_protection += THERMAL_PROTECTION_ARM_RIGHT - if(thermal_protection_flags & HAND_LEFT) - thermal_protection += THERMAL_PROTECTION_HAND_LEFT - if(thermal_protection_flags & HAND_RIGHT) - thermal_protection += THERMAL_PROTECTION_HAND_RIGHT + var/thermal_protection = 0.0 + if(thermal_protection_flags) + if(thermal_protection_flags & HEAD) + thermal_protection += THERMAL_PROTECTION_HEAD + if(thermal_protection_flags & UPPER_TORSO) + thermal_protection += THERMAL_PROTECTION_UPPER_TORSO + if(thermal_protection_flags & LOWER_TORSO) + thermal_protection += THERMAL_PROTECTION_LOWER_TORSO + if(thermal_protection_flags & LEG_LEFT) + thermal_protection += THERMAL_PROTECTION_LEG_LEFT + if(thermal_protection_flags & LEG_RIGHT) + thermal_protection += THERMAL_PROTECTION_LEG_RIGHT + if(thermal_protection_flags & FOOT_LEFT) + thermal_protection += THERMAL_PROTECTION_FOOT_LEFT + if(thermal_protection_flags & FOOT_RIGHT) + thermal_protection += THERMAL_PROTECTION_FOOT_RIGHT + if(thermal_protection_flags & ARM_LEFT) + thermal_protection += THERMAL_PROTECTION_ARM_LEFT + if(thermal_protection_flags & ARM_RIGHT) + thermal_protection += THERMAL_PROTECTION_ARM_RIGHT + if(thermal_protection_flags & HAND_LEFT) + thermal_protection += THERMAL_PROTECTION_HAND_LEFT + if(thermal_protection_flags & HAND_RIGHT) + thermal_protection += THERMAL_PROTECTION_HAND_RIGHT - return min(1,thermal_protection) + return min(1,thermal_protection) - proc/get_covered_bodyparts() - var/covered = 0 +/mob/living/carbon/human/proc/get_covered_bodyparts() + var/covered = 0 - if(head) - covered |= head.body_parts_covered - if(wear_suit) - covered |= wear_suit.body_parts_covered - if(w_uniform) - covered |= w_uniform.body_parts_covered - if(shoes) - covered |= shoes.body_parts_covered - if(gloves) - covered |= gloves.body_parts_covered - if(wear_mask) - covered |= wear_mask.body_parts_covered + if(head) + covered |= head.body_parts_covered + if(wear_suit) + covered |= wear_suit.body_parts_covered + if(w_uniform) + covered |= w_uniform.body_parts_covered + if(shoes) + covered |= shoes.body_parts_covered + if(gloves) + covered |= gloves.body_parts_covered + if(wear_mask) + covered |= wear_mask.body_parts_covered - return covered + return covered - proc/handle_chemicals_in_body() +/mob/living/carbon/human/proc/handle_chemicals_in_body() - if(reagents) - reagents.metabolize(src) + if(reagents) + reagents.metabolize(src) - if(status_flags & GODMODE) return 0 //godmode + if(status_flags & GODMODE) return 0 //godmode - if(species.flags & REQUIRE_LIGHT) - var/light_amount = 0 //how much light there is in the place, affects receiving nutrition and healing - if(isturf(loc)) //else, there's considered to be no light - var/turf/T = loc - var/atom/movable/lighting_overlay/L = locate(/atom/movable/lighting_overlay) in T - if(L) - light_amount = (L.get_clamped_lum()*10) - 5 //hardcapped so it's not abused by having a ton of flashlights - else - light_amount = 5 - nutrition += light_amount - traumatic_shock -= light_amount - - if(species.flags & IS_PLANT) - if(nutrition > 450) - nutrition = 450 - if((light_amount >= 5) && !suiciding) //if there's enough light, heal - adjustBruteLoss(-(light_amount/2)) - adjustFireLoss(-(light_amount/4)) - //adjustToxLoss(-(light_amount)) - adjustOxyLoss(-(light_amount)) - //TODO: heal wounds, heal broken limbs. - - if(species.light_dam) - var/light_amount = 0 - if(isturf(loc)) - var/turf/T = loc - var/atom/movable/lighting_overlay/L = locate(/atom/movable/lighting_overlay) in T - if(L) - light_amount = L.get_clamped_lum()*10 - else - light_amount = 10 - if(light_amount > species.light_dam) //if there's enough light, start dying - if(species.light_effect_amp) - adjustFireLoss(5) //This gets doubled by Shadowling's innate fire weakness, so it ends up being 10. - else - adjustFireLoss(1) - adjustBruteLoss(1) - src << "The light burns you!" - src << 'sound/weapons/sear.ogg' - else //heal in the dark - if(species.light_effect_amp) - adjustFireLoss(-5) - adjustBruteLoss(-5) - adjustBrainLoss(-25) //gibbering shadowlings are hilarious but also bad to have - adjustCloneLoss(-1) - SetWeakened(0) - SetStunned(0) - else - adjustFireLoss(-1) - adjustBruteLoss(-1) - - - //The fucking FAT mutation is the greatest shit ever. It makes everyone so hot and bothered. - if(species.flags & CAN_BE_FAT) - 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() + if(species.flags & REQUIRE_LIGHT) + var/light_amount = 0 //how much light there is in the place, affects receiving nutrition and healing + if(isturf(loc)) //else, there's considered to be no light + var/turf/T = loc + var/atom/movable/lighting_overlay/L = locate(/atom/movable/lighting_overlay) in T + if(L) + light_amount = (L.get_clamped_lum()*10) - 5 //hardcapped so it's not abused by having a ton of flashlights 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() + light_amount = 5 + nutrition += light_amount + traumatic_shock -= light_amount - // nutrition decrease - if (nutrition > 0 && stat != 2) - nutrition = max (0, nutrition - HUNGER_FACTOR) + if(species.flags & IS_PLANT) + if(nutrition > 450) + nutrition = 450 + if((light_amount >= 5) && !suiciding) //if there's enough light, heal + adjustBruteLoss(-(light_amount/2)) + adjustFireLoss(-(light_amount/4)) + //adjustToxLoss(-(light_amount)) + adjustOxyLoss(-(light_amount)) + //TODO: heal wounds, heal broken limbs. - if (nutrition > 450) - if(overeatduration < 800) //capped so people don't take forever to unfat - overeatduration++ + if(species.light_dam) + var/light_amount = 0 + if(isturf(loc)) + var/turf/T = loc + var/atom/movable/lighting_overlay/L = locate(/atom/movable/lighting_overlay) in T + if(L) + light_amount = L.get_clamped_lum()*10 + else + light_amount = 10 + if(light_amount > species.light_dam) //if there's enough light, start dying + if(species.light_effect_amp) + adjustFireLoss(5) //This gets doubled by Shadowling's innate fire weakness, so it ends up being 10. + else + adjustFireLoss(1) + adjustBruteLoss(1) + src << "The light burns you!" + src << 'sound/weapons/sear.ogg' + else //heal in the dark + if(species.light_effect_amp) + adjustFireLoss(-5) + adjustBruteLoss(-5) + adjustBrainLoss(-25) //gibbering shadowlings are hilarious but also bad to have + adjustCloneLoss(-1) + SetWeakened(0) + SetStunned(0) + else + adjustFireLoss(-1) + adjustBruteLoss(-1) + + //The fucking FAT mutation is the greatest shit ever. It makes everyone so hot and bothered. + if(species.flags & CAN_BE_FAT) + if(FAT in mutations) + if(overeatduration < 100) + src << "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 > 1) - if(OBESITY in mutations) - overeatduration -= 1 // Those with obesity gene take twice as long to unfat - else - overeatduration -= 2 + if(overeatduration > 500) + src << "You suddenly feel blubbery!" + mutations.Add(FAT) + update_mutantrace(0) + update_mutations(0) + update_inv_w_uniform(0) + update_inv_wear_suit() - if(species.flags & REQUIRE_LIGHT) - if(nutrition < 200) - take_overall_damage(10,0) - traumatic_shock++ + // nutrition decrease + if (nutrition > 0 && stat != 2) + nutrition = max (0, nutrition - HUNGER_FACTOR) - if (drowsyness) - drowsyness-- - eye_blurry = max(2, eye_blurry) - if (prob(5)) - sleeping += 1 - Paralyse(5) + if (nutrition > 450) + if(overeatduration < 800) //capped so people don't take forever to unfat + overeatduration++ - 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) + else + if(overeatduration > 1) + if(OBESITY in mutations) + overeatduration -= 1 // Those with obesity gene take twice as long to unfat + else + overeatduration -= 2 - if(species && species.flags & NO_INTORGANS) return + if(species.flags & REQUIRE_LIGHT) + if(nutrition < 200) + take_overall_damage(10,0) + traumatic_shock++ - if(!(species.flags & IS_SYNTHETIC)) handle_trace_chems() + if (drowsyness) + drowsyness-- + eye_blurry = max(2, eye_blurry) + if (prob(5)) + sleeping += 1 + Paralyse(5) - updatehealth() + 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) - return //TODO: DEFERRED + if(species && species.flags & NO_INTORGANS) return - proc/handle_regular_status_updates() + if(!(species.flags & IS_SYNTHETIC)) handle_trace_chems() - if(status_flags & GODMODE) return 0 + updatehealth() - //SSD check, if a logged player is awake put them back to sleep! - if(player_logged && sleeping < 2) - sleeping = 2 + return //TODO: DEFERRED - if(stat == DEAD) //DEAD. BROWN BREAD. SWIMMING WITH THE SPESS CARP - blinded = 1 - silent = 0 - else //ALIVE. LIGHTS ARE ON +/mob/living/carbon/human/proc/handle_regular_status_updates() - if(REGEN in mutations) - if(nutrition) - if(prob(10)) - var/randumb = rand(1,5) - nutrition -= randumb - heal_overall_damage(randumb,randumb) - if(nutrition < 0) - nutrition = 0 + if(status_flags & GODMODE) return 0 - // Sobering multiplier. - // Sober block grants quadruple the alcohol metabolism. + //SSD check, if a logged player is awake put them back to sleep! + if(player_logged && sleeping < 2) + sleeping = 2 + + if(stat == DEAD) //DEAD. BROWN BREAD. SWIMMING WITH THE SPESS CARP + blinded = 1 + silent = 0 + else //ALIVE. LIGHTS ARE ON + + if(REGEN in mutations) + if(nutrition) + if(prob(10)) + var/randumb = rand(1,5) + nutrition -= randumb + heal_overall_damage(randumb,randumb) + if(nutrition < 0) + nutrition = 0 + + // Sobering multiplier. + // Sober block grants quadruple the alcohol metabolism. // var/sober_str=!(SOBER in mutations)?1:4 - updatehealth() //TODO - if(!in_stasis) - handle_organs() //Optimized. - handle_blood() + updatehealth() //TODO + if(!in_stasis) + handle_organs() //Optimized. + handle_blood() - if(health <= config.health_threshold_dead || brain_op_stage == 4.0) - death() - blinded = 1 - silent = 0 - return 1 + if(health <= config.health_threshold_dead || brain_op_stage == 4.0) + death() + blinded = 1 + silent = 0 + return 1 - // the analgesic effect wears off slowly - analgesic = max(0, analgesic - 1) + // the analgesic effect wears off slowly + analgesic = max(0, analgesic - 1) - //UNCONSCIOUS. NO-ONE IS HOME - if( (getOxyLoss() > 50) || (config.health_threshold_crit >= health) ) - Paralyse(3) + //UNCONSCIOUS. NO-ONE IS HOME + if( (getOxyLoss() > 50) || (config.health_threshold_crit >= health) ) + Paralyse(3) - /* Done by handle_breath() - if( health <= 20 && prob(1) ) - spawn(0) - emote("gasp") - if(!reagents.has_reagent("epinephrine")) - adjustOxyLoss(1)*/ + /* Done by handle_breath() + if( health <= 20 && prob(1) ) + spawn(0) + emote("gasp") + if(!reagents.has_reagent("epinephrine")) + adjustOxyLoss(1)*/ - if(hallucination && !(species.flags & IS_SYNTHETIC)) - spawn handle_hallucinations() + if(hallucination && !(species.flags & IS_SYNTHETIC)) + spawn handle_hallucinations() - if(hallucination<=2) - hallucination = 0 - halloss = 0 - else - hallucination -= 2 - - - if(halloss > 100) - src << "You're in too much pain to keep going..." - for(var/mob/O in oviewers(src, null)) - O.show_message("[src] slumps to the ground, too weak to continue fighting.", 1) - Paralyse(10) - setHalLoss(99) - - if(paralysis) - AdjustParalysis(-1) - blinded = 1 - stat = UNCONSCIOUS - if(halloss > 0) - adjustHalLoss(-3) - else if(sleeping) - speech_problem_flag = 1 - handle_dreams() - adjustStaminaLoss(-10) - adjustHalLoss(-3) - if (mind) - //Are they SSD? If so we'll keep them asleep but work off some of that sleep var in case of ether or similar. - if(player_logged) - sleeping = max(sleeping-1, 2) - else - sleeping = max(sleeping-1, 0) - blinded = 1 - stat = UNCONSCIOUS - if( prob(2) && health && !hal_crit ) - spawn(0) - emote("snore") - if(mind) - if(mind.vampire) - if(istype(loc, /obj/structure/closet/coffin)) - adjustBruteLoss(-1) - adjustFireLoss(-1) - adjustToxLoss(-1) - else if(status_flags & FAKEDEATH) - blinded = 1 - stat = UNCONSCIOUS - else if(resting) - if(halloss > 0) - adjustHalLoss(-3) - //CONSCIOUS + if(hallucination<=2) + hallucination = 0 + halloss = 0 else - stat = CONSCIOUS - if(halloss > 0) - adjustHalLoss(-1) - - if(embedded_flag && !(life_tick % 10)) - var/list/E - E = get_visible_implants(0) - if(!E.len) - embedded_flag = 0 + hallucination -= 2 - //Eyes - if(sdisabilities & BLIND) //disabled-blind, doesn't get better on its own - blinded = 1 - else if(eye_blind) //blindness, heals slowly over time - eye_blind = max(eye_blind-1,0) - blinded = 1 - else if(tinttotal >= TINT_BLIND) //covering your eyes heals blurry eyes faster - eye_blurry = max(eye_blurry-3, 0) - // blinded = 1 //now handled under /handle_regular_hud_updates() - else if(eye_blurry) //blurry eyes heal slowly - eye_blurry = max(eye_blurry-1, 0) + if(halloss > 100) + src << "You're in too much pain to keep going..." + for(var/mob/O in oviewers(src, null)) + O.show_message("[src] slumps to the ground, too weak to continue fighting.", 1) + Paralyse(10) + setHalLoss(99) - //Ears - if(sdisabilities & DEAF) //disabled-deaf, doesn't get better on its own - ear_deaf = max(ear_deaf, 1) - else if(ear_deaf) //deafness, heals slowly over time - ear_deaf = max(ear_deaf-1, 0) - else if(istype(l_ear, /obj/item/clothing/ears/earmuffs) || istype(r_ear, /obj/item/clothing/ears/earmuffs)) //resting your ears with earmuffs heals ear damage faster - ear_damage = max(ear_damage-0.15, 0) - ear_deaf = max(ear_deaf, 1) - else if(ear_damage < 25) //ear damage heals slowly under this threshold. otherwise you'll need earmuffs - ear_damage = max(ear_damage-0.05, 0) + if(paralysis) + AdjustParalysis(-1) + blinded = 1 + stat = UNCONSCIOUS + if(halloss > 0) + adjustHalLoss(-3) + else if(sleeping) + speech_problem_flag = 1 + handle_dreams() + adjustStaminaLoss(-10) + adjustHalLoss(-3) + if (mind) + //Are they SSD? If so we'll keep them asleep but work off some of that sleep var in case of ether or similar. + if(player_logged) + sleeping = max(sleeping-1, 2) + else + sleeping = max(sleeping-1, 0) + blinded = 1 + stat = UNCONSCIOUS + if( prob(2) && health && !hal_crit ) + spawn(0) + emote("snore") + if(mind) + if(mind.vampire) + if(istype(loc, /obj/structure/closet/coffin)) + adjustBruteLoss(-1) + adjustFireLoss(-1) + adjustToxLoss(-1) + else if(status_flags & FAKEDEATH) + blinded = 1 + stat = UNCONSCIOUS + else if(resting) + if(halloss > 0) + adjustHalLoss(-3) + //CONSCIOUS + else + stat = CONSCIOUS + if(halloss > 0) + adjustHalLoss(-1) - //Dizziness - if(dizziness) - var/client/C = client - var/pixel_x_diff = 0 - var/pixel_y_diff = 0 - var/temp - var/saved_dizz = dizziness - dizziness = max(dizziness-1, 0) - if(C) - var/oldsrc = src - var/amplitude = dizziness*(sin(dizziness * 0.044 * world.time) + 1) / 70 // This shit is annoying at high strength - src = null - spawn(0) + if(embedded_flag && !(life_tick % 10)) + var/list/E + E = get_visible_implants(0) + if(!E.len) + embedded_flag = 0 + + + //Eyes + if(sdisabilities & BLIND) //disabled-blind, doesn't get better on its own + blinded = 1 + else if(eye_blind) //blindness, heals slowly over time + eye_blind = max(eye_blind-1,0) + blinded = 1 + else if(tinttotal >= TINT_BLIND) //covering your eyes heals blurry eyes faster + eye_blurry = max(eye_blurry-3, 0) + // blinded = 1 //now handled under /handle_regular_hud_updates() + else if(eye_blurry) //blurry eyes heal slowly + eye_blurry = max(eye_blurry-1, 0) + + //Ears + if(sdisabilities & DEAF) //disabled-deaf, doesn't get better on its own + ear_deaf = max(ear_deaf, 1) + else if(ear_deaf) //deafness, heals slowly over time + ear_deaf = max(ear_deaf-1, 0) + else if(istype(l_ear, /obj/item/clothing/ears/earmuffs) || istype(r_ear, /obj/item/clothing/ears/earmuffs)) //resting your ears with earmuffs heals ear damage faster + ear_damage = max(ear_damage-0.15, 0) + ear_deaf = max(ear_deaf, 1) + else if(ear_damage < 25) //ear damage heals slowly under this threshold. otherwise you'll need earmuffs + ear_damage = max(ear_damage-0.05, 0) + + //Dizziness + if(dizziness) + var/client/C = client + var/pixel_x_diff = 0 + var/pixel_y_diff = 0 + var/temp + var/saved_dizz = dizziness + dizziness = max(dizziness-1, 0) + if(C) + var/oldsrc = src + var/amplitude = dizziness*(sin(dizziness * 0.044 * world.time) + 1) / 70 // This shit is annoying at high strength + src = null + spawn(0) + if(C) + temp = amplitude * sin(0.008 * saved_dizz * world.time) + pixel_x_diff += temp + C.pixel_x += temp + temp = amplitude * cos(0.008 * saved_dizz * world.time) + pixel_y_diff += temp + C.pixel_y += temp + sleep(3) if(C) temp = amplitude * sin(0.008 * saved_dizz * world.time) pixel_x_diff += temp @@ -1020,641 +1025,633 @@ var/global/list/brutefireloss_overlays = list("1" = image("icon" = 'icons/mob/sc temp = amplitude * cos(0.008 * saved_dizz * world.time) pixel_y_diff += temp C.pixel_y += temp - sleep(3) - if(C) - temp = amplitude * sin(0.008 * saved_dizz * world.time) - pixel_x_diff += temp - C.pixel_x += temp - temp = amplitude * cos(0.008 * saved_dizz * world.time) - pixel_y_diff += temp - C.pixel_y += temp - sleep(3) - if(C) - C.pixel_x -= pixel_x_diff - C.pixel_y -= pixel_y_diff - src = oldsrc + sleep(3) + if(C) + C.pixel_x -= pixel_x_diff + C.pixel_y -= pixel_y_diff + src = oldsrc - //Jitteryness - if(jitteriness) - do_jitter_animation(jitteriness) + //Jitteryness + if(jitteriness) + do_jitter_animation(jitteriness) - //Flying - if(flying) - spawn() - animate(src, pixel_y = pixel_y + 5 , time = 10, loop = 1, easing = SINE_EASING) - spawn(10) - if(flying) - animate(src, pixel_y = pixel_y - 5, time = 10, loop = 1, easing = SINE_EASING) + //Flying + if(flying) + spawn() + animate(src, pixel_y = pixel_y + 5 , time = 10, loop = 1, easing = SINE_EASING) + spawn(10) + if(flying) + animate(src, pixel_y = pixel_y - 5, time = 10, loop = 1, easing = SINE_EASING) - //Other - handle_statuses() + //Other + handle_statuses() - // If you're dirty, your gloves will become dirty, too. - if(gloves && germ_level > gloves.germ_level && prob(10)) - gloves.germ_level += 1 + // If you're dirty, your gloves will become dirty, too. + if(gloves && germ_level > gloves.germ_level && prob(10)) + gloves.germ_level += 1 - CheckStamina() + CheckStamina() - return 1 + return 1 - proc/handle_regular_hud_updates() - if(hud_updateflag) - handle_hud_list() +/mob/living/carbon/human/proc/handle_regular_hud_updates() + if(hud_updateflag) + handle_hud_list() - if(!client) return 0 + if(!client) return 0 - if(hud_updateflag) - handle_hud_list() + if(hud_updateflag) + handle_hud_list() - update_action_buttons() + update_action_buttons() - for(var/image/hud in client.images) - if(copytext(hud.icon_state,1,4) == "hud") //ugly, but icon comparison is worse, I believe - client.images.Remove(hud) + for(var/image/hud in client.images) + if(copytext(hud.icon_state,1,4) == "hud") //ugly, but icon comparison is worse, I believe + client.images.Remove(hud) - client.screen.Remove(global_hud.blurry, global_hud.druggy, global_hud.vimpaired, global_hud.darkMask,/* global_hud.nvg*/) + client.screen.Remove(global_hud.blurry, global_hud.druggy, global_hud.vimpaired, global_hud.darkMask,/* global_hud.nvg*/) - if(damageoverlay.overlays) - damageoverlay.overlays = list() + if(damageoverlay.overlays) + damageoverlay.overlays = list() - if(stat == UNCONSCIOUS) - //Critical damage passage overlay - if(health <= 0) - //var/image/I - switch(health) - if(-20 to -10) - damageoverlay.overlays += unconscious_overlays["1"]//image("icon" = 'icons/mob/screen1_full.dmi', "icon_state" = "passage1") - if(-30 to -20) - damageoverlay.overlays += unconscious_overlays["2"]//image("icon" = 'icons/mob/screen1_full.dmi', "icon_state" = "passage2") - if(-40 to -30) - damageoverlay.overlays += unconscious_overlays["3"]//image("icon" = 'icons/mob/screen1_full.dmi', "icon_state" = "passage3") - if(-50 to -40) - damageoverlay.overlays += unconscious_overlays["4"]//image("icon" = 'icons/mob/screen1_full.dmi', "icon_state" = "passage4") - if(-60 to -50) - damageoverlay.overlays += unconscious_overlays["5"]//image("icon" = 'icons/mob/screen1_full.dmi', "icon_state" = "passage5") - if(-70 to -60) - damageoverlay.overlays += unconscious_overlays["6"]//image("icon" = 'icons/mob/screen1_full.dmi', "icon_state" = "passage6") - if(-80 to -70) - damageoverlay.overlays += unconscious_overlays["7"]//image("icon" = 'icons/mob/screen1_full.dmi', "icon_state" = "passage7") - if(-90 to -80) - damageoverlay.overlays += unconscious_overlays["8"]//image("icon" = 'icons/mob/screen1_full.dmi', "icon_state" = "passage8") - if(-95 to -90) - damageoverlay.overlays += unconscious_overlays["9"]//image("icon" = 'icons/mob/screen1_full.dmi', "icon_state" = "passage9") - if(-INFINITY to -95) - damageoverlay.overlays += unconscious_overlays["10"]//image("icon" = 'icons/mob/screen1_full.dmi', "icon_state" = "passage10") - //damageoverlay.overlays += I - else - //Oxygen damage overlay - if(oxyloss) - //var/image/I - switch(oxyloss) - if(10 to 20) - damageoverlay.overlays += oxyloss_overlays["1"]//image("icon" = 'icons/mob/screen1_full.dmi', "icon_state" = "oxydamageoverlay1") - if(20 to 25) - damageoverlay.overlays += oxyloss_overlays["2"]//image("icon" = 'icons/mob/screen1_full.dmi', "icon_state" = "oxydamageoverlay2") - if(25 to 30) - damageoverlay.overlays += oxyloss_overlays["3"]//image("icon" = 'icons/mob/screen1_full.dmi', "icon_state" = "oxydamageoverlay3") - if(30 to 35) - damageoverlay.overlays += oxyloss_overlays["4"]//image("icon" = 'icons/mob/screen1_full.dmi', "icon_state" = "oxydamageoverlay4") - if(35 to 40) - damageoverlay.overlays += oxyloss_overlays["5"]//image("icon" = 'icons/mob/screen1_full.dmi', "icon_state" = "oxydamageoverlay5") - if(40 to 45) - damageoverlay.overlays += oxyloss_overlays["6"]//image("icon" = 'icons/mob/screen1_full.dmi', "icon_state" = "oxydamageoverlay6") - if(45 to INFINITY) - damageoverlay.overlays += oxyloss_overlays["7"]//image("icon" = 'icons/mob/screen1_full.dmi', "icon_state" = "oxydamageoverlay7") - //damageoverlay.overlays += I + if(stat == UNCONSCIOUS) + //Critical damage passage overlay + if(health <= 0) + //var/image/I + switch(health) + if(-20 to -10) + damageoverlay.overlays += unconscious_overlays["1"]//image("icon" = 'icons/mob/screen1_full.dmi', "icon_state" = "passage1") + if(-30 to -20) + damageoverlay.overlays += unconscious_overlays["2"]//image("icon" = 'icons/mob/screen1_full.dmi', "icon_state" = "passage2") + if(-40 to -30) + damageoverlay.overlays += unconscious_overlays["3"]//image("icon" = 'icons/mob/screen1_full.dmi', "icon_state" = "passage3") + if(-50 to -40) + damageoverlay.overlays += unconscious_overlays["4"]//image("icon" = 'icons/mob/screen1_full.dmi', "icon_state" = "passage4") + if(-60 to -50) + damageoverlay.overlays += unconscious_overlays["5"]//image("icon" = 'icons/mob/screen1_full.dmi', "icon_state" = "passage5") + if(-70 to -60) + damageoverlay.overlays += unconscious_overlays["6"]//image("icon" = 'icons/mob/screen1_full.dmi', "icon_state" = "passage6") + if(-80 to -70) + damageoverlay.overlays += unconscious_overlays["7"]//image("icon" = 'icons/mob/screen1_full.dmi', "icon_state" = "passage7") + if(-90 to -80) + damageoverlay.overlays += unconscious_overlays["8"]//image("icon" = 'icons/mob/screen1_full.dmi', "icon_state" = "passage8") + if(-95 to -90) + damageoverlay.overlays += unconscious_overlays["9"]//image("icon" = 'icons/mob/screen1_full.dmi', "icon_state" = "passage9") + if(-INFINITY to -95) + damageoverlay.overlays += unconscious_overlays["10"]//image("icon" = 'icons/mob/screen1_full.dmi', "icon_state" = "passage10") + //damageoverlay.overlays += I + else + //Oxygen damage overlay + if(oxyloss) + //var/image/I + switch(oxyloss) + if(10 to 20) + damageoverlay.overlays += oxyloss_overlays["1"]//image("icon" = 'icons/mob/screen1_full.dmi', "icon_state" = "oxydamageoverlay1") + if(20 to 25) + damageoverlay.overlays += oxyloss_overlays["2"]//image("icon" = 'icons/mob/screen1_full.dmi', "icon_state" = "oxydamageoverlay2") + if(25 to 30) + damageoverlay.overlays += oxyloss_overlays["3"]//image("icon" = 'icons/mob/screen1_full.dmi', "icon_state" = "oxydamageoverlay3") + if(30 to 35) + damageoverlay.overlays += oxyloss_overlays["4"]//image("icon" = 'icons/mob/screen1_full.dmi', "icon_state" = "oxydamageoverlay4") + if(35 to 40) + damageoverlay.overlays += oxyloss_overlays["5"]//image("icon" = 'icons/mob/screen1_full.dmi', "icon_state" = "oxydamageoverlay5") + if(40 to 45) + damageoverlay.overlays += oxyloss_overlays["6"]//image("icon" = 'icons/mob/screen1_full.dmi', "icon_state" = "oxydamageoverlay6") + if(45 to INFINITY) + damageoverlay.overlays += oxyloss_overlays["7"]//image("icon" = 'icons/mob/screen1_full.dmi', "icon_state" = "oxydamageoverlay7") + //damageoverlay.overlays += I - //Fire and Brute damage overlay (BSSR) - var/hurtdamage = src.getBruteLoss() + src.getFireLoss() + damageoverlaytemp - damageoverlaytemp = 0 // We do this so we can detect if someone hits us or not. - if(hurtdamage) - //var/image/I - switch(hurtdamage) - if(10 to 25) - damageoverlay.overlays += brutefireloss_overlays["1"]//image("icon" = 'icons/mob/screen1_full.dmi', "icon_state" = "brutedamageoverlay1") - if(25 to 40) - damageoverlay.overlays += brutefireloss_overlays["2"]//image("icon" = 'icons/mob/screen1_full.dmi', "icon_state" = "brutedamageoverlay2") - if(40 to 55) - damageoverlay.overlays += brutefireloss_overlays["3"]//image("icon" = 'icons/mob/screen1_full.dmi', "icon_state" = "brutedamageoverlay3") - if(55 to 70) - damageoverlay.overlays += brutefireloss_overlays["4"]//image("icon" = 'icons/mob/screen1_full.dmi', "icon_state" = "brutedamageoverlay4") - if(70 to 85) - damageoverlay.overlays += brutefireloss_overlays["5"]//image("icon" = 'icons/mob/screen1_full.dmi', "icon_state" = "brutedamageoverlay5") - if(85 to INFINITY) - damageoverlay.overlays += brutefireloss_overlays["6"]//image("icon" = 'icons/mob/screen1_full.dmi', "icon_state" = "brutedamageoverlay6") - //damageoverlay.overlays += I + //Fire and Brute damage overlay (BSSR) + var/hurtdamage = src.getBruteLoss() + src.getFireLoss() + damageoverlaytemp + damageoverlaytemp = 0 // We do this so we can detect if someone hits us or not. + if(hurtdamage) + //var/image/I + switch(hurtdamage) + if(10 to 25) + damageoverlay.overlays += brutefireloss_overlays["1"]//image("icon" = 'icons/mob/screen1_full.dmi', "icon_state" = "brutedamageoverlay1") + if(25 to 40) + damageoverlay.overlays += brutefireloss_overlays["2"]//image("icon" = 'icons/mob/screen1_full.dmi', "icon_state" = "brutedamageoverlay2") + if(40 to 55) + damageoverlay.overlays += brutefireloss_overlays["3"]//image("icon" = 'icons/mob/screen1_full.dmi', "icon_state" = "brutedamageoverlay3") + if(55 to 70) + damageoverlay.overlays += brutefireloss_overlays["4"]//image("icon" = 'icons/mob/screen1_full.dmi', "icon_state" = "brutedamageoverlay4") + if(70 to 85) + damageoverlay.overlays += brutefireloss_overlays["5"]//image("icon" = 'icons/mob/screen1_full.dmi', "icon_state" = "brutedamageoverlay5") + if(85 to INFINITY) + damageoverlay.overlays += brutefireloss_overlays["6"]//image("icon" = 'icons/mob/screen1_full.dmi', "icon_state" = "brutedamageoverlay6") + //damageoverlay.overlays += I - see_invisible = SEE_INVISIBLE_LIVING - if( stat == DEAD ) - sight |= (SEE_TURFS|SEE_MOBS|SEE_OBJS) - see_in_dark = 8 - if(!druggy) see_invisible = SEE_INVISIBLE_LEVEL_TWO - if(healths) healths.icon_state = "health7" //DEAD healthmeter - else - sight &= ~(SEE_TURFS|SEE_MOBS|SEE_OBJS) + see_invisible = SEE_INVISIBLE_LIVING + if( stat == DEAD ) + sight |= (SEE_TURFS|SEE_MOBS|SEE_OBJS) + see_in_dark = 8 + if(!druggy) see_invisible = SEE_INVISIBLE_LEVEL_TWO + if(healths) healths.icon_state = "health7" //DEAD healthmeter + else + sight &= ~(SEE_TURFS|SEE_MOBS|SEE_OBJS) - if(mind && mind.vampire) - if((VAMP_VISION in mind.vampire.powers) && !(VAMP_FULL in mind.vampire.powers)) - sight |= SEE_MOBS - if((VAMP_FULL in mind.vampire.powers)) - sight |= SEE_TURFS|SEE_MOBS|SEE_OBJS - see_in_dark = 8 - if(!druggy) see_invisible = SEE_INVISIBLE_LEVEL_TWO - if(XRAY in mutations) + if(mind && mind.vampire) + if((VAMP_VISION in mind.vampire.powers) && !(VAMP_FULL in mind.vampire.powers)) + sight |= SEE_MOBS + if((VAMP_FULL in mind.vampire.powers)) sight |= SEE_TURFS|SEE_MOBS|SEE_OBJS see_in_dark = 8 if(!druggy) see_invisible = SEE_INVISIBLE_LEVEL_TWO + if(XRAY in mutations) + sight |= SEE_TURFS|SEE_MOBS|SEE_OBJS + see_in_dark = 8 + if(!druggy) see_invisible = SEE_INVISIBLE_LEVEL_TWO - if(seer==1) - var/obj/effect/rune/R = locate() in loc - if(R && R.word1 == cultwords["see"] && R.word2 == cultwords["hell"] && R.word3 == cultwords["join"]) - see_invisible = SEE_INVISIBLE_OBSERVER - else - see_invisible = SEE_INVISIBLE_LIVING - seer = 0 - - if(glasses || head) - if(glasses) - var/obj/item/clothing/glasses/G = glasses - if(istype(G)) - see_in_dark = (G.darkness_view ? see_in_dark + G.darkness_view : species.darksight) // Otherwise we keep our darkness view with togglable nightvision. - if(G.vision_flags) // MESONS - sight |= G.vision_flags - if(!druggy) - see_invisible = SEE_INVISIBLE_MINIMUM - if(!G.see_darkness) - see_invisible = SEE_INVISIBLE_MINIMUM - /* HUD shit goes here, as long as it doesn't modify sight flags */ - // The purpose of this is to stop xray and w/e from preventing you from using huds -- Love, Doohl - - switch(G.HUDType) - if(SECHUD) - process_sec_hud(src,1) - if(MEDHUD) - process_med_hud(src,1) - if(ANTAGHUD) - process_antag_hud(src) - - if(head) - var/obj/item/clothing/head/H = head - if(istype(H)) - if(H.vision_flags) // MESONS - sight |= H.vision_flags - if(!druggy) - see_invisible = SEE_INVISIBLE_MINIMUM - if(!H.see_darkness) - see_invisible = SEE_INVISIBLE_MINIMUM - /* HUD shit goes here, as long as it doesn't modify sight flags */ - // The purpose of this is to stop xray and w/e from preventing you from using huds -- Love, Doohl - - switch(H.HUDType) - if(SECHUD) - process_sec_hud(src,1) - if(MEDHUD) - process_med_hud(src,1) - if(ANTAGHUD) - process_antag_hud(src) - - - - - else if(!seer) - see_in_dark = species.darksight + if(seer==1) + var/obj/effect/rune/R = locate() in loc + if(R && R.word1 == cultwords["see"] && R.word2 == cultwords["hell"] && R.word3 == cultwords["join"]) + see_invisible = SEE_INVISIBLE_OBSERVER + else see_invisible = SEE_INVISIBLE_LIVING + seer = 0 - if(ticker && ticker.mode.name == "nations") - process_nations() + if(glasses || head) + if(glasses) + var/obj/item/clothing/glasses/G = glasses + if(istype(G)) + see_in_dark = (G.darkness_view ? see_in_dark + G.darkness_view : species.darksight) // Otherwise we keep our darkness view with togglable nightvision. + if(G.vision_flags) // MESONS + sight |= G.vision_flags + if(!druggy) + see_invisible = SEE_INVISIBLE_MINIMUM + if(!G.see_darkness) + see_invisible = SEE_INVISIBLE_MINIMUM + /* HUD shit goes here, as long as it doesn't modify sight flags */ + // The purpose of this is to stop xray and w/e from preventing you from using huds -- Love, Doohl - if(healths) - if (analgesic) - healths.icon_state = "health_health_numb" - else - switch(hal_screwyhud) - if(1) healths.icon_state = "health6" - if(2) healths.icon_state = "health7" - else - //switch(health - halloss) - switch(100 - ((species && species.flags & NO_PAIN) ? 0 : traumatic_shock) - staminaloss) - 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" + switch(G.HUDType) + if(SECHUD) + process_sec_hud(src,1) + if(MEDHUD) + process_med_hud(src,1) + if(ANTAGHUD) + process_antag_hud(src) - if(healthdoll) - healthdoll.overlays.Cut() - if(stat == DEAD) - healthdoll.icon_state = "healthdoll_DEAD" - else - healthdoll.icon_state = "healthdoll_OVERLAY" - for(var/obj/item/organ/external/O in organs) - var/damage = O.burn_dam + O.brute_dam - var/comparison = (O.max_damage/5) - var/icon_num = 0 - if(damage) - icon_num = 1 - if(damage > (comparison)) - icon_num = 2 - if(damage > (comparison*2)) - icon_num = 3 - if(damage > (comparison*3)) - icon_num = 4 - if(damage > (comparison*4)) - icon_num = 5 - if(icon_num) - healthdoll.overlays += image('icons/mob/screen_gen.dmi',"[O.limb_name][icon_num]") + if(head) + var/obj/item/clothing/head/H = head + if(istype(H)) + if(H.vision_flags) // MESONS + sight |= H.vision_flags + if(!druggy) + see_invisible = SEE_INVISIBLE_MINIMUM + if(!H.see_darkness) + see_invisible = SEE_INVISIBLE_MINIMUM + /* HUD shit goes here, as long as it doesn't modify sight flags */ + // The purpose of this is to stop xray and w/e from preventing you from using huds -- Love, Doohl - 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" + switch(H.HUDType) + if(SECHUD) + process_sec_hud(src,1) + if(MEDHUD) + process_med_hud(src,1) + if(ANTAGHUD) + process_antag_hud(src) - if(pressure) - pressure.icon_state = "pressure[pressure_alert]" - if(pullin) - if(pulling) pullin.icon_state = "pull1" - else pullin.icon_state = "pull0" + + + else if(!seer) + see_in_dark = species.darksight + see_invisible = SEE_INVISIBLE_LIVING + + if(ticker && ticker.mode.name == "nations") + process_nations() + + if(healths) + if (analgesic) + healths.icon_state = "health_health_numb" + else + switch(hal_screwyhud) + if(1) healths.icon_state = "health6" + if(2) healths.icon_state = "health7" + else + //switch(health - halloss) + switch(100 - ((species && species.flags & NO_PAIN) ? 0 : traumatic_shock) - staminaloss) + 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" + + if(healthdoll) + healthdoll.overlays.Cut() + if(stat == DEAD) + healthdoll.icon_state = "healthdoll_DEAD" + else + healthdoll.icon_state = "healthdoll_OVERLAY" + for(var/obj/item/organ/external/O in organs) + var/damage = O.burn_dam + O.brute_dam + var/comparison = (O.max_damage/5) + var/icon_num = 0 + if(damage) + icon_num = 1 + if(damage > (comparison)) + icon_num = 2 + if(damage > (comparison*2)) + icon_num = 3 + if(damage > (comparison*3)) + icon_num = 4 + if(damage > (comparison*4)) + icon_num = 5 + if(icon_num) + healthdoll.overlays += image('icons/mob/screen_gen.dmi',"[O.limb_name][icon_num]") + + 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) + pressure.icon_state = "pressure[pressure_alert]" + + if(pullin) + if(pulling) pullin.icon_state = "pull1" + else pullin.icon_state = "pull0" // if(rest) //Not used with new UI // if(resting || lying || sleeping) rest.icon_state = "rest1" // else rest.icon_state = "rest0" - if(toxin) - if(hal_screwyhud == 4 || toxins_alert) toxin.icon_state = "tox1" - else toxin.icon_state = "tox0" - if(oxygen) - if(hal_screwyhud == 3 || oxygen_alert) oxygen.icon_state = "oxy1" - else oxygen.icon_state = "oxy0" - if(fire) - if(fire_alert) fire.icon_state = "fire[fire_alert]" //fire_alert is either 0 if no alert, 1 for cold and 2 for heat. - else fire.icon_state = "fire0" + if(toxin) + if(hal_screwyhud == 4 || toxins_alert) toxin.icon_state = "tox1" + else toxin.icon_state = "tox0" + if(oxygen) + if(hal_screwyhud == 3 || oxygen_alert) oxygen.icon_state = "oxy1" + else oxygen.icon_state = "oxy0" + if(fire) + if(fire_alert) fire.icon_state = "fire[fire_alert]" //fire_alert is either 0 if no alert, 1 for cold and 2 for heat. + else fire.icon_state = "fire0" - if(bodytemp) - if (!species) - switch(bodytemperature) //310.055 optimal body temp - if(370 to INFINITY) bodytemp.icon_state = "temp4" - if(350 to 370) bodytemp.icon_state = "temp3" - if(335 to 350) bodytemp.icon_state = "temp2" - if(320 to 335) bodytemp.icon_state = "temp1" - if(300 to 320) bodytemp.icon_state = "temp0" - if(295 to 300) bodytemp.icon_state = "temp-1" - if(280 to 295) bodytemp.icon_state = "temp-2" - if(260 to 280) bodytemp.icon_state = "temp-3" - else bodytemp.icon_state = "temp-4" - else - var/temp_step - if (bodytemperature >= species.body_temperature) - temp_step = (species.heat_level_1 - species.body_temperature)/4 + if(bodytemp) + if (!species) + switch(bodytemperature) //310.055 optimal body temp + if(370 to INFINITY) bodytemp.icon_state = "temp4" + if(350 to 370) bodytemp.icon_state = "temp3" + if(335 to 350) bodytemp.icon_state = "temp2" + if(320 to 335) bodytemp.icon_state = "temp1" + if(300 to 320) bodytemp.icon_state = "temp0" + if(295 to 300) bodytemp.icon_state = "temp-1" + if(280 to 295) bodytemp.icon_state = "temp-2" + if(260 to 280) bodytemp.icon_state = "temp-3" + else bodytemp.icon_state = "temp-4" + else + var/temp_step + if (bodytemperature >= species.body_temperature) + temp_step = (species.heat_level_1 - species.body_temperature)/4 - if (bodytemperature >= species.heat_level_1) - bodytemp.icon_state = "temp4" - else if (bodytemperature >= species.body_temperature + temp_step*3) - bodytemp.icon_state = "temp3" - else if (bodytemperature >= species.body_temperature + temp_step*2) - bodytemp.icon_state = "temp2" - else if (bodytemperature >= species.body_temperature + temp_step*1) - bodytemp.icon_state = "temp1" - else - bodytemp.icon_state = "temp0" + if (bodytemperature >= species.heat_level_1) + bodytemp.icon_state = "temp4" + else if (bodytemperature >= species.body_temperature + temp_step*3) + bodytemp.icon_state = "temp3" + else if (bodytemperature >= species.body_temperature + temp_step*2) + bodytemp.icon_state = "temp2" + else if (bodytemperature >= species.body_temperature + temp_step*1) + bodytemp.icon_state = "temp1" + else + bodytemp.icon_state = "temp0" - else if (bodytemperature < species.body_temperature) - temp_step = (species.body_temperature - species.cold_level_1)/4 + else if (bodytemperature < species.body_temperature) + temp_step = (species.body_temperature - species.cold_level_1)/4 - if (bodytemperature <= species.cold_level_1) - bodytemp.icon_state = "temp-4" - else if (bodytemperature <= species.body_temperature - temp_step*3) - bodytemp.icon_state = "temp-3" - else if (bodytemperature <= species.body_temperature - temp_step*2) - bodytemp.icon_state = "temp-2" - else if (bodytemperature <= species.body_temperature - temp_step*1) - bodytemp.icon_state = "temp-1" - else - bodytemp.icon_state = "temp0" + if (bodytemperature <= species.cold_level_1) + bodytemp.icon_state = "temp-4" + else if (bodytemperature <= species.body_temperature - temp_step*3) + bodytemp.icon_state = "temp-3" + else if (bodytemperature <= species.body_temperature - temp_step*2) + bodytemp.icon_state = "temp-2" + else if (bodytemperature <= species.body_temperature - temp_step*1) + bodytemp.icon_state = "temp-1" + else + bodytemp.icon_state = "temp0" // This checks how much the mob's eyewear impairs their vision - if(tinttotal >= TINT_IMPAIR) - if(tinted_weldhelh) - if(tinttotal >= TINT_BLIND) - blinded = 1 // You get the sudden urge to learn to play keyboard - client.screen += global_hud.darkMask - else - client.screen += global_hud.darkMask - - if(blind) - if(blinded) blind.layer = 18 - else blind.layer = 0 - - if(disabilities & NEARSIGHTED) //this looks meh but saves a lot of memory by not requiring to add var/prescription - if(glasses) //to every /obj/item - var/obj/item/clothing/glasses/G = glasses - if(!G.prescription) - client.screen += global_hud.vimpaired + if(tinttotal >= TINT_IMPAIR) + if(tinted_weldhelh) + if(tinttotal >= TINT_BLIND) + blinded = 1 // You get the sudden urge to learn to play keyboard + client.screen += global_hud.darkMask else + client.screen += global_hud.darkMask + + if(blind) + if(blinded) blind.layer = 18 + else blind.layer = 0 + + if(disabilities & NEARSIGHTED) //this looks meh but saves a lot of memory by not requiring to add var/prescription + if(glasses) //to every /obj/item + var/obj/item/clothing/glasses/G = glasses + if(!G.prescription) client.screen += global_hud.vimpaired - - if(eye_blurry) client.screen += global_hud.blurry - if(druggy) client.screen += global_hud.druggy - - if(machine) - if(!machine.check_eye(src)) reset_view(null) else - var/isRemoteObserve = 0 - if((REMOTE_VIEW in mutations) && remoteview_target) - isRemoteObserve = 1 - // Is he unconscious or dead? - if(remoteview_target.stat!=CONSCIOUS) - src << "\red Your psy-connection grows too faint to maintain!" - isRemoteObserve = 0 + client.screen += global_hud.vimpaired - // Does he have psy resist? - if(PSY_RESIST in remoteview_target.mutations) - src << "\red Your mind is shut out!" - isRemoteObserve = 0 + if(eye_blurry) client.screen += global_hud.blurry + if(druggy) client.screen += global_hud.druggy - // Not on the station or mining? - var/turf/temp_turf = get_turf(remoteview_target) - if((!(temp_turf.z in config.contact_levels)) || remoteview_target.stat!=CONSCIOUS) - src << "\red Your psy-connection grows too faint to maintain!" - isRemoteObserve = 0 - if(!isRemoteObserve && client && !client.adminobs) - remoteview_target = null - reset_view(null) - return 1 + if(machine) + if(!machine.check_eye(src)) reset_view(null) + else + var/isRemoteObserve = 0 + if((REMOTE_VIEW in mutations) && remoteview_target) + isRemoteObserve = 1 + // Is he unconscious or dead? + if(remoteview_target.stat!=CONSCIOUS) + src << "Your psy-connection grows too faint to maintain!" + isRemoteObserve = 0 - proc/handle_random_events() - // Puke if toxloss is too high - if(!stat) - if (getToxLoss() >= 45 && nutrition > 20) - vomit() + // Does he have psy resist? + if(PSY_RESIST in remoteview_target.mutations) + src << "Your mind is shut out!" + isRemoteObserve = 0 - //0.1% chance of playing a scary sound to someone who's in complete darkness - if(isturf(loc) && rand(1,1000) == 1) - var/turf/currentTurf = loc - var/atom/movable/lighting_overlay/L = locate(/atom/movable/lighting_overlay) in currentTurf - if(L && L.lum_r + L.lum_g + L.lum_b == 0) - playsound_local(src,pick(scarySounds),50, 1, -1) + // Not on the station or mining? + var/turf/temp_turf = get_turf(remoteview_target) + if((!(temp_turf.z in config.contact_levels)) || remoteview_target.stat!=CONSCIOUS) + src << "Your psy-connection grows too faint to maintain!" + isRemoteObserve = 0 + if(!isRemoteObserve && client && !client.adminobs) + remoteview_target = null + reset_view(null) + return 1 + +/mob/living/carbon/human/proc/handle_random_events() + // Puke if toxloss is too high + if(!stat) + if (getToxLoss() >= 45 && nutrition > 20) + vomit() + + //0.1% chance of playing a scary sound to someone who's in complete darkness + if(isturf(loc) && rand(1,1000) == 1) + var/turf/currentTurf = loc + var/atom/movable/lighting_overlay/L = locate(/atom/movable/lighting_overlay) in currentTurf + if(L && L.lum_r + L.lum_g + L.lum_b == 0) + playsound_local(src,pick(scarySounds),50, 1, -1) // Separate proc so we can jump out of it when we've succeeded in spreading disease. - proc/findAirborneVirii() - for(var/obj/effect/decal/cleanable/blood/B in get_turf(src)) - if(B.virus2.len) - for (var/ID in B.virus2) - var/datum/disease2/disease/V = B.virus2[ID] - if (infect_virus2(src,V)) - return 1 +/mob/living/carbon/human/proc/findAirborneVirii() + for(var/obj/effect/decal/cleanable/blood/B in get_turf(src)) + if(B.virus2.len) + for (var/ID in B.virus2) + var/datum/disease2/disease/V = B.virus2[ID] + if (infect_virus2(src,V)) + return 1 - for(var/obj/effect/decal/cleanable/mucus/M in get_turf(src)) - if(M.virus2.len) - for (var/ID in M.virus2) - var/datum/disease2/disease/V = M.virus2[ID] - if (infect_virus2(src,V)) - return 1 + for(var/obj/effect/decal/cleanable/mucus/M in get_turf(src)) + if(M.virus2.len) + for (var/ID in M.virus2) + var/datum/disease2/disease/V = M.virus2[ID] + if (infect_virus2(src,V)) + return 1 - for(var/obj/effect/decal/cleanable/poop/P in get_turf(src)) - if(P.virus2.len) - for (var/ID in P.virus2) - var/datum/disease2/disease/V = P.virus2[ID] - if (infect_virus2(src,V)) - return 1 + for(var/obj/effect/decal/cleanable/poop/P in get_turf(src)) + if(P.virus2.len) + for (var/ID in P.virus2) + var/datum/disease2/disease/V = P.virus2[ID] + if (infect_virus2(src,V)) + return 1 - return 0 - - proc/handle_virus_updates() - if(status_flags & GODMODE) return 0 //godmode - if(bodytemperature > 406) - for (var/ID in virus2) - var/datum/disease2/disease/V = virus2[ID] - V.cure(src) - if(life_tick % 3) //don't spam checks over all objects in view every tick. - for(var/obj/effect/decal/cleanable/O in view(1,src)) - if(istype(O,/obj/effect/decal/cleanable/blood)) - var/obj/effect/decal/cleanable/blood/B = O - if(B.virus2.len) - for (var/ID in B.virus2) - var/datum/disease2/disease/V = B.virus2[ID] - infect_virus2(src,V.getcopy()) - - else if(istype(O,/obj/effect/decal/cleanable/mucus)) - var/obj/effect/decal/cleanable/mucus/M = O - if(M.virus2.len) - for (var/ID in M.virus2) - var/datum/disease2/disease/V = M.virus2[ID] - infect_virus2(src,V.getcopy()) - + return 0 +/mob/living/carbon/human/proc/handle_virus_updates() + if(status_flags & GODMODE) return 0 //godmode + if(bodytemperature > 406) for (var/ID in virus2) var/datum/disease2/disease/V = virus2[ID] - if(isnull(V)) // Trying to figure out a runtime error that keeps repeating - CRASH("virus2 nulled before calling activate()") - else - V.activate(src) - // activate may have deleted the virus - if(!V) continue + V.cure(src) + if(life_tick % 3) //don't spam checks over all objects in view every tick. + for(var/obj/effect/decal/cleanable/O in view(1,src)) + if(istype(O,/obj/effect/decal/cleanable/blood)) + var/obj/effect/decal/cleanable/blood/B = O + if(B.virus2.len) + for (var/ID in B.virus2) + var/datum/disease2/disease/V = B.virus2[ID] + infect_virus2(src,V.getcopy()) - // check if we're immune - if(V.antigen & src.antibodies) - V.dead = 1 + else if(istype(O,/obj/effect/decal/cleanable/mucus)) + var/obj/effect/decal/cleanable/mucus/M = O + if(M.virus2.len) + for (var/ID in M.virus2) + var/datum/disease2/disease/V = M.virus2[ID] + infect_virus2(src,V.getcopy()) + + + for (var/ID in virus2) + var/datum/disease2/disease/V = virus2[ID] + if(isnull(V)) // Trying to figure out a runtime error that keeps repeating + CRASH("virus2 nulled before calling activate()") + else + V.activate(src) + // activate may have deleted the virus + if(!V) continue + + // check if we're immune + if(V.antigen & src.antibodies) + V.dead = 1 + return + +/mob/living/carbon/human/proc/handle_stomach() + spawn(0) + for(var/mob/living/M in stomach_contents) + if(M.loc != src) + stomach_contents.Remove(M) + continue + if(isliving(M) && stat != 2) + if(M.stat == 2) + M.death(1) + stomach_contents.Remove(M) + qdel(M) + continue + if(mob_master.current_cycle%3==1) + if(!(M.status_flags & GODMODE)) + M.adjustBruteLoss(5) + nutrition += 10 + +/mob/living/carbon/human/proc/handle_changeling() + if(mind && mind.changeling) + mind.changeling.regenerate() + +/mob/living/carbon/human/handle_shock() + ..() + if(status_flags & GODMODE) return 0 //godmode + if(analgesic || (species && species.flags & NO_PAIN)) return // analgesic avoids all traumatic shock temporarily + + if(health <= config.health_threshold_softcrit)// health 0 makes you immediately collapse + shock_stage = max(shock_stage, 61) + + if(traumatic_shock >= 100) + shock_stage += 1 + else + shock_stage = min(shock_stage, 160) + shock_stage = max(shock_stage-1, 0) return - proc/handle_stomach() - spawn(0) - for(var/mob/living/M in stomach_contents) - if(M.loc != src) - stomach_contents.Remove(M) - continue - if(isliving(M) && stat != 2) - if(M.stat == 2) - M.death(1) - stomach_contents.Remove(M) - qdel(M) - continue - if(mob_master.current_cycle%3==1) - if(!(M.status_flags & GODMODE)) - M.adjustBruteLoss(5) - nutrition += 10 + if(shock_stage == 10) + src << ""+pick("It hurts so much!", "You really need some painkillers..", "Dear god, the pain!") - proc/handle_changeling() - if(mind && mind.changeling) - mind.changeling.regenerate() + if(shock_stage >= 30) + if(shock_stage == 30) emote("me",1,"is having trouble keeping their eyes open.") + eye_blurry = max(2, eye_blurry) + stuttering = max(stuttering, 5) - handle_shock() - ..() - if(status_flags & GODMODE) return 0 //godmode - if(analgesic || (species && species.flags & NO_PAIN)) return // analgesic avoids all traumatic shock temporarily + if(shock_stage == 40) + src << ""+pick("The pain is excrutiating!", "Please, just end the pain!", "Your whole body is going numb!") - if(health <= config.health_threshold_softcrit)// health 0 makes you immediately collapse - shock_stage = max(shock_stage, 61) - - if(traumatic_shock >= 100) - shock_stage += 1 - else - shock_stage = min(shock_stage, 160) - shock_stage = max(shock_stage-1, 0) - return - - if(shock_stage == 10) - src << ""+pick("It hurts so much!", "You really need some painkillers..", "Dear god, the pain!") - - if(shock_stage >= 30) - if(shock_stage == 30) emote("me",1,"is having trouble keeping their eyes open.") - eye_blurry = max(2, eye_blurry) - stuttering = max(stuttering, 5) - - if(shock_stage == 40) + if(shock_stage >=60) + if(shock_stage == 60) emote("me",1,"'s body becomes limp.") + if (prob(2)) src << ""+pick("The pain is excrutiating!", "Please, just end the pain!", "Your whole body is going numb!") - - if(shock_stage >=60) - if(shock_stage == 60) emote("me",1,"'s body becomes limp.") - if (prob(2)) - src << ""+pick("The pain is excrutiating!", "Please, just end the pain!", "Your whole body is going numb!") - Weaken(20) - - if(shock_stage >= 80) - if (prob(5)) - src << ""+pick("The pain is excrutiating!", "Please, just end the pain!", "Your whole body is going numb!") - Weaken(20) - - if(shock_stage >= 120) - if (prob(2)) - src << ""+pick("You black out!", "You feel like you could die any moment now.", "You're about to lose consciousness.") - Paralyse(5) - - if(shock_stage == 150) - emote("me",1,"can no longer stand, collapsing!") Weaken(20) - if(shock_stage >= 150) + if(shock_stage >= 80) + if (prob(5)) + src << ""+pick("The pain is excrutiating!", "Please, just end the pain!", "Your whole body is going numb!") Weaken(20) + if(shock_stage >= 120) + if (prob(2)) + src << ""+pick("You black out!", "You feel like you could die any moment now.", "You're about to lose consciousness.") + Paralyse(5) - proc/handle_pulse() + if(shock_stage == 150) + emote("me",1,"can no longer stand, collapsing!") + Weaken(20) - if(life_tick % 5) return pulse //update pulse every 5 life ticks (~1 tick/sec, depending on server load) + if(shock_stage >= 150) + Weaken(20) - if(species && species.flags & NO_BLOOD) return PULSE_NONE //No blood, no pulse. - if(stat == DEAD) - return PULSE_NONE //that's it, you're dead, nothing can influence your pulse +/mob/living/carbon/human/proc/handle_pulse() - if(heart_attack) - return PULSE_NONE + if(life_tick % 5) return pulse //update pulse every 5 life ticks (~1 tick/sec, depending on server load) - var/temp = PULSE_NORM + if(species && species.flags & NO_BLOOD) return PULSE_NONE //No blood, no pulse. - if(round(vessel.get_reagent_amount("blood")) <= BLOOD_VOLUME_BAD) //how much blood do we have - temp = PULSE_THREADY //not enough :( + if(stat == DEAD) + return PULSE_NONE //that's it, you're dead, nothing can influence your pulse - if(status_flags & FAKEDEATH) - temp = PULSE_NONE //pretend that we're dead. unlike actual death, can be inflienced by meds + if(heart_attack) + return PULSE_NONE - for(var/datum/reagent/R in reagents.reagent_list) - if(R.id in bradycardics) - if(temp <= PULSE_THREADY && temp >= PULSE_NORM) - temp-- - break //one reagent is enough - //comment out the breaks to make med effects stack - for(var/datum/reagent/R in reagents.reagent_list) //handles different chems' influence on pulse - if(R.id in tachycardics) - if(temp <= PULSE_FAST && temp >= PULSE_NONE) - temp++ - break - for(var/datum/reagent/R in reagents.reagent_list) //To avoid using fakedeath - if(R.id in heartstopper) + var/temp = PULSE_NORM + + if(round(vessel.get_reagent_amount("blood")) <= BLOOD_VOLUME_BAD) //how much blood do we have + temp = PULSE_THREADY //not enough :( + + if(status_flags & FAKEDEATH) + temp = PULSE_NONE //pretend that we're dead. unlike actual death, can be inflienced by meds + + for(var/datum/reagent/R in reagents.reagent_list) + if(R.id in bradycardics) + if(temp <= PULSE_THREADY && temp >= PULSE_NORM) + temp-- + break //one reagent is enough + //comment out the breaks to make med effects stack + for(var/datum/reagent/R in reagents.reagent_list) //handles different chems' influence on pulse + if(R.id in tachycardics) + if(temp <= PULSE_FAST && temp >= PULSE_NONE) + temp++ + break + for(var/datum/reagent/R in reagents.reagent_list) //To avoid using fakedeath + if(R.id in heartstopper) + temp = PULSE_NONE + break + for(var/datum/reagent/R in reagents.reagent_list) //Conditional heart-stoppage + if(R.id in cheartstopper) + if(R.volume >= R.overdose_threshold) temp = PULSE_NONE break - for(var/datum/reagent/R in reagents.reagent_list) //Conditional heart-stoppage - if(R.id in cheartstopper) - if(R.volume >= R.overdose_threshold) - temp = PULSE_NONE - break - return temp + return temp - proc/handle_decay() - var/decaytime = world.time - timeofdeath +/mob/living/carbon/human/proc/handle_decay() + var/decaytime = world.time - timeofdeath - if(species.flags & IS_SYNTHETIC) - return + if(species.flags & IS_SYNTHETIC) + return - if(reagents.has_reagent("formaldehyde")) //embalming fluid stops decay - return + if(reagents.has_reagent("formaldehyde")) //embalming fluid stops decay + return - if(decaytime <= 6000) //10 minutes for decaylevel1 -- stinky - return + if(decaytime <= 6000) //10 minutes for decaylevel1 -- stinky + return - if(decaytime > 6000 && decaytime <= 12000)//20 minutes for decaylevel2 -- bloated and very stinky - decaylevel = 1 + if(decaytime > 6000 && decaytime <= 12000)//20 minutes for decaylevel2 -- bloated and very stinky + decaylevel = 1 - if(decaytime > 12000 && decaytime <= 18000)//30 minutes for decaylevel3 -- rotting and gross - decaylevel = 2 + if(decaytime > 12000 && decaytime <= 18000)//30 minutes for decaylevel3 -- rotting and gross + decaylevel = 2 - if(decaytime > 18000 && decaytime <= 27000)//45 minutes for decaylevel4 -- skeleton - decaylevel = 3 + if(decaytime > 18000 && decaytime <= 27000)//45 minutes for decaylevel4 -- skeleton + decaylevel = 3 - if(decaytime > 27000) - decaylevel = 4 - makeSkeleton() - return //No puking over skeletons, they don't smell at all! + if(decaytime > 27000) + decaylevel = 4 + makeSkeleton() + return //No puking over skeletons, they don't smell at all! - for(var/mob/living/carbon/human/H in range(decaylevel, src)) - if(prob(5)) - if(airborne_can_reach(get_turf(src), get_turf(H))) - if(istype(loc,/obj/item/bodybag)) - return - var/obj/item/clothing/mask/M = H.wear_mask - if(M && (M.flags & MASKCOVERSMOUTH)) - return - if(H.species && H.species.flags & NO_BREATHE) - return //no puking if you can't smell! - H << "You smell something foul..." - H.fakevomit() - - proc/handle_heartbeat() - var/client/C = src.client - if(C && C.prefs.sound & SOUND_HEARTBEAT) //disable heartbeat by pref - var/obj/item/organ/heart/H = internal_organs_by_name["heart"] - - if(!H) //H.status will runtime if there is no H (obviously) - return - - if(H.status & ORGAN_ROBOT) //Handle robotic hearts specially with a wuuuubb. This also applies to machine-people. - if(shock_stage >= 10 || istype(get_turf(src), /turf/space)) - //PULSE_THREADY - maximum value for pulse, currently it 5. - //High pulse value corresponds to a fast rate of heartbeat. - //Divided by 2, otherwise it is too slow. - var/rate = (PULSE_THREADY - 2)/2 //machine people (main target) have no pulse, manually subtract standard human pulse (2). Mechanic-heart humans probably have a pulse, but 'advanced neural systems' keep the heart rate steady, or something - - if(heartbeat >= rate) - heartbeat = 0 - src << sound('sound/effects/electheart.ogg',0,0,0,30) //Credit to GhostHack (www.ghosthack.de) for sound. - else - heartbeat++ + for(var/mob/living/carbon/human/H in range(decaylevel, src)) + if(prob(5)) + if(airborne_can_reach(get_turf(src), get_turf(H))) + if(istype(loc,/obj/item/bodybag)) return - return + var/obj/item/clothing/mask/M = H.wear_mask + if(M && (M.flags & MASKCOVERSMOUTH)) + return + if(H.species && H.species.flags & NO_BREATHE) + return //no puking if you can't smell! + H << "You smell something foul..." + H.fakevomit() - if(pulse == PULSE_NONE) - return +/mob/living/carbon/human/proc/handle_heartbeat() + var/client/C = src.client + if(C && C.prefs.sound & SOUND_HEARTBEAT) //disable heartbeat by pref + var/obj/item/organ/heart/H = internal_organs_by_name["heart"] - if(pulse >= PULSE_2FAST || shock_stage >= 10 || istype(get_turf(src), /turf/space)) + if(!H) //H.status will runtime if there is no H (obviously) + return + + if(H.status & ORGAN_ROBOT) //Handle robotic hearts specially with a wuuuubb. This also applies to machine-people. + if(shock_stage >= 10 || istype(get_turf(src), /turf/space)) //PULSE_THREADY - maximum value for pulse, currently it 5. //High pulse value corresponds to a fast rate of heartbeat. //Divided by 2, otherwise it is too slow. - var/rate = (PULSE_THREADY - pulse)/2 + var/rate = (PULSE_THREADY - 2)/2 //machine people (main target) have no pulse, manually subtract standard human pulse (2). Mechanic-heart humans probably have a pulse, but 'advanced neural systems' keep the heart rate steady, or something if(heartbeat >= rate) heartbeat = 0 - if(H.status & ORGAN_ASSISTED) - src << sound('sound/effects/pacemakebeat.ogg',0,0,0,50) - else - src << sound('sound/effects/singlebeat.ogg',0,0,0,50) + src << sound('sound/effects/electheart.ogg',0,0,0,30) //Credit to GhostHack (www.ghosthack.de) for sound. else heartbeat++ + return + return + + if(pulse == PULSE_NONE) + return + + if(pulse >= PULSE_2FAST || shock_stage >= 10 || istype(get_turf(src), /turf/space)) + //PULSE_THREADY - maximum value for pulse, currently it 5. + //High pulse value corresponds to a fast rate of heartbeat. + //Divided by 2, otherwise it is too slow. + var/rate = (PULSE_THREADY - pulse)/2 + + if(heartbeat >= rate) + heartbeat = 0 + if(H.status & ORGAN_ASSISTED) + src << sound('sound/effects/pacemakebeat.ogg',0,0,0,50) + else + src << sound('sound/effects/singlebeat.ogg',0,0,0,50) + else + heartbeat++ /* Called by life(), instead of having the individual hud items update icons each tick and check for status changes