From 72711ac31e3767694f4ad1d7b610645909a803a5 Mon Sep 17 00:00:00 2001 From: jjpark-kb <55967837+jjpark-kb@users.noreply.github.com> Date: Tue, 14 Nov 2023 15:57:52 -0500 Subject: [PATCH 1/2] loopable looms (#79680) ## About The Pull Request makes the looms `loom_me` proc loop for stackable items (such as cotton). ## Why It's Good For The Game its a looping do_after, which is satisfying (and you don't need to click as much). ## Changelog :cl: qol: looms will now attempt to loop through stackable items (cotton as an example) /:cl: --------- Co-authored-by: san7890 --- code/datums/elements/loomable.dm | 34 +++++++++++++++++++++----------- 1 file changed, 22 insertions(+), 12 deletions(-) diff --git a/code/datums/elements/loomable.dm b/code/datums/elements/loomable.dm index cfd0b4bc834..76ee071a9a2 100644 --- a/code/datums/elements/loomable.dm +++ b/code/datums/elements/loomable.dm @@ -71,23 +71,33 @@ /// If a do_after of the specified loom_time passes, will create a new one of resulting_atom and either delete the item, or .use the required amount if its a stack /datum/element/loomable/proc/loom_me(obj/item/source, mob/living/user, atom/target) - if(!do_after(user, loom_time, target)) - user.balloon_alert(user, "interrupted!") - return - - ///we need to perform another check in case a stack somehow got diminished in the middle of the do_after - var/successful = TRUE + //this allows us to count the amount of times it has successfully used the stack's required amount + var/spawning_amount = 0 if(isstack(source)) var/obj/item/stack/stack_we_use = source - if(!stack_we_use.use(required_amount)) - successful = FALSE + while(stack_we_use.amount >= required_amount) + if(!do_after(user, loom_time, target)) + break + + if(!stack_we_use.use(required_amount)) + user.balloon_alert(user, "need [required_amount] of [source]!") + break + + spawning_amount++ + else + if(!do_after(user, loom_time, target)) + user.balloon_alert(user, "interrupted!") + return + qdel(source) + spawning_amount++ - //ripbozo - if(!successful) - user.balloon_alert(user, "need [required_amount] of [source]!") + if(spawning_amount == 0) return - var/new_thing = new resulting_atom(target.drop_location()) + var/new_thing + for(var/repeated in 1 to spawning_amount) + new_thing = new resulting_atom(target.drop_location()) + user.balloon_alert_to_viewers("[process_completion_verb] [new_thing]") From efa900e46bbeced687d8662d0b41afc2048fb752 Mon Sep 17 00:00:00 2001 From: NaakaKo Date: Tue, 14 Nov 2023 20:58:01 +0000 Subject: [PATCH 2/2] (upstream PR 79680)