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
This commit is contained in:
Bloop
2026-03-08 00:34:47 -08:00
committed by GitHub
parent 93004f0457
commit 38a086093e
12 changed files with 24 additions and 27 deletions
+8
View File
@@ -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)
@@ -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
@@ -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)
+6 -22
View File
@@ -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