From 1337b0276b77d133211129b381cc962246a2bfb5 Mon Sep 17 00:00:00 2001 From: Ghom <42542238+Ghommie@users.noreply.github.com> Date: Sat, 28 Feb 2026 00:17:05 +0100 Subject: [PATCH] Fixed materials not being applied when crafting while holding just enough sheets (#95264) ## About The Pull Request This will fix #95009. split_stack() calls qdel when the amount reaches zero, and mats_per_unit is unset, so we shouldn't be accessing src for materials logic here. ## Why It's Good For The Game This will fix #95009. ## Changelog :cl: fix: Fixed materials not being applied when crafting with stacks if said stack is zero'd in the process. /:cl: --- code/game/objects/items/stacks/stack.dm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/code/game/objects/items/stacks/stack.dm b/code/game/objects/items/stacks/stack.dm index d6f12c38265..9cbaeb0dd45 100644 --- a/code/game/objects/items/stacks/stack.dm +++ b/code/game/objects/items/stacks/stack.dm @@ -461,8 +461,8 @@ builder.investigate_log("crafted [recipe.title]", INVESTIGATE_CRAFTING) // Apply mat datums - if(LAZYLEN(mats_per_unit) && !(recipe.crafting_flags & CRAFT_NO_MATERIALS)) - var/list/result_mats = mats_per_unit.Copy() + if(LAZYLEN(used_stack.mats_per_unit) && !(recipe.crafting_flags & CRAFT_NO_MATERIALS)) + var/list/result_mats = used_stack.mats_per_unit.Copy() for(var/mat in recipe.removed_mats) var/to_remove = recipe.removed_mats[mat] var/datum/material/ref_mat = locate(mat) in result_mats