Merge pull request #11798 from timothyteakettle/food-quality

adds a new feature to cooking: food quality
This commit is contained in:
Ghom
2020-04-20 23:48:35 +02:00
committed by GitHub
14 changed files with 94 additions and 24 deletions
+8 -4
View File
@@ -16,6 +16,7 @@
resistance_flags = FLAMMABLE
var/foodtype = NONE
var/last_check_time
var/food_quality = 50
/obj/item/reagent_containers/food/Initialize(mapload)
. = ..()
@@ -23,6 +24,9 @@
pixel_x = rand(-5, 5)
pixel_y = rand(-5, 5)
/obj/item/reagent_containers/food/proc/adjust_food_quality(new_quality)
food_quality = CLAMP(new_quality,0,100)
/obj/item/reagent_containers/food/proc/checkLiked(var/fraction, mob/M)
if(last_check_time + 50 < world.time)
if(ishuman(M))
@@ -32,13 +36,13 @@
to_chat(H,"<span class='warning'>What the hell was that thing?!</span>")
H.adjust_disgust(25 + 30 * fraction)
SEND_SIGNAL(H, COMSIG_ADD_MOOD_EVENT, "toxic_food", /datum/mood_event/disgusting_food)
else if(foodtype & H.dna.species.disliked_food)
else if((foodtype & H.dna.species.disliked_food) || food_quality <= 30)
to_chat(H,"<span class='notice'>That didn't taste very good...</span>")
H.adjust_disgust(11 + 15 * fraction)
SEND_SIGNAL(H, COMSIG_ADD_MOOD_EVENT, "gross_food", /datum/mood_event/gross_food)
else if(foodtype & H.dna.species.liked_food)
else if(((foodtype & H.dna.species.liked_food) && food_quality >= 50) || food_quality >= 70) //you like food of high quality, and food of regular quality you have a preference for
to_chat(H,"<span class='notice'>I love this taste!</span>")
H.adjust_disgust(-5 + -2.5 * fraction)
H.adjust_disgust(-5 + (-2.5 * food_quality/50) + -2.5 * fraction)
SEND_SIGNAL(H, COMSIG_ADD_MOOD_EVENT, "fav_food", /datum/mood_event/favorite_food)
else
if(foodtype & H.dna.species.toxic_food)
@@ -48,4 +52,4 @@
SEND_SIGNAL(H, COMSIG_ADD_MOOD_EVENT, "breakfast", /datum/mood_event/breakfast)
last_check_time = world.time
#undef STOP_SERVING_BREAKFAST
#undef STOP_SERVING_BREAKFAST
@@ -20,6 +20,7 @@
var/list/ingredients = list()
var/ingredients_placement = INGREDIENTS_FILL
var/customname = "custom"
var/total_quality = 0 //quality of all ingredients added together
/obj/item/reagent_containers/food/snacks/customizable/examine(mob/user)
. = ..()
@@ -56,6 +57,9 @@
S.reagents.trans_to(src,min(S.reagents.total_volume, 15)) //limit of 15, we don't want our custom food to be completely filled by just one ingredient with large reagent volume.
foodtype |= S.foodtype
update_snack_overlays(S)
//quality of customised food is average of the ingredient's qualities
total_quality += S.food_quality
food_quality = total_quality / length(ingredients)
to_chat(user, "<span class='notice'>You add the [I.name] to the [name].</span>")
update_name(S)
else
@@ -153,6 +153,12 @@ All foods are distributed among various categories. Use common sense.
/obj/item/reagent_containers/food/snacks/examine(mob/user)
. = ..()
if(food_quality >= 70)
. += "It is of a high quality."
else
if(food_quality <= 30)
. += "It is of a low quality."
if(bitecount == 0)
return
else if(bitecount == 1)
@@ -296,6 +302,10 @@ All foods are distributed among various categories. Use common sense.
var/obj/item/result
if(cooked_type)
result = new cooked_type(T)
//if the result is food, set its food quality to the original food item's quality
if(isfood(result))
var/obj/item/reagent_containers/food/food_output = result
food_output.adjust_food_quality(food_quality + M.quality_increase)
if(istype(M))
initialize_cooked_food(result, M.efficiency)
else
@@ -197,6 +197,7 @@
icon = 'icons/obj/food/food.dmi'
icon_state = ""
bitesize = 2
var/fried_garbage = FALSE //did you really fry a fire extinguisher?
GLOBAL_VAR_INIT(frying_hardmode, TRUE)
GLOBAL_VAR_INIT(frying_bad_chem_add_volume, TRUE)
@@ -227,21 +228,13 @@ GLOBAL_LIST_INIT(frying_bad_chems, list(
item_flags = fried.item_flags
obj_flags = fried.obj_flags
if(istype(fried, /obj/item/reagent_containers/food/snacks))
if(isfood(fried))
fried.reagents.trans_to(src, fried.reagents.total_volume)
qdel(fried)
else
fried.forceMove(src)
trash = fried
if(!istype(fried, /obj/item/reagent_containers/food) && GLOB.frying_hardmode && GLOB.frying_bad_chems.len)
var/R = rand(1, GLOB.frying_bad_chems.len)
var/bad_chem = GLOB.frying_bad_chems[R]
var/bad_chem_amount = GLOB.frying_bad_chems[bad_chem]
if(GLOB.frying_bad_chem_add_volume)
reagents.maximum_volume += bad_chem_amount + 2 //Added room for condensed cooking oil
reagents.add_reagent(bad_chem, bad_chem_amount)
//All fried inedible items also get condensed cooking oil added, which induces minor vomiting and heart damage
reagents.add_reagent(/datum/reagent/toxin/condensed_cooking_oil, 2)
fried_garbage = TRUE
/obj/item/reagent_containers/food/snacks/deepfryholder/Destroy()
if(trash)
@@ -249,6 +242,13 @@ GLOBAL_LIST_INIT(frying_bad_chems, list(
. = ..()
/obj/item/reagent_containers/food/snacks/deepfryholder/On_Consume(mob/living/eater)
if(fried_garbage && GLOB.frying_hardmode && GLOB.frying_bad_chems.len)
var/R = rand(1, GLOB.frying_bad_chems.len)
var/bad_chem = GLOB.frying_bad_chems[R]
var/bad_chem_amount = GLOB.frying_bad_chems[bad_chem]
eater.reagents.add_reagent(bad_chem, bad_chem_amount)
//All fried inedible items also get condensed cooking oil added, which induces minor vomiting and heart damage
eater.reagents.add_reagent(/datum/reagent/toxin/condensed_cooking_oil, 2)
if(trash)
QDEL_NULL(trash)
..()
@@ -259,18 +259,22 @@ GLOBAL_LIST_INIT(frying_bad_chems, list(
add_atom_colour(rgb(166,103,54), FIXED_COLOUR_PRIORITY)
name = "lightly-fried [name]"
desc = "[desc] It's been lightly fried in a deep fryer."
adjust_food_quality(food_quality - 5)
if(16 to 49)
add_atom_colour(rgb(103,63,24), FIXED_COLOUR_PRIORITY)
name = "fried [name]"
desc = "[desc] It's been fried, increasing its tastiness value by [rand(1, 75)]%."
adjust_food_quality(food_quality - 10)
if(50 to 59)
add_atom_colour(rgb(63,23,4), FIXED_COLOUR_PRIORITY)
name = "deep-fried [name]"
desc = "[desc] Deep-fried to perfection."
adjust_food_quality(food_quality) //we shouldn't punish perfection in the fried arts
if(60 to INFINITY)
add_atom_colour(rgb(33,19,9), FIXED_COLOUR_PRIORITY)
name = "the physical manifestation of the very concept of fried foods"
desc = "A heavily-fried...something. Who can tell anymore?"
adjust_food_quality(0) //good job, you're truly the best cook.
filling_color = color
foodtype |= FRIED
@@ -104,6 +104,12 @@ God bless America.
else if(!frying && user.transferItemToLoc(I, src))
to_chat(user, "<span class='notice'>You put [I] into [src].</span>")
frying = new/obj/item/reagent_containers/food/snacks/deepfryholder(src, I)
//setup food quality for item depending on if it's edible or not
if(isfood(I))
var/obj/item/reagent_containers/food/original_food = I
frying.adjust_food_quality(original_food.food_quality) //food quality remains unchanged until degree of frying is calculated
else
frying.adjust_food_quality(10) //inedible fried item has low quality
icon_state = "fryer_on"
fry_loop.start()
@@ -14,6 +14,7 @@
var/gibtime = 40 // Time from starting until meat appears
var/meat_produced = 0
var/ignore_clothing = FALSE
var/meat_quality = 35 //food_quality of meat produced
/obj/machinery/gibber/Initialize()
@@ -23,8 +24,10 @@
/obj/machinery/gibber/RefreshParts()
gibtime = 40
meat_produced = 0
meat_quality = 35 // unupgraded this means quality is 50, and max upgraded it is 95
for(var/obj/item/stock_parts/matter_bin/B in component_parts)
meat_produced += B.rating
meat_quality += B.rating * 15
for(var/obj/item/stock_parts/manipulator/M in component_parts)
gibtime -= 5 * M.rating
if(M.rating >= 2)
@@ -181,6 +184,7 @@
for (var/i=1 to meat_produced)
var/obj/item/reagent_containers/food/snacks/meat/slab/newmeat = new typeofmeat
newmeat.adjust_food_quality(meat_quality)
newmeat.name = "[sourcename] [newmeat.name]"
if(istype(newmeat))
newmeat.subjectname = sourcename
@@ -19,6 +19,7 @@
var/broken = 0 // 0, 1 or 2 // How broken is it???
var/max_n_of_items = 10
var/efficiency = 0
var/quality_increase = 5 // how much do we increase the quality of microwaved items
var/productivity = 0
var/datum/looping_sound/microwave/soundloop
var/list/ingredients = list() // may only contain /atom/movables
@@ -51,7 +52,10 @@
efficiency += M.rating * 0.4
productivity += M.rating
for(var/obj/item/stock_parts/matter_bin/M in component_parts)
max_n_of_items += M.rating * 5
max_n_of_items = 10 * M.rating
quality_increase = M.rating * 5
break
/obj/machinery/microwave/examine(mob/user)
. = ..()
@@ -14,10 +14,13 @@
var/processing = FALSE
var/rating_speed = 1
var/rating_amount = 1
var/quality_increase = 5
/obj/machinery/processor/RefreshParts()
quality_increase = 0
for(var/obj/item/stock_parts/matter_bin/B in component_parts)
rating_amount = B.rating
quality_increase += B.rating * 5
for(var/obj/item/stock_parts/manipulator/M in component_parts)
rating_speed = M.rating
@@ -28,8 +31,10 @@
/obj/machinery/processor/proc/process_food(datum/food_processor_process/recipe, atom/movable/what)
if (recipe.output && loc && !QDELETED(src))
var/obj/item/reagent_containers/food/food_input = what
for(var/i = 0, i < rating_amount, i++)
new recipe.output(drop_location())
var/obj/item/reagent_containers/food/food_output = new recipe.output(drop_location())
food_output.adjust_food_quality(food_input.food_quality + quality_increase)
if (ismob(what))
var/mob/themob = what
themob.gib(TRUE,TRUE,TRUE)
@@ -8,7 +8,6 @@
parts |= reqs
//////////////////////////////////////////FOOD MIXTURES////////////////////////////////////
/datum/chemical_reaction/tofu
name = "Tofu"
id = "tofu"
@@ -35,8 +35,6 @@
SEND_SIGNAL(M, COMSIG_ADD_MOOD_EVENT, "quality_drink", /datum/mood_event/quality_fantastic)
if (RACE_DRINK)
SEND_SIGNAL(M, COMSIG_ADD_MOOD_EVENT, "quality_drink", /datum/mood_event/race_drink)
if (FOOD_AMAZING)
SEND_SIGNAL(M, COMSIG_ADD_MOOD_EVENT, "quality_food", /datum/mood_event/amazingtaste)
return ..()
/datum/reagent/consumable/nutriment
@@ -819,11 +817,20 @@
nutriment_factor = 2 * REAGENTS_METABOLISM
color = "#792300"
taste_description = "indescribable"
quality = FOOD_AMAZING
taste_mult = 100
can_synth = FALSE
pH = 6.1
/datum/reagent/consumable/secretsauce/reaction_obj(obj/O, reac_volume)
//splashing any amount above or equal to 1u of secret sauce onto a piece of food turns its quality to 100
if(reac_volume >= 1 && isfood(O))
var/obj/item/reagent_containers/food/splashed_food = O
splashed_food.adjust_food_quality(100)
// if it's a customisable food, we need to edit its total quality too, to prevent its quality resetting from adding more ingredients!
if(istype(O, /obj/item/reagent_containers/food/snacks/customizable))
var/obj/item/reagent_containers/food/snacks/customizable/splashed_custom_food = O
splashed_custom_food.total_quality += 10000
/datum/reagent/consumable/char
name = "Char"
description = "Essence of the grill. Has strange properties when overdosed."
@@ -506,7 +506,7 @@
taste_description = "awful cooking"
/datum/reagent/toxin/condensed_cooking_oil/on_mob_life(mob/living/carbon/M)
if(prob(15))
if(prob(5))
M.vomit()
else
if(prob(40))