From 38a086093eeac0b30194b8a1a73bcbe3022480dc Mon Sep 17 00:00:00 2001 From: Bloop <13398309+vinylspiders@users.noreply.github.com> Date: Sun, 8 Mar 2026 04:34:47 -0400 Subject: [PATCH] create_and_destroy will no longer spawn abstract types (#95071) ## About The Pull Request What it says on the tin-- with having a nice abstract types system now, we can utilize that in create_and_destroy. ## Why It's Good For The Game Removes a lot of the need for snowflake item exclusions, and makes this test likely a lot more stable (and a little faster even). ## Changelog Not player-facing --- code/__DEFINES/research/anomalies.dm | 1 - .../food_and_drinks/restaurant/_venue.dm | 1 + code/modules/mob_spawn/mob_spawn.dm | 1 + code/modules/power/cell.dm | 1 - code/modules/power/turbine/turbine.dm | 1 + .../research/experimentor/experimentor.dm | 3 +- .../xenobiology/crossbreeding/recurring.dm | 1 + .../surgery/organs/external/wings/wings.dm | 1 + code/modules/unit_tests/crafting.dm | 8 ++++++ code/modules/unit_tests/create_and_destroy.dm | 3 +- .../unit_tests/modify_fantasy_variable.dm | 2 +- code/modules/unit_tests/unit_test.dm | 28 ++++--------------- 12 files changed, 24 insertions(+), 27 deletions(-) diff --git a/code/__DEFINES/research/anomalies.dm b/code/__DEFINES/research/anomalies.dm index b9c93bce7c1..d2e4f5cf772 100644 --- a/code/__DEFINES/research/anomalies.dm +++ b/code/__DEFINES/research/anomalies.dm @@ -30,7 +30,6 @@ GLOBAL_LIST_INIT(bioscrambler_organs_blacklist, typecacheof(list ( /obj/item/organ/pod_hair, /obj/item/organ/spines, /obj/item/organ/wings, - /obj/item/organ/wings/functional, /obj/item/organ/alien, /obj/item/organ/brain, /obj/item/organ/body_egg, diff --git a/code/modules/food_and_drinks/restaurant/_venue.dm b/code/modules/food_and_drinks/restaurant/_venue.dm index c26aadf196a..4e0d196f71b 100644 --- a/code/modules/food_and_drinks/restaurant/_venue.dm +++ b/code/modules/food_and_drinks/restaurant/_venue.dm @@ -313,6 +313,7 @@ /obj/item/holosign_creator/robot_seat/attack_self(mob/user) return + /obj/structure/holosign/robot_seat density = FALSE desc = "Used to indicate a place to sit for a robot tourist. I better be careful." diff --git a/code/modules/mob_spawn/mob_spawn.dm b/code/modules/mob_spawn/mob_spawn.dm index 479b2ff5d43..7e3940829f8 100644 --- a/code/modules/mob_spawn/mob_spawn.dm +++ b/code/modules/mob_spawn/mob_spawn.dm @@ -5,6 +5,7 @@ //So it shows up in the map editor icon = 'icons/effects/mapping_helpers.dmi' icon_state = "mobspawner" + abstract_type = /obj/effect/mob_spawn /// Can this spawner be used up? var/infinite_use = FALSE ///A forced name of the mob, though can be overridden if a special name is passed as an argument diff --git a/code/modules/power/cell.dm b/code/modules/power/cell.dm index ae0fd85e244..a79e079cbe9 100644 --- a/code/modules/power/cell.dm +++ b/code/modules/power/cell.dm @@ -261,7 +261,6 @@ connector_type = null custom_materials = null emp_damage_modifier = 0 - abstract_type = /obj/item/stock_parts/power_store/cell/ethereal /obj/item/stock_parts/power_store/cell/ethereal/grind_results() return null diff --git a/code/modules/power/turbine/turbine.dm b/code/modules/power/turbine/turbine.dm index dc9708a1d1a..65e07267551 100644 --- a/code/modules/power/turbine/turbine.dm +++ b/code/modules/power/turbine/turbine.dm @@ -9,6 +9,7 @@ resistance_flags = FIRE_PROOF can_atmos_pass = ATMOS_PASS_DENSITY processing_flags = START_PROCESSING_MANUALLY + abstract_type = /obj/machinery/power/turbine ///The cached efficiency of this turbines installed part var/efficiency = 0 diff --git a/code/modules/research/experimentor/experimentor.dm b/code/modules/research/experimentor/experimentor.dm index 76d5bab2b5d..438f92c7dfa 100644 --- a/code/modules/research/experimentor/experimentor.dm +++ b/code/modules/research/experimentor/experimentor.dm @@ -53,7 +53,8 @@ if(!banned_typecache) banned_typecache = typecacheof(list( /obj/item/stock_parts/power_store/cell/infinite, - /obj/item/grenade/chem_grenade/tuberculosis + /obj/item/stock_parts/power_store/cell/ethereal, + /obj/item/grenade/chem_grenade/tuberculosis, )) if(!length(valid_items)) diff --git a/code/modules/research/xenobiology/crossbreeding/recurring.dm b/code/modules/research/xenobiology/crossbreeding/recurring.dm index e9cd6149cde..b5ccd01447f 100644 --- a/code/modules/research/xenobiology/crossbreeding/recurring.dm +++ b/code/modules/research/xenobiology/crossbreeding/recurring.dm @@ -8,6 +8,7 @@ Recurring extracts: desc = "A tiny, glowing core, wrapped in several layers of goo." effect = "recurring" icon_state = "recurring" + abstract_type = /obj/item/slimecross/recurring var/extract_type var/obj/item/slime_extract/extract var/cooldown = 0 diff --git a/code/modules/surgery/organs/external/wings/wings.dm b/code/modules/surgery/organs/external/wings/wings.dm index 3c518792e4f..bdb5c9087dd 100644 --- a/code/modules/surgery/organs/external/wings/wings.dm +++ b/code/modules/surgery/organs/external/wings/wings.dm @@ -10,6 +10,7 @@ bodypart_overlay = /datum/bodypart_overlay/mutant/wings organ_flags = parent_type::organ_flags | ORGAN_EXTERNAL + abstract_type = /obj/item/organ/wings ///Checks if the wings can soften short falls /obj/item/organ/wings/proc/can_soften_fall() diff --git a/code/modules/unit_tests/crafting.dm b/code/modules/unit_tests/crafting.dm index 2a362dbe182..7734732389e 100644 --- a/code/modules/unit_tests/crafting.dm +++ b/code/modules/unit_tests/crafting.dm @@ -69,6 +69,14 @@ new req_path(turf, /*new_amount =*/ amount, /*merge =*/ FALSE) continue + // Some recipes might accept an abstract base type as its reqs - e.g. obj/item/food/grown - signifying it can use any item of that type. + // Let's not actually create those abstract base types though, and instead pick a random subtype to use. + var/datum/req_path_datum = req_path + if(req_path_datum.abstract_type == req_path) + var/list/subtypes = valid_subtypesof(req_path_datum) + if(length(subtypes)) + req_path = pick(subtypes) + //it's any other item for(var/iteration in 1 to amount) new req_path(turf) diff --git a/code/modules/unit_tests/create_and_destroy.dm b/code/modules/unit_tests/create_and_destroy.dm index 0c9498b19bf..366ebc29c13 100644 --- a/code/modules/unit_tests/create_and_destroy.dm +++ b/code/modules/unit_tests/create_and_destroy.dm @@ -14,7 +14,8 @@ GLOBAL_VAR_INIT(running_create_and_destroy, FALSE) var/original_baseturf_count = length(original_baseturfs) GLOB.running_create_and_destroy = TRUE - for(var/type_path in typesof(/atom/movable, /turf) - uncreatables) //No areas please + var/list/type_paths_to_check = (valid_typesof(/atom/movable) + valid_typesof(/turf)) - uncreatables // No areas please + for(var/type_path in type_paths_to_check) if(ispath(type_path, /turf)) spawn_at.ChangeTurf(type_path) //We change it back to prevent baseturfs stacking and hitting the limit diff --git a/code/modules/unit_tests/modify_fantasy_variable.dm b/code/modules/unit_tests/modify_fantasy_variable.dm index 72dc776af32..29ce4f5eae9 100644 --- a/code/modules/unit_tests/modify_fantasy_variable.dm +++ b/code/modules/unit_tests/modify_fantasy_variable.dm @@ -4,7 +4,7 @@ priority = TEST_LONGER /datum/unit_test/modify_fantasy_variable/Run() - var/list/applicable_types = subtypesof(/obj/item) - uncreatables + var/list/applicable_types = valid_subtypesof(/obj/item) - uncreatables for(var/obj/item/path as anything in applicable_types) var/obj/item/object = allocate(path) diff --git a/code/modules/unit_tests/unit_test.dm b/code/modules/unit_tests/unit_test.dm index 1fdafe33017..430bfc8e9b1 100644 --- a/code/modules/unit_tests/unit_test.dm +++ b/code/modules/unit_tests/unit_test.dm @@ -258,45 +258,29 @@ GLOBAL_VAR_INIT(focused_tests, focused_tests()) /// It is appreciated to add the reason why the atom shouldn't be initialized if you add it to this list. /datum/unit_test/proc/build_list_of_uncreatables() RETURN_TYPE(/list) - var/list/returnable_list = list() - // The following are just generic, singular types. - returnable_list = list( - //Never meant to be created, errors out the ass for mobcode reasons - /mob/living/carbon, - //And another - /obj/item/slimecross/recurring, - //This should be obvious - /obj/machinery/doomsday_device, + // The following are just generic, singular types + var/list/returnable_list = list( //Yet more templates /obj/machinery/restaurant_portal, //Template type - /obj/machinery/power/turbine, - //Template type - /obj/effect/mob_spawn, - //Template type /obj/structure/holosign/robot_seat, //Singleton /mob/dview, - //Template type - /obj/item/bodypart, //This is meant to fail extremely loud every single time it occurs in any environment in any context, and it falsely alarms when this unit test iterates it. Let's not spawn it in. /obj/merge_conflict_marker, - //briefcase launchpads erroring - /obj/machinery/launchpad/briefcase, - //Wings abstract path - /obj/item/organ/wings, //Not meant to spawn without the machine wand /obj/effect/bug_moving, - //The abstract grown item expects a seed, but doesn't have one - /obj/item/food/grown, //Single use case holder atom requiring a user /atom/movable/looking_holder, //Should not exist outside of holders /obj/effect/decal/cleanable/blood/trail, + //Should not exist outside of ethereals + /obj/item/stock_parts/power_store/cell/ethereal, ) // Everything that follows is a typesof() check. - + returnable_list += typesof(/obj/machinery/doomsday_device) //This should be obvious + returnable_list += typesof(/obj/machinery/launchpad/briefcase) //briefcase launchpads erroring //Say it with me now, type template returnable_list += typesof(/obj/effect/mapping_helpers) //This turf existing is an error in and of itself