Ugh another big 'Carn broke everything' commit.

Tried to standardise the (confusing as all hell) handle_regular_status_updates() procs for monkeys alien/humanoid, alien/larva, brains and humans.

Removed clamp_values as per Rockdtben's request.

Hopefully this should make those procs a lot easier to read and work with as well as reduce the number of calculations done every call.

Admin's rejuvinate verb cures disabilities, sdisabilities and sight/hearing.

Xenos can actually use their sleeping icon properly now.

If I've broken anything let me know directly and I'll have it fixed/reverted within 24 hours.

git-svn-id: http://tgstation13.googlecode.com/svn/trunk@3933 316c924e-a436-60f5-8080-3fe189b3f50e
This commit is contained in:
elly1989@rocketmail.com
2012-06-27 19:47:17 +00:00
parent 1cd5085a0f
commit ea333ff216
11 changed files with 1294 additions and 1413 deletions
@@ -533,11 +533,12 @@ In all, this is a lot like the monkey code. /N
return
/mob/living/carbon/alien/humanoid/updatehealth()
if (nodamage == 0)
//oxyloss is only used for suicide
//toxloss isn't used for aliens, its actually used as alien powers!!
health = 100 - getOxyLoss() - getFireLoss() - getBruteLoss()
else
if(nodamage)
health = 100
stat = 0
else
//oxyloss is only used for suicide
//toxloss isn't used for aliens, its actually used as alien powers!!
health = 100 - getOxyLoss() - getFireLoss() - getBruteLoss()
@@ -12,12 +12,12 @@
set invisibility = 0
set background = 1
if (src.monkeyizing)
if (monkeyizing)
return
..()
if (src.stat != DEAD) //still breathing
if (stat != DEAD) //still breathing
//First, resolve location and get a breath
@@ -34,7 +34,7 @@
//blinded get reset each cycle and then get activated later in the
//code. Very ugly. I dont care. Moving this stuff here so its easy
//to find it.
src.blinded = null
blinded = null
//Disease Check
handle_virus_updates()
@@ -59,8 +59,6 @@
//Status updates, death etc.
handle_regular_status_updates()
// Yup.
update_canmove()
// Grabbing
@@ -70,501 +68,477 @@
if(client)
handle_regular_hud_updates()
clamp_values()
/mob/living/carbon/alien/humanoid
proc
clamp_values()
proc/handle_disabilities()
if (disabilities & 2)
if ((prob(1) && paralysis < 10 && r_epil < 1))
src << "\red You have a seizure!"
Paralyse(10)
if (disabilities & 4)
if ((prob(5) && paralysis <= 1 && r_ch_cou < 1))
drop_item()
spawn( 0 )
emote("cough")
return
if (disabilities & 8)
if ((prob(10) && paralysis <= 1 && r_Tourette < 1))
Stun(10)
spawn( 0 )
emote("twitch")
return
if (disabilities & 16)
if (prob(10))
stuttering = max(10, stuttering)
// SetStunned(min(stunned, 20))
SetParalysis(min(paralysis, 20))
// SetWeakened(min(weakened, 20))
sleeping = max(min(sleeping, 20), 0)
adjustBruteLoss(0)
adjustToxLoss(0)
adjustOxyLoss(0)
adjustFireLoss(0)
proc/update_mind()
if(!mind && client)
mind = new
mind.current = src
mind.assigned_role = "Hunter"
mind.key = key
proc/handle_mutations_and_radiation()
handle_disabilities()
if(getFireLoss())
if((COLD_RESISTANCE in mutations) || prob(50))
switch(getFireLoss())
if(1 to 50)
adjustFireLoss(-1)
if(51 to 100)
adjustFireLoss(-5)
if (src.disabilities & 2)
if ((prob(1) && src.paralysis < 10 && src.r_epil < 1))
src << "\red You have a seizure!"
Paralyse(10)
if (src.disabilities & 4)
if ((prob(5) && src.paralysis <= 1 && src.r_ch_cou < 1))
src.drop_item()
spawn( 0 )
emote("cough")
return
if (src.disabilities & 8)
if ((prob(10) && src.paralysis <= 1 && src.r_Tourette < 1))
Stun(10)
spawn( 0 )
emote("twitch")
return
if (src.disabilities & 16)
if (prob(10))
src.stuttering = max(10, src.stuttering)
if ((HULK in mutations) && health <= 25)
mutations.Remove(HULK)
src << "\red You suddenly feel very weak."
Weaken(3)
emote("collapse")
update_mind()
if(!mind && client)
mind = new
mind.current = src
mind.assigned_role = "Hunter"
mind.key = key
handle_mutations_and_radiation()
if(src.getFireLoss())
if((COLD_RESISTANCE in src.mutations) || prob(50))
switch(src.getFireLoss())
if(1 to 50)
src.adjustFireLoss(-1)
if(51 to 100)
src.adjustFireLoss(-5)
if ((HULK in src.mutations) && src.health <= 25)
src.mutations.Remove(HULK)
src << "\red You suddenly feel very weak."
Weaken(3)
if (radiation)
if (radiation > 100)
radiation = 100
Weaken(10)
src << "\red You feel weak."
emote("collapse")
if (src.radiation)
if (src.radiation > 100)
src.radiation = 100
Weaken(10)
src << "\red You feel weak."
emote("collapse")
if (radiation < 0)
radiation = 0
if (src.radiation < 0)
src.radiation = 0
switch(radiation)
if(1 to 49)
radiation--
if(prob(25))
adjustToxLoss(1)
updatehealth()
switch(src.radiation)
if(1 to 49)
src.radiation--
if(prob(25))
src.adjustToxLoss(1)
src.updatehealth()
if(50 to 74)
radiation -= 2
adjustToxLoss(1)
if(prob(5))
radiation -= 5
Weaken(3)
src << "\red You feel weak."
emote("collapse")
updatehealth()
if(50 to 74)
src.radiation -= 2
src.adjustToxLoss(1)
if(prob(5))
src.radiation -= 5
Weaken(3)
src << "\red You feel weak."
emote("collapse")
src.updatehealth()
if(75 to 100)
src.radiation -= 3
src.adjustToxLoss(3)
if(prob(1))
src << "\red You mutate!"
randmutb(src)
domutcheck(src,null)
emote("gasp")
src.updatehealth()
if(75 to 100)
radiation -= 3
adjustToxLoss(3)
if(prob(1))
src << "\red You mutate!"
randmutb(src)
domutcheck(src,null)
emote("gasp")
updatehealth()
breathe()
if(src.reagents)
if(src.reagents.has_reagent("lexorin")) return
if(istype(loc, /obj/machinery/atmospherics/unary/cryo_cell)) return
proc/breathe()
if(reagents)
if(reagents.has_reagent("lexorin")) return
if(istype(loc, /obj/machinery/atmospherics/unary/cryo_cell)) return
var/datum/gas_mixture/environment = loc.return_air()
var/datum/air_group/breath
// HACK NEED CHANGING LATER
if(src.health < 0)
src.losebreath++
var/datum/gas_mixture/environment = loc.return_air()
var/datum/air_group/breath
// HACK NEED CHANGING LATER
if(health < 0)
losebreath++
if(losebreath>0) //Suffocating so do not take a breath
src.losebreath--
if (prob(75)) //High chance of gasping for air
spawn emote("gasp")
if(losebreath>0) //Suffocating so do not take a breath
losebreath--
if (prob(75)) //High chance of gasping for air
spawn emote("gasp")
if(istype(loc, /obj/))
var/obj/location_as_object = loc
location_as_object.handle_internal_lifeform(src, 0)
else
//First, check for air from internal atmosphere (using an air tank and mask generally)
breath = get_breath_from_internal(BREATH_VOLUME)
//No breath from internal atmosphere so get breath from location
if(!breath)
if(istype(loc, /obj/))
var/obj/location_as_object = loc
breath = location_as_object.handle_internal_lifeform(src, BREATH_VOLUME)
else if(istype(loc, /turf/))
var/breath_moles = 0
/*if(environment.return_pressure() > ONE_ATMOSPHERE)
// Loads of air around (pressure effect will be handled elsewhere), so lets just take a enough to fill our lungs at normal atmos pressure (using n = Pv/RT)
breath_moles = (ONE_ATMOSPHERE*BREATH_VOLUME/R_IDEAL_GAS_EQUATION*environment.temperature)
else*/
// Not enough air around, take a percentage of what's there to model this properly
breath_moles = environment.total_moles()*BREATH_PERCENTAGE
breath = loc.remove_air(breath_moles)
// Handle chem smoke effect -- Doohl
for(var/obj/effect/effect/chem_smoke/smoke in view(1, src))
if(smoke.reagents.total_volume)
smoke.reagents.reaction(src, INGEST)
spawn(5)
if(smoke)
smoke.reagents.copy_to(src, 10) // I dunno, maybe the reagents enter the blood stream through the lungs?
break // If they breathe in the nasty stuff once, no need to continue checking
else //Still give containing object the chance to interact
if(istype(loc, /obj/))
var/obj/location_as_object = loc
location_as_object.handle_internal_lifeform(src, 0)
else
//First, check for air from internal atmosphere (using an air tank and mask generally)
breath = get_breath_from_internal(BREATH_VOLUME)
//No breath from internal atmosphere so get breath from location
if(!breath)
if(istype(loc, /obj/))
var/obj/location_as_object = loc
breath = location_as_object.handle_internal_lifeform(src, BREATH_VOLUME)
else if(istype(loc, /turf/))
var/breath_moles = 0
/*if(environment.return_pressure() > ONE_ATMOSPHERE)
// Loads of air around (pressure effect will be handled elsewhere), so lets just take a enough to fill our lungs at normal atmos pressure (using n = Pv/RT)
breath_moles = (ONE_ATMOSPHERE*BREATH_VOLUME/R_IDEAL_GAS_EQUATION*environment.temperature)
else*/
// Not enough air around, take a percentage of what's there to model this properly
breath_moles = environment.total_moles()*BREATH_PERCENTAGE
handle_breath(breath)
breath = loc.remove_air(breath_moles)
// Handle chem smoke effect -- Doohl
for(var/obj/effect/effect/chem_smoke/smoke in view(1, src))
if(smoke.reagents.total_volume)
smoke.reagents.reaction(src, INGEST)
spawn(5)
if(smoke)
smoke.reagents.copy_to(src, 10) // I dunno, maybe the reagents enter the blood stream through the lungs?
break // If they breathe in the nasty stuff once, no need to continue checking
if(breath)
loc.assume_air(breath)
else //Still give containing object the chance to interact
if(istype(loc, /obj/))
var/obj/location_as_object = loc
location_as_object.handle_internal_lifeform(src, 0)
handle_breath(breath)
if(breath)
loc.assume_air(breath)
get_breath_from_internal(volume_needed)
proc/get_breath_from_internal(volume_needed)
if(internal)
if (!contents.Find(internal))
internal = null
if (!wear_mask || !(wear_mask.flags & MASKINTERNALS) )
internal = null
if(internal)
if (!contents.Find(src.internal))
internal = null
if (!wear_mask || !(wear_mask.flags & MASKINTERNALS) )
internal = null
if(internal)
if (src.internals)
src.internals.icon_state = "internal1"
return internal.remove_air_volume(volume_needed)
else
if (src.internals)
src.internals.icon_state = "internal0"
return null
if (internals)
internals.icon_state = "internal1"
return internal.remove_air_volume(volume_needed)
else
if (internals)
internals.icon_state = "internal0"
return null
handle_breath(datum/gas_mixture/breath)
if(src.nodamage)
return
proc/handle_breath(datum/gas_mixture/breath)
if(nodamage)
return
if(!breath || (breath.total_moles() == 0))
//Aliens breathe in vaccuum
return 0
if(!breath || (breath.total_moles() == 0))
//Aliens breathe in vaccuum
return 0
var/toxins_used = 0
var/breath_pressure = (breath.total_moles()*R_IDEAL_GAS_EQUATION*breath.temperature)/BREATH_VOLUME
var/toxins_used = 0
var/breath_pressure = (breath.total_moles()*R_IDEAL_GAS_EQUATION*breath.temperature)/BREATH_VOLUME
//Partial pressure of the toxins in our breath
var/Toxins_pp = (breath.toxins/breath.total_moles())*breath_pressure
//Partial pressure of the toxins in our breath
var/Toxins_pp = (breath.toxins/breath.total_moles())*breath_pressure
if(Toxins_pp) // Detect toxins in air
if(Toxins_pp) // Detect toxins in air
adjustToxLoss(breath.toxins*250)
toxins_alert = max(toxins_alert, 1)
adjustToxLoss(breath.toxins*250)
toxins_alert = max(toxins_alert, 1)
toxins_used = breath.toxins
toxins_used = breath.toxins
else
toxins_alert = 0
//Breathe in toxins and out oxygen
breath.toxins -= toxins_used
breath.oxygen += toxins_used
if(breath.temperature > (T0C+66) && !(COLD_RESISTANCE in mutations)) // Hot air hurts :(
if(prob(20))
src << "\red You feel a searing heat in your lungs!"
fire_alert = max(fire_alert, 1)
else
fire_alert = 0
//Temporary fixes to the alerts.
return 1
proc/handle_environment()
//If there are alien weeds on the ground then heal if needed or give some toxins
if(locate(/obj/effect/alien/weeds) in loc)
if(health >= 100)
adjustToxLoss(15)
else
toxins_alert = 0
//Breathe in toxins and out oxygen
breath.toxins -= toxins_used
breath.oxygen += toxins_used
if(breath.temperature > (T0C+66) && !(COLD_RESISTANCE in src.mutations)) // Hot air hurts :(
if(prob(20))
src << "\red You feel a searing heat in your lungs!"
fire_alert = max(fire_alert, 1)
else
fire_alert = 0
//Temporary fixes to the alerts.
return 1
handle_environment()
//If there are alien weeds on the ground then heal if needed or give some toxins
if(locate(/obj/effect/alien/weeds) in loc)
if(health >= 100)
adjustToxLoss(15)
else
adjustBruteLoss(-15)
adjustFireLoss(-15)
adjustBruteLoss(-15)
adjustFireLoss(-15)
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/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
get_thermal_protection()
var/thermal_protection = 1.0
//Handle normal clothing
if(head && (head.body_parts_covered & HEAD))
thermal_protection += 0.5
if(wear_suit && (wear_suit.body_parts_covered & UPPER_TORSO))
thermal_protection += 0.5
if(wear_suit && (wear_suit.body_parts_covered & LEGS))
thermal_protection += 0.2
if(wear_suit && (wear_suit.body_parts_covered & ARMS))
thermal_protection += 0.2
if(wear_suit && (wear_suit.body_parts_covered & HANDS))
thermal_protection += 0.2
if(wear_suit && (wear_suit.flags & SUITSPACE))
thermal_protection += 3
if(COLD_RESISTANCE in src.mutations)
thermal_protection += 5
proc/get_thermal_protection()
var/thermal_protection = 1.0
//Handle normal clothing
if(head && (head.body_parts_covered & HEAD))
thermal_protection += 0.5
if(wear_suit && (wear_suit.body_parts_covered & UPPER_TORSO))
thermal_protection += 0.5
if(wear_suit && (wear_suit.body_parts_covered & LEGS))
thermal_protection += 0.2
if(wear_suit && (wear_suit.body_parts_covered & ARMS))
thermal_protection += 0.2
if(wear_suit && (wear_suit.body_parts_covered & HANDS))
thermal_protection += 0.2
if(wear_suit && (wear_suit.flags & SUITSPACE))
thermal_protection += 3
if(COLD_RESISTANCE in mutations)
thermal_protection += 5
return thermal_protection
return thermal_protection
add_fire_protection(var/temp)
var/fire_prot = 0
if(head)
if(head.protective_temperature > temp)
fire_prot += (head.protective_temperature/10)
if(wear_mask)
if(wear_mask.protective_temperature > temp)
fire_prot += (wear_mask.protective_temperature/10)
if(wear_suit)
if(wear_suit.protective_temperature > temp)
fire_prot += (wear_suit.protective_temperature/10)
proc/add_fire_protection(var/temp)
var/fire_prot = 0
if(head)
if(head.protective_temperature > temp)
fire_prot += (head.protective_temperature/10)
if(wear_mask)
if(wear_mask.protective_temperature > temp)
fire_prot += (wear_mask.protective_temperature/10)
if(wear_suit)
if(wear_suit.protective_temperature > temp)
fire_prot += (wear_suit.protective_temperature/10)
return fire_prot
return fire_prot
handle_chemicals_in_body()
proc/handle_chemicals_in_body()
if(reagents) reagents.metabolize(src)
if(reagents) reagents.metabolize(src)
if(FAT in mutations)
if(nutrition < 100)
if(prob(round((50 - src.nutrition) / 100)))
src << "\blue You feel fit again!"
src.mutations.Remove(FAT)
else
if(nutrition > 500)
if(prob(5 + round((src.nutrition - 200) / 2)))
src << "\red You suddenly feel blubbery!"
src.mutations.Add(FAT)
if(FAT in mutations)
if(nutrition < 100)
if(prob(round((50 - nutrition) / 100)))
src << "\blue You feel fit again!"
mutations.Remove(FAT)
else
if(nutrition > 500)
if(prob(5 + round((nutrition - 200) / 2)))
src << "\red You suddenly feel blubbery!"
mutations.Add(FAT)
if (src.nutrition > 0)
src.nutrition -= HUNGER_FACTOR
if (nutrition > 0)
nutrition -= HUNGER_FACTOR
if (src.drowsyness)
src.drowsyness--
src.eye_blurry = max(2, src.eye_blurry)
if (prob(5))
src.sleeping += 1
src.Paralyse(5)
if (drowsyness)
drowsyness--
eye_blurry = max(2, eye_blurry)
if (prob(5))
sleeping += 1
Paralyse(5)
confused = max(0, confused - 1)
// decrement dizziness counter, clamped to 0
if(resting)
dizziness = max(0, dizziness - 5)
jitteriness = max(0, jitteriness - 5)
else
dizziness = max(0, dizziness - 1)
jitteriness = max(0, jitteriness - 1)
confused = max(0, confused - 1)
// decrement dizziness counter, clamped to 0
if(resting)
dizziness = max(0, dizziness - 5)
jitteriness = max(0, jitteriness - 5)
else
dizziness = max(0, dizziness - 1)
jitteriness = max(0, jitteriness - 1)
src.updatehealth()
updatehealth()
return //TODO: DEFERRED
return //TODO: DEFERRED
handle_regular_status_updates()
health = 100 - (getOxyLoss() + getFireLoss() + getBruteLoss() + getCloneLoss())
proc/handle_regular_status_updates()
updatehealth()
if(getOxyLoss() > 50) Paralyse(3)
if(stat == DEAD) //DEAD. BROWN BREAD. SWIMMING WITH THE SPESS CARP
blinded = 1
silent = 0
else //ALIVE. LIGHTS ARE ON
if(health < config.health_threshold_dead || brain_op_stage == 4.0)
death()
blinded = 1
stat = DEAD
silent = 0
return 1
if(src.sleeping)
//UNCONSCIOUS. NO-ONE IS HOME
if( (getOxyLoss() > 50) || (config.health_threshold_crit > health) )
if( health <= 20 && prob(1) )
spawn(0)
emote("gasp")
if(!reagents.has_reagent("inaprovaline"))
adjustOxyLoss(1)
Paralyse(3)
//if (prob(10) && health) emote("snore") //Invalid emote for aliens, but it might be worth making sleep noticeable somehow -Yvarov
src.sleeping--
// if(src.resting)
// Weaken(5)
if(paralysis)
AdjustParalysis(-1)
blinded = 1
stat = UNCONSCIOUS
else if(sleeping)
sleeping = max(sleeping-1, 0)
blinded = 1
stat = UNCONSCIOUS
if( prob(10) && health )
spawn(0)
emote("hiss")
//CONSCIOUS
else
stat = CONSCIOUS
/* What in the living hell is this?*/
if(move_delay_add > 0)
move_delay_add = max(0, move_delay_add - rand(1, 2))
if(health < config.health_threshold_dead || src.brain_op_stage == 4.0)
death()
else if(src.health < config.health_threshold_crit)
if(src.health <= 20 && prob(1)) spawn(0) emote("gasp")
//Eyes
if(sdisabilities & 1) //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(eye_blurry) //blurry eyes heal slowly
eye_blurry = max(eye_blurry-1, 0)
//if(!src.rejuv) src.oxyloss++
if(!src.reagents.has_reagent("inaprovaline")) src.adjustOxyLoss(1)
//Ears
if(sdisabilities & 4) //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(ear_damage < 25) //ear damage heals slowly under this threshold. otherwise you'll need earmuffs
ear_damage = max(ear_damage-0.05, 0)
if(src.stat != 2) src.stat = 1
Paralyse(5)
//Other
if(stunned)
AdjustStunned(-1)
if (src.stat != DEAD) //Alive.
if(weakened)
weakened = max(weakened-1,0) //before you get mad Rockdtben: I done this so update_canmove isn't called multiple times
if (resting || src.paralysis || src.stunned || src.weakened) //Stunned etc.
if (resting)
src.lying = 1
if (src.stunned > 0)
AdjustStunned(-1)
src.stat = 0
if (src.weakened > 0)
AdjustWeakened(-1)
src.lying = 1
src.stat = 0
if (src.paralysis > 0)
AdjustParalysis(-1)
src.blinded = 1
src.lying = 1
src.stat = 1
drop_item()
hand = !hand
drop_item()
hand = !hand
if(stuttering)
stuttering = max(stuttering-1, 0)
else //Not stunned.
src.lying = 0
src.stat = 0
if(silent)
silent = max(silent-1, 0)
else //Dead.
src.lying = 1
src.blinded = 1
src.stat = 2
if (src.stuttering) src.stuttering--
if (src.eye_blind)
src.eye_blind--
src.blinded = 1
if (src.ear_deaf > 0) src.ear_deaf--
if (src.ear_damage < 25)
src.ear_damage -= 0.05
src.ear_damage = max(src.ear_damage, 0)
src.density = !( src.lying )
if ((src.sdisabilities & 1))
src.blinded = 1
if ((src.sdisabilities & 4))
src.ear_deaf = 1
if (src.eye_blurry > 0)
src.eye_blurry--
src.eye_blurry = max(0, src.eye_blurry)
if (src.druggy > 0)
src.druggy--
src.druggy = max(0, src.druggy)
return 1
handle_regular_hud_updates()
if (src.stat == 2 || (XRAY in src.mutations))
src.sight |= SEE_TURFS
src.sight |= SEE_MOBS
src.sight |= SEE_OBJS
src.see_in_dark = 8
src.see_invisible = 2
else if (src.stat != 2)
src.sight |= SEE_MOBS
src.sight &= ~SEE_TURFS
src.sight &= ~SEE_OBJS
src.see_in_dark = 4
src.see_invisible = 2
if (src.sleep) src.sleep.icon_state = text("sleep[]", src.sleeping)
if (src.rest) src.rest.icon_state = text("rest[]", src.resting)
if (src.healths)
if (src.stat != 2)
switch(health)
if(100 to INFINITY)
src.healths.icon_state = "health0"
if(75 to 100)
src.healths.icon_state = "health1"
if(50 to 75)
src.healths.icon_state = "health2"
if(25 to 50)
src.healths.icon_state = "health3"
if(0 to 25)
src.healths.icon_state = "health4"
else
src.healths.icon_state = "health5"
else
src.healths.icon_state = "health6"
if(src.pullin) src.pullin.icon_state = "pull[src.pulling ? 1 : 0]"
if(druggy)
druggy = max(druggy-1, 0)
return 1
if (src.toxin) src.toxin.icon_state = "tox[src.toxins_alert ? 1 : 0]"
if (src.oxygen) src.oxygen.icon_state = "oxy[src.oxygen_alert ? 1 : 0]"
if (src.fire) src.fire.icon_state = "fire[src.fire_alert ? 1 : 0]"
//NOTE: the alerts dont reset when youre out of danger. dont blame me,
//blame the person who coded them. Temporary fix added.
proc/handle_regular_hud_updates()
src.client.screen -= src.hud_used.blurry
src.client.screen -= src.hud_used.druggy
src.client.screen -= src.hud_used.vimpaired
if (stat == 2 || (XRAY in mutations))
sight |= SEE_TURFS
sight |= SEE_MOBS
sight |= SEE_OBJS
see_in_dark = 8
see_invisible = 2
else if (stat != 2)
sight |= SEE_MOBS
sight &= ~SEE_TURFS
sight &= ~SEE_OBJS
see_in_dark = 4
see_invisible = 2
if ((src.blind && src.stat != 2))
if ((src.blinded))
src.blind.layer = 18
else
src.blind.layer = 0
if (sleep) sleep.icon_state = text("sleep[]", sleeping)
if (rest) rest.icon_state = text("rest[]", resting)
if (src.disabilities & 1)
src.client.screen += src.hud_used.vimpaired
if (healths)
if (stat != 2)
switch(health)
if(100 to INFINITY)
healths.icon_state = "health0"
if(75 to 100)
healths.icon_state = "health1"
if(50 to 75)
healths.icon_state = "health2"
if(25 to 50)
healths.icon_state = "health3"
if(0 to 25)
healths.icon_state = "health4"
else
healths.icon_state = "health5"
else
healths.icon_state = "health6"
if (src.eye_blurry)
src.client.screen += src.hud_used.blurry
if(pullin) pullin.icon_state = "pull[pulling ? 1 : 0]"
if (src.druggy)
src.client.screen += src.hud_used.druggy
if (src.stat != 2)
if (src.machine)
if (!( src.machine.check_eye(src) ))
src.reset_view(null)
else
if(!client.adminobs)
reset_view(null)
if (toxin) toxin.icon_state = "tox[toxins_alert ? 1 : 0]"
if (oxygen) oxygen.icon_state = "oxy[oxygen_alert ? 1 : 0]"
if (fire) fire.icon_state = "fire[fire_alert ? 1 : 0]"
//NOTE: the alerts dont reset when youre out of danger. dont blame me,
//blame the person who coded them. Temporary fix added.
return 1
client.screen -= hud_used.blurry
client.screen -= hud_used.druggy
client.screen -= hud_used.vimpaired
handle_virus_updates()
if(src.bodytemperature > 406)
for(var/datum/disease/D in viruses)
D.cure()
return
if ((blind && stat != 2))
if ((blinded))
blind.layer = 18
else
blind.layer = 0
handle_stomach()
spawn(0)
for(var/mob/M in stomach_contents)
if(M.loc != src)
if (disabilities & 1)
client.screen += hud_used.vimpaired
if (eye_blurry)
client.screen += hud_used.blurry
if (druggy)
client.screen += hud_used.druggy
if (stat != 2)
if (machine)
if (!( machine.check_eye(src) ))
reset_view(null)
else
if(!client.adminobs)
reset_view(null)
return 1
proc/handle_virus_updates()
if(bodytemperature > 406)
for(var/datum/disease/D in viruses)
D.cure()
return
proc/handle_stomach()
spawn(0)
for(var/mob/M in stomach_contents)
if(M.loc != src)
stomach_contents.Remove(M)
continue
if(istype(M, /mob/living/carbon) && stat != 2)
if(M.stat == 2)
M.death(1)
stomach_contents.Remove(M)
del(M)
continue
if(istype(M, /mob/living/carbon) && src.stat != 2)
if(M.stat == 2)
M.death(1)
stomach_contents.Remove(M)
del(M)
continue
if(air_master.current_cycle%3==1)
if(!M.nodamage)
M.adjustBruteLoss(5)
src.nutrition += 10
if(air_master.current_cycle%3==1)
if(!M.nodamage)
M.adjustBruteLoss(5)
nutrition += 10
@@ -469,14 +469,13 @@
return
/mob/living/carbon/alien/larva/updatehealth()
if (nodamage == 0)
//oxyloss is only used for suicide
//toxloss isn't used for aliens, its actually used as alien powers!!
health = 25 - getOxyLoss() - getFireLoss() - getBruteLoss()
else
if(nodamage)
health = 25
stat = 0
else
//oxyloss is only used for suicide
//toxloss isn't used for aliens, its actually used as alien powers!!
health = 25 - getOxyLoss() - getFireLoss() - getBruteLoss() - getCloneLoss()
/* Commented out because it's duplicated in life.dm
/mob/living/carbon/alien/larva/proc/grow() // Larvae can grow into full fledged Xenos if they survive long enough -- TLE
+341 -365
View File
@@ -54,11 +54,8 @@
//stuff in the stomach
handle_stomach()
//Status updates, death etc.
handle_regular_status_updates()
//Handles updating canmove.
update_canmove()
// Grabbing
@@ -68,432 +65,411 @@
if(client)
handle_regular_hud_updates()
clamp_values()
/mob/living/carbon/alien/larva
proc
clamp_values()
proc/handle_mutations_and_radiation()
// SetStunned(min(stunned, 20))
SetParalysis(min(paralysis, 20))
// SetWeakened(min(weakened, 20))
sleeping = max(min(sleeping, 20), 0)
if(amount_grown == 200)
src << "\green You are growing into a beautiful alien! It is time to choose a caste."
src << "\green There are three to choose from:"
src << "\green <B>Hunters</B> are strong and agile, able to hunt away from the hive and rapidly move through ventilation shafts. Hunters generate plasma slowly and have low reserves."
src << "\green <B>Sentinels</B> are tasked with protecting the hive and are deadly up close and at a range. They are not as physically imposing nor fast as the hunters."
src << "\green <B>Drones</B> are the working class, offering the largest plasma storage and generation. They are the only caste which may evolve again, turning into the dreaded alien queen."
var/alien_caste = alert(src, "Please choose which alien caste you shall belong to.",,"Hunter","Sentinel","Drone")
handle_mutations_and_radiation()
var/mob/living/carbon/alien/humanoid/new_xeno
switch(alien_caste)
if("Hunter")
new_xeno = new /mob/living/carbon/alien/humanoid/hunter (loc)
if("Sentinel")
new_xeno = new /mob/living/carbon/alien/humanoid/sentinel (loc)
if("Drone")
new_xeno = new /mob/living/carbon/alien/humanoid/drone (loc)
if(amount_grown == 200)
src << "\green You are growing into a beautiful alien! It is time to choose a caste."
src << "\green There are three to choose from:"
src << "\green <B>Hunters</B> are strong and agile, able to hunt away from the hive and rapidly move through ventilation shafts. Hunters generate plasma slowly and have low reserves."
src << "\green <B>Sentinels</B> are tasked with protecting the hive and are deadly up close and at a range. They are not as physically imposing nor fast as the hunters."
src << "\green <B>Drones</B> are the working class, offering the largest plasma storage and generation. They are the only caste which may evolve again, turning into the dreaded alien queen."
var/alien_caste = alert(src, "Please choose which alien caste you shall belong to.",,"Hunter","Sentinel","Drone")
new_xeno.mind_initialize(src, alien_caste)
new_xeno.key = key
var/mob/living/carbon/alien/humanoid/new_xeno
switch(alien_caste)
if("Hunter")
new_xeno = new /mob/living/carbon/alien/humanoid/hunter (loc)
if("Sentinel")
new_xeno = new /mob/living/carbon/alien/humanoid/sentinel (loc)
if("Drone")
new_xeno = new /mob/living/carbon/alien/humanoid/drone (loc)
del(src)
return
//grow!! but not if metroid or dead
if(health>-100)
amount_grown++
new_xeno.mind_initialize(src, alien_caste)
new_xeno.key = key
if (radiation)
if (radiation > 100)
radiation = 100
Weaken(10)
src << "\red You feel weak."
emote("collapse")
del(src)
return
//grow!! but not if metroid or dead
if(health>-100)
amount_grown++
if (radiation < 0)
radiation = 0
if (radiation)
if (radiation > 100)
radiation = 100
Weaken(10)
src << "\red You feel weak."
emote("collapse")
if (radiation < 0)
radiation = 0
switch(radiation)
if(1 to 49)
radiation--
if(prob(25))
adjustToxLoss(1)
updatehealth()
if(50 to 74)
radiation -= 2
switch(radiation)
if(1 to 49)
radiation--
if(prob(25))
adjustToxLoss(1)
if(prob(5))
radiation -= 5
Weaken(3)
src << "\red You feel weak."
emote("collapse")
updatehealth()
if(75 to 100)
radiation -= 3
adjustToxLoss(3)
updatehealth()
if(50 to 74)
radiation -= 2
adjustToxLoss(1)
if(prob(5))
radiation -= 5
Weaken(3)
src << "\red You feel weak."
emote("collapse")
updatehealth()
update_mind()
if(!mind && client)
mind = new
mind.current = src
mind.assigned_role = "Larva"
mind.key = key
if(75 to 100)
radiation -= 3
adjustToxLoss(3)
updatehealth()
breathe()
proc/update_mind()
if(!mind && client)
mind = new
mind.current = src
mind.assigned_role = "Larva"
mind.key = key
if(reagents.has_reagent("lexorin")) return
if(istype(loc, /obj/machinery/atmospherics/unary/cryo_cell)) return
proc/breathe()
var/datum/gas_mixture/environment = loc.return_air()
var/datum/air_group/breath
// HACK NEED CHANGING LATER
if(health < 0)
losebreath++
if(reagents.has_reagent("lexorin")) return
if(istype(loc, /obj/machinery/atmospherics/unary/cryo_cell)) return
if(losebreath>0) //Suffocating so do not take a breath
losebreath--
if (prob(75)) //High chance of gasping for air
spawn emote("gasp")
var/datum/gas_mixture/environment = loc.return_air()
var/datum/air_group/breath
// HACK NEED CHANGING LATER
if(health < 0)
losebreath++
if(losebreath>0) //Suffocating so do not take a breath
losebreath--
if (prob(75)) //High chance of gasping for air
spawn emote("gasp")
if(istype(loc, /obj/))
var/obj/location_as_object = loc
location_as_object.handle_internal_lifeform(src, 0)
else
//First, check for air from internal atmosphere (using an air tank and mask generally)
breath = get_breath_from_internal(BREATH_VOLUME)
//No breath from internal atmosphere so get breath from location
if(!breath)
if(istype(loc, /obj/))
var/obj/location_as_object = loc
breath = location_as_object.handle_internal_lifeform(src, BREATH_VOLUME)
else if(istype(loc, /turf/))
var/breath_moles = 0
/*if(environment.return_pressure() > ONE_ATMOSPHERE)
// Loads of air around (pressure effect will be handled elsewhere), so lets just take a enough to fill our lungs at normal atmos pressure (using n = Pv/RT)
breath_moles = (ONE_ATMOSPHERE*BREATH_VOLUME/R_IDEAL_GAS_EQUATION*environment.temperature)
else*/
// Not enough air around, take a percentage of what's there to model this properly
breath_moles = environment.total_moles()*BREATH_PERCENTAGE
breath = loc.remove_air(breath_moles)
// Handle chem smoke effect -- Doohl
for(var/obj/effect/effect/chem_smoke/smoke in view(1, src))
if(smoke.reagents.total_volume)
smoke.reagents.reaction(src, INGEST)
spawn(5)
if(smoke)
smoke.reagents.copy_to(src, 10) // I dunno, maybe the reagents enter the blood stream through the lungs?
break // If they breathe in the nasty stuff once, no need to continue checking
else //Still give containing object the chance to interact
if(istype(loc, /obj/))
var/obj/location_as_object = loc
location_as_object.handle_internal_lifeform(src, 0)
else
//First, check for air from internal atmosphere (using an air tank and mask generally)
breath = get_breath_from_internal(BREATH_VOLUME)
//No breath from internal atmosphere so get breath from location
if(!breath)
if(istype(loc, /obj/))
var/obj/location_as_object = loc
breath = location_as_object.handle_internal_lifeform(src, BREATH_VOLUME)
else if(istype(loc, /turf/))
var/breath_moles = 0
/*if(environment.return_pressure() > ONE_ATMOSPHERE)
// Loads of air around (pressure effect will be handled elsewhere), so lets just take a enough to fill our lungs at normal atmos pressure (using n = Pv/RT)
breath_moles = (ONE_ATMOSPHERE*BREATH_VOLUME/R_IDEAL_GAS_EQUATION*environment.temperature)
else*/
// Not enough air around, take a percentage of what's there to model this properly
breath_moles = environment.total_moles()*BREATH_PERCENTAGE
handle_breath(breath)
breath = loc.remove_air(breath_moles)
// Handle chem smoke effect -- Doohl
for(var/obj/effect/effect/chem_smoke/smoke in view(1, src))
if(smoke.reagents.total_volume)
smoke.reagents.reaction(src, INGEST)
spawn(5)
if(smoke)
smoke.reagents.copy_to(src, 10) // I dunno, maybe the reagents enter the blood stream through the lungs?
break // If they breathe in the nasty stuff once, no need to continue checking
if(breath)
loc.assume_air(breath)
else //Still give containing object the chance to interact
if(istype(loc, /obj/))
var/obj/location_as_object = loc
location_as_object.handle_internal_lifeform(src, 0)
handle_breath(breath)
if(breath)
loc.assume_air(breath)
get_breath_from_internal(volume_needed)
proc/get_breath_from_internal(volume_needed)
if(internal)
if (!contents.Find(internal))
internal = null
if (!wear_mask || !(wear_mask.flags & MASKINTERNALS) )
internal = null
if(internal)
if (!contents.Find(internal))
internal = null
if (!wear_mask || !(wear_mask.flags & MASKINTERNALS) )
internal = null
if(internal)
if (internals)
internals.icon_state = "internal1"
return internal.remove_air_volume(volume_needed)
else
if (internals)
internals.icon_state = "internal0"
return null
handle_breath(datum/gas_mixture/breath)
if(nodamage)
return
if(!breath || (breath.total_moles() == 0))
//Aliens breathe in vaccuum
return 0
var/toxins_used = 0
var/breath_pressure = (breath.total_moles()*R_IDEAL_GAS_EQUATION*breath.temperature)/BREATH_VOLUME
//Partial pressure of the toxins in our breath
var/Toxins_pp = (breath.toxins/breath.total_moles())*breath_pressure
if(Toxins_pp) // Detect toxins in air
adjustToxLoss(breath.toxins*250)
toxins_alert = max(toxins_alert, 1)
toxins_used = breath.toxins
if (internals)
internals.icon_state = "internal1"
return internal.remove_air_volume(volume_needed)
else
toxins_alert = 0
//Breathe in toxins and out oxygen
breath.toxins -= toxins_used
breath.oxygen += toxins_used
if(breath.temperature > (T0C+66) && !(COLD_RESISTANCE in src.mutations)) // Hot air hurts :(
if(prob(20))
src << "\red You feel a searing heat in your lungs!"
fire_alert = max(fire_alert, 1)
else
fire_alert = 0
//Temporary fixes to the alerts.
return 1
handle_environment()
//If there are alien weeds on the ground then heal if needed or give some toxins
if(locate(/obj/effect/alien/weeds) in loc)
if(health >= 25)
adjustToxLoss(5)
else
adjustBruteLoss(-5)
adjustFireLoss(-5)
if (internals)
internals.icon_state = "internal0"
return null
proc/handle_breath(datum/gas_mixture/breath)
if(nodamage)
return
if(!breath || (breath.total_moles() == 0))
//Aliens breathe in vaccuum
return 0
handle_chemicals_in_body()
if(reagents) reagents.metabolize(src)
var/toxins_used = 0
var/breath_pressure = (breath.total_moles()*R_IDEAL_GAS_EQUATION*breath.temperature)/BREATH_VOLUME
if(FAT in mutations)
if(nutrition < 100)
if(prob(round((50 - nutrition) / 100)))
src << "\blue You feel fit again!"
mutations.Add(FAT)
//Partial pressure of the toxins in our breath
var/Toxins_pp = (breath.toxins/breath.total_moles())*breath_pressure
if(Toxins_pp) // Detect toxins in air
adjustToxLoss(breath.toxins*250)
toxins_alert = max(toxins_alert, 1)
toxins_used = breath.toxins
else
toxins_alert = 0
//Breathe in toxins and out oxygen
breath.toxins -= toxins_used
breath.oxygen += toxins_used
if(breath.temperature > (T0C+66) && !(COLD_RESISTANCE in mutations)) // Hot air hurts :(
if(prob(20))
src << "\red You feel a searing heat in your lungs!"
fire_alert = max(fire_alert, 1)
else
fire_alert = 0
//Temporary fixes to the alerts.
return 1
proc/handle_environment()
//If there are alien weeds on the ground then heal if needed or give some toxins
if(locate(/obj/effect/alien/weeds) in loc)
if(health >= 25)
adjustToxLoss(5)
else
if(nutrition > 500)
if(prob(5 + round((nutrition - 200) / 2)))
src << "\red You suddenly feel blubbery!"
mutations.Add(FAT)
adjustBruteLoss(-5)
adjustFireLoss(-5)
if (nutrition > 0)
nutrition-= HUNGER_FACTOR
return
if (drowsyness)
drowsyness--
eye_blurry = max(2, eye_blurry)
if (prob(5))
sleeping += 1
Paralyse(5)
confused = max(0, confused - 1)
// decrement dizziness counter, clamped to 0
if(resting)
dizziness = max(0, dizziness - 5)
jitteriness = max(0, jitteriness - 5)
else
dizziness = max(0, dizziness - 1)
jitteriness = max(0, jitteriness - 1)
proc/handle_chemicals_in_body()
if(reagents) reagents.metabolize(src)
updatehealth()
if(FAT in mutations)
if(nutrition < 100)
if(prob(round((50 - nutrition) / 100)))
src << "\blue You feel fit again!"
mutations.Add(FAT)
else
if(nutrition > 500)
if(prob(5 + round((nutrition - 200) / 2)))
src << "\red You suddenly feel blubbery!"
mutations.Add(FAT)
return //TODO: DEFERRED
if (nutrition > 0)
nutrition-= HUNGER_FACTOR
handle_regular_status_updates()
if (drowsyness)
drowsyness--
eye_blurry = max(2, eye_blurry)
if (prob(5))
sleeping += 1
Paralyse(5)
health = 25 - (getOxyLoss() + getFireLoss() + getBruteLoss() + getCloneLoss())
confused = max(0, confused - 1)
// decrement dizziness counter, clamped to 0
if(resting)
dizziness = max(0, dizziness - 5)
jitteriness = max(0, jitteriness - 5)
else
dizziness = max(0, dizziness - 1)
jitteriness = max(0, jitteriness - 1)
if(getOxyLoss() > 50) Paralyse(3)
updatehealth()
if(sleeping)
return //TODO: DEFERRED
proc/handle_regular_status_updates()
updatehealth()
if(stat == DEAD) //DEAD. BROWN BREAD. SWIMMING WITH THE SPESS CARP
blinded = 1
silent = 0
else //ALIVE. LIGHTS ARE ON
if(health < config.health_threshold_dead || brain_op_stage == 4.0)
death()
blinded = 1
silent = 0
return 1
//UNCONSCIOUS. NO-ONE IS HOME
if( (getOxyLoss() > 50) || (config.health_threshold_crit > health) )
if( health <= 20 && prob(1) )
spawn(0)
emote("gasp")
if(!reagents.has_reagent("inaprovaline"))
adjustOxyLoss(1)
Paralyse(3)
//if (prob(10) && health) spawn(0) emote("snore") Invalid Emote
sleeping--
if(resting)
Weaken(5)
if(paralysis)
AdjustParalysis(-1)
blinded = 1
stat = UNCONSCIOUS
else if(sleeping)
sleeping = max(sleeping-1, 0)
blinded = 1
stat = UNCONSCIOUS
if( prob(10) && health )
spawn(0)
emote("hiss")
//CONSCIOUS
else
stat = CONSCIOUS
/* What in the living hell is this?*/
if(move_delay_add > 0)
move_delay_add = max(0, move_delay_add - rand(1, 2))
if(health < config.health_threshold_dead || brain_op_stage == 4.0)
death()
else if(health < config.health_threshold_crit)
if(health <= 20 && prob(1)) spawn(0) emote("gasp")
//if(!rejuv) oxyloss++
if(!reagents.has_reagent("inaprovaline")) adjustOxyLoss(1)
if(stat != 2) stat = 1
Paralyse(5)
if (stat != 2) //Alive.
if (paralysis || stunned || weakened) //Stunned etc.
if (stunned > 0)
AdjustStunned(-1)
stat = 0
if (weakened > 0)
AdjustWeakened(-1)
lying = 1
stat = 0
if (paralysis > 0)
AdjustParalysis(-1)
blinded = 1
lying = 1
stat = 1
var/h = hand
hand = 0
drop_item()
hand = 1
drop_item()
hand = h
else //Not stunned.
lying = 0
stat = 0
else //Dead.
lying = 1
//Eyes
if(sdisabilities & 1) //disabled-blind, doesn't get better on its own
blinded = 1
stat = 2
if (stuttering) stuttering--
if (eye_blind)
eye_blind--
else if(eye_blind) //blindness, heals slowly over time
eye_blind = max(eye_blind-1,0)
blinded = 1
else if(eye_blurry) //blurry eyes heal slowly
eye_blurry = max(eye_blurry-1, 0)
if (ear_deaf > 0) ear_deaf--
if (ear_damage < 25)
ear_damage -= 0.05
ear_damage = max(ear_damage, 0)
//Ears
if(sdisabilities & 4) //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(ear_damage < 25) //ear damage heals slowly under this threshold. otherwise you'll need earmuffs
ear_damage = max(ear_damage-0.05, 0)
density = !( lying )
//Other
if(stunned)
AdjustStunned(-1)
if ((sdisabilities & 1))
blinded = 1
if ((sdisabilities & 4))
ear_deaf = 1
if(weakened)
weakened = max(weakened-1,0) //before you get mad Rockdtben: I done this so update_canmove isn't called multiple times
if (eye_blurry > 0)
eye_blurry--
eye_blurry = max(0, eye_blurry)
if(stuttering)
stuttering = max(stuttering-1, 0)
if (druggy > 0)
druggy--
druggy = max(0, druggy)
if(silent)
silent = max(silent-1, 0)
return 1
handle_regular_hud_updates()
if (stat == 2 || (XRAY in src.mutations))
sight |= SEE_TURFS
sight |= SEE_MOBS
sight |= SEE_OBJS
see_in_dark = 8
see_invisible = 2
else if (stat != 2)
sight |= SEE_MOBS
sight &= ~SEE_TURFS
sight &= ~SEE_OBJS
see_in_dark = 4
see_invisible = 2
if (sleep) sleep.icon_state = text("sleep[]", sleeping)
if (rest) rest.icon_state = text("rest[]", resting)
if (healths)
if (stat != 2)
switch(health)
if(25 to INFINITY)
healths.icon_state = "health0"
if(19 to 25)
healths.icon_state = "health1"
if(13 to 19)
healths.icon_state = "health2"
if(7 to 13)
healths.icon_state = "health3"
if(0 to 7)
healths.icon_state = "health4"
else
healths.icon_state = "health5"
else
healths.icon_state = "health6"
if(pullin) pullin.icon_state = "pull[pulling ? 1 : 0]"
if(druggy)
druggy = max(druggy-1, 0)
return 1
if (toxin) toxin.icon_state = "tox[toxins_alert ? 1 : 0]"
if (oxygen) oxygen.icon_state = "oxy[oxygen_alert ? 1 : 0]"
if (fire) fire.icon_state = "fire[fire_alert ? 1 : 0]"
//NOTE: the alerts dont reset when youre out of danger. dont blame me,
//blame the person who coded them. Temporary fix added.
proc/handle_regular_hud_updates()
if (stat == 2 || (XRAY in mutations))
sight |= SEE_TURFS
sight |= SEE_MOBS
sight |= SEE_OBJS
see_in_dark = 8
see_invisible = 2
else if (stat != 2)
sight |= SEE_MOBS
sight &= ~SEE_TURFS
sight &= ~SEE_OBJS
see_in_dark = 4
see_invisible = 2
client.screen -= hud_used.blurry
client.screen -= hud_used.druggy
client.screen -= hud_used.vimpaired
if ((blind && stat != 2))
if ((blinded))
blind.layer = 18
else
blind.layer = 0
if (disabilities & 1)
client.screen += hud_used.vimpaired
if (eye_blurry)
client.screen += hud_used.blurry
if (druggy)
client.screen += hud_used.druggy
if (sleep) sleep.icon_state = text("sleep[]", sleeping)
if (rest) rest.icon_state = text("rest[]", resting)
if (healths)
if (stat != 2)
if (machine)
if (!( machine.check_eye(src) ))
reset_view(null)
else
if(!client.adminobs)
reset_view(null)
switch(health)
if(25 to INFINITY)
healths.icon_state = "health0"
if(19 to 25)
healths.icon_state = "health1"
if(13 to 19)
healths.icon_state = "health2"
if(7 to 13)
healths.icon_state = "health3"
if(0 to 7)
healths.icon_state = "health4"
else
healths.icon_state = "health5"
else
healths.icon_state = "health6"
return 1
if(pullin) pullin.icon_state = "pull[pulling ? 1 : 0]"
handle_random_events()
return
handle_virus_updates()
if(bodytemperature > 406)
for(var/datum/disease/D in viruses)
D.cure()
return
if (toxin) toxin.icon_state = "tox[toxins_alert ? 1 : 0]"
if (oxygen) oxygen.icon_state = "oxy[oxygen_alert ? 1 : 0]"
if (fire) fire.icon_state = "fire[fire_alert ? 1 : 0]"
//NOTE: the alerts dont reset when youre out of danger. dont blame me,
//blame the person who coded them. Temporary fix added.
handle_stomach()
spawn(0)
for(var/mob/M in stomach_contents)
if(M.loc != src)
client.screen -= hud_used.blurry
client.screen -= hud_used.druggy
client.screen -= hud_used.vimpaired
if ((blind && stat != 2))
if ((blinded))
blind.layer = 18
else
blind.layer = 0
if (disabilities & 1)
client.screen += hud_used.vimpaired
if (eye_blurry)
client.screen += hud_used.blurry
if (druggy)
client.screen += hud_used.druggy
if (stat != 2)
if (machine)
if (!( machine.check_eye(src) ))
reset_view(null)
else
if(!client.adminobs)
reset_view(null)
return 1
proc/handle_random_events()
return
proc/handle_virus_updates()
if(bodytemperature > 406)
for(var/datum/disease/D in viruses)
D.cure()
return
proc/handle_stomach()
spawn(0)
for(var/mob/M in stomach_contents)
if(M.loc != src)
stomach_contents.Remove(M)
continue
if(istype(M, /mob/living/carbon) && stat != 2)
if(M.stat == 2)
M.death(1)
stomach_contents.Remove(M)
del(M)
continue
if(istype(M, /mob/living/carbon) && stat != 2)
if(M.stat == 2)
M.death(1)
stomach_contents.Remove(M)
del(M)
continue
if(air_master.current_cycle%3==1)
if(!M.nodamage)
M.adjustBruteLoss(5)
nutrition += 10
if(air_master.current_cycle%3==1)
if(!M.nodamage)
M.adjustBruteLoss(5)
nutrition += 10
@@ -43,3 +43,8 @@
src.verbs += /mob/proc/ghost
return
/mob/living/carbon/brain/update_canmove()
if(in_contents_of(/obj/mecha)) canmove = 1
else canmove = 0
return canmove
+254 -285
View File
@@ -1,313 +1,282 @@
/mob/living/carbon/brain
/mob/living/carbon/brain/Life()
set invisibility = 0
set background = 1
..()
Life()
set invisibility = 0
set background = 1
..()
var/datum/gas_mixture/environment // Added to prevent null location errors-- TLE
if(loc)
environment = loc.return_air()
var/datum/gas_mixture/environment // Added to prevent null location errors-- TLE
if(loc)
environment = loc.return_air()
//Apparently, the person who wrote this code designed it so that
//blinded get reset each cycle and then get activated later in the
//code. Very ugly. I dont care. Moving this stuff here so its easy
//to find it.
blinded = null
blinded = null
//Disease Check
handle_virus_updates()
handle_virus_updates()
//Handle temperature/pressure differences between body and environment
if(environment) // More error checking -- TLE
handle_environment(environment)
if(environment) // More error checking -- TLE
handle_environment(environment)
//Mutations and radiation
handle_mutations_and_radiation()
handle_mutations_and_radiation()
//Chemicals in the body
handle_chemicals_in_body()
handle_chemicals_in_body()
//Status updates, death etc.
handle_regular_status_updates()
if(client)
handle_regular_hud_updates()
// Yup.
update_canmove()
clamp_values()
proc
clamp_values()
AdjustParalysis(0)
// AdjustStunned(0)
// AdjustWeakened(0)
adjustBruteLoss(0)
adjustFireLoss(0)
adjustOxyLoss(0)
adjustToxLoss(0)
handle_mutations_and_radiation()
if (radiation)
if (radiation > 100)
radiation = 100
Weaken(10)
src << "\red You feel weak."
switch(radiation)
if(1 to 49)
radiation--
if(prob(25))
adjustToxLoss(1)
updatehealth()
if(50 to 74)
radiation -= 2
adjustToxLoss(1)
if(prob(5))
radiation -= 5
Weaken(3)
src << "\red You feel weak."
// emote("collapse")
updatehealth()
if(75 to 100)
radiation -= 3
adjustToxLoss(3)
if(prob(1))
src << "\red You mutate!"
randmutb(src)
domutcheck(src,null)
emote("gasp")
updatehealth()
handle_environment(datum/gas_mixture/environment)
if(!environment)
return
var/environment_heat_capacity = environment.heat_capacity()
if(istype(loc, /turf/space))
environment_heat_capacity = loc:heat_capacity
if((environment.temperature > (T0C + 50)) || (environment.temperature < (T0C + 10)))
var/transfer_coefficient
transfer_coefficient = 1
if(wear_mask && (wear_mask.body_parts_covered & HEAD) && (environment.temperature < wear_mask.protective_temperature))
transfer_coefficient *= wear_mask.heat_transfer_coefficient
handle_temperature_damage(HEAD, environment.temperature, environment_heat_capacity*transfer_coefficient)
if(stat==2)
bodytemperature += 0.1*(environment.temperature - bodytemperature)*environment_heat_capacity/(environment_heat_capacity + 270000)
//Account for massive pressure differences
return //TODO: DEFERRED
handle_temperature_damage(body_part, exposed_temperature, exposed_intensity)
if(nodamage) return
if(exposed_temperature > bodytemperature)
var/discomfort = min( abs(exposed_temperature - bodytemperature)*(exposed_intensity)/2000000, 1.0)
//adjustFireLoss(2.5*discomfort)
//adjustFireLoss(5.0*discomfort)
adjustFireLoss(20.0*discomfort)
else
var/discomfort = min( abs(exposed_temperature - bodytemperature)*(exposed_intensity)/2000000, 1.0)
//adjustFireLoss(2.5*discomfort)
adjustFireLoss(5.0*discomfort)
handle_chemicals_in_body()
if(reagents) reagents.metabolize(src)
if (drowsyness)
drowsyness--
eye_blurry = max(2, eye_blurry)
if (prob(5))
sleeping += 1
Paralyse(5)
confused = max(0, confused - 1)
// decrement dizziness counter, clamped to 0
if(resting)
dizziness = max(0, dizziness - 5)
else
dizziness = max(0, dizziness - 1)
updatehealth()
return //TODO: DEFERRED
handle_regular_status_updates()
health = 100 - (getOxyLoss() + getToxLoss() + getFireLoss() + getBruteLoss() + getCloneLoss())
if(getOxyLoss() > 25) Paralyse(3)
if(sleeping)
Paralyse(5)
if (prob(1) && health) spawn(0) emote("snore")
if(resting)
Weaken(5)
if(stat != 2 && (!container && (health < config.health_threshold_dead || (config.revival_brain_life >= 0 && ((world.time - timeofhostdeath) > config.revival_brain_life )))))
death()
else if(health < config.health_threshold_crit)
if(health <= 20 && prob(1)) spawn(0) emote("gasp")
//if(!rejuv) oxyloss++
if(!reagents.has_reagent("inaprovaline")) adjustOxyLoss(1)
if(stat != 2) stat = 1
Paralyse(5)
if (stat != 2) //Alive.
if (paralysis || stunned || weakened) //Stunned etc.
if (stunned > 0)
AdjustStunned(-1)
stat = 0
if (weakened > 0)
AdjustWeakened(-1)
lying = 1
stat = 0
if (paralysis > 0)
AdjustParalysis(-1)
blinded = 1
lying = 1
stat = 1
var/h = hand
hand = 0
drop_item()
hand = 1
drop_item()
hand = h
else //Not stunned.
lying = 0
stat = 0
else //Dead.
lying = 1
blinded = 1
stat = 2
if (stuttering) stuttering--
if (eye_blind)
eye_blind--
blinded = 1
if (ear_deaf > 0) ear_deaf--
if (ear_damage < 25)
ear_damage -= 0.05
ear_damage = max(ear_damage, 0)
// density = !( lying )
if (sdisabilities & 1)
blinded = 1
if (sdisabilities & 4)
ear_deaf = 1
if (eye_blurry > 0)
eye_blurry--
eye_blurry = max(0, eye_blurry)
if (druggy > 0)
druggy--
druggy = max(0, druggy)
return 1
handle_regular_status_updates()
update_canmove()
if(client)
handle_regular_hud_updates()
if (stat == 2 || (XRAY in src.mutations))
sight |= SEE_TURFS
sight |= SEE_MOBS
sight |= SEE_OBJS
see_in_dark = 8
see_invisible = 2
else if (stat != 2)
sight &= ~SEE_TURFS
sight &= ~SEE_MOBS
sight &= ~SEE_OBJS
see_in_dark = 2
see_invisible = 0
if (sleep) sleep.icon_state = text("sleep[]", sleeping)
if (rest) rest.icon_state = text("rest[]", resting)
/mob/living/carbon/brain/
proc/handle_mutations_and_radiation()
if (healths)
if (stat != 2)
switch(health)
if(100 to INFINITY)
healths.icon_state = "health0"
if(80 to 100)
healths.icon_state = "health1"
if(60 to 80)
healths.icon_state = "health2"
if(40 to 60)
healths.icon_state = "health3"
if(20 to 40)
healths.icon_state = "health4"
if(0 to 20)
healths.icon_state = "health5"
else
healths.icon_state = "health6"
else
healths.icon_state = "health7"
if (radiation)
if (radiation > 100)
radiation = 100
Weaken(10)
src << "\red You feel weak."
if(pullin) pullin.icon_state = "pull[pulling ? 1 : 0]"
switch(radiation)
if(1 to 49)
radiation--
if(prob(25))
adjustToxLoss(1)
updatehealth()
client.screen -= hud_used.blurry
client.screen -= hud_used.druggy
client.screen -= hud_used.vimpaired
if(50 to 74)
radiation -= 2
adjustToxLoss(1)
if(prob(5))
radiation -= 5
Weaken(3)
src << "\red You feel weak."
// emote("collapse")
updatehealth()
if ((blind && stat != 2))
if ((blinded))
blind.layer = 18
else
blind.layer = 0
if(75 to 100)
radiation -= 3
adjustToxLoss(3)
if(prob(1))
src << "\red You mutate!"
randmutb(src)
domutcheck(src,null)
emote("gasp")
updatehealth()
if (disabilities & 1)
client.screen += hud_used.vimpaired
if (eye_blurry)
client.screen += hud_used.blurry
if (druggy)
client.screen += hud_used.druggy
if (stat != 2)
if (machine)
if (!( machine.check_eye(src) ))
reset_view(null)
else
if(!client.adminobs)
reset_view(null)
return 1
handle_virus_updates()
if(bodytemperature > 409)
for(var/datum/disease/D in viruses)
D.cure()
proc/handle_environment(datum/gas_mixture/environment)
if(!environment)
return
var/environment_heat_capacity = environment.heat_capacity()
if(istype(loc, /turf/space))
environment_heat_capacity = loc:heat_capacity
update_canmove()
if(in_contents_of(/obj/mecha)) canmove = 1
else canmove = 0
return canmove
if((environment.temperature > (T0C + 50)) || (environment.temperature < (T0C + 10)))
var/transfer_coefficient
transfer_coefficient = 1
if(wear_mask && (wear_mask.body_parts_covered & HEAD) && (environment.temperature < wear_mask.protective_temperature))
transfer_coefficient *= wear_mask.heat_transfer_coefficient
handle_temperature_damage(HEAD, environment.temperature, environment_heat_capacity*transfer_coefficient)
if(stat==2)
bodytemperature += 0.1*(environment.temperature - bodytemperature)*environment_heat_capacity/(environment_heat_capacity + 270000)
//Account for massive pressure differences
return //TODO: DEFERRED
proc/handle_temperature_damage(body_part, exposed_temperature, exposed_intensity)
if(nodamage) return
if(exposed_temperature > bodytemperature)
var/discomfort = min( abs(exposed_temperature - bodytemperature)*(exposed_intensity)/2000000, 1.0)
//adjustFireLoss(2.5*discomfort)
//adjustFireLoss(5.0*discomfort)
adjustFireLoss(20.0*discomfort)
else
var/discomfort = min( abs(exposed_temperature - bodytemperature)*(exposed_intensity)/2000000, 1.0)
//adjustFireLoss(2.5*discomfort)
adjustFireLoss(5.0*discomfort)
proc/handle_chemicals_in_body()
if(reagents) reagents.metabolize(src)
if (drowsyness)
drowsyness--
eye_blurry = max(2, eye_blurry)
if (prob(5))
sleeping += 1
Paralyse(5)
confused = max(0, confused - 1)
// decrement dizziness counter, clamped to 0
if(resting)
dizziness = max(0, dizziness - 5)
else
dizziness = max(0, dizziness - 1)
updatehealth()
return //TODO: DEFERRED
proc/handle_regular_status_updates() //TODO: comment out the unused bits >_>
updatehealth()
if(stat == DEAD) //DEAD. BROWN BREAD. SWIMMING WITH THE SPESS CARP
blinded = 1
silent = 0
else //ALIVE. LIGHTS ARE ON
if( !container && (health < config.health_threshold_dead || ((world.time - timeofhostdeath) > config.revival_brain_life)) )
death()
blinded = 1
silent = 0
return 1
//UNCONSCIOUS. NO-ONE IS HOME
if( (getOxyLoss() > 25) || (config.health_threshold_crit > health) )
if( health <= 20 && prob(1) )
spawn(0)
emote("gasp")
if(!reagents.has_reagent("inaprovaline"))
adjustOxyLoss(1)
Paralyse(3)
if(paralysis)
AdjustParalysis(-1)
blinded = 1
stat = UNCONSCIOUS
else if(sleeping)
sleeping = max(sleeping-1, 0)
blinded = 1
stat = UNCONSCIOUS
if( prob(10) && health )
spawn(0)
emote("snore")
//CONSCIOUS
else
stat = CONSCIOUS
//Eyes
if(sdisabilities & 1) //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(eye_blurry) //blurry eyes heal slowly
eye_blurry = max(eye_blurry-1, 0)
//Ears
if(sdisabilities & 4) //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(ear_damage < 25) //ear damage heals slowly under this threshold. otherwise you'll need earmuffs
ear_damage = max(ear_damage-0.05, 0)
//Other
if(stunned)
AdjustStunned(-1)
if(weakened)
weakened = max(weakened-1,0) //before you get mad Rockdtben: I done this so update_canmove isn't called multiple times
if(stuttering)
stuttering = max(stuttering-1, 0)
if(silent)
silent = max(silent-1, 0)
if(druggy)
druggy = max(druggy-1, 0)
return 1
proc/handle_regular_hud_updates()
if (stat == 2 || (XRAY in src.mutations))
sight |= SEE_TURFS
sight |= SEE_MOBS
sight |= SEE_OBJS
see_in_dark = 8
see_invisible = 2
else if (stat != 2)
sight &= ~SEE_TURFS
sight &= ~SEE_MOBS
sight &= ~SEE_OBJS
see_in_dark = 2
see_invisible = 0
if (sleep) sleep.icon_state = text("sleep[]", sleeping)
if (rest) rest.icon_state = text("rest[]", resting)
if (healths)
if (stat != 2)
switch(health)
if(100 to INFINITY)
healths.icon_state = "health0"
if(80 to 100)
healths.icon_state = "health1"
if(60 to 80)
healths.icon_state = "health2"
if(40 to 60)
healths.icon_state = "health3"
if(20 to 40)
healths.icon_state = "health4"
if(0 to 20)
healths.icon_state = "health5"
else
healths.icon_state = "health6"
else
healths.icon_state = "health7"
if(pullin) pullin.icon_state = "pull[pulling ? 1 : 0]"
client.screen -= hud_used.blurry
client.screen -= hud_used.druggy
client.screen -= hud_used.vimpaired
if ((blind && stat != 2))
if ((blinded))
blind.layer = 18
else
blind.layer = 0
if (disabilities & 1)
client.screen += hud_used.vimpaired
if (eye_blurry)
client.screen += hud_used.blurry
if (druggy)
client.screen += hud_used.druggy
if (stat != 2)
if (machine)
if (!( machine.check_eye(src) ))
reset_view(null)
else
if(!client.adminobs)
reset_view(null)
return 1
proc/handle_virus_updates()
if(bodytemperature > 409)
for(var/datum/disease/D in viruses)
D.cure()
return
+95 -126
View File
@@ -19,11 +19,15 @@
..()
//Apparently, the person who wrote this code designed it so that
//blinded get reset each cycle and then get activated later in the
//code. Very ugly. I dont care. Moving this stuff here so its easy
//to find it.
blinded = null
//TODO: seperate this out
var/datum/gas_mixture/environment = loc.return_air()
//No need to update all of these procs if the guy is dead.
if(stat != DEAD)
if(air_master.current_cycle%4==2) //First, resolve location and get a breath
@@ -52,15 +56,6 @@
//Random events (vomiting etc)
handle_random_events()
update_canmove() //TODO: remove from life() if viable ~Carn
//Removed for dead people, that's at least a small step closer to removing it! - Nodrak
else if(stat == DEAD)
canmove = 0 //Since canmove doesn't update if they're dead, force this var 0.
//These should be updated whether the mob is dead or alive
blinded = null
//Update Mind
update_mind()
@@ -70,10 +65,12 @@
//stuff in the stomach
handle_stomach()
//Flashlights and such
UpdateLuminosity()
//Status updates, death etc.
UpdateLuminosity()
handle_regular_status_updates() //TODO: optimise ~Carn
update_canmove()
//Update our name based on whether our face is obscured/disfigured
name = get_visible_name() //TODO: this was broken by the dismemberment revert ~Carn
@@ -85,14 +82,6 @@
for(var/obj/item/weapon/grab/G in src)
G.process()
//TODO: optimise this.
if(isturf(loc) && rand(1,1000) == 1) //0.1% chance of playing a scary sound to someone who's in complete darkness
var/turf/currentTurf = loc
if(!currentTurf.sd_lumcount)
playsound_local(src,pick(scarySounds),50, 1, -1)
clamp_values() //TODO: finish removing this ~Carn
/mob/living/carbon/human/calculate_affecting_pressure(var/pressure)
..()
@@ -111,20 +100,6 @@
return ONE_ATMOSPHERE - pressure_difference
/mob/living/carbon/human
//I've rewritten this to do what it was intended to do.
//This can probably be removed like Rockdtben suggested, but I'd like to go over the damage procs first just to be safe.
//Perhaps code view-vars to be unable to directly edit the damagevariables without using procs
proc/clamp_values()
// stunned = max( min(stunned,20), 0 ) // positive and under 20
paralysis = max( min(paralysis,20), 0 ) // positive and under 20
// weakened = max( min(weakened,20), 0 ) // positive and under 20
sleeping = max( min(sleeping, 20), 0 ) // positive and under 20
oxyloss = max(oxyloss,0) // positive
toxloss = max(toxloss,0) // positive
// bruteloss = max(bruteloss,0) // positive
// fireloss = max(fireloss,0) // positive
proc/update_mind()
if(!mind && client)
mind = new
@@ -136,38 +111,6 @@
proc/handle_disabilities()
if(hallucination > 0)
if(hallucination >= 20 && health > 0)
if(prob(3))
fake_attack(src)
//for(var/atom/a in hallucinations)
// a.hallucinate(src)
if(!handling_hal && hallucination > 20)
spawn handle_hallucinations() //The not boring kind!
if(hallucination <= 2)
halloss = 0
hallucination = 0
else
hallucination -= 2
//if(health < 0)
// for(var/obj/a in hallucinations)
// del a
else
//halloss = 0
for(var/atom/a in hallucinations)
del a
if(halloss > 100)
src << "You're too tired to keep going..."
for(var/mob/O in viewers(src, null))
if(O == src)
continue
O.show_message(text("\red <B>[src] slumps to the ground panting, too weak to continue fighting."), 1)
Paralyse(15)
setHalLoss(99)
if (disabilities & 2)
if ((prob(1) && paralysis < 1 && r_epil < 1))
src << "\red You have a seizure!"
@@ -262,32 +205,33 @@
if (radiation < 0)
radiation = 0
switch(radiation)
if(1 to 49)
radiation--
if(prob(25))
else
switch(radiation)
if(1 to 49)
radiation--
if(prob(25))
adjustToxLoss(1)
updatehealth()
if(50 to 74)
radiation -= 2
adjustToxLoss(1)
if(prob(5))
radiation -= 5
Weaken(3)
src << "\red You feel weak."
emote("collapse")
updatehealth()
if(50 to 74)
radiation -= 2
adjustToxLoss(1)
if(prob(5))
radiation -= 5
Weaken(3)
src << "\red You feel weak."
emote("collapse")
updatehealth()
if(75 to 100)
radiation -= 3
adjustToxLoss(3)
if(prob(1))
src << "\red You mutate!"
randmutb(src)
domutcheck(src,null)
emote("gasp")
updatehealth()
if(75 to 100)
radiation -= 3
adjustToxLoss(3)
if(prob(1))
src << "\red You mutate!"
randmutb(src)
domutcheck(src,null)
emote("gasp")
updatehealth()
proc/breathe()
@@ -453,7 +397,7 @@
if(SA_pp > SA_para_min) // Enough to make us paralysed for a bit
Paralyse(3) // 3 gives them one second to wake up and run away a bit!
if(SA_pp > SA_sleep_min) // Enough to make us sleep as well
sleeping = max(src.sleeping+2, 10)
sleeping = max(sleeping+2, 10)
else if(SA_pp > 0.01) // There is sleeping gas in their lungs, but only a little, so give them a bit of a warning
if(prob(20))
spawn(0) emote(pick("giggle", "laugh"))
@@ -743,59 +687,66 @@
proc/handle_regular_status_updates()
if(stat == DEAD) //DEAD. BROWN BREAD. SWIMMING WITH THE SPESS CARP
blinded = 1
stat = DEAD
silent = 0
else //ALIVE. LIGHTS ARE ON
updatehealth() //TODO
if(health < config.health_threshold_dead || brain_op_stage == 4.0)
death()
blinded = 1
stat = DEAD
silent = 0
return 1
stat = CONSCIOUS
if(getOxyLoss() > 50)
Paralyse(3)
if(health < config.health_threshold_crit) //UNCONSCIOUS. NO-ONE IS HOME
//UNCONSCIOUS. NO-ONE IS HOME
if( (getOxyLoss() > 50) || (config.health_threshold_crit > health) )
if( health <= 20 && prob(1) )
spawn(0)
emote("gasp")
if(!reagents.has_reagent("inaprovaline"))
adjustOxyLoss(1)
Paralyse(3)
stat = UNCONSCIOUS
Paralyse(5)
if(hallucination)
if(hallucination >= 20)
if(prob(3))
fake_attack(src)
if(!handling_hal)
spawn handle_hallucinations() //The not boring kind!
if(silent)
silent = max(silent-1, 0)
if(hallucination<=2)
hallucination = 0
halloss = 0
else
hallucination -= 2
if(stunned > 0)
AdjustStunned(-1)
if(weakened > 0)
AdjustWeakened(-1)
else
for(var/atom/a in hallucinations)
del a
//Incapacitated
if(paralysis > 0)
if(halloss > 100)
src << "<span class='notice'>You're too tired to keep going...</span>"
for(var/mob/O in oviewers(src, null))
O.show_message("<B>[src]</B> slumps to the ground panting, too weak to continue fighting.", 1)
Paralyse(3)
setHalLoss(99)
if(paralysis)
AdjustParalysis(-1)
blinded = 1
stat = UNCONSCIOUS
if(sleeping > 0)
else if(sleeping)
handle_dreams()
adjustHalLoss(-5)
sleeping = max(sleeping-1, 0)
blinded = 1
stat = UNCONSCIOUS
if( prob(10) && health && !hal_crit )
spawn(0)
emote("snore")
sleeping = max(sleeping-1, 0)
//CONSCIOUS
else
stat = CONSCIOUS
if(stuttering)
stuttering = max(stuttering-1, 0)
//Eyes & Ears
//Eyes
if(sdisabilities & 1) //disabled-blind, doesn't get better on its own
blinded = 1
else if(eye_blind) //blindness, heals slowly over time
@@ -807,6 +758,7 @@
else if(eye_blurry) //blurry eyes heal slowly
eye_blurry = max(eye_blurry-1, 0)
//Ears
if(sdisabilities & 4) //disabled-deaf, doesn't get better on its own
ear_deaf = max(ear_deaf, 1)
else if(ear_deaf) //deafness, heals slowly over time
@@ -817,6 +769,19 @@
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)
//Other
if(stunned)
AdjustStunned(-1)
if(weakened)
weakened = max(weakened-1,0) //before you get mad Rockdtben: I done this so update_canmove isn't called multiple times
if(stuttering)
stuttering = max(stuttering-1, 0)
if(silent)
silent = max(silent-1, 0)
if(druggy)
druggy = max(druggy-1, 0)
return 1
@@ -925,7 +890,7 @@
/* HUD shit goes here, as long as it doesn't modify src.sight flags */
/* 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(istype(glasses, /obj/item/clothing/glasses/hud/health))
if(client)
@@ -1055,27 +1020,24 @@
bodytemp.icon_state = "temp-4"
if(!client) return 0 //Wish we did not need these
client.screen -= hud_used.blurry
client.screen -= hud_used.druggy
client.screen -= hud_used.vimpaired
client.screen -= hud_used.darkMask
client.screen.Remove(hud_used.blurry, hud_used.druggy, hud_used.vimpaired, hud_used.darkMask)
if ((blind && stat != 2))
if ((blinded))
if(blinded)
blind.layer = 18
else
blind.layer = 0
if (disabilities & 1 && !istype(glasses, /obj/item/clothing/glasses/regular) )
if( disabilities & 1 && !istype(glasses, /obj/item/clothing/glasses/regular) )
client.screen += hud_used.vimpaired
if (eye_blurry)
if(eye_blurry)
client.screen += hud_used.blurry
if (druggy)
if(druggy)
client.screen += hud_used.druggy
if ((istype(head, /obj/item/clothing/head/welding)) )
if( istype(head, /obj/item/clothing/head/welding) )
if(!head:up && tinted_weldhelh)
client.screen += hud_used.darkMask
@@ -1114,7 +1076,7 @@
for(var/mob/O in viewers(world.view, src))
O.show_message(text("<b>\red [] throws up!</b>", src), 1)
playsound(src.loc, 'splat.ogg', 50, 1)
playsound(loc, 'splat.ogg', 50, 1)
var/turf/location = loc
if (istype(location, /turf/simulated))
@@ -1126,6 +1088,12 @@
// make it so you can only puke so fast
lastpuke = 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
if(!currentTurf.sd_lumcount)
playsound_local(src,pick(scarySounds),50, 1, -1)
proc/handle_virus_updates()
if(bodytemperature > 406)
for(var/datum/disease/D in viruses)
@@ -1156,3 +1124,4 @@
if ((changeling.geneticdamage > 0))
changeling.geneticdamage = changeling.geneticdamage-1
#undef HUMAN_MAX_OXYLOSS
+168 -184
View File
@@ -11,14 +11,14 @@
/mob/living/carbon/monkey/Life()
set invisibility = 0
set background = 1
if (src.monkeyizing) return
if (monkeyizing) return
..()
var/datum/gas_mixture/environment // Added to prevent null location errors-- TLE
if(src.loc)
if(loc)
environment = loc.return_air()
if (src.stat != DEAD) //still breathing
if (stat != DEAD) //still breathing
//First, resolve location and get a breath
if(air_master.current_cycle%4==2)
//Only try to take a breath every 4 seconds, unless suffocating
@@ -32,7 +32,7 @@
//blinded get reset each cycle and then get activated later in the
//code. Very ugly. I dont care. Moving this stuff here so its easy
//to find it.
src.blinded = null
blinded = null
//Disease Check
handle_virus_updates()
@@ -53,12 +53,12 @@
//Disabilities
handle_disabilities()
//Status updates, death etc.
//Flashlights and such
UpdateLuminosity()
//Status updates, death etc.
handle_regular_status_updates()
update_canmove()
clamp_values()
if(client)
handle_regular_hud_updates()
@@ -79,33 +79,27 @@
/mob/living/carbon/monkey
proc/clamp_values()
// AdjustStunned(0)
AdjustParalysis(0)
// AdjustWeakened(0)
proc/handle_disabilities()
if (src.disabilities & 2)
if ((prob(1) && src.paralysis < 10 && src.r_epil < 1))
if (disabilities & 2)
if ((prob(1) && paralysis < 10 && r_epil < 1))
src << "\red You have a seizure!"
Paralyse(10)
if (src.disabilities & 4)
if ((prob(5) && src.paralysis <= 1 && src.r_ch_cou < 1))
src.drop_item()
if (disabilities & 4)
if ((prob(5) && paralysis <= 1 && r_ch_cou < 1))
drop_item()
spawn( 0 )
emote("cough")
return
if (src.disabilities & 8)
if ((prob(10) && src.paralysis <= 1 && src.r_Tourette < 1))
if (disabilities & 8)
if ((prob(10) && paralysis <= 1 && r_Tourette < 1))
Stun(10)
spawn( 0 )
emote("twitch")
return
if (src.disabilities & 16)
if (disabilities & 16)
if (prob(10))
src.stuttering = max(10, src.stuttering)
stuttering = max(10, stuttering)
proc/update_mind()
if(!mind && client)
@@ -115,59 +109,59 @@
proc/handle_mutations_and_radiation()
if(src.getFireLoss())
if(getFireLoss())
if((COLD_RESISTANCE in mutations) || prob(50))
switch(src.getFireLoss())
switch(getFireLoss())
if(1 to 50)
src.adjustFireLoss(-1)
adjustFireLoss(-1)
if(51 to 100)
src.adjustFireLoss(-5)
adjustFireLoss(-5)
if ((HULK in mutations) && src.health <= 25)
src.mutations.Remove(HULK)
if ((HULK in mutations) && health <= 25)
mutations.Remove(HULK)
src << "\red You suddenly feel very weak."
Weaken(3)
emote("collapse")
if (src.radiation)
if (src.radiation > 100)
src.radiation = 100
if (radiation)
if (radiation > 100)
radiation = 100
Weaken(10)
src << "\red You feel weak."
emote("collapse")
switch(src.radiation)
switch(radiation)
if(1 to 49)
src.radiation--
radiation--
if(prob(25))
src.adjustToxLoss(1)
src.updatehealth()
adjustToxLoss(1)
updatehealth()
if(50 to 74)
src.radiation -= 2
src.adjustToxLoss(1)
radiation -= 2
adjustToxLoss(1)
if(prob(5))
src.radiation -= 5
radiation -= 5
Weaken(3)
src << "\red You feel weak."
emote("collapse")
src.updatehealth()
updatehealth()
if(75 to 100)
src.radiation -= 3
src.adjustToxLoss(3)
radiation -= 3
adjustToxLoss(3)
if(prob(1))
src << "\red You mutate!"
randmutb(src)
domutcheck(src,null)
emote("gasp")
src.updatehealth()
updatehealth()
proc/breathe()
if(src.reagents)
if(reagents)
if(src.reagents.has_reagent("lexorin")) return
if(reagents.has_reagent("lexorin")) return
if(!loc) return //probably ought to make a proper fix for this, but :effort: --NeoFite
@@ -175,7 +169,7 @@
var/datum/air_group/breath
if(losebreath>0) //Suffocating so do not take a breath
src.losebreath--
losebreath--
if (prob(75)) //High chance of gasping for air
spawn emote("gasp")
if(istype(loc, /obj/))
@@ -224,21 +218,21 @@
proc/get_breath_from_internal(volume_needed)
if(internal)
if (!contents.Find(src.internal))
if (!contents.Find(internal))
internal = null
if (!wear_mask || !(wear_mask.flags|MASKINTERNALS) )
internal = null
if(internal)
if (src.internals)
src.internals.icon_state = "internal1"
if (internals)
internals.icon_state = "internal1"
return internal.remove_air_volume(volume_needed)
else
if (src.internals)
src.internals.icon_state = "internal0"
if (internals)
internals.icon_state = "internal0"
return null
proc/handle_breath(datum/gas_mixture/breath)
if(src.nodamage)
if(nodamage)
return
if(!breath || (breath.total_moles() == 0))
@@ -314,7 +308,7 @@
if(SA_pp > SA_para_min) // Enough to make us paralysed for a bit
Paralyse(3) // 3 gives them one second to wake up and run away a bit!
if(SA_pp > SA_sleep_min) // Enough to make us sleep as well
src.sleeping = max(src.sleeping+2, 10)
sleeping = max(sleeping+2, 10)
else if(SA_pp > 0.01) // There is sleeping gas in their lungs, but only a little, so give them a bit of a warning
if(prob(20))
spawn(0) emote(pick("giggle", "laugh"))
@@ -361,7 +355,7 @@
return //TODO: DEFERRED
proc/handle_temperature_damage(body_part, exposed_temperature, exposed_intensity)
if(src.nodamage) return
if(nodamage) return
var/discomfort = min( abs(exposed_temperature - bodytemperature)*(exposed_intensity)/2000000, 1.0)
//adjustFireLoss(2.5*discomfort)
@@ -375,11 +369,11 @@
if(reagents) reagents.metabolize(src)
if (src.drowsyness)
src.drowsyness--
src.eye_blurry = max(2, src.eye_blurry)
if (drowsyness)
drowsyness--
eye_blurry = max(2, eye_blurry)
if (prob(5))
src.sleeping += 1
sleeping += 1
Paralyse(5)
confused = max(0, confused - 1)
@@ -389,130 +383,120 @@
else
dizziness = max(0, dizziness - 1)
src.updatehealth()
updatehealth()
return //TODO: DEFERRED
proc/handle_regular_status_updates()
updatehealth()
health = 100 - (getOxyLoss() + getToxLoss() + getFireLoss() + getBruteLoss() + getCloneLoss())
if(stat == DEAD) //DEAD. BROWN BREAD. SWIMMING WITH THE SPESS CARP
blinded = 1
silent = 0
else //ALIVE. LIGHTS ARE ON
if(health < config.health_threshold_dead || brain_op_stage == 4.0)
death()
blinded = 1
stat = DEAD
silent = 0
return 1
if(getOxyLoss() > 25) Paralyse(3)
//UNCONSCIOUS. NO-ONE IS HOME
if( (getOxyLoss() > 25) || (config.health_threshold_crit > health) )
if( health <= 20 && prob(1) )
spawn(0)
emote("gasp")
if(!reagents.has_reagent("inaprovaline"))
adjustOxyLoss(1)
Paralyse(3)
if(src.sleeping)
Paralyse(5)
if (prob(1) && health) spawn(0) emote("snore")
if(paralysis)
AdjustParalysis(-1)
blinded = 1
stat = UNCONSCIOUS
else if(sleeping)
sleeping = max(sleeping-1, 0)
blinded = 1
stat = UNCONSCIOUS
if( prob(10) && health )
spawn(0)
emote("snore")
//CONSCIOUS
else
stat = CONSCIOUS
if(src.resting)
Weaken(5)
//Eyes
if(sdisabilities & 1) //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(eye_blurry) //blurry eyes heal slowly
eye_blurry = max(eye_blurry-1, 0)
if(health < config.health_threshold_dead && stat != 2)
death()
else if(src.health < config.health_threshold_crit)
if(src.health <= 20 && prob(1)) spawn(0) emote("gasp")
//Ears
if(sdisabilities & 4) //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(ear_damage < 25) //ear damage heals slowly under this threshold. otherwise you'll need earmuffs
ear_damage = max(ear_damage-0.05, 0)
//if(!src.rejuv) src.oxyloss++ //-Nodrak (I can't believe I thought this should be commented back in)
if(!src.reagents.has_reagent("inaprovaline") && src.stat != 2) src.adjustOxyLoss(2)
//Other
if(stunned)
AdjustStunned(-1)
if(src.stat != 2) src.stat = 1
Paralyse(5)
if(weakened)
weakened = max(weakened-1,0) //before you get mad Rockdtben: I done this so update_canmove isn't called multiple times
if (src.stat != 2) //Alive.
if(stuttering)
stuttering = max(stuttering-1, 0)
if (src.paralysis || src.stunned || src.weakened || (changeling && changeling.changeling_fakedeath)) //Stunned etc.
if (src.stunned > 0)
AdjustStunned(-1)
src.stat = 0
if (src.weakened > 0)
AdjustWeakened(-1)
src.lying = 1
src.stat = 0
if (src.paralysis > 0)
AdjustParalysis(-1)
src.blinded = 1
src.lying = 1
src.stat = 1
var/h = src.hand
src.hand = 0
drop_item()
src.hand = 1
drop_item()
src.hand = h
else //Not stunned.
src.lying = 0
src.stat = 0
else //Dead.
src.lying = 1
src.blinded = 1
src.stat = 2
if (src.stuttering) src.stuttering--
if (src.eye_blind)
src.eye_blind--
src.blinded = 1
if (src.ear_deaf > 0) src.ear_deaf--
if (src.ear_damage < 25)
src.ear_damage -= 0.05
src.ear_damage = max(src.ear_damage, 0)
src.density = !( src.lying )
if (src.sdisabilities & 1)
src.blinded = 1
if (src.sdisabilities & 4)
src.ear_deaf = 1
if (src.eye_blurry > 0)
src.eye_blurry--
src.eye_blurry = max(0, src.eye_blurry)
if (src.druggy > 0)
src.druggy--
src.druggy = max(0, src.druggy)
if(silent)
silent = max(silent-1, 0)
if(druggy)
druggy = max(druggy-1, 0)
return 1
proc/handle_regular_hud_updates()
if (src.stat == 2 || (XRAY in mutations))
src.sight |= SEE_TURFS
src.sight |= SEE_MOBS
src.sight |= SEE_OBJS
src.see_in_dark = 8
src.see_invisible = 2
else if (src.stat != 2)
src.sight &= ~SEE_TURFS
src.sight &= ~SEE_MOBS
src.sight &= ~SEE_OBJS
src.see_in_dark = 2
src.see_invisible = 0
if (stat == 2 || (XRAY in mutations))
sight |= SEE_TURFS
sight |= SEE_MOBS
sight |= SEE_OBJS
see_in_dark = 8
see_invisible = 2
else if (stat != 2)
sight &= ~SEE_TURFS
sight &= ~SEE_MOBS
sight &= ~SEE_OBJS
see_in_dark = 2
see_invisible = 0
if (src.sleep) src.sleep.icon_state = text("sleep[]", src.sleeping)
if (src.rest) src.rest.icon_state = text("rest[]", src.resting)
if (sleep) sleep.icon_state = text("sleep[]", sleeping)
if (rest) rest.icon_state = text("rest[]", resting)
if (src.healths)
if (src.stat != 2)
if (healths)
if (stat != 2)
switch(health)
if(100 to INFINITY)
src.healths.icon_state = "health0"
healths.icon_state = "health0"
if(80 to 100)
src.healths.icon_state = "health1"
healths.icon_state = "health1"
if(60 to 80)
src.healths.icon_state = "health2"
healths.icon_state = "health2"
if(40 to 60)
src.healths.icon_state = "health3"
healths.icon_state = "health3"
if(20 to 40)
src.healths.icon_state = "health4"
healths.icon_state = "health4"
if(0 to 20)
src.healths.icon_state = "health5"
healths.icon_state = "health5"
else
src.healths.icon_state = "health6"
healths.icon_state = "health6"
else
src.healths.icon_state = "health7"
healths.icon_state = "health7"
if (pressure)
var/datum/gas_mixture/environment = loc.return_air()
@@ -530,59 +514,59 @@
else
pressure.icon_state = "pressure-2"
if(src.pullin) src.pullin.icon_state = "pull[src.pulling ? 1 : 0]"
if(pullin) pullin.icon_state = "pull[pulling ? 1 : 0]"
if (src.toxin) src.toxin.icon_state = "tox[src.toxins_alert ? 1 : 0]"
if (src.oxygen) src.oxygen.icon_state = "oxy[src.oxygen_alert ? 1 : 0]"
if (src.fire) src.fire.icon_state = "fire[src.fire_alert ? 1 : 0]"
if (toxin) toxin.icon_state = "tox[toxins_alert ? 1 : 0]"
if (oxygen) oxygen.icon_state = "oxy[oxygen_alert ? 1 : 0]"
if (fire) fire.icon_state = "fire[fire_alert ? 1 : 0]"
//NOTE: the alerts dont reset when youre out of danger. dont blame me,
//blame the person who coded them. Temporary fix added.
if(bodytemp)
switch(src.bodytemperature) //310.055 optimal body temp
switch(bodytemperature) //310.055 optimal body temp
if(345 to INFINITY)
src.bodytemp.icon_state = "temp4"
bodytemp.icon_state = "temp4"
if(335 to 345)
src.bodytemp.icon_state = "temp3"
bodytemp.icon_state = "temp3"
if(327 to 335)
src.bodytemp.icon_state = "temp2"
bodytemp.icon_state = "temp2"
if(316 to 327)
src.bodytemp.icon_state = "temp1"
bodytemp.icon_state = "temp1"
if(300 to 316)
src.bodytemp.icon_state = "temp0"
bodytemp.icon_state = "temp0"
if(295 to 300)
src.bodytemp.icon_state = "temp-1"
bodytemp.icon_state = "temp-1"
if(280 to 295)
src.bodytemp.icon_state = "temp-2"
bodytemp.icon_state = "temp-2"
if(260 to 280)
src.bodytemp.icon_state = "temp-3"
bodytemp.icon_state = "temp-3"
else
src.bodytemp.icon_state = "temp-4"
bodytemp.icon_state = "temp-4"
src.client.screen -= src.hud_used.blurry
src.client.screen -= src.hud_used.druggy
src.client.screen -= src.hud_used.vimpaired
client.screen -= hud_used.blurry
client.screen -= hud_used.druggy
client.screen -= hud_used.vimpaired
if ((src.blind && src.stat != 2))
if ((src.blinded))
src.blind.layer = 18
if ((blind && stat != 2))
if ((blinded))
blind.layer = 18
else
src.blind.layer = 0
blind.layer = 0
if (src.disabilities & 1)
src.client.screen += src.hud_used.vimpaired
if (disabilities & 1)
client.screen += hud_used.vimpaired
if (src.eye_blurry)
src.client.screen += src.hud_used.blurry
if (eye_blurry)
client.screen += hud_used.blurry
if (src.druggy)
src.client.screen += src.hud_used.druggy
if (druggy)
client.screen += hud_used.druggy
if (src.stat != 2)
if (src.machine)
if (!( src.machine.check_eye(src) ))
src.reset_view(null)
if (stat != 2)
if (machine)
if (!( machine.check_eye(src) ))
reset_view(null)
else
if(!client.adminobs)
reset_view(null)
@@ -596,7 +580,7 @@
return
proc/handle_virus_updates()
if(src.bodytemperature > 406)
if(bodytemperature > 406)
for(var/datum/disease/D in viruses)
D.cure()
return
+20 -15
View File
@@ -23,11 +23,12 @@
/mob/living/proc/updatehealth()
if(!src.nodamage)
src.health = 100 - src.getOxyLoss() - src.getToxLoss() - src.getFireLoss() - src.getBruteLoss() - src.getCloneLoss() -src.halloss
else
if(nodamage)
src.health = 100
src.stat = 0
else
src.health = 100 - src.getOxyLoss() - src.getToxLoss() - src.getFireLoss() - src.getBruteLoss() - src.getCloneLoss() - src.halloss
//This proc is used for mobs which are affected by pressure to calculate the amount of pressure that actually
//affects them once clothing is factored in. ~Errorage
@@ -152,21 +153,25 @@
src.updatehealth()
/mob/living/proc/revive()
//src.fireloss = 0
src.setToxLoss(0)
//src.bruteloss = 0
src.setOxyLoss(0)
setToxLoss(0)
setOxyLoss(0)
SetParalysis(0)
SetStunned(0)
SetWeakened(0)
src.radiation = 0
src.nutrition = 400
src.bodytemperature = 310
//src.health = 100
src.heal_overall_damage(1000, 1000)
src.buckled = initial(src.buckled)
src.handcuffed = initial(src.handcuffed)
if(src.stat > 1) src.stat = CONSCIOUS
radiation = 0
nutrition = 400
bodytemperature = 310
sdisabilities = 0
disabilities = 0
blinded = 0
eye_blind = 0
eye_blurry = 0
ear_deaf = 0
ear_damage = 0
heal_overall_damage(1000, 1000)
buckled = initial(src.buckled)
handcuffed = initial(src.handcuffed)
stat = CONSCIOUS
..()
return
+1 -1
View File
@@ -89,7 +89,7 @@
var/blinded = null
var/bhunger = 0 //Carbon
var/ajourn = 0
var/rejuv = null
// var/rejuv = null
var/druggy = 0 //Carbon
var/confused = 0 //Carbon
var/antitoxs = null