Skip to content

Commit

Permalink
Reworks the wave spawning to runtime less
Browse files Browse the repository at this point in the history
  • Loading branch information
BogCreature committed Nov 10, 2023
1 parent b3bd54d commit 307975c
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
16 changes: 15 additions & 1 deletion code/datums/components/spawner.dm
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@
var/spawn_distance_min = 1
var/spawn_distance_max = 1
var/wave_length //Average time until break in spawning
var/wave_downtime
var/wave_downtime //Average time until spawning starts again
var/spawning_paused = FALSE
var/wave_timer
var/downtime_timer


/datum/component/spawner/Initialize(_mob_types, _spawn_time, _faction, _spawn_text, _max_mobs, _spawn_sound, _spawn_distance_min, _spawn_distance_max, _wave_length, _wave_downtime)
Expand Down Expand Up @@ -63,11 +64,24 @@
/datum/component/spawner/proc/try_spawn_mob()
var/atom/P = parent
var/turf/spot = P.loc
//Checks for handling the wave-based pausing and unpausing of spawning
//Almost certainly a better way to do this, but until then this technically works
if(spawning_paused)
if(!downtime_timer)
downtime_timer = wave_downtime + world.time
if(world.time > downtime_timer)
spawning_paused = FALSE
downtime_timer = null
return 0
else
return 0
if(!wave_timer && wave_length)
wave_timer = wave_length + world.time
if(wave_timer && world.time > wave_timer)
spawning_paused = TRUE
wave_timer = null
return 0
////////////////////////////////
if(spawned_mobs.len >= max_mobs)
return 0
if(spawn_delay > world.time)
Expand Down
1 change: 0 additions & 1 deletion code/modules/mining/drill.dm
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,6 @@
if(active)
to_chat(user, "<span class='notice'>[src] can't be unsecured while it's running!</span>")
return
playsound(src, 'sound/items/ratchet.ogg', 50, TRUE)
if(!anchored && tool.use_tool(src, user, 30, volume=50))
to_chat(user, "<span class='notice'>You secure the [src] to the ore vein.</span>")
playsound(src, 'sound/items/deconstruct.ogg', 50, TRUE)
Expand Down

0 comments on commit 307975c

Please sign in to comment.