Merge pull request #7854 from phil235/LifeProcsDuplicateFix

Life procs duplicate fix
This commit is contained in:
Cheridan
2015-03-02 09:16:09 -06:00
30 changed files with 956 additions and 1661 deletions
+17 -24
View File
@@ -25,10 +25,6 @@
var/heal_rate = 5
var/plasma_rate = 5
var/oxygen_alert = 0
var/toxins_alert = 0
var/fire_alert = 0
var/heat_protection = 0.5
var/leaping = 0
@@ -111,31 +107,28 @@
fire_alert = max(fire_alert, 2)
return
/mob/living/carbon/alien/handle_mutations_and_radiation()
// Aliens love radiation nom nom nom
if (radiation)
if (radiation > 100)
radiation = 100
/mob/living/carbon/alien/ex_act(severity, target)
..()
if (radiation < 0)
radiation = 0
switch (severity)
if (1.0)
gib()
return
switch(radiation)
if(0 to 50)
radiation--
if(prob(25))
adjustToxLoss(1)
if (2.0)
adjustBruteLoss(60)
adjustFireLoss(60)
adjustEarDamage(30,120)
if(50 to 75)
radiation -= 2
adjustToxLoss(1)
if(prob(5))
radiation -= 5
if(3.0)
adjustBruteLoss(30)
if (prob(50))
Paralyse(1)
adjustEarDamage(15,60)
updatehealth()
if(75 to 100)
radiation -= 3
adjustToxLoss(3)
/mob/living/carbon/alien/handle_fire()//Aliens on fire code
if(..())
@@ -15,26 +15,26 @@
real_name = name
..()
/mob/living/carbon/alien/humanoid/hunter/handle_regular_hud_updates()
..() //-Yvarov
/mob/living/carbon/alien/humanoid/hunter/handle_hud_icons_health()
if (healths)
if (stat != 2)
switch(health)
if(150 to INFINITY)
healths.icon_state = "health0"
if(100 to 150)
if(120 to 150)
healths.icon_state = "health1"
if(50 to 100)
if(90 to 120)
healths.icon_state = "health2"
if(25 to 50)
if(60 to 90)
healths.icon_state = "health3"
if(0 to 25)
if(30 to 60)
healths.icon_state = "health4"
else
if(0 to 30)
healths.icon_state = "health5"
else
healths.icon_state = "health6"
else
healths.icon_state = "health6"
healths.icon_state = "health7"
/mob/living/carbon/alien/humanoid/hunter/handle_environment()
@@ -17,9 +17,7 @@
verbs.Add(/mob/living/carbon/alien/humanoid/proc/corrosive_acid,/mob/living/carbon/alien/humanoid/proc/neurotoxin)
..()
/mob/living/carbon/alien/humanoid/sentinel/handle_regular_hud_updates()
..() //-Yvarov
/mob/living/carbon/alien/humanoid/sentinel/handle_hud_icons_health()
if (healths)
if (stat != 2)
switch(health)
@@ -29,14 +27,16 @@
healths.icon_state = "health1"
if(75 to 100)
healths.icon_state = "health2"
if(25 to 75)
if(50 to 75)
healths.icon_state = "health3"
if(0 to 25)
if(25 to 50)
healths.icon_state = "health4"
else
if(0 to 25)
healths.icon_state = "health5"
else
healths.icon_state = "health6"
else
healths.icon_state = "health6"
healths.icon_state = "health7"
/mob/living/carbon/alien/humanoid/sentinel/movement_delay()
. = ..()
@@ -28,53 +28,6 @@
if(l_store) l_store.emp_act(severity)
..()
/mob/living/carbon/alien/humanoid/ex_act(severity, target)
..()
var/shielded = 0
var/b_loss = null
var/f_loss = null
switch (severity)
if (1.0)
gib()
return
if (2.0)
if (!shielded)
b_loss += 60
f_loss += 60
adjustEarDamage(30, 120)
if(3.0)
b_loss += 30
if (prob(50) && !shielded)
Paralyse(1)
adjustEarDamage(15 , 60)
adjustBruteLoss(b_loss)
adjustFireLoss(f_loss)
updatehealth()
/mob/living/carbon/alien/humanoid/blob_act()
if (stat == 2)
return
var/shielded = 0
var/damage = null
if (stat != 2)
damage = rand(30,40)
if(shielded)
damage /= 4
show_message("<span class='userdanger'>The blob attacks!</span>")
adjustFireLoss(damage)
return
/mob/living/carbon/alien/humanoid/attack_slime(mob/living/carbon/slime/M as mob)
..()
var/damage = rand(5, 35)
@@ -139,10 +92,6 @@
return 0
/mob/living/carbon/alien/humanoid/var/co2overloadtime = null
/mob/living/carbon/alien/humanoid/var/temperature_resistance = T0C+75
/mob/living/carbon/alien/humanoid/show_inv(mob/user)
user.set_machine(src)
var/dat = {"
@@ -5,7 +5,6 @@
toxins_alert = 0
fire_alert = 0
pass_flags = PASSTABLE
var/temperature_alert = 0
/mob/living/carbon/alien/humanoid/proc/adjust_body_temperature(current, loc_temp, boost)
@@ -25,162 +24,4 @@
temp_change = (temperature - current)
return temp_change
/mob/living/carbon/alien/humanoid/handle_regular_status_updates()
updatehealth()
if(stat == DEAD) //DEAD. BROWN BREAD. SWIMMING WITH THE SPESS CARP
eye_blind = 1
silent = 0
else //ALIVE. LIGHTS ARE ON
if(health < config.health_threshold_dead || !getorgan(/obj/item/organ/brain))
death()
eye_blind = 1
stat = DEAD
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("epinephrine"))
adjustOxyLoss(1)
Paralyse(3)
if(paralysis)
AdjustParalysis(-1)
eye_blind = max(eye_blind, 1)
stat = UNCONSCIOUS
else if(sleeping)
sleeping = max(sleeping-1, 0)
eye_blind = max(eye_blind, 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))
//Eyes
if(disabilities & BLIND) //disabled-blind, doesn't get better on its own
eye_blind = max(eye_blind, 1)
else if(eye_blind) //blindness, heals slowly over time
eye_blind = max(eye_blind-1,0)
else if(eye_blurry) //blurry eyes heal slowly
eye_blurry = max(eye_blurry-1, 0)
//Ears
if(disabilities & DEAF) //disabled-deaf, doesn't get better on its own
setEarDamage(-1, max(ear_deaf, 1))
else
adjustEarDamage(-1, (ear_damage < 25 ? -0.05 : 0))
//deafness, heals slowly over time
//ear damage heals slowly under this threshold. otherwise you'll need earmuffs
//Other
if(stunned)
AdjustStunned(-1)
if(!stunned)
update_icons()
if(weakened)
weakened = max(weakened-1,0)
if(!weakened)
update_icons()
if(stuttering)
stuttering = max(stuttering-1, 0)
if(silent)
silent = max(silent-1, 0)
if(druggy)
druggy = max(druggy-1, 0)
return 1
/mob/living/carbon/alien/humanoid/handle_regular_hud_updates()
if (stat == 2)
sight |= SEE_TURFS
sight |= SEE_MOBS
sight |= SEE_OBJS
see_in_dark = 8
see_invisible = SEE_INVISIBLE_LEVEL_TWO
else if (stat != 2)
sight |= SEE_MOBS
sight &= ~SEE_TURFS
sight &= ~SEE_OBJS
if(nightvision)
see_in_dark = 8
see_invisible = SEE_INVISIBLE_MINIMUM
else if(!nightvision)
see_in_dark = 4
see_invisible = 45
if(see_override)
see_invisible = see_override
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(pullin)
if(pulling)
pullin.icon_state = "pull"
else
pullin.icon_state = "pull0"
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.
client.screen.Remove(global_hud.blurry,global_hud.druggy,global_hud.vimpaired)
if ((blind && stat != 2))
if ((eye_blind))
blind.layer = 18
else
blind.layer = 0
if (disabilities & NEARSIGHT)
client.screen += global_hud.vimpaired
if (eye_blurry)
client.screen += global_hud.blurry
if (druggy)
client.screen += global_hud.druggy
if (stat != 2)
if (machine)
if (!( machine.check_eye(src) ))
reset_view(null)
else
if(!client.adminobs)
reset_view(null)
return 1
@@ -25,26 +25,26 @@
verbs.Add(/mob/living/carbon/alien/humanoid/proc/corrosive_acid,/mob/living/carbon/alien/humanoid/proc/neurotoxin,/mob/living/carbon/alien/humanoid/proc/resin)
..()
/mob/living/carbon/alien/humanoid/queen/handle_regular_hud_updates()
..() //-Yvarov
/mob/living/carbon/alien/humanoid/queen/handle_hud_icons_health()
if (src.healths)
if (src.stat != 2)
switch(health)
if(250 to INFINITY)
src.healths.icon_state = "health0"
if(175 to 250)
if(200 to 250)
src.healths.icon_state = "health1"
if(100 to 175)
if(150 to 200)
src.healths.icon_state = "health2"
if(50 to 100)
if(100 to 150)
src.healths.icon_state = "health3"
if(0 to 50)
if(50 to 100)
src.healths.icon_state = "health4"
else
if(0 to 50)
src.healths.icon_state = "health5"
else
src.healths.icon_state = "health6"
else
src.healths.icon_state = "health6"
src.healths.icon_state = "health7"
/mob/living/carbon/alien/humanoid/queen/movement_delay()
. = ..()
@@ -76,9 +76,9 @@
if (!src.restrained())
message = text("<span class='name'>[src]</span> signs[].", (text2num(param) ? text(" the number []", text2num(param)) : null))
m_type = 1
// if ("sit")
// message = "<span class='name'>[src]</span> sits down." //Larvan can't sit down, /N
// m_type = 1
if ("snore")
message = "<B>[src]</B> snores."
m_type = 2
if ("sulk")
message = "<span class='name'>[src]</span> sulks down sadly."
m_type = 1
@@ -34,60 +34,6 @@
amount_grown = min(amount_grown + 1, max_grown)
..(amount)
/mob/living/carbon/alien/larva/ex_act(severity, target)
..()
var/b_loss = null
var/f_loss = null
switch (severity)
if (1.0)
gib()
return
if (2.0)
b_loss += 60
f_loss += 60
adjustEarDamage(30,120)
if(3.0)
b_loss += 30
if (prob(50))
Paralyse(1)
adjustEarDamage(15,60)
adjustBruteLoss(b_loss)
adjustFireLoss(f_loss)
updatehealth()
/mob/living/carbon/alien/larva/blob_act()
if (stat == 2)
return
var/shielded = 0
var/damage = null
if (stat != 2)
damage = rand(10,30)
if(shielded)
damage /= 4
//paralysis += 1
show_message("<span class='userdanger'>The blob attacks you!</span>")
adjustFireLoss(damage)
updatehealth()
return
//can't equip anything
/mob/living/carbon/alien/larva/attack_ui(slot_id)
return
@@ -137,9 +83,6 @@
/mob/living/carbon/alien/larva/restrained()
return 0
/mob/living/carbon/alien/larva/var/co2overloadtime = null
/mob/living/carbon/alien/larva/var/temperature_resistance = T0C+75
// new damage icon system
// now constructs damage icon for each organ from mask * damage field
@@ -153,15 +96,6 @@
/mob/living/carbon/alien/larva/start_pulling()
return
/* 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
if(icon_state == "larva_l" && !canmove) // This is a shit death check. It is made of shit and death. Fix later.
return
else
var/mob/living/carbon/alien/humanoid/A = new(loc)
A.key = key
qdel(src) */
/mob/living/carbon/alien/larva/stripPanelUnequip(obj/item/what, mob/who)
src << "<span class='warning'>You don't have the dexterity to do this!</span>"
return
@@ -1,10 +1,11 @@
//This file was auto-corrected by findeclaration.exe on 25.5.2012 20:42:32
/mob/living/carbon/alien/larva
var/temperature_alert = 0
/mob/living/carbon/alien/larva/Life()
set invisibility = 0
set background = BACKGROUND_ENABLED
if (notransform)
return
if(..())
// GROW!
if(amount_grown < max_grown)
@@ -13,160 +14,26 @@
//some kind of bug in canmove() isn't properly calling update_icons, so this is here as a placeholder
update_icons()
/mob/living/carbon/alien/larva/handle_regular_status_updates()
updatehealth()
if(stat == DEAD) //DEAD. BROWN BREAD. SWIMMING WITH THE SPESS CARP
eye_blind = max(1, eye_blind)
silent = 0
else //ALIVE. LIGHTS ARE ON
if(health < -25 || !getorgan(/obj/item/organ/brain))
death()
eye_blind = max(1, eye_blind)
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("epinephrine"))
adjustOxyLoss(1)
Paralyse(3)
if(paralysis)
AdjustParalysis(-2)
eye_blind = max(eye_blind, 1)
stat = UNCONSCIOUS
else if(sleeping)
sleeping = max(sleeping-1, 0)
eye_blind = max(eye_blind, 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))
//Eyes
if(disabilities & BLIND) //disabled-blind, doesn't get better on its own
eye_blind = max(eye_blind, 1)
else if(eye_blind) //blindness, heals slowly over time
eye_blind = max(eye_blind-1,0)
else if(eye_blurry) //blurry eyes heal slowly
eye_blurry = max(eye_blurry-1, 0)
//Ears
if(disabilities & DEAF) //disabled-deaf, doesn't get better on its own
setEarDamage(-1, max(ear_deaf, 1))
else
adjustEarDamage(-1, (ear_damage < 25 ? -0.05 : 0))
//deafness, heals slowly over time
//ear damage heals slowly under this threshold. otherwise you'll need earmuffs
//Other
if(stunned)
AdjustStunned(-1)
if(weakened)
weakened = max(weakened-1,0)
if(stuttering)
stuttering = max(stuttering-1, 0)
if(silent)
silent = max(silent-1, 0)
if(druggy)
druggy = max(druggy-1, 0)
return 1
/mob/living/carbon/alien/larva/handle_regular_hud_updates()
if (stat == 2)
sight |= SEE_TURFS
sight |= SEE_MOBS
sight |= SEE_OBJS
see_in_dark = 8
see_invisible = SEE_INVISIBLE_LEVEL_TWO
else if (stat != 2)
sight |= SEE_MOBS
sight &= ~SEE_TURFS
sight &= ~SEE_OBJS
if(nightvision)
see_in_dark = 8
see_invisible = SEE_INVISIBLE_MINIMUM
else if(!nightvision)
see_in_dark = 4
see_invisible = 45
if(see_override)
see_invisible = see_override
/mob/living/carbon/alien/larva/handle_hud_icons_health()
if (healths)
if (stat != 2)
switch(health)
if(25 to INFINITY)
healths.icon_state = "health0"
if(19 to 25)
if(20 to 25)
healths.icon_state = "health1"
if(13 to 19)
if(15 to 20)
healths.icon_state = "health2"
if(7 to 13)
if(10 to 15)
healths.icon_state = "health3"
if(0 to 7)
if(5 to 10)
healths.icon_state = "health4"
else
if(0 to 5)
healths.icon_state = "health5"
else
healths.icon_state = "health6"
else
healths.icon_state = "health6"
if(pullin)
if(pulling)
pullin.icon_state = "pull"
else
pullin.icon_state = "pull0"
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.
client.screen.Remove(global_hud.blurry,global_hud.druggy,global_hud.vimpaired)
if ((blind && stat != 2))
if ((eye_blind))
blind.layer = 18
else
blind.layer = 0
if (disabilities & NEARSIGHT)
client.screen += global_hud.vimpaired
if (eye_blurry)
client.screen += global_hud.blurry
if (druggy)
client.screen += global_hud.druggy
if (stat != 2)
if (machine)
if (!( machine.check_eye(src) ))
reset_view(null)
else
if(!client.adminobs)
reset_view(null)
return 1
healths.icon_state = "health7"
+74 -92
View File
@@ -1,95 +1,5 @@
/mob/living/carbon/alien/Life()
if(..())
//First, resolve location and get a breath
if(SSair.times_fired%4==2)
//Only try to take a breath every 4 seconds, unless suffocating
spawn(0) breathe()
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)
return 1
/mob/living/carbon/alien/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)
jitteriness = max(0, jitteriness - 5)
else
dizziness = max(0, dizziness - 1)
jitteriness = max(0, jitteriness - 1)
updatehealth()
return //TODO: DEFERRED
/mob/living/carbon/alien/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/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(75)) //High chance of gasping for air
spawn emote("gasp")
if(istype(loc, /obj/))
var/obj/location_as_object = loc
location_as_object.handle_internal_lifeform(src, 0)
else
//First, check for air from internal atmosphere (using an air tank and mask generally)
breath = get_breath_from_internal(BREATH_VOLUME)
//No breath from internal atmosphere so get breath from location
if(!breath)
if(istype(loc, /obj/))
var/obj/location_as_object = loc
breath = location_as_object.handle_internal_lifeform(src, BREATH_VOLUME)
else if(istype(loc, /turf/))
var/breath_moles = environment.total_moles()*BREATH_PERCENTAGE
breath = loc.remove_air(breath_moles)
// Handle chem smoke effect -- Doohl
for(var/obj/effect/effect/chem_smoke/smoke in view(1, src))
if(smoke.reagents.total_volume)
smoke.reagents.reaction(src, INGEST)
spawn(5)
if(smoke)
smoke.reagents.copy_to(src, 10) // I dunno, maybe the reagents enter the blood stream through the lungs?
break // If they breathe in the nasty stuff once, no need to continue checking
else //Still give containing object the chance to interact
if(istype(loc, /obj/))
var/obj/location_as_object = loc
location_as_object.handle_internal_lifeform(src, 0)
handle_breath(breath)
if(breath)
loc.assume_air(breath)
/mob/living/carbon/alien/proc/handle_breath(datum/gas_mixture/breath)
/mob/living/carbon/alien/check_breath(datum/gas_mixture/breath)
if(status_flags & GODMODE)
return
@@ -117,6 +27,10 @@
breath.toxins -= toxins_used
breath.oxygen += toxins_used
//BREATH TEMPERATURE
handle_breath_temperature(breath)
/mob/living/carbon/alien/handle_breath_temperature(datum/gas_mixture/breath)
if(breath.temperature > (T0C+66)) // Hot air hurts :(
if(prob(20))
src << "<span class='danger'>You feel a searing heat in your lungs!</span>"
@@ -124,8 +38,76 @@
else
fire_alert = 0
//Temporary fixes to the alerts.
return 1
/mob/living/carbon/alien/handle_regular_status_updates()
..()
//natural reduction of movement delay due to stun.
if(move_delay_add > 0)
move_delay_add = max(0, move_delay_add - rand(1, 2))
return 1
/mob/living/carbon/alien/handle_vision()
client.screen.Remove(global_hud.blurry, global_hud.druggy, global_hud.vimpaired, global_hud.darkMask)
if (stat == 2)
sight |= SEE_TURFS
sight |= SEE_MOBS
sight |= SEE_OBJS
see_in_dark = 8
see_invisible = SEE_INVISIBLE_LEVEL_TWO
else if (stat != 2)
sight |= SEE_MOBS
sight &= ~SEE_TURFS
sight &= ~SEE_OBJS
if(nightvision)
see_in_dark = 8
see_invisible = SEE_INVISIBLE_MINIMUM
else if(!nightvision)
see_in_dark = 4
see_invisible = 45
if(see_override)
see_invisible = see_override
if ((blind && stat != 2))
if((eye_blind))
blind.layer = 18
else
blind.layer = 0
if (disabilities & NEARSIGHT)
client.screen += global_hud.vimpaired
if (eye_blurry)
client.screen += global_hud.blurry
if (druggy)
client.screen += global_hud.druggy
if (stat != 2)
if(machine)
if (!( machine.check_eye(src) ))
reset_view(null)
else
if(!client.adminobs)
reset_view(null)
/mob/living/carbon/alien/handle_hud_icons()
handle_hud_icons_health()
if(pullin)
if(pulling)
pullin.icon_state = "pull"
else
pullin.icon_state = "pull0"
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]"
return 1
@@ -29,6 +29,9 @@
/mob/living/carbon/brain/ex_act() //you cant blow up brainmobs because it makes transfer_to() freak out when borgs blow up.
return
/mob/living/carbon/brain/blob_act()
return
/mob/living/carbon/brain/Move(var/atom/newloc)
if(container)
container.Move(newloc)
+65 -181
View File
@@ -1,40 +1,25 @@
/mob/living/carbon/brain/handle_breathing()
return
/mob/living/carbon/brain/handle_mutations_and_radiation()
if (radiation)
if (radiation > 100)
radiation = 100
if(!container)//If it's not in an MMI
src << "<span class='danger'>You feel weak.</span>"
else//Fluff-wise, since the brain can't detect anything itself, the MMI handles thing like that
src << "<span class='danger'>STATUS: CRITICAL AMOUNTS OF RADIATION DETECTED.</span>"
if (radiation < 0)
radiation = 0
switch(radiation)
if(0 to 50)
radiation--
if(prob(25))
adjustToxLoss(1)
updatehealth()
if(50 to 75)
radiation -= 2
adjustToxLoss(1)
if(prob(5))
radiation -= 5
if(!container)
src << "<span class='danger'>You feel weak.</span>"
else
src << "<span class='danger'>STATUS: DANGEROUS LEVELS OF RADIATION DETECTED.</span>"
updatehealth()
if(75 to 100)
radiation -= 3
adjustToxLoss(3)
updatehealth()
..()
/mob/living/carbon/brain/handle_environment(datum/gas_mixture/environment)
if(!environment)
@@ -61,193 +46,92 @@
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)
/mob/living/carbon/brain/handle_chemicals_in_body()
if(reagents) reagents.metabolize(src)
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
/mob/living/carbon/brain/handle_regular_status_updates() //TODO: comment out the unused bits >_>
updatehealth()
if(stat == DEAD) //DEAD. BROWN BREAD. SWIMMING WITH THE SPESS CARP
if(stat == DEAD)
eye_blind = max(eye_blind, 1)
silent = 0
else //ALIVE. LIGHTS ARE ON
else
updatehealth()
if( !container && (health < config.health_threshold_dead || ((world.time - timeofhostdeath) > config.revival_brain_life)) )
death()
eye_blind = max(eye_blind, 1)
silent = 0
return 1
if(health < config.health_threshold_crit)
stat = UNCONSCIOUS
eye_blind = max(eye_blind, 1)
else
stat = CONSCIOUS
//Handling EMP effect in the Life(), it's made VERY simply, and has some additional effects handled elsewhere
if(emp_damage) //This is pretty much a damage type only used by MMIs, dished out by the emp_act
if(!(container && istype(container, /obj/item/device/mmi)))
emp_damage = 0
//Handling EMP effect in the Life(), it's made VERY simply, and has some additional effects handled elsewhere
if(emp_damage) //This is pretty much a damage type only used by MMIs, dished out by the emp_act
if(!(container && istype(container, /obj/item/device/mmi)))
emp_damage = 0
else
emp_damage = round(emp_damage,1)//Let's have some nice numbers to work with
switch(emp_damage)
if(31 to INFINITY)
emp_damage = 30//Let's not overdo it
if(21 to 30)//High level of EMP damage, unable to see, hear, or speak
eye_blind = max(eye_blind, 1)
setEarDamage(-1,1)
silent = 1
if(!alert)//Sounds an alarm, but only once per 'level'
emote("alarm")
src << "<span class='danger'>Major electrical distruption detected: System rebooting.</span>"
alert = 1
if(prob(75))
emp_damage -= 1
if(20)
alert = 0
eye_blind = 0
setEarDamage(-1,0)
silent = 0
emp_damage -= 1
if(11 to 19)//Moderate level of EMP damage, resulting in nearsightedness and ear damage
eye_blurry = 1
setEarDamage(1,-1)
if(!alert)
emote("alert")
src << "<span class='danger'>Primary systems are now online.</span>"
alert = 1
if(prob(50))
emp_damage -= 1
if(10)
alert = 0
eye_blurry = 0
setEarDamage(0,-1)
emp_damage -= 1
if(2 to 9)//Low level of EMP damage, has few effects(handled elsewhere)
if(!alert)
emote("notice")
src << "<span class='danger'>System reboot nearly complete.</span>"
alert = 1
if(prob(25))
emp_damage -= 1
if(1)
alert = 0
src << "<span class='danger'>All systems restored.</span>"
emp_damage -= 1
else
emp_damage = round(emp_damage,1)//Let's have some nice numbers to work with
switch(emp_damage)
if(31 to INFINITY)
emp_damage = 30//Let's not overdo it
if(21 to 30)//High level of EMP damage, unable to see, hear, or speak
eye_blind = max(eye_blind, 1)
setEarDamage(-1,1)
silent = 1
if(!alert)//Sounds an alarm, but only once per 'level'
emote("alarm")
src << "<span class='danger'>Major electrical distruption detected: System rebooting.</span>"
alert = 1
if(prob(75))
emp_damage -= 1
if(20)
alert = 0
eye_blind = 0
setEarDamage(-1,0)
silent = 0
emp_damage -= 1
if(11 to 19)//Moderate level of EMP damage, resulting in nearsightedness and ear damage
eye_blurry = 1
setEarDamage(1,-1)
if(!alert)
emote("alert")
src << "<span class='danger'>Primary systems are now online.</span>"
alert = 1
if(prob(50))
emp_damage -= 1
if(10)
alert = 0
eye_blurry = 0
setEarDamage(0,-1)
emp_damage -= 1
if(2 to 9)//Low level of EMP damage, has few effects(handled elsewhere)
if(!alert)
emote("notice")
src << "<span class='danger'>System reboot nearly complete.</span>"
alert = 1
if(prob(25))
emp_damage -= 1
if(1)
alert = 0
src << "<span class='danger'>All systems restored.</span>"
emp_damage -= 1
eye_blind = 0
//Other
/* commented out because none of these should happen
if(stunned)
AdjustStunned(-1)
if(weakened)
weakened = max(weakened-1,0)
if(stuttering)
stuttering = max(stuttering-1, 0)
if(silent)
silent = max(silent-1, 0)
if(druggy)
druggy = max(druggy-1, 0)
*/
return 1
/mob/living/carbon/brain/handle_regular_hud_updates()
if (stat == 2)
sight |= SEE_TURFS
sight |= SEE_MOBS
sight |= SEE_OBJS
see_in_dark = 8
see_invisible = SEE_INVISIBLE_LEVEL_TWO
else if (stat != 2)
sight &= ~SEE_TURFS
sight &= ~SEE_MOBS
sight &= ~SEE_OBJS
see_in_dark = 2
see_invisible = SEE_INVISIBLE_LIVING
if(see_override)
see_invisible = see_override
handle_vision()
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.Remove(global_hud.blurry,global_hud.druggy,global_hud.vimpaired)
if ((blind && stat != 2))
if (eye_blind)
blind.layer = 18
else
blind.layer = 0
if (disabilities & NEARSIGHT)
client.screen += global_hud.vimpaired
if (eye_blurry)
client.screen += global_hud.blurry
if (druggy)
client.screen += global_hud.druggy
if (stat != 2)
if (machine)
if (!( machine.check_eye(src) ))
reset_view(null)
else
if(!client.adminobs)
reset_view(null)
handle_hud_icons_health()
return 1
/*/mob/living/carbon/brain/emp_act(severity)
if(!(container && istype(container, /obj/item/device/mmi)))
return
else
switch(severity)
if(1)
emp_damage += rand(20,30)
if(2)
emp_damage += rand(10,20)
if(3)
emp_damage += rand(0,10)
..()*/
+7
View File
@@ -377,3 +377,10 @@ var/const/GALOSHES_DONT_HELP = 8
/mob/living/carbon/is_muzzled()
return(istype(src.wear_mask, /obj/item/clothing/mask/muzzle))
/mob/living/carbon/blob_act()
if (stat == DEAD)
return
else
show_message("<span class='userdanger'>The blob attacks!</span>")
adjustBruteLoss(10)
@@ -15,3 +15,8 @@
var/obj/item/weapon/tank/internal = null
var/datum/dna/dna = null//Carbon
var/failed_last_breath = 0 //This is used to determine if the mob failed a breath. If they did fail a brath, they will attempt to breathe each tick, otherwise just once per 4 ticks.
var/co2overloadtime = null
var/temperature_resistance = T0C+75
+4 -10
View File
@@ -78,7 +78,6 @@
/mob/living/carbon/human/ex_act(severity, ex_target)
var/shielded = 0
var/b_loss = null
var/f_loss = null
switch (severity)
@@ -95,8 +94,7 @@
//user.throw_at(target, 200, 4)
if (2.0)
if (!shielded)
b_loss += 60
b_loss += 60
f_loss += 60
@@ -106,7 +104,7 @@
if (!istype(ears, /obj/item/clothing/ears/earmuffs))
adjustEarDamage(30, 120)
if (prob(70) && !shielded)
if (prob(70))
Paralyse(10)
if(3.0)
@@ -115,7 +113,7 @@
b_loss = b_loss/2
if (!istype(ears, /obj/item/clothing/ears/earmuffs))
adjustEarDamage(15,60)
if (prob(50) && !shielded)
if (prob(50))
Paralyse(10)
var/update = 0
@@ -138,17 +136,13 @@
..()
/mob/living/carbon/human/blob_act()
if(stat == 2) return
if(stat == DEAD) return
show_message("<span class='userdanger'> The blob attacks you!</span>")
var/dam_zone = pick("chest", "l_hand", "r_hand", "l_leg", "r_leg")
var/obj/item/organ/limb/affecting = get_organ(ran_zone(dam_zone))
apply_damage(5, BRUTE, affecting, run_armor_check(affecting, "melee"))
return
/mob/living/carbon/human/var/co2overloadtime = null
/mob/living/carbon/human/var/temperature_resistance = T0C+75
/mob/living/carbon/human/show_inv(mob/user)
user.set_machine(src)
var/has_breathable_mask = istype(wear_mask, /obj/item/clothing/mask)
@@ -44,8 +44,6 @@
var/special_voice = "" // For changing our voice. Used by a symptom.
var/failed_last_breath = 0 //This is used to determine if the mob failed a breath. If they did fail a brath, they will attempt to breathe each tick, otherwise just once per 4 ticks.
var/xylophone = 0 //For the spoooooooky xylophone cooldown
var/gender_ambiguous = 0 //if something goes wrong during gender reassignment this generates a line in examine
+48 -313
View File
@@ -6,8 +6,6 @@
#define TINT_IMPAIR 2 //Threshold of tint level to apply weld mask overlay
#define TINT_BLIND 3 //Threshold of tint level to obscure vision fully
#define HUMAN_MAX_OXYLOSS 3 //Defines how much oxyloss humans can get per tick. A tile with no air at all (such as space) applies this value, otherwise it's a percentage of it.
#define HEAT_DAMAGE_LEVEL_1 2 //Amount of damage applied when your body temperature just passes the 360.15k safety point
#define HEAT_DAMAGE_LEVEL_2 3 //Amount of damage applied when your body temperature passes the 400K point
#define HEAT_DAMAGE_LEVEL_3 8 //Amount of damage applied when your body temperature passes the 460K point and you are on fire
@@ -26,31 +24,21 @@
#define COLD_GAS_DAMAGE_LEVEL_3 3 //Amount of damage applied when the current breath's temperature passes the 120K point
/mob/living/carbon/human
var/oxygen_alert = 0
var/toxins_alert = 0
var/fire_alert = 0
var/pressure_alert = 0
var/temperature_alert = 0
var/tinttotal = 0 // Total level of visualy impairing items
/mob/living/carbon/human/Life()
set invisibility = 0
set background = BACKGROUND_ENABLED
if (notransform)
return
fire_alert = 0 //Reset this here, because both breathe() and handle_environment() have a chance to set it.
tinttotal = tintcheck() //here as both hud updates and status updates call it
if(..())
if(dna)
for(var/datum/mutation/human/HM in dna.mutations)
HM.on_life(src)
if(SSmob.times_fired%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
if(istype(loc, /obj/))
var/obj/location_as_object = loc
location_as_object.handle_internal_lifeform(src, 0)
//Stuff jammed in your limbs hurts
handle_embedded_objects()
@@ -79,7 +67,19 @@
/mob/living/carbon/human/handle_disabilities()
if (getBrainLoss() >= 60 && stat != 2)
..()
//Eyes
if(!(disabilities & BLIND))
if(tinttotal >= TINT_BLIND) //covering your eyes heals blurry eyes faster
eye_blurry = max(eye_blurry-2, 0)
//Ears
if(!(disabilities & DEAF))
if(istype(ears, /obj/item/clothing/ears/earmuffs)) // earmuffs rest your ears, healing ear_deaf faster and ear_damage, but keeping you deaf.
setEarDamage(max(ear_damage-0.10, 0), max(ear_deaf - 1, 1))
if (getBrainLoss() >= 60 && stat != DEAD)
if (prob(3))
switch(pick(1,2,3))
if(1)
@@ -92,9 +92,10 @@
/mob/living/carbon/human/handle_mutations_and_radiation()
if(dna)
dna.species.handle_mutations_and_radiation(src)
if(dna.species.handle_mutations_and_radiation(src))
..()
/mob/living/carbon/human/proc/breathe()
/mob/living/carbon/human/breathe()
if(dna)
dna.species.breathe(src)
@@ -140,27 +141,8 @@
dna.species.ExtinguishMob(src)
else
..()
//END FIRE CODE
/*
/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
*/
/mob/living/carbon/human/proc/stabilize_temperature_from_calories()
switch(bodytemperature)
@@ -297,290 +279,28 @@
return min(1,thermal_protection)
/*
/mob/living/carbon/human/proc/add_fire_protection(var/temp)
var/fire_prot = 0
if(head)
if(head.protective_temperature > temp)
fire_prot += (head.protective_temperature/10)
if(wear_mask)
if(wear_mask.protective_temperature > temp)
fire_prot += (wear_mask.protective_temperature/10)
if(glasses)
if(glasses.protective_temperature > temp)
fire_prot += (glasses.protective_temperature/10)
if(ears)
if(ears.protective_temperature > temp)
fire_prot += (ears.protective_temperature/10)
if(wear_suit)
if(wear_suit.protective_temperature > temp)
fire_prot += (wear_suit.protective_temperature/10)
if(w_uniform)
if(w_uniform.protective_temperature > temp)
fire_prot += (w_uniform.protective_temperature/10)
if(gloves)
if(gloves.protective_temperature > temp)
fire_prot += (gloves.protective_temperature/10)
if(shoes)
if(shoes.protective_temperature > temp)
fire_prot += (shoes.protective_temperature/10)
return fire_prot
/mob/living/carbon/human/proc/handle_temperature_damage(body_part, exposed_temperature, exposed_intensity)
if(nodamage)
return
//world <<"body_part = [body_part], exposed_temperature = [exposed_temperature], exposed_intensity = [exposed_intensity]"
var/discomfort = min(abs(exposed_temperature - bodytemperature)*(exposed_intensity)/2000000, 1.0)
if(exposed_temperature > bodytemperature)
discomfort *= 4
if(mutantrace == "plant")
discomfort *= TEMPERATURE_DAMAGE_COEFFICIENT * 2 //I don't like magic numbers. I'll make mutantraces a datum with vars sometime later. -- Urist
else
discomfort *= TEMPERATURE_DAMAGE_COEFFICIENT //Dangercon 2011 - now with less magic numbers!
//world <<"[discomfort]"
switch(body_part)
if(HEAD)
apply_damage(2.5*discomfort, BURN, "head")
if(CHEST)
apply_damage(2.5*discomfort, BURN, "chest")
if(LEGS)
apply_damage(0.6*discomfort, BURN, "l_leg")
apply_damage(0.6*discomfort, BURN, "r_leg")
if(ARMS)
apply_damage(0.4*discomfort, BURN, "l_arm")
apply_damage(0.4*discomfort, BURN, "r_arm")
*/
/mob/living/carbon/human/handle_chemicals_in_body()
..()
if(dna)
dna.species.handle_chemicals_in_body(src)
return //TODO: DEFERRED
/mob/living/carbon/human/handle_regular_status_updates()
if(stat == DEAD) //DEAD. BROWN BREAD. SWIMMING WITH THE SPESS CARP
silent = 0
else //ALIVE. LIGHTS ARE ON
updatehealth() //TODO
if(health <= config.health_threshold_dead || !getorgan(/obj/item/organ/brain))
death()
silent = 0
return 1
//UNCONSCIOUS. NO-ONE IS HOME
if( (getOxyLoss() > 50) || (config.health_threshold_crit >= health) )
Paralyse(3)
if(hallucination)
spawn handle_hallucinations()
if(hallucination<=2)
hallucination = 0
else
hallucination -= 2
else
for(var/atom/a in hallucinations)
qdel(a)
if(paralysis)
AdjustParalysis(-1)
stat = UNCONSCIOUS
else if(sleeping)
handle_dreams()
adjustStaminaLoss(-10)
sleeping = max(sleeping-1, 0)
stat = UNCONSCIOUS
if( prob(10) && health && !hal_crit )
spawn(0)
emote("snore")
else if (status_flags & FAKEDEATH)
stat = UNCONSCIOUS
//CONSCIOUS
else
stat = CONSCIOUS
//Eyes
if(disabilities & BLIND || stat) //disabled-blind, doesn't get better on its own
eye_blind = max(eye_blind, 1)
else if(eye_blind) //blindness, heals slowly over time
eye_blind = max(eye_blind-1,0)
else if(tinttotal >= TINT_BLIND) //covering your eyes heals blurry eyes faster
eye_blurry = max(eye_blurry-3, 0)
else if(eye_blurry) //blurry eyes heal slowly
eye_blurry = max(eye_blurry-1, 0)
//Ears
if(disabilities & DEAF) //disabled-deaf, doesn't get better on its own
setEarDamage(-1, max(ear_deaf, 1))
else if (ear_damage < 100) // deafness heals slowly over time, unless ear_damage is over 100
if(istype(ears, /obj/item/clothing/ears/earmuffs)) // earmuffs rest your ears, healing 3x faster, but keeping you deaf.
setEarDamage(max(ear_damage-0.15, 0), max(ear_deaf - 1, 1))
else
adjustEarDamage(-0.05, -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(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
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
//Jitteryness
if(jitteriness)
do_jitter_animation(jitteriness)
jitteriness = max(jitteriness-1, 0)
//Other
if(stunned)
AdjustStunned(-1)
if(weakened)
weakened = max(weakened-1,0)
if(stuttering)
stuttering = max(stuttering-1, 0)
if(slurring)
slurring = max(slurring-1,0)
if(silent)
silent = max(silent-1, 0)
if(druggy)
druggy = max(druggy-1, 0)
CheckStamina()
/mob/living/carbon/human/handle_vision()
client.screen.Remove(global_hud.blurry, global_hud.druggy, global_hud.vimpaired, global_hud.darkMask)
if(machine)
if(!machine.check_eye(src)) reset_view(null)
else
if(!client.adminobs) reset_view(null)
if(dna)
dna.species.handle_vision(src)
return 1
/mob/living/carbon/human/handle_regular_hud_updates()
if(!client) return 0
client.screen.Remove(global_hud.blurry, global_hud.druggy, global_hud.vimpaired, global_hud.darkMask)
update_action_buttons()
if(damageoverlay.overlays)
damageoverlay.overlays = list()
if(stat == UNCONSCIOUS)
//Critical damage passage overlay
if(health <= config.health_threshold_crit)
var/image/I = image("icon" = 'icons/mob/screen_full.dmi', "icon_state" = "passage0")
I.blend_mode = BLEND_OVERLAY //damageoverlay is BLEND_MULTIPLY
switch(health)
if(-20 to -10)
I.icon_state = "passage1"
if(-30 to -20)
I.icon_state = "passage2"
if(-40 to -30)
I.icon_state = "passage3"
if(-50 to -40)
I.icon_state = "passage4"
if(-60 to -50)
I.icon_state = "passage5"
if(-70 to -60)
I.icon_state = "passage6"
if(-80 to -70)
I.icon_state = "passage7"
if(-90 to -80)
I.icon_state = "passage8"
if(-95 to -90)
I.icon_state = "passage9"
if(-INFINITY to -95)
I.icon_state = "passage10"
damageoverlay.overlays += I
else
//Oxygen damage overlay
if(oxyloss)
var/image/I = image("icon" = 'icons/mob/screen_full.dmi', "icon_state" = "oxydamageoverlay0")
switch(oxyloss)
if(10 to 20)
I.icon_state = "oxydamageoverlay1"
if(20 to 25)
I.icon_state = "oxydamageoverlay2"
if(25 to 30)
I.icon_state = "oxydamageoverlay3"
if(30 to 35)
I.icon_state = "oxydamageoverlay4"
if(35 to 40)
I.icon_state = "oxydamageoverlay5"
if(40 to 45)
I.icon_state = "oxydamageoverlay6"
if(45 to INFINITY)
I.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 = image("icon" = 'icons/mob/screen_full.dmi', "icon_state" = "brutedamageoverlay0")
I.blend_mode = BLEND_ADD
switch(hurtdamage)
if(5 to 15)
I.icon_state = "brutedamageoverlay1"
if(15 to 30)
I.icon_state = "brutedamageoverlay2"
if(30 to 45)
I.icon_state = "brutedamageoverlay3"
if(45 to 70)
I.icon_state = "brutedamageoverlay4"
if(70 to 85)
I.icon_state = "brutedamageoverlay5"
if(85 to INFINITY)
I.icon_state = "brutedamageoverlay6"
var/image/black = image(I.icon, I.icon_state) //BLEND_ADD doesn't let us darken, so this is just to blacken the edge of the screen
black.color = "#170000"
damageoverlay.overlays += I
damageoverlay.overlays += black
if(machine)
if(!machine.check_eye(src)) reset_view(null)
else
if(!client.adminobs) reset_view(null)
/mob/living/carbon/human/handle_hud_icons()
if(dna)
dna.species.handle_hud_icons(src)
return 1
/mob/living/carbon/human/handle_random_events()
// Puke if toxloss is too high
if(!stat)
@@ -605,10 +325,25 @@
/mob/living/carbon/human/handle_changeling()
if(mind && mind.changeling)
mind.changeling.regenerate()
if(mind)
if(mind.changeling)
mind.changeling.regenerate()
hud_used.lingchemdisplay.invisibility = 0
hud_used.lingchemdisplay.maptext = "<div align='center' valign='middle' style='position:relative; top:0px; left:6px'> <font color='#dd66dd'>[mind.changeling.chem_charges]</font></div>"
else
hud_used.lingchemdisplay.invisibility = 101
/mob/living/carbon/human/has_smoke_protection()
if(wear_mask)
if(wear_mask.flags & BLOCK_GAS_SMOKE_EFFECT)
. = 1
if(glasses)
if(glasses.flags & BLOCK_GAS_SMOKE_EFFECT)
. = 1
if(head)
if(head.flags & BLOCK_GAS_SMOKE_EFFECT)
. = 1
return .
/mob/living/carbon/human/proc/handle_embedded_objects()
for(var/obj/item/organ/limb/L in organs)
for(var/obj/item/I in L.embedded_objects)
@@ -622,4 +357,4 @@
I.loc = get_turf(src)
visible_message("<span class='danger'>\the [I] falls out of [name]'s [L.getDisplayName()]!</span>","<span class='userdanger'>\the [I] falls out of your [L.getDisplayName()]!</span>")
#undef HUMAN_MAX_OXYLOSS
#undef HUMAN_MAX_OXYLOSS
+13 -63
View File
@@ -449,7 +449,6 @@
////////
/datum/species/proc/handle_chemicals_in_body(var/mob/living/carbon/human/H)
if(H.reagents) H.reagents.metabolize(H)
//The fucking FAT mutation is the dumbest shit ever. It makes the code so difficult to work with
if(H.disabilities & FAT)
@@ -501,22 +500,6 @@
H << "<span class='notice'>You no longer feel vigorous.</span>"
H.metabolism_efficiency = 1
if (H.drowsyness)
H.drowsyness--
H.eye_blurry = max(2, H.eye_blurry)
if (prob(5))
H.sleeping += 1
H.Paralyse(5)
H.confused = max(0, H.confused - 1)
// decrement dizziness counter, clamped to 0
if(H.resting)
H.dizziness = max(0, H.dizziness - 15)
H.jitteriness = max(0, H.jitteriness - 15)
else
H.dizziness = max(0, H.dizziness - 3)
H.jitteriness = max(0, H.jitteriness - 3)
H.updatehealth()
return
@@ -535,13 +518,6 @@
if(H.seer)
H.see_invisible = SEE_INVISIBLE_OBSERVER
if(H.mind)
if(H.mind.changeling)
H.hud_used.lingchemdisplay.invisibility = 0
H.hud_used.lingchemdisplay.maptext = "<div align='center' valign='middle' style='position:relative; top:0px; left:6px'> <font color='#dd66dd'>[H.mind.changeling.chem_charges]</font></div>"
else
H.hud_used.lingchemdisplay.invisibility = 101
if(H.glasses)
if(istype(H.glasses, /obj/item/clothing/glasses))
var/obj/item/clothing/glasses/G = H.glasses
@@ -676,29 +652,17 @@
/datum/species/proc/handle_mutations_and_radiation(var/mob/living/carbon/human/H)
if (H.radiation && !(RADIMMUNE in specflags))
if (H.radiation > 100)
H.radiation = 100
H.Weaken(10)
H << "<span class='danger'>You feel weak.</span>"
H.emote("collapse")
if(!(RADIMMUNE in specflags))
if(H.radiation)
if (H.radiation > 100)
H.Weaken(10)
H << "<span class='danger'>You feel weak.</span>"
H.emote("collapse")
if (H.radiation < 0)
H.radiation = 0
else
switch(H.radiation)
if(0 to 50)
H.radiation--
if(prob(25))
H.adjustToxLoss(1)
H.updatehealth()
if(50 to 75)
H.radiation -= 2
H.adjustToxLoss(1)
if(prob(5))
H.radiation -= 5
H.Weaken(3)
H << "<span class='danger'>You feel weak.</span>"
H.emote("collapse")
@@ -709,17 +673,14 @@
H.facial_hair_style = "Shaved"
H.hair_style = "Bald"
H.update_hair()
H.updatehealth()
if(75 to 100)
H.radiation -= 3
H.adjustToxLoss(3)
if(prob(1))
H << "<span class='danger'>You mutate!</span>"
randmutb(H)
domutcheck(H,null)
H.emote("gasp")
H.updatehealth()
return 1
////////////////
// MOVE SPEED //
@@ -1108,20 +1069,9 @@
breath_moles = environment.total_moles()*BREATH_PERCENTAGE
breath = H.loc.remove_air(breath_moles)
// Handle chem smoke effect -- Doohl
var/block = 0
if(H.wear_mask)
if(H.wear_mask.flags & BLOCK_GAS_SMOKE_EFFECT)
block = 1
if(H.glasses)
if(H.glasses.flags & BLOCK_GAS_SMOKE_EFFECT)
block = 1
if(H.head)
if(H.head.flags & BLOCK_GAS_SMOKE_EFFECT)
block = 1
if(!block)
if(!H.has_smoke_protection())
for(var/obj/effect/effect/chem_smoke/smoke in view(1, H))
if(smoke.reagents.total_volume)
smoke.reagents.reaction(H, INGEST)
@@ -1135,12 +1085,12 @@
var/obj/location_as_object = H.loc
location_as_object.handle_internal_lifeform(H, 0)
handle_breath(breath, H)
check_breath(breath, H)
if(breath)
H.loc.assume_air(breath)
/datum/species/proc/handle_breath(datum/gas_mixture/breath, var/mob/living/carbon/human/H)
/datum/species/proc/check_breath(datum/gas_mixture/breath, var/mob/living/carbon/human/H)
if((H.status_flags & GODMODE))
return
@@ -1239,11 +1189,11 @@
if(prob(20))
spawn(0) H.emote(pick("giggle", "laugh"))
handle_temperature(breath, H)
handle_breath_temperature(breath, H)
return 1
/datum/species/proc/handle_temperature(datum/gas_mixture/breath, var/mob/living/carbon/human/H) // called by human/life, handles temperatures
/datum/species/proc/handle_breath_temperature(datum/gas_mixture/breath, var/mob/living/carbon/human/H) // called by human/life, handles temperatures
if( (abs(310.15 - breath.temperature) > 50) && !(mutations_list[COLDRES] in H.dna.mutations) && !(COLDRES in specflags)) // Hot air hurts :(
if(breath.temperature < 260.15)
if(prob(20))
+578 -75
View File
@@ -1,3 +1,252 @@
/mob/living/carbon
var/oxygen_alert = 0
var/toxins_alert = 0
var/fire_alert = 0
var/pressure_alert = 0
var/temperature_alert = 0
/mob/living/carbon/Life()
set invisibility = 0
set background = BACKGROUND_ENABLED
if (notransform)
return
if(!loc)
return
var/datum/gas_mixture/environment = loc.return_air()
if(stat != DEAD)
//Breathing, if applicable
handle_breathing()
//Updates the number of stored chemicals for powers
handle_changeling()
//Mutations and radiation
handle_mutations_and_radiation()
//Chemicals in the body
handle_chemicals_in_body()
//Blud
handle_blood()
//Random events (vomiting etc)
handle_random_events()
. = 1
//Handle temperature/pressure differences between body and environment
handle_environment(environment)
handle_fire()
//stuff in the stomach
handle_stomach()
update_canmove()
update_gravity(mob_has_gravity())
for(var/obj/item/weapon/grab/G in src)
G.process()
handle_regular_status_updates() // Status updates, death etc.
if(client)
handle_regular_hud_updates()
return .
///////////////
// BREATHING //
///////////////
//Start of a breath chain, calls breathe()
/mob/living/carbon/proc/handle_breathing()
if(SSmob.times_fired%4==2 || failed_last_breath)
breathe() //Breathe per 4 ticks, unless suffocating
else
if(istype(loc, /obj/))
var/obj/location_as_object = loc
location_as_object.handle_internal_lifeform(src,0)
//Second link in a breath chain, calls check_breath()
/mob/living/carbon/proc/breathe()
if(reagents.has_reagent("lexorin"))
return
if(istype(loc, /obj/machinery/atmospherics/unary/cryo_cell))
return
var/datum/gas_mixture/environment
if(loc)
environment = loc.return_air()
var/datum/gas_mixture/breath
if(health <= config.health_threshold_crit)
losebreath++
//Suffocate
if(losebreath > 0)
losebreath--
if(prob(10))
spawn emote("gasp")
if(istype(loc, /obj/))
var/obj/loc_as_obj = loc
loc_as_obj.handle_internal_lifeform(src,0)
else
//Breathe from internal
breath = get_breath_from_internal(BREATH_VOLUME)
if(!breath)
if(isobj(loc)) //Breathe from loc as object
var/obj/loc_as_obj = loc
breath = loc_as_obj.handle_internal_lifeform(src, BREATH_VOLUME)
else if(isturf(loc)) //Breathe from loc as turf
var/breath_moles = 0
if(environment)
breath_moles = environment.total_moles()*BREATH_PERCENTAGE
breath = loc.remove_air(breath_moles)
//Harmful gasses
if(!has_smoke_protection())
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)
break
else //Breathe from loc as obj again
if(istype(loc, /obj/))
var/obj/loc_as_obj = loc
loc_as_obj.handle_internal_lifeform(src,0)
check_breath(breath)
if(breath)
loc.assume_air(breath)
/mob/living/carbon/proc/has_smoke_protection()
return 0
//Third link in a breath chain, calls handle_breath_temperature()
/mob/living/carbon/proc/check_breath(datum/gas_mixture/breath)
if((status_flags & GODMODE))
return
//CRIT
if(!breath || (breath.total_moles() == 0))
if(reagents.has_reagent("epinephrine"))
return
adjustOxyLoss(1)
failed_last_breath = 1
oxygen_alert = max(oxygen_alert, 1)
return 0
var/safe_oxy_min = 16
var/safe_co2_max = 10
var/safe_tox_max = 0.05
var/SA_para_min = 1
var/SA_sleep_min = 5
var/oxygen_used = 0
var/breath_pressure = (breath.total_moles()*R_IDEAL_GAS_EQUATION*breath.temperature)/BREATH_VOLUME
var/O2_partialpressure = (breath.oxygen/breath.total_moles())*breath_pressure
var/Toxins_partialpressure = (breath.toxins/breath.total_moles())*breath_pressure
var/CO2_partialpressure = (breath.carbon_dioxide/breath.total_moles())*breath_pressure
//OXYGEN
if(O2_partialpressure < safe_oxy_min) //Not enough oxygen
if(prob(20))
spawn(0)
emote("gasp")
if(O2_partialpressure > 0)
var/ratio = safe_oxy_min/O2_partialpressure
adjustOxyLoss(min(5*ratio, 3))
failed_last_breath = 1
oxygen_used = breath.oxygen*ratio/6
else
adjustOxyLoss(3)
failed_last_breath = 1
oxygen_alert = max(oxygen_alert, 1)
else //Enough oxygen
failed_last_breath = 0
adjustOxyLoss(-5)
oxygen_used = breath.oxygen/6
oxygen_alert = 0
breath.oxygen -= oxygen_used
breath.carbon_dioxide += oxygen_used
//CARBON DIOXIDE
if(CO2_partialpressure > safe_co2_max)
if(!co2overloadtime)
co2overloadtime = world.time
else if(world.time - co2overloadtime > 120)
Paralyse(3)
adjustOxyLoss(3)
if(world.time - co2overloadtime > 300)
adjustOxyLoss(8)
if(prob(20))
spawn(0) emote("cough")
else
co2overloadtime = 0
//TOXINS/PLASMA
if(Toxins_partialpressure > safe_tox_max)
var/ratio = (breath.toxins/safe_tox_max) * 10
if(reagents)
reagents.add_reagent("plasma", Clamp(ratio, MIN_PLASMA_DAMAGE, MAX_PLASMA_DAMAGE))
toxins_alert = max(toxins_alert, 1)
else
toxins_alert = 0
//TRACE GASES
if(breath.trace_gases.len)
for(var/datum/gas/sleeping_agent/SA in breath.trace_gases)
var/SA_partialpressure = (SA.moles/breath.total_moles())*breath_pressure
if(SA_partialpressure > SA_para_min)
Paralyse(3)
if(SA_partialpressure > SA_sleep_min)
sleeping = max(sleeping+2, 10)
else if(SA_partialpressure > 0.01)
if(prob(20))
spawn(0) emote(pick("giggle","laugh"))
//BREATH TEMPERATURE
handle_breath_temperature(breath)
return 1
//Fourth and final link in a breath chain
/mob/living/carbon/proc/handle_breath_temperature(datum/gas_mixture/breath)
if(breath.temperature > (T0C+66)) // Hot air hurts :(
if(prob(20))
src << "<span class='danger'>You feel a searing heat in your lungs!</span>"
fire_alert = max(fire_alert, 2)
else
fire_alert = 0
if(breath.temperature < (T0C-20))
if(prob(20))
src << "<span class='danger'>You feel your face freezing and an icicle forming in your lungs!</span>"
return
/mob/living/carbon/proc/get_breath_from_internal(volume_needed)
if(internal)
if (!contents.Find(internal))
@@ -13,85 +262,56 @@
internals.icon_state = "internal0"
return
/mob/living/carbon/Life()
set invisibility = 0
set background = BACKGROUND_ENABLED
if (notransform)
return
if(!loc)
return
var/datum/gas_mixture/environment = loc.return_air()
//Handle temperature/pressure differences between body and environment
handle_environment(environment)
handle_regular_status_updates() // Status updates, death etc.
if(stat != DEAD)
//Updates the number of stored chemicals for powers
handle_changeling()
//Mutations and radiation
handle_mutations_and_radiation()
//Chemicals in the body
handle_chemicals_in_body()
//Disabilities
handle_disabilities()
//Blud
handle_blood()
//Random events (vomiting etc)
handle_random_events()
. = 1
handle_fire()
//stuff in the stomach
handle_stomach()
update_canmove()
update_gravity(mob_has_gravity())
for(var/obj/item/weapon/grab/G in src)
G.process()
if(client)
handle_regular_hud_updates()
return .
//remember to remove the "proc" of the child procs of these.
/mob/living/carbon/proc/handle_changeling()
return
/mob/living/carbon/proc/handle_mutations_and_radiation()
return
if(radiation)
switch(radiation)
if(0 to 50)
radiation--
if(prob(25))
adjustToxLoss(1)
updatehealth()
if(50 to 75)
radiation -= 2
adjustToxLoss(1)
if(prob(5))
radiation -= 5
updatehealth()
if(75 to 100)
radiation -= 3
adjustToxLoss(3)
updatehealth()
radiation = Clamp(radiation, 0, 100)
/mob/living/carbon/proc/handle_chemicals_in_body()
return
if(reagents)
reagents.metabolize(src)
/mob/living/carbon/proc/handle_disabilities()
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)
updatehealth()
return
/mob/living/carbon/proc/handle_blood()
@@ -103,9 +323,6 @@
/mob/living/carbon/proc/handle_environment(var/datum/gas_mixture/environment)
return
/mob/living/carbon/proc/handle_regular_status_updates()
return
/mob/living/carbon/proc/handle_stomach()
spawn(0)
for(var/mob/living/M in stomach_contents)
@@ -123,7 +340,293 @@
M.adjustBruteLoss(5)
nutrition += 10
/mob/living/carbon/proc/handle_regular_status_updates()
if(stat == DEAD)
eye_blind = max(eye_blind, 1)
silent = 0
else
updatehealth()
if(health <= config.health_threshold_dead || !getorgan(/obj/item/organ/brain))
death()
eye_blind = max(eye_blind, 1)
silent = 0
return 1
if( (getOxyLoss() > 50) || (config.health_threshold_crit >= health) )
Paralyse(3)
if(paralysis)
AdjustParalysis(-1)
stat = UNCONSCIOUS
else if(sleeping)
handle_dreams()
adjustStaminaLoss(-10)
sleeping = max(sleeping-1, 0)
stat = UNCONSCIOUS
if( prob(10) && health && !hal_crit )
spawn(0)
emote("snore")
else if (status_flags & FAKEDEATH)
stat = UNCONSCIOUS
else
stat = CONSCIOUS
handle_disabilities()
//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
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
//Jitteryness
if(jitteriness)
do_jitter_animation(jitteriness)
jitteriness = max(jitteriness-1, 0)
//Other
if(stuttering)
stuttering = max(stuttering-1, 0)
if(slurring)
slurring = max(slurring-1,0)
if(silent)
silent = max(silent-1, 0)
if(druggy)
druggy = max(druggy-1, 0)
if(stunned)
AdjustStunned(-1)
if(!stunned)
update_icons()
if(weakened)
weakened = max(weakened-1,0)
if(!weakened)
update_icons()
if(hallucination)
spawn handle_hallucinations()
if(hallucination<=2)
hallucination = 0
else
hallucination -= 2
else
for(var/atom/a in hallucinations)
qdel(a)
CheckStamina()
return 1
/mob/living/carbon/proc/handle_disabilities()
//Eyes
if(disabilities & BLIND || stat) //blindness from disability or unconsciousness doesn't get better on its own
eye_blind = max(eye_blind, 1)
else if(eye_blind) //blindness, heals slowly over time
eye_blind = max(eye_blind-1,0)
else if(eye_blurry) //blurry eyes heal slowly
eye_blurry = max(eye_blurry-1, 0)
//Ears
if(disabilities & DEAF) //disabled-deaf, doesn't get better on its own
setEarDamage(-1, max(ear_deaf, 1))
else
// deafness heals slowly over time, unless ear_damage is over 100
if(ear_damage < 100)
adjustEarDamage(-0.05,-1)
//this handles hud updates. Calles update_vision() and handle_hud_icons()
/mob/living/carbon/proc/handle_regular_hud_updates()
if(!client) return 0
update_action_buttons()
if(damageoverlay)
if(damageoverlay.overlays)
damageoverlay.overlays = list()
if(stat == UNCONSCIOUS)
//Critical damage passage overlay
if(health <= config.health_threshold_crit)
var/image/I = image("icon" = 'icons/mob/screen_full.dmi', "icon_state" = "passage0")
I.blend_mode = BLEND_OVERLAY //damageoverlay is BLEND_MULTIPLY
switch(health)
if(-20 to -10)
I.icon_state = "passage1"
if(-30 to -20)
I.icon_state = "passage2"
if(-40 to -30)
I.icon_state = "passage3"
if(-50 to -40)
I.icon_state = "passage4"
if(-60 to -50)
I.icon_state = "passage5"
if(-70 to -60)
I.icon_state = "passage6"
if(-80 to -70)
I.icon_state = "passage7"
if(-90 to -80)
I.icon_state = "passage8"
if(-95 to -90)
I.icon_state = "passage9"
if(-INFINITY to -95)
I.icon_state = "passage10"
damageoverlay.overlays += I
else
//Oxygen damage overlay
if(oxyloss)
var/image/I = image("icon" = 'icons/mob/screen_full.dmi', "icon_state" = "oxydamageoverlay0")
switch(oxyloss)
if(10 to 20)
I.icon_state = "oxydamageoverlay1"
if(20 to 25)
I.icon_state = "oxydamageoverlay2"
if(25 to 30)
I.icon_state = "oxydamageoverlay3"
if(30 to 35)
I.icon_state = "oxydamageoverlay4"
if(35 to 40)
I.icon_state = "oxydamageoverlay5"
if(40 to 45)
I.icon_state = "oxydamageoverlay6"
if(45 to INFINITY)
I.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 = image("icon" = 'icons/mob/screen_full.dmi', "icon_state" = "brutedamageoverlay0")
I.blend_mode = BLEND_ADD
switch(hurtdamage)
if(5 to 15)
I.icon_state = "brutedamageoverlay1"
if(15 to 30)
I.icon_state = "brutedamageoverlay2"
if(30 to 45)
I.icon_state = "brutedamageoverlay3"
if(45 to 70)
I.icon_state = "brutedamageoverlay4"
if(70 to 85)
I.icon_state = "brutedamageoverlay5"
if(85 to INFINITY)
I.icon_state = "brutedamageoverlay6"
var/image/black = image(I.icon, I.icon_state) //BLEND_ADD doesn't let us darken, so this is just to blacken the edge of the screen
black.color = "#170000"
damageoverlay.overlays += I
damageoverlay.overlays += black
handle_vision()
handle_hud_icons()
return 1
/mob/living/carbon/proc/handle_vision()
client.screen.Remove(global_hud.blurry, global_hud.druggy, global_hud.vimpaired, global_hud.darkMask)
if(stat == DEAD)
sight |= SEE_TURFS
sight |= SEE_MOBS
sight |= SEE_OBJS
see_in_dark = 8
see_invisible = SEE_INVISIBLE_LEVEL_TWO
else
sight &= ~SEE_TURFS
sight &= ~SEE_MOBS
sight &= ~SEE_OBJS
see_in_dark = 2
see_invisible = SEE_INVISIBLE_LIVING
if(see_override)
see_invisible = see_override
if(blind)
if(eye_blind)
blind.layer = 18
else
blind.layer = 0
if (disabilities & NEARSIGHT)
client.screen += global_hud.vimpaired
if (eye_blurry)
client.screen += global_hud.blurry
if (druggy)
client.screen += global_hud.druggy
if(eye_stat > 20)
if(eye_stat > 30)
client.screen += global_hud.darkMask
else
client.screen += global_hud.vimpaired
if(machine)
if (!( machine.check_eye(src) ))
reset_view(null)
else
if(!client.adminobs)
reset_view(null)
/mob/living/carbon/proc/handle_hud_icons()
return
/mob/living/carbon/proc/handle_hud_icons_health()
if(healths)
if (stat != DEAD)
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"
+21 -349
View File
@@ -1,24 +1,16 @@
//This file was auto-corrected by findeclaration.exe on 25.5.2012 20:42:32
/mob/living/carbon/monkey
var/oxygen_alert = 0
var/toxins_alert = 0
var/fire_alert = 0
var/pressure_alert = 0
var/temperature_alert = 0
/mob/living/carbon/monkey/Life()
if(..())
//First, resolve location and get a breath
if(SSmob.times_fired%4==2)
//Only try to take a breath every 4 seconds, unless suffocating
breathe()
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)
set invisibility = 0
set background = BACKGROUND_ENABLED
if (notransform)
return
..()
if(!client && stat == CONSCIOUS)
if(prob(33) && canmove && isturf(loc) && !pulledby && !grabbed_by.len)
@@ -30,203 +22,31 @@
..()
return pressure
/mob/living/carbon/monkey/handle_disabilities()
/mob/living/carbon/monkey/handle_mutations_and_radiation()
if (radiation)
if (radiation > 100)
radiation = 100
Weaken(10)
src << "<span class='danger'>You feel weak.</span>"
emote("collapse")
if (radiation < 0)
radiation = 0
switch(radiation)
if(0 to 50)
radiation--
if(prob(25))
adjustToxLoss(1)
updatehealth()
if(50 to 75)
radiation -= 2
adjustToxLoss(1)
if(prob(5))
radiation -= 5
Weaken(3)
src << "<span class='danger'>You feel weak.</span>"
emote("collapse")
updatehealth()
if(75 to 100)
radiation -= 3
adjustToxLoss(3)
if(prob(1))
src << "<span class='danger'>You mutate!</span>"
randmutb(src)
domutcheck(src,null)
emote("gasp")
updatehealth()
..()
/mob/living/carbon/monkey/proc/breathe()
if(reagents)
if(reagents.has_reagent("lexorin")) return
if(!loc) return //probably ought to make a proper fix for this, but :effort: --NeoFite
var/datum/gas_mixture/environment = loc.return_air()
var/datum/gas_mixture/breath
if(health <= config.health_threshold_crit)
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 = environment.total_moles()*BREATH_PERCENTAGE
breath = loc.remove_air(breath_moles)
// Handle chem smoke effect -- Doohl
var/block = 0
if(wear_mask)
if(istype(wear_mask, /obj/item/clothing/mask/gas))
block = 1
if(!block)
for(var/obj/effect/effect/chem_smoke/smoke in view(1, src))
if(smoke.reagents.total_volume)
smoke.reagents.reaction(src, INGEST)
spawn(5)
if(smoke)
smoke.reagents.copy_to(src, 10) // I dunno, maybe the reagents enter the blood stream through the lungs?
break // If they breathe in the nasty stuff once, no need to continue checking
else //Still give containing object the chance to interact
if(istype(loc, /obj/))
var/obj/location_as_object = loc
location_as_object.handle_internal_lifeform(src, 0)
handle_breath(breath)
if(breath)
loc.assume_air(breath)
/mob/living/carbon/monkey/proc/handle_breath(datum/gas_mixture/breath)
if(status_flags & GODMODE)
return
if(!breath || (breath.total_moles() == 0))
adjustOxyLoss(7)
oxygen_alert = max(oxygen_alert, 1)
return 0
var/safe_oxygen_min = 16 // Minimum safe partial pressure of O2, in kPa
//var/safe_oxygen_max = 140 // Maximum safe partial pressure of O2, in kPa (Not used for now)
var/safe_co2_max = 10 // Yes it's an arbitrary value who cares?
var/safe_toxins_max = 0.5
var/SA_para_min = 0.5
var/SA_sleep_min = 5
var/oxygen_used = 0
var/breath_pressure = (breath.total_moles()*R_IDEAL_GAS_EQUATION*breath.temperature)/BREATH_VOLUME
//Partial pressure of the O2 in our breath
var/O2_pp = (breath.oxygen/breath.total_moles())*breath_pressure
// Same, but for the toxins
var/Toxins_pp = (breath.toxins/breath.total_moles())*breath_pressure
// And CO2, lets say a PP of more than 10 will be bad (It's a little less really, but eh, being passed out all round aint no fun)
var/CO2_pp = (breath.carbon_dioxide/breath.total_moles())*breath_pressure
if(O2_pp < safe_oxygen_min) // Too little oxygen
if(prob(20))
spawn(0) emote("gasp")
if (O2_pp == 0)
O2_pp = 0.01
var/ratio = safe_oxygen_min/O2_pp
adjustOxyLoss(min(5*ratio, 7)) // Don't fuck them up too fast (space only does 7 after all!)
oxygen_used = breath.oxygen*ratio/6
oxygen_alert = max(oxygen_alert, 1)
/*else if (O2_pp > safe_oxygen_max) // Too much oxygen (commented this out for now, I'll deal with pressure damage elsewhere I suppose)
spawn(0) emote("cough")
var/ratio = O2_pp/safe_oxygen_max
oxyloss += 5*ratio
oxygen_used = breath.oxygen*ratio/6
oxygen_alert = max(oxygen_alert, 1)*/
else // We're in safe limits
adjustOxyLoss(-5)
oxygen_used = breath.oxygen/6
oxygen_alert = 0
breath.oxygen -= oxygen_used
breath.carbon_dioxide += oxygen_used
if(CO2_pp > safe_co2_max)
if(!co2overloadtime) // If it's the first breath with too much CO2 in it, lets start a counter, then have them pass out after 12s or so.
co2overloadtime = world.time
else if(world.time - co2overloadtime > 120)
Paralyse(3)
adjustOxyLoss(3) // Lets hurt em a little, let them know we mean business
if(world.time - co2overloadtime > 300) // They've been in here 30s now, lets start to kill them for their own good!
adjustOxyLoss(8)
if(prob(20)) // Lets give them some chance to know somethings not right though I guess.
spawn(0) emote("cough")
else
co2overloadtime = 0
if(Toxins_pp > safe_toxins_max) // Too much toxins
var/ratio = (breath.toxins/safe_toxins_max) * 10
//adjustToxLoss(Clamp(ratio, MIN_PLASMA_DAMAGE, MAX_PLASMA_DAMAGE)) //Limit amount of damage toxin exposure can do per second
if(reagents)
reagents.add_reagent("plasma", Clamp(ratio, MIN_PLASMA_DAMAGE, MAX_PLASMA_DAMAGE))
toxins_alert = max(toxins_alert, 1)
else
toxins_alert = 0
if(breath.trace_gases.len) // If there's some other shit in the air lets deal with it here.
for(var/datum/gas/sleeping_agent/SA in breath.trace_gases)
var/SA_pp = (SA.moles/breath.total_moles())*breath_pressure
if(SA_pp > SA_para_min) // Enough to make us paralysed for a bit
Paralyse(3) // 3 gives them one second to wake up and run away a bit!
if(SA_pp > SA_sleep_min) // Enough to make us sleep as well
sleeping = max(sleeping+2, 10)
else if(SA_pp > 0.01) // There is sleeping gas in their lungs, but only a little, so give them a bit of a warning
if(prob(20))
spawn(0) emote(pick("giggle", "laugh"))
if(breath.temperature > (T0C+66)) // Hot air hurts :(
if(prob(20))
src << "<span class='danger'>You feel a searing heat in your lungs!</span>"
fire_alert = max(fire_alert, 2)
else
fire_alert = 0
//Temporary fixes to the alerts.
return 1
/mob/living/carbon/monkey/handle_environment(datum/gas_mixture/environment)
if(!environment)
return
@@ -267,143 +87,15 @@
/mob/living/carbon/monkey/proc/handle_temperature_damage(body_part, exposed_temperature, exposed_intensity)
if(status_flags & GODMODE) return
var/discomfort = min( abs(exposed_temperature - bodytemperature)*(exposed_intensity)/2000000, 1.0)
//adjustFireLoss(2.5*discomfort)
if(exposed_temperature > bodytemperature)
adjustFireLoss(20.0*discomfort)
else
adjustFireLoss(5.0*discomfort)
/mob/living/carbon/monkey/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
/mob/living/carbon/monkey/handle_regular_status_updates()
updatehealth()
if(stat == DEAD) //DEAD. BROWN BREAD. SWIMMING WITH THE SPESS CARP
silent = 0
else //ALIVE. LIGHTS ARE ON
if(health < config.health_threshold_dead || !getorgan(/obj/item/organ/brain))
death()
stat = DEAD
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("epinephrine"))
adjustOxyLoss(1)
Paralyse(3)
if(paralysis)
AdjustParalysis(-1)
stat = UNCONSCIOUS
else if(sleeping)
sleeping = max(sleeping-1, 0)
stat = UNCONSCIOUS
if( prob(10) && health )
spawn(0)
emote("snore")
//CONSCIOUS
else
stat = CONSCIOUS
//Eyes
if(disabilities & BLIND || stat) //disabled-blind, doesn't get better on its own
eye_blind = max(eye_blind, 2)
else if(eye_blind) //blindness, heals slowly over time
eye_blind = max(eye_blind-1,0)
else if(eye_blurry) //blurry eyes heal slowly
eye_blurry = max(eye_blurry-1, 0)
//Ears
if(disabilities & DEAF) //disabled-deaf, doesn't get better on its own
setEarDamage(-1, max(ear_deaf, 1))
else
// deafness heals slowly over time, unless ear_damage is over 100
if (ear_damage < 100)
adjustEarDamage(-0.05,-1)
//Other
if(stunned)
AdjustStunned(-1)
if(weakened)
weakened = max(weakened-1,0)
if(stuttering)
stuttering = max(stuttering-1, 0)
if(silent)
silent = max(silent-1, 0)
if(druggy)
druggy = max(druggy-1, 0)
CheckStamina()
return 1
/mob/living/carbon/monkey/handle_regular_hud_updates()
if (stat == 2)
sight |= SEE_TURFS
sight |= SEE_MOBS
sight |= SEE_OBJS
see_in_dark = 8
see_invisible = SEE_INVISIBLE_LEVEL_TWO
else if (stat != 2)
sight &= ~SEE_TURFS
sight &= ~SEE_MOBS
sight &= ~SEE_OBJS
see_in_dark = 2
see_invisible = SEE_INVISIBLE_LIVING
if(see_override)
see_invisible = see_override
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"
/mob/living/carbon/monkey/handle_hud_icons()
handle_hud_icons_health()
if(pressure)
pressure.icon_state = "pressure[pressure_alert]"
@@ -417,8 +109,6 @@
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 ? 2 : 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(bodytemperature) //310.055 optimal body temp
@@ -441,31 +131,6 @@
else
bodytemp.icon_state = "temp-4"
client.screen.Remove(global_hud.blurry,global_hud.druggy,global_hud.vimpaired)
if(blind && stat != DEAD)
if(eye_blind)
blind.layer = 18
else
blind.layer = 0
if(disabilities & NEARSIGHT)
client.screen += global_hud.vimpaired
if(eye_blurry)
client.screen += global_hud.blurry
if(druggy)
client.screen += global_hud.druggy
if (stat != 2)
if (machine)
if (!( machine.check_eye(src) ))
reset_view(null)
else
if(!client.adminobs)
reset_view(null)
return 1
/mob/living/carbon/monkey/handle_random_events()
@@ -476,11 +141,18 @@
/mob/living/carbon/monkey/handle_changeling()
if(mind && mind.changeling)
mind.changeling.regenerate()
hud_used.lingchemdisplay.invisibility = 0
hud_used.lingchemdisplay.maptext = "<div align='center' valign='middle' style='position:relative; top:0px; left:6px'> <font color='#dd66dd'>[src.mind.changeling.chem_charges]</font></div>"
if(mind)
if(mind.changeling)
mind.changeling.regenerate()
hud_used.lingchemdisplay.invisibility = 0
hud_used.lingchemdisplay.maptext = "<div align='center' valign='middle' style='position:relative; top:0px; left:6px'> <font color='#dd66dd'>[mind.changeling.chem_charges]</font></div>"
else
hud_used.lingchemdisplay.invisibility = 101
/mob/living/carbon/monkey/has_smoke_protection()
if(wear_mask)
if(wear_mask.flags & BLOCK_GAS_SMOKE_EFFECT)
return 1
///FIRE CODE
/mob/living/carbon/monkey/handle_fire()
@@ -190,9 +190,6 @@
internal = null
return
/mob/living/carbon/monkey/var/co2overloadtime = null
/mob/living/carbon/monkey/var/temperature_resistance = T0C+75
/mob/living/carbon/monkey/ex_act(severity, target)
..()
switch(severity)
@@ -202,28 +199,16 @@
if(2.0)
adjustBruteLoss(60)
adjustFireLoss(60)
adjustEarDamage(30,120)
if(3.0)
adjustBruteLoss(30)
if (prob(50))
Paralyse(10)
adjustEarDamage(15,60)
updatehealth()
return
/mob/living/carbon/monkey/blob_act()
if (stat != 2)
show_message("<span class='userdanger'>The blob attacks you!</span>")
adjustFireLoss(60)
health = 100 - getOxyLoss() - getToxLoss() - getFireLoss() - getBruteLoss()
if (prob(50))
Paralyse(10)
if (stat == DEAD && client)
gib()
return
if (stat == DEAD && !client)
gibs(loc, viruses)
qdel(src)
return
/mob/living/carbon/monkey/IsAdvancedToolUser()//Unless its monkey mode monkeys cant use advanced tools
return 0
@@ -1,4 +1,6 @@
/mob/living/carbon/slime/death(gibbed)
if(stat == DEAD)
return
if(!gibbed)
if(is_adult)
var/mob/living/carbon/slime/M = new /mob/living/carbon/slime(loc)
@@ -11,12 +13,12 @@
number = rand(1, 1000)
name = "[colour] [is_adult ? "adult" : "baby"] slime ([number])"
return
else
visible_message("<b>The [name]</b> seizes up and falls limp...")
if(stat == DEAD) return
stat = DEAD
icon_state = "[colour] baby slime dead"
overlays.len = 0
visible_message("<b>The [name]</b> seizes up and falls limp...") //ded -- Urist
update_canmove()
if(blind) blind.layer = 0
@@ -24,4 +26,8 @@
if(ticker && ticker.mode)
ticker.mode.check_win()
return ..(gibbed)
return ..(gibbed)
/mob/living/carbon/slime/gib()
death(1)
qdel(src)
+47 -39
View File
@@ -6,12 +6,19 @@
var/SStun = 0 // stun variable
/mob/living/carbon/slime/Life()
set invisibility = 0
set background = BACKGROUND_ENABLED
if (notransform)
return
if(..())
handle_nutrition()
handle_targets()
if (!ckey)
handle_speech_and_mood()
/mob/living/carbon/slime/handle_breathing()
return
/mob/living/carbon/slime/proc/AIprocess() // the master AI process
@@ -25,14 +32,14 @@
AIproc = 1
while(AIproc && stat != 2 && (attacked || hungry || rabid || Victim))
while(AIproc && stat != DEAD && (attacked || hungry || rabid || Victim))
if(Victim) // can't eat AND have this little process at the same time
break
if(!Target || client)
break
if(Target.health <= -70 || Target.stat == 2)
if(Target.health <= -70 || Target.stat == DEAD)
Target = null
AIproc = 0
break
@@ -155,6 +162,13 @@
return //TODO: DEFERRED
/mob/living/carbon/slime/handle_mutations_and_radiation()
return
/mob/living/carbon/slime/handle_regular_hud_updates()
return
/mob/living/carbon/slime/handle_regular_status_updates()
if(is_adult)
@@ -162,17 +176,21 @@
else
health = 150 - (getOxyLoss() + getToxLoss() + getFireLoss() + getBruteLoss() + getCloneLoss())
if(health < config.health_threshold_dead && stat != 2)
if(health < config.health_threshold_dead && stat != DEAD)
death()
return
else if(src.health < config.health_threshold_crit)
else if(health < config.health_threshold_crit)
if(!src.reagents.has_reagent("epinephrine"))
src.adjustOxyLoss(10)
if(!reagents.has_reagent("epinephrine"))
adjustOxyLoss(3)
if(src.stat != DEAD)
src.stat = UNCONSCIOUS
if(stat != DEAD)
Paralyse(3)
stat = UNCONSCIOUS
else
if(stat != DEAD)
stat = CONSCIOUS
if(prob(30))
adjustOxyLoss(-1)
@@ -181,46 +199,36 @@
adjustCloneLoss(-1)
adjustBruteLoss(-1)
if (src.stat == DEAD)
src.lying = 1
src.eye_blind = max(eye_blind, 1)
if (stat == DEAD)
lying = 1
eye_blind = max(eye_blind, 1)
else
if (src.paralysis || src.stunned || src.weakened || (status_flags && FAKEDEATH)) //Stunned etc.
if (src.stunned > 0)
AdjustStunned(-1)
src.stat = 0
if (src.weakened > 0)
AdjustWeakened(-1)
src.lying = 0
src.stat = 0
if (src.paralysis > 0)
AdjustParalysis(-1)
src.eye_blind = 0
src.lying = 0
src.stat = 0
if(stunned > 0)
AdjustStunned(-1)
if(weakened > 0)
AdjustWeakened(-1)
if (paralysis > 0)
AdjustParalysis(-1)
else
src.lying = 0
src.stat = 0
if(stuttering)
stuttering = 0
if (src.stuttering) src.stuttering = 0
if (src.eye_blind)
src.eye_blind = 0
src.eye_blind = max(eye_blind, 1)
if(eye_blind)
eye_blind = 0
eye_blind = max(eye_blind, 1)
setEarDamage((ear_damage < 25 ? 0 : ear_damage),(disabilities & DEAF ? 1 :0))
src.density = !( src.lying )
density = !( src.lying )
if (src.disabilities & BLIND)
src.eye_blind = max(eye_blind, 1)
if(disabilities & BLIND)
eye_blind = max(eye_blind, 1)
if (src.eye_blurry > 0)
src.eye_blurry = 0
if(eye_blurry > 0)
eye_blurry = 0
if (src.druggy > 0)
src.druggy = 0
if(druggy > 0)
druggy = 0
return 1
+4 -36
View File
@@ -161,49 +161,20 @@
/mob/living/carbon/slime/ex_act(severity, target)
..()
var/b_loss = null
var/f_loss = null
switch (severity)
if (1.0)
qdel(src)
gib()
return
if (2.0)
b_loss += 60
f_loss += 60
adjustBruteLoss(60)
adjustFireLoss(60)
if(3.0)
b_loss += 30
adjustBruteLoss(b_loss)
adjustFireLoss(f_loss)
adjustBruteLoss(30)
updatehealth()
/mob/living/carbon/slime/blob_act()
if (stat == 2)
return
var/shielded = 0
var/damage = null
if (stat != 2)
damage = rand(10,30)
if(shielded)
damage /= 4
//paralysis += 1
show_message("<span class='userdanger'> The blob attacks you!</span>")
adjustFireLoss(damage)
updatehealth()
return
/mob/living/carbon/slime/MouseDrop(var/atom/movable/A as mob|obj)
if(isliving(A) && A != src && usr == src)
var/mob/living/Food = A
@@ -496,9 +467,6 @@
/mob/living/carbon/slime/restrained()
return 0
mob/living/carbon/slime/var/co2overloadtime = null
mob/living/carbon/slime/var/temperature_resistance = T0C+75
/mob/living/carbon/slime/show_inv(mob/user)
return