Added Willox’s explosion code. It should make explosions faster than they have been lately.

Moved an unchecked file into unused, please put any unchecked files out of WIP or FEA into unused that way if you see an unchecked file you know it should be checked.  DM loves to uncheck files when you are messing around with folders in the editor.
Moved the old TEG defines into the proper files.
Commented out some old nonfunctioning FEA debug code.
Removed some commented out codechunks from FEA and attempted to clean up a few of the files a bit. 


git-svn-id: http://tgstation13.googlecode.com/svn/trunk@3852 316c924e-a436-60f5-8080-3fe189b3f50e
This commit is contained in:
mport2004@gmail.com
2012-06-18 01:56:24 +00:00
parent b1394e315f
commit b6f8b3fb77
11 changed files with 1632 additions and 1498 deletions
+46 -50
View File
@@ -1,14 +1,20 @@
var/roundExplosions = 1
var/roundExplosions = 1 // If anyone else gets confused this means round as in circle, not the game round
//TODO: Flash range does nothing currently
proc/explosion(turf/epicenter, devastation_range, heavy_impact_range, light_impact_range, flash_range, adminlog = 1)
if(!epicenter) return
spawn(0)
if(defer_powernet_rebuild != 2)
defer_powernet_rebuild = 1
if (!istype(epicenter, /turf))
epicenter = get_turf(epicenter.loc)
playsound(epicenter.loc, 'explosionfar.ogg', 100, 1, round(devastation_range*2,1) )
playsound(epicenter.loc, "explosion", 100, 1, round(devastation_range,1) )
if (adminlog)
message_admins("Explosion with size ([devastation_range], [heavy_impact_range], [light_impact_range]) in area [epicenter.loc.name] ")
log_game("Explosion with size ([devastation_range], [heavy_impact_range], [light_impact_range]) in area [epicenter.loc.name] ")
@@ -20,62 +26,52 @@ proc/explosion(turf/epicenter, devastation_range, heavy_impact_range, light_impa
E.set_up(epicenter)
E.start()
var/list/dTurfs = list() //Holds the turfs in devestation range.
var/list/hTurfs = list() //Holds the turfs in heavy impact range, minus turfs in devestation range.
var/list/lTurfs = list() //Holds the turfs in light impact range, minus turfs in devestation range and heavy impact range.
var/list/fTurfs = list() //Holds turfs to loop through for mobs to flash. (Hehehe, dirty)
var/list/expTurfs = list() // All turfs being affected by the explosion (not flash range)
if(roundExplosions)
fTurfs = circlerangeturfs(epicenter,max(devastation_range, heavy_impact_range, light_impact_range, flash_range))
dTurfs = circlerangeturfs(epicenter,devastation_range)
hTurfs = circlerangeturfs(epicenter,heavy_impact_range) - dTurfs
lTurfs = circlerangeturfs(epicenter,light_impact_range) - dTurfs - hTurfs
expTurfs = circlerangeturfs(epicenter, max(devastation_range, heavy_impact_range, light_impact_range))
else
fTurfs = range(epicenter,max(devastation_range, heavy_impact_range, light_impact_range, flash_range))
dTurfs = range(epicenter,devastation_range)
hTurfs = range(epicenter,heavy_impact_range) - dTurfs
lTurfs = range(epicenter,light_impact_range) - dTurfs - hTurfs
expTurfs = range(epicenter, max(devastation_range, heavy_impact_range, light_impact_range))
// Hello future editors, please note that 1000 calls to spawn will not speed this up, but this exact amount has been tested
// Now, tonnes of calls to spawn will allow other stuff to happen, but I believe we may as well let explosions
// Get over with and blow up like an explosion would
var/list/dTurfs = list()
var/list/hTurfs = list()
var/list/lTurfs = list()
for(var/turf/T in expTurfs) // This doesn't slow it down at all, even 100,100,100 bombs
var/dist = circledistance(epicenter, T)
if(dist < devastation_range)
dTurfs.Add(T)
else if(dist < heavy_impact_range)
hTurfs.Add(T)
else // The expTurfs list only has turfs that are in it's range, so no if here for light_impact
lTurfs.Add(T)
spawn()
for(var/mob/living/carbon/mob in fTurfs)
flick("flash", mob:flash)
for(var/turf/T in dTurfs)
if(prob(10))
T.ex_act(2)
else
T.ex_act(1)
for(var/atom/object in T.contents)
object.ex_act(1)
spawn()
for(var/turf/T in hTurfs)
T.ex_act(2)
for(var/atom/object in T.contents)
object.ex_act(2)
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 lTurfs)
T.ex_act(3)
for(var/atom/object in T.contents)
object.ex_act(3)
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)
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)
sleep(-1)
sleep(20)
if(defer_powernet_rebuild != 2)
defer_powernet_rebuild = 0
return 1