mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2026-08-26 06:40:08 +01:00
[MIRROR] Move autolathe design datums to techweb datums (#12565)
Co-authored-by: Will <7099514+Willburd@users.noreply.github.com> Co-authored-by: Cameron Lennox <killer65311@gmail.com>
This commit is contained in:
co-authored by
Will
Cameron Lennox
parent
b61399d8e7
commit
90d7e7d352
@@ -14,3 +14,43 @@
|
||||
|
||||
if(length(failures))
|
||||
TEST_FAIL("[length(failures)] material\s had missing name strings: [english_list(failures)].")
|
||||
|
||||
/datum/unit_test/all_sheets_must_be_printable_from_autolathe
|
||||
|
||||
/datum/unit_test/all_sheets_must_be_printable_from_autolathe/Run()
|
||||
// Get the materials all the sheets can be broken down into
|
||||
var/list/needed_materials = list()
|
||||
for(var/path in subtypesof(/obj/item/stack))
|
||||
var/obj/item/stack/material/sheet = new path()
|
||||
var/list/get_mats = sheet.get_material_composition()
|
||||
for(var/mat in get_mats)
|
||||
needed_materials |= mat
|
||||
qdel(sheet)
|
||||
|
||||
// Then get the sheets those materials are represented by
|
||||
var/list/required_sheets = list()
|
||||
for(var/datum/material/mat in needed_materials)
|
||||
if(!mat || !mat.stack_type)
|
||||
continue
|
||||
required_sheets |= mat.stack_type
|
||||
|
||||
// Get all material sheet printing recipies in the autolathe
|
||||
var/list/sheet_print_designs = list()
|
||||
for(var/id in SSresearch.techweb_designs)
|
||||
var/datum/design_techweb/design = SSresearch.techweb_designs[id]
|
||||
if(!(design.build_type & AUTOLATHE))
|
||||
continue
|
||||
if(!(design.build_path in subtypesof(/obj/item/stack/material)))
|
||||
continue
|
||||
sheet_print_designs |= design.build_path
|
||||
|
||||
// Check all sheets for EXISTANCE
|
||||
var/failed = FALSE
|
||||
for(var/sheet in required_sheets)
|
||||
if(sheet in sheet_print_designs)
|
||||
continue
|
||||
failed = TRUE
|
||||
TEST_NOTICE(src, "[sheet] - Missing an autolathe design, all material sheets must be printable, or materials can get stuck in the lathe forever")
|
||||
|
||||
if(failed)
|
||||
TEST_FAIL("materials missing autolathe print recipies.")
|
||||
|
||||
Reference in New Issue
Block a user