From 73e8328da107c7060fd93a68b1f2ee460ba6ebb7 Mon Sep 17 00:00:00 2001 From: SkyMarshal Date: Wed, 6 Jun 2012 11:13:17 -0700 Subject: [PATCH] A sanity check and some improvements (again) to the optimization on explosions. --- code/game/objects/explosion.dm | 63 +++++++++++++++++----------------- code/modules/mob/death.dm | 3 +- 2 files changed, 34 insertions(+), 32 deletions(-) diff --git a/code/game/objects/explosion.dm b/code/game/objects/explosion.dm index a8cfbdcf52f..3210d70d6ef 100644 --- a/code/game/objects/explosion.dm +++ b/code/game/objects/explosion.dm @@ -44,39 +44,40 @@ proc/explosion(turf/epicenter, devastation_range, heavy_impact_range, light_impa hTurfs = range(epicenter,heavy_impact_range) - dTurfs lTurfs = range(epicenter,light_impact_range) - dTurfs - hTurfs - spawn() //Lets pop these into different threads. - for(var/turf/T in dTurfs) //Loop through the turfs in devestation range. - spawn() //Try to pop each turf into it's own thread, speed things along. - if(T) //Sanity checking. - //Now, the actual explosion stuff happens. - if(prob(5)) - T.ex_act(2) - else - T.ex_act(1) - for(var/atom/object in T.contents) - spawn() - if(object) - object.ex_act(1) - spawn() - for(var/turf/T in hTurfs) - spawn() - if(T) - if(prob(15) && devastation_range > 2 && heavy_impact_range > 2) - secondaryexplosion(T, 1) - else - T.ex_act(2) - for(var/atom/object in T.contents) + + for(var/turf/T in dTurfs) //Loop through the turfs in devestation range. + spawn() //Try to pop each turf into it's own thread, speed things along. + if(T) //Sanity checking. + //Now, the actual explosion stuff happens. + if(prob(5)) + T.ex_act(2) + else + T.ex_act(1) + for(var/atom/object in T.contents) + spawn() + if(object) + object.ex_act(1) + + for(var/turf/T in hTurfs) + spawn() + if(T) + if(prob(15) && devastation_range > 2 && heavy_impact_range > 2) + secondaryexplosion(T, 1) + else + T.ex_act(2) + for(var/atom/object in T.contents) + spawn() if(object) object.ex_act(2) - spawn() - for(var/turf/T in lTurfs) - spawn() - if(T) - T.ex_act(3) - for(var/atom/object in T.contents) - spawn() - if(object) - object.ex_act(3) + + for(var/turf/T in lTurfs) + spawn() + if(T) + T.ex_act(3) + for(var/atom/object in T.contents) + spawn() + if(object) + object.ex_act(3) spawn() for(var/mob/living/carbon/mob in fTurfs) diff --git a/code/modules/mob/death.dm b/code/modules/mob/death.dm index ba3034ad531..6b714b2dd31 100644 --- a/code/modules/mob/death.dm +++ b/code/modules/mob/death.dm @@ -47,7 +47,8 @@ /mob/proc/death(gibbed) timeofdeath = world.time - client.onDeath() + if(client) + client.onDeath() var/cancel = 0 for(var/mob/M in world)