mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-25 06:00:16 +01:00
Food items should now pass down their intrinsic food materials during crafting (#91808)
## About The Pull Request  Food items pass down their intrinsic materials during crafting, which should prevent foods being crafted from meat being red and squishy. The implementation might be too broad or kinda suck but it worked for the problem items I tested it on (headcheese, crispy breaded headcheese, moussaka, ballpark tsukune). Also properly sets up `material_flags` to be a bitflag when viewing variables. ## Why It's Good For The Game Makes intrinsic food materials actually do what they're supposed to do (prevent food being crafted with meat from being weirdly too meaty). ## Changelog 🆑 code: Materials bitflags should now show the bitflag interface in VV. fix: Food items now pass down their intrinsic materials during crafting/processing/microwaving/etc. etc. /🆑 Co-authored-by: Hatterhat <Hatterhat@users.noreply.github.com>
This commit is contained in:
@@ -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,
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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))
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user