From 747be9cbe4a53885708a4e51aed82e75bdda0b78 Mon Sep 17 00:00:00 2001 From: Akrilla Date: Sat, 11 Apr 2020 00:59:29 +0100 Subject: [PATCH] Better random plush spawning (#11792) * better spawning * check list size * changes --- code/game/objects/items/plushes.dm | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/code/game/objects/items/plushes.dm b/code/game/objects/items/plushes.dm index 498990fcf3..a564d7f9f9 100644 --- a/code/game/objects/items/plushes.dm +++ b/code/game/objects/items/plushes.dm @@ -434,7 +434,15 @@ GLOBAL_LIST_INIT(valid_plushie_paths, valid_plushie_paths()) can_random_spawn = FALSE /obj/item/toy/plush/random/Initialize() - var/newtype = prob(CONFIG_GET(number/snowflake_plushie_prob))? /obj/item/toy/plush/random_snowflake : pick(GLOB.valid_plushie_paths) + var/newtype + var/list/snowflake_list = CONFIG_GET(keyed_list/snowflake_plushies) + + /// If there are no snowflake plushies we'll default to base plush, so we grab from the valid list + if (snowflake_list.len) + newtype = prob(CONFIG_GET(number/snowflake_plushie_prob)) ? /obj/item/toy/plush/random_snowflake : pick(GLOB.valid_plushie_paths) + else + newtype = pick(GLOB.valid_plushie_paths) + new newtype(loc) return INITIALIZE_HINT_QDEL