From ccebece42e01e8d822af3ab5fec62b9b3c8d0384 Mon Sep 17 00:00:00 2001
From: Timothy Teakettle <59849408+timothyteakettle@users.noreply.github.com>
Date: Wed, 8 Sep 2021 18:18:27 +0100
Subject: [PATCH] icecream
---
.../kitchen_machinery/icecream_vat.dm | 35 ++++++--
code/modules/reagents/chemistry/holder.dm | 84 ++++++++++---------
tgstation.dme | 2 +-
3 files changed, 73 insertions(+), 48 deletions(-)
diff --git a/code/modules/food_and_drinks/kitchen_machinery/icecream_vat.dm b/code/modules/food_and_drinks/kitchen_machinery/icecream_vat.dm
index 4fc55ba4c3..303d18b4a4 100644
--- a/code/modules/food_and_drinks/kitchen_machinery/icecream_vat.dm
+++ b/code/modules/food_and_drinks/kitchen_machinery/icecream_vat.dm
@@ -8,8 +8,6 @@
#define CONE_WAFFLE 8
#define CONE_CHOC 9
-
-
/obj/machinery/icecream_vat
name = "ice cream vat"
desc = "Ding-aling ding dong. Get your Nanotrasen-approved ice cream!"
@@ -35,6 +33,8 @@
/datum/reagent/consumable/ethanol/singulo = 6,
/datum/reagent/consumable/peachjuice = 6,
/datum/reagent/consumable/grapejuice = 6)
+ var/custom_taste
+ var/custom_color
/obj/machinery/icecream_vat/proc/get_ingredient_list(type)
switch(type)
@@ -99,7 +99,10 @@
dat += "Peach ice cream: Select Make x5 [product_types[ICECREAM_PEACH]] dollops left. (Ingredients: milk, ice, peach juice)
"
dat += "Grape ice cream: Select Make x5 [product_types[ICECREAM_GRAPE]] dollops left. (Ingredients: milk, ice, grape juice)
"
dat += "Blue ice cream: Select Make x5 [product_types[ICECREAM_BLUE]] dollops left. (Ingredients: milk, ice, singulo)
"
- dat += "Custom ice cream: Select Make x5 [product_types[ICECREAM_CUSTOM]] dollops left. (Ingredients: milk, ice, optional flavoring)
"
+ dat += "Custom ice cream: Select Make x5 [product_types[ICECREAM_CUSTOM]] dollops left. (Ingredients: milk, ice, optional flavoring)
"
+ dat += "Change custom taste: [custom_taste ? custom_taste : "Default"]"
+ dat += "
Change custom color: [custom_color ? custom_color : "Default"]"
+ dat += "
Reset custom ice cream taste and color to defaults"
dat += "
CONES
"
dat += "
Waffle cones: Dispense Make x5 [product_types[CONE_WAFFLE]] cones left. (Ingredients: flour, sugar)
"
dat += "
Chocolate cones: Dispense Make x5 [product_types[CONE_CHOC]] cones left. (Ingredients: flour, sugar, coco powder)
"
@@ -128,7 +131,7 @@
visible_message("[icon2html(src, viewers(src))] [user] scoops delicious [flavour_name] ice cream into [I].")
product_types[dispense_flavour] -= 1
if(beaker && beaker.reagents.total_volume)
- I.add_ice_cream(flavour_name, beaker.reagents)
+ I.add_ice_cream(flavour_name, beaker.reagents, custom_color, custom_taste)
else
I.add_ice_cream(flavour_name)
if(I.reagents.total_volume < 10)
@@ -213,14 +216,25 @@
if(href_list["refill"])
RefillFromBeaker()
- updateDialog()
-
if(href_list["refresh"])
updateDialog()
if(href_list["close"])
usr.unset_machine()
usr << browse(null,"window=icecreamvat")
+
+ if(href_list["custom_taste"])
+ custom_taste = stripped_input(usr, "Set a custom taste for the custom icecream. 50 characters max, leave blank to go back to the default option.", max_length = 50)
+
+ if(href_list["custom_color"])
+ custom_color = input(usr, "Choose a color for the custom icecream. Cancel to go back to the default option.") as color|null
+
+ if(href_list["reset_custom"])
+ custom_taste = null
+ custom_color = null
+
+ updateDialog() // i have no clue why we even have refresh when this is a thing but sure
+
return
/obj/item/reagent_containers/food/snacks/icecream
@@ -251,7 +265,7 @@
desc = "Delicious [cone_name] cone, but no ice cream."
-/obj/item/reagent_containers/food/snacks/icecream/proc/add_ice_cream(flavour_name, datum/reagents/R)
+/obj/item/reagent_containers/food/snacks/icecream/proc/add_ice_cream(flavour_name, datum/reagents/R, custom_color, custom_taste)
name = "[flavour_name] icecream"
switch (flavour_name) // adding the actual reagents advertised in the ingredient list
if ("vanilla")
@@ -286,8 +300,11 @@
if(R && R.total_volume >= 4) //consumable reagents have stronger taste so higher volume will allow non-food flavourings to break through better.
var/mutable_appearance/flavoring = mutable_appearance(icon,"icecream_custom")
var/datum/reagent/master = R.get_master_reagent()
- flavoring.color = master.color
- filling_color = master.color
+ flavoring.color = custom_color ? custom_color : master.color
+ filling_color = custom_color ? custom_color : master.color
+ if(custom_taste)
+ tastes = list("[custom_taste]" = 1)
+ reagents.force_alt_taste = TRUE
name = "[master.name] icecream"
desc = "A delicious [cone_type] cone filled with artisanal icecream. Made with real [master.name]. Ain't that something."
R.trans_to(src, 4)
diff --git a/code/modules/reagents/chemistry/holder.dm b/code/modules/reagents/chemistry/holder.dm
index afad323a27..922e14e580 100644
--- a/code/modules/reagents/chemistry/holder.dm
+++ b/code/modules/reagents/chemistry/holder.dm
@@ -62,6 +62,7 @@
var/fermiIsReacting = FALSE //that prevents multiple reactions from occurring (i.e. add_reagent calls to process_reactions(), this stops any extra reactions.)
var/fermiReactID //instance of the chem reaction used during a fermireaction, kept here so it's cache isn't lost between loops/procs.
var/value_multiplier = DEFAULT_REAGENTS_VALUE //used for cargo reagents selling.
+ var/force_alt_taste = FALSE
/datum/reagents/New(maximum=100, new_flags = NONE, new_value = DEFAULT_REAGENTS_VALUE)
maximum_volume = maximum
@@ -1120,47 +1121,54 @@
. = locate(type) in cached_reagents
/datum/reagents/proc/generate_taste_message(minimum_percent=15)
- // the lower the minimum percent, the more sensitive the message is.
var/list/out = list()
- var/list/tastes = list() //descriptor = strength
- if(minimum_percent <= 100)
- for(var/datum/reagent/R in reagent_list)
- if(!R.taste_mult)
- continue
-
- if(istype(R, /datum/reagent/consumable/nutriment))
- var/list/taste_data = R.data
- for(var/taste in taste_data)
- var/ratio = taste_data[taste]
- var/amount = ratio * R.taste_mult * R.volume
- if(taste in tastes)
- tastes[taste] += amount
- else
- tastes[taste] = amount
- else
- var/taste_desc = R.taste_description
- var/taste_amount = R.volume * R.taste_mult
- if(taste_desc in tastes)
- tastes[taste_desc] += taste_amount
- else
- tastes[taste_desc] = taste_amount
- //deal with percentages
- // TODO it would be great if we could sort these from strong to weak
- var/total_taste = counterlist_sum(tastes)
- if(total_taste > 0)
- for(var/taste_desc in tastes)
- var/percent = tastes[taste_desc]/total_taste * 100
- if(percent < minimum_percent)
+ if(!force_alt_taste)
+ // the lower the minimum percent, the more sensitive the message is.
+ var/list/tastes = list() //descriptor = strength
+ if(minimum_percent <= 100)
+ for(var/datum/reagent/R in reagent_list)
+ if(!R.taste_mult)
continue
- var/intensity_desc = "a hint of"
- if(ISINRANGE(percent, minimum_percent * 2, minimum_percent * 3)|| percent == 100)
- intensity_desc = ""
- else if(percent > minimum_percent * 3)
- intensity_desc = "the strong flavor of"
- if(intensity_desc != "")
- out += "[intensity_desc] [taste_desc]"
+
+ if(istype(R, /datum/reagent/consumable/nutriment))
+ var/list/taste_data = R.data
+ for(var/taste in taste_data)
+ var/ratio = taste_data[taste]
+ var/amount = ratio * R.taste_mult * R.volume
+ if(taste in tastes)
+ tastes[taste] += amount
+ else
+ tastes[taste] = amount
else
- out += "[taste_desc]"
+ var/taste_desc = R.taste_description
+ var/taste_amount = R.volume * R.taste_mult
+ if(taste_desc in tastes)
+ tastes[taste_desc] += taste_amount
+ else
+ tastes[taste_desc] = taste_amount
+ //deal with percentages
+ // TODO it would be great if we could sort these from strong to weak
+ var/total_taste = counterlist_sum(tastes)
+ if(total_taste > 0)
+ for(var/taste_desc in tastes)
+ var/percent = tastes[taste_desc]/total_taste * 100
+ if(percent < minimum_percent)
+ continue
+ var/intensity_desc = "a hint of"
+ if(ISINRANGE(percent, minimum_percent * 2, minimum_percent * 3)|| percent == 100)
+ intensity_desc = ""
+ else if(percent > minimum_percent * 3)
+ intensity_desc = "the strong flavor of"
+ if(intensity_desc != "")
+ out += "[intensity_desc] [taste_desc]"
+ else
+ out += "[taste_desc]"
+
+ else
+ // alternate taste is to force the taste of the atom if its a food item
+ if(my_atom && isfood(my_atom))
+ var/obj/item/reagent_containers/food/snacks/F = my_atom
+ out = F.tastes
return english_list(out, "something indescribable")
diff --git a/tgstation.dme b/tgstation.dme
index d6a59998a4..c3a1e7087c 100644
--- a/tgstation.dme
+++ b/tgstation.dme
@@ -178,8 +178,8 @@
#include "code\__HELPERS\icon_smoothing.dm"
#include "code\__HELPERS\icons.dm"
#include "code\__HELPERS\level_traits.dm"
-#include "code\__HELPERS\markov.dm"
#include "code\__HELPERS\lighting.dm"
+#include "code\__HELPERS\markov.dm"
#include "code\__HELPERS\matrices.dm"
#include "code\__HELPERS\mobs.dm"
#include "code\__HELPERS\mouse_control.dm"