From 6d2c37b33372ad5ee9fc4b1cdcf7dbda9edcbaf6 Mon Sep 17 00:00:00 2001 From: RKz Date: Tue, 19 Sep 2023 19:45:04 -0400 Subject: [PATCH] processing cleanup(Desc) makes processing use the correct grammar. Makes it randomize products so you dont have 6 pizzas on the same pixel. Gets rid of edgecases --- code/__HELPERS/pronouns.dm | 15 ++++++++++++++ code/datums/elements/food/processable.dm | 7 +++---- code/game/atoms.dm | 26 ++++++++++++++++++------ 3 files changed, 38 insertions(+), 10 deletions(-) diff --git a/code/__HELPERS/pronouns.dm b/code/__HELPERS/pronouns.dm index 8727cdbacf1b3..0f783ff4930cf 100644 --- a/code/__HELPERS/pronouns.dm +++ b/code/__HELPERS/pronouns.dm @@ -39,6 +39,21 @@ /datum/proc/p_es(temp_gender) . = "es" +/datum/proc/plural_s(pluralize) + switch(copytext_char(pluralize, -2)) + if ("ss") + return "es" + if ("sh") + return "es" + if ("ch") + return "es" + else + switch(copytext_char(pluralize, -1)) + if("s", "x", "z") + return "es" + else + return "s" + //like clients, which do have gender. /client/p_they(capitalized, temp_gender) if(!temp_gender) diff --git a/code/datums/elements/food/processable.dm b/code/datums/elements/food/processable.dm index 503e5169c8778..a80853dab4177 100644 --- a/code/datums/elements/food/processable.dm +++ b/code/datums/elements/food/processable.dm @@ -3,7 +3,7 @@ element_flags = ELEMENT_BESPOKE id_arg_index = 2 ///The type of atom this creates when the processing recipe is used. - var/result_atom_type + var/atom/result_atom_type ///The tool behaviour for this processing recipe var/tool_behaviour ///Time to process the atom @@ -40,8 +40,7 @@ var/found_table = locate(/obj/structure/table) in found_location var/found_tray = locate(/obj/item/storage/bag/tray) in found_location if(!found_turf && !istype(found_location, /obj/item/storage/bag/tray) || found_turf && !(found_table || found_tray)) - to_chat(user, "You cannot make that here! You need a table or at least a tray.") + to_chat(user, "You cannot make [initial(result_atom_type.name)] here! You need a table or at least a tray.") return - mutable_recipes += list(list(TOOL_PROCESSING_RESULT = result_atom_type, TOOL_PROCESSING_AMOUNT = amount_created, TOOL_PROCESSING_TIME = time_to_process)) - return COMPONENT_NO_AFTERATTACK + mutable_recipes += list(list(TOOL_PROCESSING_RESULT = result_atom_type, TOOL_PROCESSING_AMOUNT = amount_created, TOOL_PROCESSING_TIME = time_to_process))\ diff --git a/code/game/atoms.dm b/code/game/atoms.dm index f681b0ab5fbb9..6d44f8a2f5335 100644 --- a/code/game/atoms.dm +++ b/code/game/atoms.dm @@ -1378,16 +1378,30 @@ StartProcessingAtom(user, I, choices_to_options[pick]) -/atom/proc/StartProcessingAtom(mob/living/user, obj/item/I, list/chosen_option) +/atom/proc/StartProcessingAtom(mob/living/user, obj/item/process_item, list/chosen_option) + var/processing_time = chosen_option[TOOL_PROCESSING_TIME] to_chat(user, "You start working on [src]") - if(I.use_tool(src, user, chosen_option[TOOL_PROCESSING_TIME], volume=50)) + if(process_item.use_tool(src, user, processing_time, volume=50)) var/atom/atom_to_create = chosen_option[TOOL_PROCESSING_RESULT] - for(var/i = 1 to chosen_option[TOOL_PROCESSING_AMOUNT]) - new atom_to_create(loc) - to_chat(user, "You manage to create [chosen_option[TOOL_PROCESSING_AMOUNT]] [initial(atom_to_create.name)] from [src]") - qdel(src) + //var/list/atom/created_atoms = list() //Customfood + 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()) + 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, "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].") + //SEND_SIGNAL(src, COMSIG_ATOM_PROCESSED, user, process_item, created_atoms) //Custom food + UsedforProcessing(user, process_item, chosen_option) return +/atom/proc/UsedforProcessing(mob/living/user, obj/item/used_item, list/chosen_option) + qdel(src) + return + /atom/proc/OnCreatedFromProcessing(mob/living/user, obj/item/I, list/chosen_option, atom/original_atom) return