Merge: death and respawn (#1318)

Fixes #1314 .
Fixes a runtime error from setting time of deaths.
Fixes #1309 
Fixes #1312
This commit is contained in:
skull132
2016-12-26 17:31:23 +02:00
committed by GitHub
parent 5a54b7a030
commit 9bca1343ae
5 changed files with 71 additions and 60 deletions

View File

@@ -955,48 +955,41 @@
death()
blinded = 1
silent = 0
else //ALIVE. LIGHTS ARE ON
updatehealth() //TODO
return 1
if(health <= config.health_threshold_dead || (species.has_organ["brain"] && !has_brain()))
death()
blinded = 1
silent = 0
return 1
//UNCONSCIOUS. NO-ONE IS HOME
if((getOxyLoss() > exhaust_threshold) || (health <= config.health_threshold_crit))
Paralyse(3)
//UNCONSCIOUS. NO-ONE IS HOME
if((getOxyLoss() > exhaust_threshold) || (health <= config.health_threshold_crit))
Paralyse(3)
if(hallucination)
//Machines do not hallucinate.
if (hallucination >= 20 && !(species.flags & (NO_POISON|IS_PLANT)))
if(prob(3))
fake_attack(src)
if(!handling_hal)
spawn handle_hallucinations() //The not boring kind!
if(client && prob(5))
client.dir = pick(2,4,8)
var/client/C = client
spawn(rand(20,50))
if(C)
C.dir = 1
if(hallucination<=2)
hallucination = 0
halloss = 0
else
hallucination -= 2
if(hallucination)
//Machines do not hallucinate.
if (hallucination >= 20 && !(species.flags & (NO_POISON|IS_PLANT)))
if(prob(3))
fake_attack(src)
if(!handling_hal)
spawn handle_hallucinations() //The not boring kind!
if(client && prob(5))
client.dir = pick(2,4,8)
var/client/C = client
spawn(rand(20,50))
if(C)
C.dir = 1
if(hallucination<=2)
hallucination = 0
halloss = 0
else
for(var/atom/a in hallucinations)
qdel(a)
hallucination -= 2
if(halloss > 100)
src << "<span class='warning'>[species.halloss_message_self]</span>"
src.visible_message("<B>[src]</B> [species.halloss_message].")
Paralyse(10)
setHalLoss(99)
else
for(var/atom/a in hallucinations)
qdel(a)
if(halloss > 100)
src << "<span class='warning'>[species.halloss_message_self]</span>"
src.visible_message("<B>[src]</B> [species.halloss_message].")
Paralyse(10)
setHalLoss(99)
if(paralysis || sleeping)
blinded = 1

View File

@@ -105,7 +105,6 @@
user << "<span class='danger'>You are banned from playing synthetics and cannot spawn as a drone.</span>"
return
// #TODO-MERGE: refactor teh various respawn timers into MayRespawn
if(!user.MayRespawn(1, DRONE_SPAWN_DELAY))
return
@@ -129,4 +128,4 @@
if(user && fabricator && !((fabricator.stat & NOPOWER) || !fabricator.produce_drones || fabricator.drone_progress < 100))
fabricator.create_drone(user.client)
return 1
return
return

View File

@@ -906,8 +906,16 @@ proc/is_blind(A)
if (client)
P = client.prefs
else if (ckey)
P = preferences_datums[ckey]
else return null
// To avoid runtimes during adminghost.
if (copytext(ckey, 1, 2) == "@")
P = preferences_datums[copytext(ckey, 2)]
else
P = preferences_datums[ckey]
else
return null
if (!P)
return null
return P.time_of_death[which]
@@ -916,10 +924,17 @@ proc/is_blind(A)
if (client)
P = client.prefs
else if (ckey)
P = preferences_datums[ckey]
// To avoid runtimes during adminghost.
if (copytext(ckey, 1, 2) == "@")
P = preferences_datums[copytext(ckey, 2)]
else
P = preferences_datums[ckey]
else
return 0
if (!P)
return 0
P.time_of_death[which] = value
return 1