From 6d50d3a7c014f2fee40e867a13e2fe470e5ff4d4 Mon Sep 17 00:00:00 2001 From: SkyratBot <59378654+SkyratBot@users.noreply.github.com> Date: Thu, 10 Aug 2023 14:09:47 +0200 Subject: [PATCH] [MIRROR] Fixing an oversight with processable items that leads to the same chat message being sent multiple times [MDB IGNORE] (#22985) * Fixing an oversight with processable items that leads to the same chat message being sent multiple times (#77443) ## About The Pull Request Exactly what it reads on the title. Also, I've stored the value of atoms to create in a variable. ## Why It's Good For The Game This will fix #77378. ## Changelog :cl: fix: Fixed an oversight with processable items that lead to the same chat message being sent multiple times. /:cl: * Fixing an oversight with processable items that leads to the same chat message being sent multiple times --------- Co-authored-by: Ghom <42542238+Ghommie@users.noreply.github.com> --- code/game/atoms.dm | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/code/game/atoms.dm b/code/game/atoms.dm index 3c3d345dd6b..8eb99205789 100644 --- a/code/game/atoms.dm +++ b/code/game/atoms.dm @@ -1668,18 +1668,19 @@ if(process_item.use_tool(src, user, processing_time, volume=50)) var/atom/atom_to_create = chosen_option[TOOL_PROCESSING_RESULT] var/list/atom/created_atoms = list() - for(var/i = 1 to chosen_option[TOOL_PROCESSING_AMOUNT]) + var/amount_to_create = chosen_option[TOOL_PROCESSING_AMOUNT] + for(var/i = 1 to amount_to_create) var/atom/created_atom = new atom_to_create(drop_location()) if(custom_materials) - created_atom.set_custom_materials(custom_materials, 1 / chosen_option[TOOL_PROCESSING_AMOUNT]) + created_atom.set_custom_materials(custom_materials, 1 / amount_to_create) created_atom.pixel_x = pixel_x created_atom.pixel_y = pixel_y if(i > 1) created_atom.pixel_x += rand(-8,8) created_atom.pixel_y += rand(-8,8) created_atom.OnCreatedFromProcessing(user, process_item, chosen_option, src) - to_chat(user, span_notice("You manage to create [chosen_option[TOOL_PROCESSING_AMOUNT]] [initial(atom_to_create.gender) == PLURAL ? "[initial(atom_to_create.name)]" : "[initial(atom_to_create.name)][plural_s(initial(atom_to_create.name))]"] from [src].")) created_atoms.Add(created_atom) + to_chat(user, span_notice("You manage to create [amount_to_create] [initial(atom_to_create.gender) == PLURAL ? "[initial(atom_to_create.name)]" : "[initial(atom_to_create.name)][plural_s(initial(atom_to_create.name))]"] from [src].")) SEND_SIGNAL(src, COMSIG_ATOM_PROCESSED, user, process_item, created_atoms) UsedforProcessing(user, process_item, chosen_option) return