mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-07-18 11:36:24 +01:00
Fix maint loot spawners not deleting after roundstart/spawning their loot. (#61707)
Maint loot spawners hang around and never get qdeleted after spawning their loot. This does a little bit of simple code logic to limit copypasta and ensure that loot spawners never qdel late and that they qdel precisely when they intend to. Or when SSmapping intends for them to.
This commit is contained in:
@@ -601,4 +601,4 @@ GLOBAL_LIST_EMPTY(the_station_areas)
|
||||
CHECK_TICK
|
||||
|
||||
spawner.spawn_loot()
|
||||
spawner.hide()
|
||||
qdel(spawner)
|
||||
|
||||
@@ -10,16 +10,21 @@
|
||||
. += span_info("This spawner has an effective loot count of [get_effective_lootcount()].")
|
||||
|
||||
/obj/effect/spawner/random/maintenance/Initialize(mapload)
|
||||
. = ..()
|
||||
// There is a single callback in SSmapping to spawn all delayed maintenance loot
|
||||
// so we don't just make one callback per loot spawner
|
||||
GLOB.maintenance_loot_spawners += src
|
||||
loot = GLOB.maintenance_loot
|
||||
|
||||
// Late loaded templates like shuttles can have maintenance loot
|
||||
if(SSticker.current_state >= GAME_STATE_SETTING_UP)
|
||||
spawn_loot()
|
||||
hide()
|
||||
. = ..()
|
||||
|
||||
GLOB.maintenance_loot_spawners += src
|
||||
|
||||
/obj/effect/spawner/random/maintenance/should_spawn_on_init()
|
||||
. = ..()
|
||||
|
||||
if(.)
|
||||
return
|
||||
|
||||
// Late loaded templates like shuttles can have maintenance loot.
|
||||
// Once the game state progresses to roundstart, new maint loot spawners should just instantly pop.
|
||||
return (SSticker.current_state >= GAME_STATE_SETTING_UP)
|
||||
|
||||
/obj/effect/spawner/random/maintenance/Destroy()
|
||||
GLOB.maintenance_loot_spawners -= src
|
||||
|
||||
@@ -33,10 +33,14 @@
|
||||
/obj/effect/spawner/random/Initialize(mapload)
|
||||
. = ..()
|
||||
|
||||
if(spawn_on_init)
|
||||
if(should_spawn_on_init())
|
||||
spawn_loot()
|
||||
return INITIALIZE_HINT_QDEL
|
||||
|
||||
/// Helper proc that returns TRUE if the spawner should spawn loot in Initialise() and FALSE otherwise. Override this to change spawning behaviour.
|
||||
/obj/effect/spawner/random/proc/should_spawn_on_init()
|
||||
return spawn_on_init
|
||||
|
||||
///If the spawner has any loot defined, randomly picks some and spawns it. Does not cleanup the spawner.
|
||||
/obj/effect/spawner/random/proc/spawn_loot(lootcount_override)
|
||||
if(!prob(spawn_loot_chance))
|
||||
|
||||
Reference in New Issue
Block a user