41 files changed, original only had 4. SPACES.

This commit is contained in:
LetterJay
2017-05-30 14:36:11 -05:00
parent 11344c4682
commit ae22a1876a
14 changed files with 43 additions and 222 deletions
+10 -6
View File
@@ -43,6 +43,10 @@ GLOBAL_LIST_EMPTY(explosions)
return
GLOB.explosions += src
if(isnull(flame_range))
flame_range = light_impact_range
if(isnull(flash_range))
flash_range = devastation_range
// Archive the uncapped explosion for the doppler array
var/orig_dev_range = devastation_range
@@ -121,7 +125,7 @@ GLOBAL_LIST_EMPTY(explosions)
E = new
E.set_up(epicenter)
E.start()
EX_PREPROCESS_CHECK_TICK
//flash mobs
@@ -188,7 +192,7 @@ GLOBAL_LIST_EMPTY(explosions)
var/throw_range = rand(throw_dist, max_range)
var/turf/throw_at = get_ranged_target_turf(I, throw_dir, throw_range)
I.throw_speed = EXPLOSION_THROW_SPEED //Temporarily change their throw_speed for embedding purposes (Reset when it finishes throwing, regardless of hitting anything)
I.throw_at(throw_at, throw_range, EXPLOSION_THROW_SPEED)
I.throw_at(throw_at, throw_range, EXPLOSION_THROW_SPEED)
//wait for the lists to repop
var/break_condition
@@ -204,7 +208,7 @@ GLOBAL_LIST_EMPTY(explosions)
if(!running)
break
//update the trackers
affTurfLen = affected_turfs.len
expBlockLen = cached_exp_block.len
@@ -270,7 +274,7 @@ GLOBAL_LIST_EMPTY(explosions)
. = list()
var/processed = 0
while(!stopped && running)
var/I
var/I
for(I in (processed + 1) to affected_turfs.len) // we cache the explosion block rating of every turf in the explosion area
var/turf/T = affected_turfs[I]
var/current_exp_block = T.density ? T.explosion_block : 0
@@ -285,12 +289,12 @@ GLOBAL_LIST_EMPTY(explosions)
for(var/obj/structure/blob/B in T)
current_exp_block += B.explosion_block
.[T] = current_exp_block
if(TICK_CHECK)
break
processed = I
stoplag()
-53
View File
@@ -1,53 +0,0 @@
diff a/code/datums/explosion.dm b/code/datums/explosion.dm (rejected hunks)
@@ -1,10 +1,48 @@
-/proc/explosion(turf/epicenter, devastation_range, heavy_impact_range, light_impact_range, flash_range, adminlog = 1, ignorecap = 0, flame_range = 0 ,silent = 0, smoke = 1)
- set waitfor = 0
- src = null //so we don't abort once src is deleted
+GLOBAL_LIST_EMPTY(explosions)
+//Against my better judgement, I will return the explosion datum
+//If I see any GC errors for it I will find you
+//and I will gib you
+// --Cyberboss
+/proc/explosion(atom/epicenter, devastation_range, heavy_impact_range, light_impact_range, flash_range, adminlog = TRUE, ignorecap = FALSE, flame_range = 0 , silent = FALSE, smoke = FALSE)
+ return new /datum/explosion(epicenter, devastation_range, heavy_impact_range, light_impact_range, flash_range, adminlog, ignorecap, flame_range, silent, smoke)
+
+//This datum creates 3 threads
+//1 GatherSpiralTurfsProc runs spiral_range_turfs(tick_checked = TRUE) to populate the affected_turfs list
+//2 CaculateExplosionBlock adds the blockings to the cached_exp_block list
+//3 The main thread explodes the prepared turfs
+
+/datum/explosion
+ var/explosion_id
+ var/started_at
+ var/running = TRUE
+ var/stopped = 0 //This is the number of threads stopped !DOESN'T COUNT THREAD 2!
+ var/static/id_counter = 0
+
+#define EX_PREPROCESS_EXIT_CHECK \
+ if(!running) {\
+ stopped = 2;\
+ qdel(src);\
+ return;\
+ }
+
+#define EX_PREPROCESS_CHECK_TICK \
+ if(TICK_CHECK) {\
+ stoplag();\
+ EX_PREPROCESS_EXIT_CHECK\
+ }
+
+/datum/explosion/New(atom/epicenter, devastation_range, heavy_impact_range, light_impact_range, flash_range, adminlog, ignorecap, flame_range, silent, smoke)
+ set waitfor = FALSE
+
+ var/id = ++id_counter
+ explosion_id = id
+
epicenter = get_turf(epicenter)
if(!epicenter)
return
+ GLOB.explosions += src
+
// Archive the uncapped explosion for the doppler array
var/orig_dev_range = devastation_range
var/orig_heavy_range = heavy_impact_range