mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-10 18:22:39 +00:00
Random item spawners qdel properly on init without using sleep (#7134)
This commit is contained in:
@@ -11,15 +11,7 @@
|
|||||||
. = ..()
|
. = ..()
|
||||||
if (!prob(spawn_nothing_percentage))
|
if (!prob(spawn_nothing_percentage))
|
||||||
spawn_item()
|
spawn_item()
|
||||||
Random_SafeDestroy(0)
|
return INITIALIZE_HINT_QDEL
|
||||||
|
|
||||||
// This function should, theoretically, guarantee the deletion of the random object. Not all of them destroy themselves for some reason, especially if created through non-standard means.
|
|
||||||
/obj/random/proc/Random_SafeDestroy(var/recursion_level)
|
|
||||||
set waitfor = FALSE
|
|
||||||
sleep(30)
|
|
||||||
qdel(src)
|
|
||||||
if(src && recursion_level < 5)
|
|
||||||
Random_SafeDestroy(recursion_level + 1)
|
|
||||||
|
|
||||||
// this function should return a specific item to spawn
|
// this function should return a specific item to spawn
|
||||||
/obj/random/proc/item_to_spawn()
|
/obj/random/proc/item_to_spawn()
|
||||||
|
|||||||
Reference in New Issue
Block a user