From d2ea4be6c828d4f06a41a35649c92c488d4c653e Mon Sep 17 00:00:00 2001 From: cacogen <25089914+cacogen@users.noreply.github.com> Date: Thu, 27 May 2021 23:39:17 +1200 Subject: [PATCH] Fixes human burgers not naming after the meat donor (#59286) - Adds custom materials to result of grilling - Adds custom materials to result of atom processing - Adds source name and job to mob_meat material if available - Makes processed atoms have same pixel offsets as their source but randomise with each subsequent one --- code/datums/components/grillable.dm | 3 +++ code/datums/materials/meat.dm | 12 ++++++++++++ code/game/atoms.dm | 9 +++++++-- code/game/objects/items/food/burgers.dm | 19 +++++++------------ 4 files changed, 29 insertions(+), 14 deletions(-) diff --git a/code/datums/components/grillable.dm b/code/datums/components/grillable.dm index 6ef1bff7186..2e2be16be41 100644 --- a/code/datums/components/grillable.dm +++ b/code/datums/components/grillable.dm @@ -70,6 +70,9 @@ var/atom/original_object = parent var/atom/grilled_result = new cook_result(original_object.loc) + if(original_object.custom_materials) + grilled_result.set_custom_materials(original_object.custom_materials, 1) + grilled_result.pixel_x = original_object.pixel_x grilled_result.pixel_y = original_object.pixel_y diff --git a/code/datums/materials/meat.dm b/code/datums/materials/meat.dm index 208d8284340..9d584fc6d63 100644 --- a/code/datums/materials/meat.dm +++ b/code/datums/materials/meat.dm @@ -34,12 +34,24 @@ /datum/material/meat/mob_meat init_flags = MATERIAL_INIT_BESPOKE + var/subjectname = "" + var/subjectjob = null /datum/material/meat/mob_meat/Initialize(_id, mob/living/source) if(!istype(source)) return FALSE name = "[source?.name ? "[source.name]'s" : "mystery"] [initial(name)]" + + if(source.real_name) + subjectname = source.real_name + else if(source.name) + subjectname = source.name + + if(ishuman(source)) + var/mob/living/carbon/human/human_source = source + subjectjob = human_source.job + return ..() /datum/material/meat/species_meat diff --git a/code/game/atoms.dm b/code/game/atoms.dm index 9f01284a47e..850ce26d059 100644 --- a/code/game/atoms.dm +++ b/code/game/atoms.dm @@ -1431,8 +1431,13 @@ var/list/atom/created_atoms = list() for(var/i = 1 to chosen_option[TOOL_PROCESSING_AMOUNT]) var/atom/created_atom = new atom_to_create(drop_location()) - created_atom.pixel_x = rand(-8, 8) - created_atom.pixel_y = rand(-8, 8) + if(custom_materials) + created_atom.set_custom_materials(custom_materials, 1 / chosen_option[TOOL_PROCESSING_AMOUNT]) + 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) SEND_SIGNAL(created_atom, COMSIG_ATOM_CREATEDBY_PROCESSING, src, chosen_option) created_atom.OnCreatedFromProcessing(user, I, chosen_option, src) to_chat(user, "You manage to create [chosen_option[TOOL_PROCESSING_AMOUNT]] [initial(atom_to_create.name)]\s from [src].") diff --git a/code/game/objects/items/food/burgers.dm b/code/game/objects/items/food/burgers.dm index 509ad93683e..39786efd92a 100644 --- a/code/game/objects/items/food/burgers.dm +++ b/code/game/objects/items/food/burgers.dm @@ -34,22 +34,17 @@ food_reagents = list(/datum/reagent/consumable/nutriment = 2, /datum/reagent/consumable/nutriment/protein = 6, /datum/reagent/consumable/nutriment/vitamin = 5) tastes = list("bun" = 2, "long pig" = 4) foodtypes = MEAT | GRAIN | GROSS - var/subjectname = "" - var/subjectjob = null venue_value = FOOD_PRICE_CHEAP /obj/item/food/burger/human/CheckParts(list/parts_list) ..() - var/obj/item/food/meat/M = locate(/obj/item/food/meat/steak/plain/human) in contents - if(M) - subjectname = M.subjectname - subjectjob = M.subjectjob - if(subjectname) - name = "[subjectname] burger" - else if(subjectjob) - name = "[subjectjob] burger" - qdel(M) - + var/obj/item/food/patty/human/human_patty = locate(/obj/item/food/patty/human) in contents + if(LAZYLEN(human_patty.custom_materials)) + for(var/datum/material/meat/mob_meat/mob_meat_material in human_patty.custom_materials) + if(mob_meat_material.subjectname) + name = "[mob_meat_material.subjectname] burger" + else if(mob_meat_material.subjectjob) + name = "[mob_meat_material.subjectjob] burger" /obj/item/food/burger/corgi name = "corgi burger"