mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-24 13:38:41 +01:00
## About The Pull Request De-hardcodes food/crafting complexity (the stuff responsible for food buffs) from food items and gives the var to the edible component, so that objects crafted with pizza or meat sheets can have it as well. Renamed TRAIT_FOOD_CHEF_MADE to TRAIT_HANDMADE now that it's also given to the item when crafted through either the stack recipe UI or crafting UI. ## Why It's Good For The Game See title. In all seriousness though, it's more flexible code. ## Changelog 🆑 refactor: Refactored a couple things around food/recipe complexity (what food buffs depend on). Technically, you can now kiss that pizza toilet, which you crafted (right?), with the chef kiss skillchip enabled to add "love" to its reagents. /🆑
65 lines
2.8 KiB
Plaintext
65 lines
2.8 KiB
Plaintext
/datum/material/pizza
|
|
name = "pizza"
|
|
desc = "~Jamme, jamme, n'coppa, jamme ja! Jamme, jamme, n'coppa jamme ja, funi-culi funi-cala funi-culi funi-cala!! Jamme jamme ja funiculi funicula!~"
|
|
color = "#FF9F23"
|
|
mat_flags = MATERIAL_BASIC_RECIPES | MATERIAL_CLASS_ORGANIC
|
|
mat_properties = list(
|
|
MATERIAL_DENSITY = 4,
|
|
MATERIAL_HARDNESS = 1,
|
|
MATERIAL_FLEXIBILITY = 5,
|
|
MATERIAL_REFLECTIVITY = 2,
|
|
MATERIAL_ELECTRICAL = 8,
|
|
MATERIAL_THERMAL = 4,
|
|
MATERIAL_CHEMICAL = 2,
|
|
)
|
|
sheet_type = /obj/item/stack/sheet/pizza
|
|
item_sound_override = 'sound/effects/meatslap.ogg'
|
|
turf_sound_override = FOOTSTEP_MEAT
|
|
texture_layer_icon_state = "pizza"
|
|
mat_rust_resistance = RUST_RESISTANCE_REINFORCED
|
|
|
|
/datum/material/pizza/on_main_applied(atom/source, mat_amount, multiplier)
|
|
. = ..()
|
|
make_edible(source, mat_amount)
|
|
ADD_TRAIT(source, TRAIT_ROD_REMOVE_FISHING_DUD, REF(src)) //the fishing rod itself is the bait... sorta.
|
|
|
|
/datum/material/pizza/on_applied(atom/source, mat_amount, multiplier, from_slot)
|
|
. = ..()
|
|
if(IS_EDIBLE(source))
|
|
make_edible(source, mat_amount, multiplier)
|
|
|
|
/datum/material/pizza/on_edible_applied(atom/source, datum/component/edible/edible)
|
|
for(var/datum/reagent/consumable/nutriment/foodchem in source.reagents.reagent_list)
|
|
var/list/margherita_tastes = /obj/item/food/pizza/margherita::tastes
|
|
for(var/taste in margherita_tastes)
|
|
LAZYSET(foodchem.data, taste, 1)
|
|
source.AddComponentFrom(SOURCE_EDIBLE_MEAT_MAT, /datum/component/edible, foodtypes = GRAIN | DAIRY | VEGETABLES)
|
|
|
|
/datum/material/pizza/on_edible_removed(atom/source, datum/component/edible/edible)
|
|
for(var/datum/reagent/consumable/nutriment/foodchem in source.reagents.reagent_list)
|
|
var/list/margherita_tastes = /obj/item/food/pizza/margherita::tastes
|
|
for(var/taste in margherita_tastes)
|
|
LAZYREMOVE(foodchem.data, taste)
|
|
//the edible source is removed by on_removed()
|
|
|
|
/datum/material/pizza/proc/make_edible(atom/source, mat_amount)
|
|
if(source.material_flags & MATERIAL_NO_EDIBILITY)
|
|
return
|
|
var/nutriment_count = 3 * (mat_amount / SHEET_MATERIAL_AMOUNT)
|
|
var/oil_count = 2 * (mat_amount / SHEET_MATERIAL_AMOUNT)
|
|
source.AddComponentFrom(SOURCE_EDIBLE_PIZZA_MAT, \
|
|
/datum/component/edible, \
|
|
initial_reagents = list(/datum/reagent/consumable/nutriment = nutriment_count, /datum/reagent/consumable/nutriment/fat/oil = oil_count), \
|
|
foodtypes = GRAIN | DAIRY | VEGETABLES, \
|
|
eat_time = 3 SECONDS, \
|
|
tastes = /obj/item/food/pizza/margherita::tastes,\
|
|
handmade_complexity = /obj/item/food/pizzaslice/margherita::crafting_complexity)
|
|
|
|
/datum/material/pizza/on_removed(atom/source, mat_amount, multiplier, from_slot)
|
|
. = ..()
|
|
source.RemoveComponentSource(SOURCE_EDIBLE_PIZZA_MAT, /datum/component/edible)
|
|
|
|
/datum/material/pizza/on_main_removed(atom/source, mat_amount, multiplier)
|
|
. = ..()
|
|
REMOVE_TRAIT(source, TRAIT_ROD_REMOVE_FISHING_DUD, REF(src))
|