mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-25 06:00:16 +01:00
Adds a unit test for techweb design presence, puts some missing designs into protolathes (#90219)
## About The Pull Request Adds a unit test that checks that all designs are accessible through some source, be it techweb, disks, or innate designs. Certain designs, like pocket extinguishers, entertainment screens, etc, that have been present in autolathes but not in the techweb despite having PROTOLATHE flag assigned have been put into protolathes (where it made sense, otherwise the flag was removed). An important change is that restaurant portals are now printable, and thus can be constructed and deconstructed. Indestructible portals have been a major gripe of mine for a while, and I don't see a solid reason for keeping them indestructible if they can easily be printed from the service protolathe. Closes #90212 ## Why It's Good For The Game Initial argument for keeping portals unbreakable was to prevent people from griefing the chef/bartender, but by that logic we can make most machinery unbreakable too. I don't think that having an unbreakable portal is good if its locking us out from allowing chefs/bartenders to reorder or even outright reposition their lunchroom/bar. ## Changelog 🆑 balance: Restaurant portals can now be printed, constructed and deconstructed. They're also no longer completely invulnerable. /🆑
This commit is contained in:
@@ -32,3 +32,58 @@
|
||||
if (isnull(current_design.surgery) || current_design.surgery == default_design_surgery.surgery) //Check if surgery was not set
|
||||
TEST_FAIL("Surgery Design [current_design.type] has default or null surgery var")
|
||||
|
||||
/datum/unit_test/design_source
|
||||
|
||||
/datum/unit_test/design_source/Run()
|
||||
var/list/all_designs = list()
|
||||
var/list/exceptions = list(
|
||||
/datum/design/surgery/healing, // Ignored due to the above test
|
||||
)
|
||||
|
||||
for (var/datum/design/design as anything in subtypesof(/datum/design))
|
||||
var/design_id = design::id
|
||||
if (design_id == DESIGN_ID_IGNORE || (design in exceptions))
|
||||
continue
|
||||
if (design_id in all_designs)
|
||||
TEST_FAIL("Design [design] shares an ID \"[design_id]\" with another design")
|
||||
continue
|
||||
all_designs[design_id] = design
|
||||
|
||||
for (var/datum/techweb_node/node as anything in subtypesof(/datum/techweb_node))
|
||||
node = new node()
|
||||
for (var/design_id in node.design_ids)
|
||||
if (!all_designs[design_id])
|
||||
TEST_FAIL("Techweb node [node.display_name] ([node.id]) has a design_id \"[design_id]\" which doesn't correspond to any existing design!")
|
||||
continue
|
||||
all_designs -= design_id
|
||||
qdel(node)
|
||||
|
||||
// Designs can also be disk-exclusive
|
||||
for (var/obj/item/disk/design_disk/design_disk as anything in subtypesof(/obj/item/disk/design_disk))
|
||||
design_disk = new design_disk()
|
||||
for (var/datum/design/design as anything in design_disk.blueprints)
|
||||
all_designs -= design.id
|
||||
qdel(design_disk)
|
||||
|
||||
for (var/obj/item/disk/surgery/design_disk as anything in subtypesof(/obj/item/disk/surgery))
|
||||
design_disk = new design_disk()
|
||||
for (var/surgery_type as anything in design_disk.surgeries)
|
||||
for (var/design_id in all_designs)
|
||||
var/datum/design/surgery/design = all_designs[design_id]
|
||||
if (ispath(design, /datum/design/surgery) && design::surgery == surgery_type)
|
||||
all_designs -= design::id
|
||||
qdel(design_disk)
|
||||
|
||||
// Or machine-exclusive
|
||||
for (var/datum/techweb/autounlocking/techweb as anything in subtypesof(/datum/techweb/autounlocking))
|
||||
techweb = new techweb()
|
||||
for (var/design_id in techweb.researched_designs + techweb.hacked_designs)
|
||||
var/datum/design/design = SSresearch.techweb_design_by_id(design_id)
|
||||
// If we have a design thats supposed to be printable from a protolathe and an autolathe, but only autolathes can print it
|
||||
// then we still should error because then we either have a missing design_id or redundant build flags
|
||||
if (!(design.build_type & (~techweb.allowed_buildtypes)))
|
||||
all_designs -= design_id
|
||||
qdel(techweb)
|
||||
|
||||
for (var/missing_id in all_designs)
|
||||
TEST_FAIL("Design [all_designs[missing_id]] has an ID \"[missing_id]\" which is not in any of the techweb nodes or tech disks, or it is possibly misconfigured!")
|
||||
|
||||
Reference in New Issue
Block a user