diff --git a/code/_globalvars/bitfields.dm b/code/_globalvars/bitfields.dm index 9a808bb9ddb..2d8d098b09b 100644 --- a/code/_globalvars/bitfields.dm +++ b/code/_globalvars/bitfields.dm @@ -242,6 +242,15 @@ DEFINE_BITFIELD(machine_stat, list( "NOPOWER" = NOPOWER, )) +DEFINE_BITFIELD(material_flags, list( + "MATERIAL_EFFECTS" = MATERIAL_EFFECTS, + "MATERIAL_COLOR" = MATERIAL_COLOR, + "MATERIAL_ADD_PREFIX" = MATERIAL_ADD_PREFIX, + "MATERIAL_AFFECT_STATISTICS" = MATERIAL_AFFECT_STATISTICS, + "MATERIAL_GREYSCALE" = MATERIAL_GREYSCALE, + "MATERIAL_NO_SLOWDOWN" = MATERIAL_NO_SLOWDOWN, +)) + DEFINE_BITFIELD(mat_container_flags, list( "MATCONTAINER_EXAMINE" = MATCONTAINER_EXAMINE, "MATCONTAINER_NO_INSERT" = MATCONTAINER_NO_INSERT, diff --git a/code/datums/components/bakeable.dm b/code/datums/components/bakeable.dm index 93e96f65d58..5d54bbd8170 100644 --- a/code/datums/components/bakeable.dm +++ b/code/datums/components/bakeable.dm @@ -79,6 +79,10 @@ original_object.reagents.trans_to(baked_result, original_object.reagents.total_volume) if(added_reagents) // Add any new reagents that should be added baked_result.reagents.add_reagent_list(added_reagents) + if(istype(original_object, /obj/item/food) && istype(baked_result, /obj/item/food)) + var/obj/item/food/original_food = original_object + var/obj/item/food/baked_food = baked_result + LAZYADD(baked_food.intrinsic_food_materials, original_food.intrinsic_food_materials) if(who_baked_us) ADD_TRAIT(baked_result, TRAIT_FOOD_CHEF_MADE, who_baked_us) diff --git a/code/datums/components/grillable.dm b/code/datums/components/grillable.dm index afa2ea31a0e..dd23854fee9 100644 --- a/code/datums/components/grillable.dm +++ b/code/datums/components/grillable.dm @@ -139,6 +139,10 @@ else grilled_result = new cook_result(original_object.loc) + if(istype(original_object, /obj/item/food) && istype(grilled_result, /obj/item/food)) + var/obj/item/food/original_food = original_object + var/obj/item/food/grilled_food = grilled_result + LAZYADD(grilled_food.intrinsic_food_materials, original_food.intrinsic_food_materials) grilled_result.set_custom_materials(original_object.custom_materials) if(IsEdible(grilled_result) && positive_result) diff --git a/code/datums/elements/food/microwavable.dm b/code/datums/elements/food/microwavable.dm index 94267a876c4..86f0b2083b8 100644 --- a/code/datums/elements/food/microwavable.dm +++ b/code/datums/elements/food/microwavable.dm @@ -54,6 +54,11 @@ if(added_reagents) // Add any new reagents that should be added result.reagents.add_reagent_list(added_reagents) + if(istype(source, /obj/item/food) && istype(result, /obj/item/food)) + var/obj/item/food/original_food = source + var/obj/item/food/microwaved_food = result + LAZYADD(microwaved_food.intrinsic_food_materials, original_food.intrinsic_food_materials) + if(microwaver && microwaver.mind) ADD_TRAIT(result, TRAIT_FOOD_CHEF_MADE, REF(microwaver.mind)) diff --git a/code/game/atom/_atom.dm b/code/game/atom/_atom.dm index c368c87ffe3..63cbfe69317 100644 --- a/code/game/atom/_atom.dm +++ b/code/game/atom/_atom.dm @@ -658,6 +658,7 @@ 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.OnCreatedFromProcessing(user, process_item, chosen_option, src) if(custom_materials) created_atom.set_custom_materials(custom_materials, 1 / amount_to_create) created_atom.pixel_x = pixel_x @@ -665,7 +666,6 @@ 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) 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) diff --git a/code/game/objects/items/food/_food.dm b/code/game/objects/items/food/_food.dm index 4ef13601e67..1003119a2c4 100644 --- a/code/game/objects/items/food/_food.dm +++ b/code/game/objects/items/food/_food.dm @@ -19,7 +19,7 @@ * stops food *normally* containing meat from having redundant prefixes, an unfitting appearance and too much meatiness overall. * However, the same material effects will apply on a fruit or a vegetable. */ - var/list/intrisic_food_materials + var/list/intrinsic_food_materials ///List of reagents this food gets on creation during reaction or map spawn var/list/food_reagents ///Extra flags for things such as if the food is in a container or not @@ -72,9 +72,9 @@ for(var/mat_type in custom_materials) if(custom_materials[mat_type] > mat_amount) main_mat_type = mat_type - LAZYADD(intrisic_food_materials, main_mat_type) - if(intrisic_food_materials) - intrisic_food_materials = typecacheof(intrisic_food_materials) + LAZYADD(intrinsic_food_materials, main_mat_type) + if(intrinsic_food_materials) + intrinsic_food_materials = typecacheof(intrinsic_food_materials) . = ..() @@ -96,7 +96,7 @@ /obj/item/food/apply_material_effects(list/materials) if(!HAS_TRAIT(src, TRAIT_INGREDIENTS_HOLDER)) //ingredients holder handle prefixes and colors differently var/datum/material/main_material = materials[1] //The list is sorted by amount so the first of the list is the main mat - if(!is_type_in_typecache(main_material, intrisic_food_materials)) + if(!is_type_in_typecache(main_material, intrinsic_food_materials)) material_flags |= MATERIAL_EFFECTS|MATERIAL_AFFECT_STATISTICS|MATERIAL_ADD_PREFIX|MATERIAL_COLOR else //food items with the ingredients holders component are still affected by the materials stats and effects wise. @@ -126,6 +126,11 @@ /obj/item/food/on_craft_completion(list/components, datum/crafting_recipe/current_recipe, atom/crafter) . = ..() + for(var/obj/item/item in components) // parent proc assumes machinery or structures in components are used, so we should be fine to assume only items from here + if(!istype(item, /obj/item/food)) + continue + var/obj/item/food/food_component = item + LAZYADD(intrinsic_food_materials, food_component.intrinsic_food_materials) var/mob/living/user = crafter if(istype(user) && !isnull(user.mind)) ADD_TRAIT(src, TRAIT_FOOD_CHEF_MADE, REF(user.mind)) @@ -181,3 +186,11 @@ final_foodtypes &= ~current_recipe.removed_foodtypes ///Update the foodtypes AddComponentFrom(SOURCE_EDIBLE_INNATE, /datum/component/edible, foodtypes = final_foodtypes) + +/obj/item/food/OnCreatedFromProcessing(mob/living/user, obj/item/work_tool, list/chosen_option, atom/original_atom) + . = ..() + if(!istype(original_atom, /obj/item/food)) + return + var/obj/item/food/original_food = original_atom + if(original_food.intrinsic_food_materials) + LAZYADD(intrinsic_food_materials, original_food.intrinsic_food_materials) diff --git a/code/game/objects/items/food/pizza.dm b/code/game/objects/items/food/pizza.dm index a634ab83680..6fe4032e6db 100644 --- a/code/game/objects/items/food/pizza.dm +++ b/code/game/objects/items/food/pizza.dm @@ -302,7 +302,7 @@ slice_type = /obj/item/food/pizzaslice/donkpocket boxtag = "Bangin' Donk" crafting_complexity = FOOD_COMPLEXITY_3 - intrisic_food_materials = list(/datum/material/meat) //default donkpockets do not contain meat but homemade ones do. + intrinsic_food_materials = list(/datum/material/meat) //default donkpockets do not contain meat but homemade ones do. /obj/item/food/pizza/donkpocket/raw name = "raw donkpocket pizza" @@ -319,7 +319,7 @@ icon_state = "donkpocketpizzaslice" tastes = list("crust" = 1, "tomato" = 1, "cheese" = 1, "umami" = 1, "laziness" = 1) foodtypes = GRAIN|VEGETABLES|DAIRY|JUNKFOOD - intrisic_food_materials = list(/datum/material/meat) //default donkpockets do not contain meat but homemade ones do. + intrinsic_food_materials = list(/datum/material/meat) //default donkpockets do not contain meat but homemade ones do. /obj/item/food/pizza/dank name = "dank pizza"