Files
Paradise/code/modules/mob/living/carbon/brain/life.dm
vageyenaman@gmail.com ebcdc09c10 There's a few things in this revision made by me, and some made by other people that
requested I commit into the SVN. Please PM the collective coders if you find any bugs in 

their work.


AI:

     The AI now has a verb that lets it change its appearance. It doesn't do much, but but 

it's some neat aesthetics that compliment the little display panes scattered around the 

station that the AI can modify. This was a combined effort between Firecage, Petethegoat, 

and Superxpdude.



Miscellaneous Changes (by Petethegreat):

     - Cup Ramen sprite changed to a nicer one by Cheridan
     - Plasma sheet sprite changed to a thicker one by Aru




Metroids:

     They work. There might be some lingering bugs I simply cannot catch by testing alone, 

but they WORK. They act as an entire new player-controllable race, are found in 

xeniobiology, and I refuse to say anything else on the matter that would spoil anything. If 

you feel so entitled to, you can view the source code to spoil everything like a little 

cheater! I haven't completed everything I would like to, and as a result Metroids are 

pretty useless. They're still very fun though!

     Xenobiology, as a result of Metroids, got a bit of expansion. Scientists have access 

to Xenobiology now, for now. If anyone wants Xenobiology to become a standalone job or 

whatever, here's the place to post feedback.


Bugfixes:
     
     - Perriot's Throat virus no longer makes you mute, instead, does what it was intended 

to HONKHONKHONKHONK!!!!
     - Some bugfixes with Turrets.


git-svn-id: http://tgstation13.googlecode.com/svn/trunk@1774 316c924e-a436-60f5-8080-3fe189b3f50e
2011-07-05 19:34:42 +00:00

301 lines
6.9 KiB
Plaintext

/mob/living/carbon/brain
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()
//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
//Disease Check
handle_virus_updates()
//Handle temperature/pressure differences between body and environment
if(environment) // More error checking -- TLE
handle_environment(environment)
//Mutations and radiation
handle_mutations_and_radiation()
//Chemicals in the 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()
stunned = max(stunned,0)
paralysis = max(paralysis, 0)
weakened = max(weakened, 0)
bruteloss = max(bruteloss, 0)
fireloss = max(fireloss, 0)
oxyloss = max(oxyloss, 0)
toxloss = max(toxloss, 0)
handle_mutations_and_radiation()
if (radiation)
if (radiation > 100)
radiation = 100
weakened = 10
src << "\red You feel weak."
switch(radiation)
if(1 to 49)
radiation--
if(prob(25))
toxloss++
updatehealth()
if(50 to 74)
radiation -= 2
toxloss++
if(prob(5))
radiation -= 5
weakened = 3
src << "\red You feel weak."
// emote("collapse")
updatehealth()
if(75 to 100)
radiation -= 3
toxloss += 3
if(prob(1))
src << "\red You mutate!"
randmutb(src)
domutcheck(src,null)
emote("gasp")
updatehealth()
update_canmove()
if(in_contents_of(/obj/mecha))
canmove = 1
else
canmove = 0
return
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
var/discomfort = min( abs(exposed_temperature - bodytemperature)*(exposed_intensity)/2000000, 1.0)
//fireloss += 2.5*discomfort
fireloss += 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
paralysis = 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 - (oxyloss + toxloss + fireloss + bruteloss + cloneloss)
if(oxyloss > 25) paralysis = max(paralysis, 3)
if(sleeping)
paralysis = max(paralysis, 5)
if (prob(1) && health) spawn(0) emote("snore")
if(resting)
weakened = max(weakened, 5)
if(health < -100 && stat != 2)
death()
else if(health < 0)
if(health <= 20 && prob(1)) spawn(0) emote("gasp")
//if(!rejuv) oxyloss++
if(!reagents.has_reagent("inaprovaline")) oxyloss++
if(stat != 2) stat = 1
paralysis = max(paralysis, 5)
if (stat != 2) //Alive.
if (paralysis || stunned || weakened) //Stunned etc.
if (stunned > 0)
stunned--
stat = 0
if (weakened > 0)
weakened--
lying = 1
stat = 0
if (paralysis > 0)
paralysis--
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_hud_updates()
if (stat == 2 || mutations & XRAY)
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
handle_virus_updates()
if(bodytemperature > 409)
for(var/datum/disease/D in viruses)
D.cure()
return