From d9ca6addde071c1832138ee988de084d1cab97cb Mon Sep 17 00:00:00 2001 From: SkyratBot <59378654+SkyratBot@users.noreply.github.com> Date: Thu, 4 Mar 2021 02:01:44 +0100 Subject: [PATCH] [MIRROR] Fix stacking of blast doors and shutters from crafting (#3822) * Fix stacking of blast doors and shutters from crafting (#57360) * Fix stacking of blast doors and shutters from crafting Co-authored-by: Ghilker <42839747+Ghilker@users.noreply.github.com> --- code/datums/components/crafting/crafting.dm | 4 ++++ code/datums/components/crafting/recipes.dm | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/code/datums/components/crafting/crafting.dm b/code/datums/components/crafting/crafting.dm index 75f4ec2f3c4..d8a62b693a9 100644 --- a/code/datums/components/crafting/crafting.dm +++ b/code/datums/components/crafting/crafting.dm @@ -195,6 +195,10 @@ var/send_feedback = 1 if(check_contents(a, R, contents)) if(check_tools(a, R, contents)) + if(R.one_per_turf) + for(var/content as anything in get_turf(a)) + if(istype(content, R.result)) + return ", object already present." //If we're a mob we'll try a do_after; non mobs will instead instantly construct the item if(ismob(a) && !do_after(a, R.time, target = a)) return "." diff --git a/code/datums/components/crafting/recipes.dm b/code/datums/components/crafting/recipes.dm index 80216c7e1aa..8dcf1ca4166 100644 --- a/code/datums/components/crafting/recipes.dm +++ b/code/datums/components/crafting/recipes.dm @@ -22,6 +22,8 @@ var/additional_req_text ///Required machines for the craft, set the assigned value of the typepath to CRAFTING_MACHINERY_CONSUME or CRAFTING_MACHINERY_USE. Lazy associative list: type_path key -> flag value. var/list/machinery + ///Should only one object exist on the same turf? + var/one_per_turf = FALSE /datum/crafting_recipe/New() if(!(result in reqs)) @@ -1165,6 +1167,7 @@ tool_behaviors = list(TOOL_SCREWDRIVER, TOOL_MULTITOOL, TOOL_WIRECUTTER, TOOL_WELDER) time = 15 SECONDS category = CAT_MISC + one_per_turf = TRUE /datum/crafting_recipe/blast_doors name = "Blast Door" @@ -1176,6 +1179,7 @@ tool_behaviors = list(TOOL_SCREWDRIVER, TOOL_MULTITOOL, TOOL_WIRECUTTER, TOOL_WELDER) time = 30 SECONDS category = CAT_MISC + one_per_turf = TRUE /datum/crafting_recipe/aquarium name = "Aquarium"