From 7ace9f0203a454eec68166c5b736c59288d308a4 Mon Sep 17 00:00:00 2001 From: kevinz000 <2003111+kevinz000@users.noreply.github.com> Date: Fri, 10 Jan 2020 06:25:23 -0800 Subject: [PATCH] abstract types --- code/game/objects/items/plushes.dm | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/code/game/objects/items/plushes.dm b/code/game/objects/items/plushes.dm index 0d9363f95e..21056ce6ee 100644 --- a/code/game/objects/items/plushes.dm +++ b/code/game/objects/items/plushes.dm @@ -31,7 +31,8 @@ var/normal_desc //--end of love :'(-- - var/snowflake_id //if we set from a config snowflake plushie. + var/snowflake_id //if we set from a config snowflake plushie. + var/abstract_type = /obj/item/toy/plush //to prevent us from spawning "base" plushies. set this to a plush's own type. only use this if a plush is not meant to be standalone/spawned, ever. /obj/item/toy/plush/random_snowflake/Initialize(mapload, set_snowflake_id) . = ..() @@ -127,6 +128,7 @@ squeak_override = P.squeak_override attack_verb = P.attack_verb gender = P.gender + qdel(P) if(jsonlist["name"]) name = jsonlist["name"] if(jsonlist["desc"]) @@ -415,13 +417,22 @@ if(mood_message) desc += mood_message +GLOBAL_LIST_INIT(valid_plushie_paths, valid_plushie_paths()) +/proc/valid_plushie_paths() + . = list() + for(var/i in subtypesof(/obj/item/toy/plush)) + var/obj/item/toy/plush/abstract = i + if(initial(abstract.abstract_type) == i) + continue + . += i + /obj/item/toy/plush/random name = "Illegal plushie" desc = "Something fucked up" var/blacklisted_plushes = list(/obj/item/toy/plush/carpplushie/dehy_carp, /obj/item/toy/plush/awakenedplushie, /obj/item/toy/plush/random) /obj/item/toy/plush/random/Initialize() - var/newtype = prob(CONFIG_GET(number/snowflake_plushie_prob))? /obj/item/toy/plush/random_snowflake : (pick(subtypesof(/obj/item/toy/plush) - typecacheof(blacklisted_plushes))) + var/newtype = prob(CONFIG_GET(number/snowflake_plushie_prob))? /obj/item/toy/plush/random_snowflake : pick(GLOB.valid_plushie_paths) new newtype(loc) return INITIALIZE_HINT_QDEL @@ -676,6 +687,7 @@ /obj/item/toy/plush/mammal name = "mammal plushie" desc = "An adorable stuffed toy resembling some sort of crew member." + abstract_type = /obj/item/toy/plush/mammal /obj/item/toy/plush/catgirl/fermis name = "medcat plushie" @@ -689,17 +701,20 @@ name = "xenohybrid plushie" desc = "An adorable stuffed toy that resmembles a xenomorphic crewmember." squeak_override = list('sound/voice/hiss2.ogg' = 1) + abstract_type = /obj/item/toy/plush/xeno /obj/item/toy/plush/bird name = "bird plushie" desc = "An adorable stuffed plushie that resembles an avian." attack_verb = list("peeped", "beeped", "poofed") squeak_override = list('modular_citadel/sound/voice/peep.ogg' = 1) + abstract_type = /obj/item/toy/plush/bird /obj/item/toy/plush/sergal name = "sergal plushie" desc = "An adorable stuffed plushie that resembles a sagaru." squeak_override = list('modular_citadel/sound/voice/merp.ogg' = 1) + abstract_type = /obj/item/toy/plush/sergal /obj/item/toy/plush/mammal/dog desc = "An adorable stuffed toy that resembles a canine." @@ -708,9 +723,11 @@ 'modular_citadel/sound/voice/bark1.ogg' = 1, 'modular_citadel/sound/voice/bark2.ogg' = 1 ) + abstract_type = /obj/item/toy/plush/mammal/dog /obj/item/toy/plush/catgirl name = "feline plushie" desc = "An adorable stuffed toy that resembles a feline." attack_verb = list("headbutt", "scritched", "bit") squeak_override = list('modular_citadel/sound/voice/nya.ogg' = 1) + abstract_type = /obj/item/toy/plush/catgirl