mob/living/Life() now handles regular status updates.

This commit is contained in:
PsiOmegaDelta
2015-06-17 16:01:26 +02:00
parent d4b2fb7176
commit 9d38bcc149
9 changed files with 86 additions and 29 deletions
+1 -2
View File
@@ -16,7 +16,6 @@
blinded = null
//Status updates, death etc.
handle_regular_status_updates()
update_icons()
/mob/living/carbon/alien/handle_mutations_and_radiation()
@@ -35,7 +34,7 @@
adjustToxLoss(-(rads))
return
/mob/living/carbon/alien/proc/handle_regular_status_updates()
/mob/living/carbon/alien/handle_regular_status_updates()
if(status_flags & GODMODE) return 0
+1 -15
View File
@@ -1,20 +1,6 @@
/mob/living/carbon/brain/handle_breathing()
return
/mob/living/carbon/brain/Life()
set invisibility = 0
set background = 1
..()
//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
//Status updates, death etc.
handle_regular_status_updates()
/mob/living/carbon/brain/handle_mutations_and_radiation()
if (radiation)
if (radiation > 100)
@@ -108,7 +94,7 @@
return //TODO: DEFERRED
/mob/living/carbon/brain/proc/handle_regular_status_updates() //TODO: comment out the unused bits >_>
/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
+11 -6
View File
@@ -87,17 +87,19 @@
handle_stasis_bag()
if(life_tick > 5 && timeofdeath && (timeofdeath < 5 || world.time - timeofdeath > 6000)) //We are long dead, or we're junk mobs spawned like the clowns on the clown shuttle
if(!handle_some_updates())
return //We go ahead and process them 5 times for HUD images and other stuff though.
//Status updates, death etc.
handle_regular_status_updates() //Optimized a bit
//Update our name based on whether our face is obscured/disfigured
name = get_visible_name()
pulse = handle_pulse()
/mob/living/carbon/human/proc/handle_some_updates()
if(life_tick > 5 && timeofdeath && (timeofdeath < 5 || world.time - timeofdeath > 6000)) //We are long dead, or we're junk mobs spawned like the clowns on the clown shuttle
return 0
return 1
/mob/living/carbon/human/breathe()
if(!in_stasis)
..()
@@ -149,7 +151,7 @@
else
return ONE_ATMOSPHERE + pressure_difference
/mob/living/carbon/human/proc/handle_disabilities()
/mob/living/carbon/human/handle_disabilities()
if (disabilities & EPILEPSY)
if ((prob(1) && paralysis < 1))
src << "\red You have a seizure!"
@@ -911,7 +913,10 @@
return //TODO: DEFERRED
/mob/living/carbon/human/proc/handle_regular_status_updates()
/mob/living/carbon/human/handle_regular_status_updates()
if(!handle_some_updates())
return 0
if(status_flags & GODMODE) return 0
//SSD check, if a logged player is awake put them back to sleep!
@@ -17,10 +17,6 @@
handle_AI()
handle_speech_and_mood()
regular_hud_updates()
handle_regular_status_updates() // Status updates, death etc.
/mob/living/carbon/slime/handle_environment(datum/gas_mixture/environment)
if(!environment)
adjustToxLoss(rand(10,20))
@@ -91,7 +87,7 @@
return //TODO: DEFERRED
/mob/living/carbon/slime/proc/handle_regular_status_updates()
/mob/living/carbon/slime/handle_regular_status_updates()
src.blinded = null
+47
View File
@@ -43,6 +43,10 @@
for(var/obj/item/weapon/grab/G in src)
G.process()
if(handle_regular_status_updates()) // Status & health update, are we dead or alive etc.
handle_disabilities() // eye, ear, brain damages
handle_status_effects() //all special effects, stunned, weakened, jitteryness, hallucination, sleeping, etc
update_canmove()
if(client)
@@ -74,6 +78,49 @@
if(incapacitated())
stop_pulling()
//This updates the health and status of the mob (conscious, unconscious, dead)
/mob/living/proc/handle_regular_status_updates()
updatehealth()
if(stat != DEAD)
if(paralysis)
stat = UNCONSCIOUS
else if (status_flags & FAKEDEATH)
stat = UNCONSCIOUS
else
stat = CONSCIOUS
return 1
//this updates all special effects: stunned, sleeping, weakened, druggy, stuttering, etc..
/mob/living/proc/handle_status_effects()
if(paralysis)
paralysis = max(paralysis-1,0)
if(stunned)
stunned = max(stunned-1,0)
if(!stunned)
update_icons()
if(weakened)
weakened = max(weakened-1,0)
if(!weakened)
update_icons()
/mob/living/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. Calls update_vision() and handle_hud_icons()
/mob/living/proc/handle_regular_hud_updates()
if(!client) return 0
+12
View File
@@ -800,3 +800,15 @@ default behaviour is:
return
..()
//damage/heal the mob ears and adjust the deaf amount
/mob/living/adjustEarDamage(var/damage, var/deaf)
ear_damage = max(0, ear_damage + damage)
ear_deaf = max(0, ear_deaf + deaf)
//pass a negative argument to skip one of the variable
/mob/living/setEarDamage(var/damage, var/deaf)
if(damage >= 0)
ear_damage = damage
if(deaf >= 0)
ear_deaf = deaf
@@ -61,7 +61,7 @@
lights_on = 0
set_light(0)
/mob/living/silicon/robot/proc/handle_regular_status_updates()
/mob/living/silicon/robot/handle_regular_status_updates()
if(src.camera && !scrambledcodes)
if(src.stat == 2 || wires.IsIndexCut(BORG_WIRE_CAMERA))
@@ -350,3 +350,9 @@
/mob/living/silicon/proc/is_malf_or_traitor()
return is_traitor() || is_malf()
/mob/living/silicon/adjustEarDamage()
return
/mob/living/silicon/setEarDamage()
return
+6
View File
@@ -1027,3 +1027,9 @@ mob/proc/yank_out_object()
/mob/verb/westfaceperm()
set hidden = 1
set_face_dir(WEST)
/mob/proc/adjustEarDamage()
return
/mob/proc/setEarDamage()
return