From bc6294baa9d1de6e3a884389abdd83405c7dcdb3 Mon Sep 17 00:00:00 2001
From: timothyteakettle <59849408+timothyteakettle@users.noreply.github.com>
Date: Thu, 9 Apr 2020 01:10:34 +0100
Subject: [PATCH] i too, like food quality.
---
code/datums/components/crafting/craft.dm | 12 ++++++++++++
code/modules/food_and_drinks/food.dm | 8 ++++++--
code/modules/food_and_drinks/food/snacks.dm | 4 ++++
.../food_and_drinks/kitchen_machinery/processor.dm | 4 +++-
4 files changed, 25 insertions(+), 3 deletions(-)
diff --git a/code/datums/components/crafting/craft.dm b/code/datums/components/crafting/craft.dm
index 9b19cd0106..64bde5da29 100644
--- a/code/datums/components/crafting/craft.dm
+++ b/code/datums/components/crafting/craft.dm
@@ -201,6 +201,18 @@
var/atom/movable/I = new R.result (get_turf(user.loc))
I.CheckParts(parts, R)
if(isitem(I))
+ if(istype(I, /obj/item/reagent_containers/food))
+ var/obj/item/reagent_containers/food/food_result = I
+ var/total_quality = 0
+ var/total_items = 0
+ for(var/obj/item/ingredient in parts)
+ var/obj/item/reagent_containers/food/food_ingredient = ingredient
+ total_items += 1
+ total_quality += food_ingredient.food_quality
+ if(total_items == 0)
+ food_result.adjust_food_quality(50)
+ else
+ food_result.adjust_food_quality(total_quality / total_items)
user.put_in_hands(I)
if(send_feedback)
SSblackbox.record_feedback("tally", "object_crafted", 1, I.type)
diff --git a/code/modules/food_and_drinks/food.dm b/code/modules/food_and_drinks/food.dm
index 2af24080cb..b1df946e34 100644
--- a/code/modules/food_and_drinks/food.dm
+++ b/code/modules/food_and_drinks/food.dm
@@ -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 = min(new_quality,100)
+
/obj/item/reagent_containers/food/proc/checkLiked(var/fraction, mob/M)
if(last_check_time + 50 < world.time)
if(ishuman(M))
@@ -32,11 +36,11 @@
to_chat(H,"What the hell was that thing?!")
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,"That didn't taste very good...")
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 >= 70)
to_chat(H,"I love this taste!")
H.adjust_disgust(-5 + -2.5 * fraction)
SEND_SIGNAL(H, COMSIG_ADD_MOOD_EVENT, "fav_food", /datum/mood_event/favorite_food)
diff --git a/code/modules/food_and_drinks/food/snacks.dm b/code/modules/food_and_drinks/food/snacks.dm
index 0b277e328b..177dba0b86 100644
--- a/code/modules/food_and_drinks/food/snacks.dm
+++ b/code/modules/food_and_drinks/food/snacks.dm
@@ -296,6 +296,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(istype(result, /obj/item/reagent_containers/food))
+ var/obj/item/reagent_containers/food/food_output = result
+ food_output.adjust_food_quality(food_quality)
if(istype(M))
initialize_cooked_food(result, M.efficiency)
else
diff --git a/code/modules/food_and_drinks/kitchen_machinery/processor.dm b/code/modules/food_and_drinks/kitchen_machinery/processor.dm
index 3fa188fb94..113378fbb4 100644
--- a/code/modules/food_and_drinks/kitchen_machinery/processor.dm
+++ b/code/modules/food_and_drinks/kitchen_machinery/processor.dm
@@ -28,8 +28,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) //output quality equals input quality for the food processor
if (ismob(what))
var/mob/themob = what
themob.gib(TRUE,TRUE,TRUE)