From 7820442652ba5a0f842d64b4a5b50d600b0146fd Mon Sep 17 00:00:00 2001 From: MarinaGryphon Date: Fri, 9 Jul 2021 08:31:21 -0500 Subject: [PATCH] Fix log examine being weird. --- code/game/objects/items/stacks/stack.dm | 11 +++++++---- .../modules/materials/materials/_materials.dm | 1 + .../materials/materials/organic/wood.dm | 7 +++++-- code/modules/materials/sheets/_sheets.dm | 7 ++++++- code/unit_tests/material_tests.dm | 19 +++++++++++++++++++ vorestation.dme | 1 + 6 files changed, 39 insertions(+), 7 deletions(-) create mode 100644 code/unit_tests/material_tests.dm diff --git a/code/game/objects/items/stacks/stack.dm b/code/game/objects/items/stacks/stack.dm index e80afbef41..d5d1fe42d1 100644 --- a/code/game/objects/items/stacks/stack.dm +++ b/code/game/objects/items/stacks/stack.dm @@ -56,14 +56,17 @@ icon_state = "[initial(icon_state)]_3" item_state = initial(icon_state) +/obj/item/stack/proc/get_examine_string() + if(!uses_charge) + return "There [src.amount == 1 ? "is" : "are"] [src.amount] [src.singular_name]\s in the stack." + else + return "There is enough charge for [get_amount()]." + /obj/item/stack/examine(mob/user) . = ..() if(Adjacent(user)) - if(!uses_charge) - . += "There are [src.amount] [src.singular_name]\s in the stack." - else - . += "There is enough charge for [get_amount()]." + . += get_examine_string() /obj/item/stack/attack_self(mob/user) tgui_interact(user) diff --git a/code/modules/materials/materials/_materials.dm b/code/modules/materials/materials/_materials.dm index 890eab5722..83cf22271d 100644 --- a/code/modules/materials/materials/_materials.dm +++ b/code/modules/materials/materials/_materials.dm @@ -165,6 +165,7 @@ var/list/name_to_material var/flags = 0 // Various status modifiers. var/sheet_singular_name = "sheet" var/sheet_plural_name = "sheets" + var/sheet_collective_name = "stack" var/is_fusion_fuel // Shards/tables/structures diff --git a/code/modules/materials/materials/organic/wood.dm b/code/modules/materials/materials/organic/wood.dm index 5d82ec4875..4293979c3b 100644 --- a/code/modules/materials/materials/organic/wood.dm +++ b/code/modules/materials/materials/organic/wood.dm @@ -67,10 +67,12 @@ /datum/material/wood/log name = MAT_LOG + display_name = "wood" // will lead to "wood log" icon_base = "log" stack_type = /obj/item/stack/material/log - sheet_singular_name = null - sheet_plural_name = "pile" + sheet_singular_name = "log" + sheet_plural_name = "logs" + sheet_collective_name = "pile" pass_stack_colors = TRUE supply_conversion_value = 1 @@ -81,6 +83,7 @@ /datum/material/wood/log/sif name = MAT_SIFLOG + display_name = "alien wood" icon_colour = "#0099cc" // Cyan-ish stack_origin_tech = list(TECH_MATERIAL = 2, TECH_BIO = 2) stack_type = /obj/item/stack/material/log/sif \ No newline at end of file diff --git a/code/modules/materials/sheets/_sheets.dm b/code/modules/materials/sheets/_sheets.dm index ddc815bbae..ee359c863b 100644 --- a/code/modules/materials/sheets/_sheets.dm +++ b/code/modules/materials/sheets/_sheets.dm @@ -54,13 +54,18 @@ if(amount>1) name = "[material.use_name] [material.sheet_plural_name]" - desc = "A stack of [material.use_name] [material.sheet_plural_name]." + desc = "A [material.sheet_collective_name] of [material.use_name] [material.sheet_plural_name]." gender = PLURAL else name = "[material.use_name] [material.sheet_singular_name]" desc = "A [material.sheet_singular_name] of [material.use_name]." gender = NEUTER +/obj/item/stack/material/get_examine_string() + if(!uses_charge) + return "There [amount == 1 ? "is" : "are"] [amount] [material.sheet_singular_name]\s in the [material.sheet_collective_name]." + return ..() + /obj/item/stack/material/use(var/used) . = ..() update_strings() diff --git a/code/unit_tests/material_tests.dm b/code/unit_tests/material_tests.dm new file mode 100644 index 0000000000..e3c80b6cd3 --- /dev/null +++ b/code/unit_tests/material_tests.dm @@ -0,0 +1,19 @@ +/datum/unit_test/materials_shall_have_names + name = "MATERIALS: Materials Shall Have All Names" + +/datum/unit_test/materials_shall_have_names/start_test() + var/list/failures = list() + populate_material_list() + for(var/name in global.name_to_material) + var/datum/material/mat = global.name_to_material[name] + if(!mat) + continue // how did we get here? + if(!mat.display_name || !mat.use_name || !mat.sheet_singular_name || !mat.sheet_plural_name || !mat.sheet_collective_name) + failures[name] = mat.type + + if(length(failures)) + fail("[length(failures)] material\s had missing name strings: [english_list(failures)].") + else + pass("All materials had all their name strings.") + + return TRUE diff --git a/vorestation.dme b/vorestation.dme index 0741990489..8ff0c8bc2b 100644 --- a/vorestation.dme +++ b/vorestation.dme @@ -3995,6 +3995,7 @@ #include "code\unit_tests\language_tests.dm" #include "code\unit_tests\loadout_tests.dm" #include "code\unit_tests\map_tests.dm" +#include "code\unit_tests\material_tests.dm" #include "code\unit_tests\mob_tests.dm" #include "code\unit_tests\recipe_tests.dm" #include "code\unit_tests\research_tests.dm"