From ccae3b5dd2286a7ea149752abce0fa3686037ba7 Mon Sep 17 00:00:00 2001 From: Zephyr <12817816+ZephyrTFA@users.noreply.github.com> Date: Sun, 17 Sep 2023 02:28:23 -0400 Subject: [PATCH] Items created from durathread are now 50% more resistant to consuming (#78325) ## About The Pull Request Title. This means that a moth can take, on average due to rounding, double the normal bites from an article of durathread clothing. --- code/game/objects/items/stacks/sheets/sheet_types.dm | 3 +++ code/game/objects/items/stacks/stack.dm | 5 +++++ 2 files changed, 8 insertions(+) diff --git a/code/game/objects/items/stacks/sheets/sheet_types.dm b/code/game/objects/items/stacks/sheets/sheet_types.dm index 9257035d8de..289920c8889 100644 --- a/code/game/objects/items/stacks/sheets/sheet_types.dm +++ b/code/game/objects/items/stacks/sheets/sheet_types.dm @@ -505,6 +505,9 @@ GLOBAL_LIST_INIT(durathread_recipes, list ( \ . = ..() . += GLOB.durathread_recipes +/obj/item/stack/sheet/durathread/on_item_crafted(mob/builder, atom/created) + created.set_armor_rating(CONSUME, max(50, created.get_armor_rating(CONSUME))) + /obj/item/stack/sheet/cotton name = "raw cotton bundle" desc = "A bundle of raw cotton ready to be spun on the loom." diff --git a/code/game/objects/items/stacks/stack.dm b/code/game/objects/items/stacks/stack.dm index 54fb4866835..5c616fa4803 100644 --- a/code/game/objects/items/stacks/stack.dm +++ b/code/game/objects/items/stacks/stack.dm @@ -401,6 +401,7 @@ if(created) created.setDir(builder.dir) + on_item_crafted(builder, created) // Use up the material use(recipe.req_amount * multiplier) @@ -431,6 +432,10 @@ return TRUE +/// Run special logic on created items after they've been successfully crafted. +/obj/item/stack/proc/on_item_crafted(mob/builder, atom/created) + return + /obj/item/stack/vv_edit_var(vname, vval) if(vname == NAMEOF(src, amount)) add(clamp(vval, 1-amount, max_amount - amount)) //there must always be one.