diff --git a/code/datums/elements/loomable.dm b/code/datums/elements/loomable.dm index 6886cfc6cec5..3ffeb97c8a3e 100644 --- a/code/datums/elements/loomable.dm +++ b/code/datums/elements/loomable.dm @@ -76,6 +76,7 @@ if(isstack(source)) var/obj/item/stack/stack_we_use = source while(stack_we_use.amount >= required_amount) + combine_nearby_stacks(user, stack_we_use) // monkestation edit: automatically merge nearby stacks if(!do_after(user, loom_time, target)) break diff --git a/monkestation/code/datums/elements/loomable.dm b/monkestation/code/datums/elements/loomable.dm new file mode 100644 index 000000000000..9534fd1ade2b --- /dev/null +++ b/monkestation/code/datums/elements/loomable.dm @@ -0,0 +1,6 @@ +/datum/element/loomable/proc/combine_nearby_stacks(atom/target, obj/item/stack/our_stack) + for(var/obj/item/stack/nearby_stack as anything in view(1, get_turf(target))) + if(our_stack.amount >= our_stack.max_amount) + break + if(our_stack.can_merge(nearby_stack, inhand = TRUE)) + nearby_stack.merge(our_stack) diff --git a/tgstation.dme b/tgstation.dme index 03945169b298..ff890969fccb 100644 --- a/tgstation.dme +++ b/tgstation.dme @@ -5843,6 +5843,7 @@ #include "monkestation\code\datums\diseases\advance\symptoms\clockwork.dm" #include "monkestation\code\datums\elements\area_locked.dm" #include "monkestation\code\datums\elements\basic_eating.dm" +#include "monkestation\code\datums\elements\loomable.dm" #include "monkestation\code\datums\elements\trash_if_empty.dm" #include "monkestation\code\datums\elements\uncompressed_storage.dm" #include "monkestation\code\datums\ert\moff_inspectors.dm"