[MIRROR] Cooking Update (#11058)

Co-authored-by: ShadowLarkens <shadowlarkens@gmail.com>
Co-authored-by: Cameron Lennox <killer65311@gmail.com>
This commit is contained in:
CHOMPStation2StaffMirrorBot
2025-06-12 16:19:19 -07:00
committed by GitHub
parent a631a763ba
commit c7b3df4d04
12 changed files with 1153 additions and 161 deletions

View File

@@ -434,9 +434,58 @@
cooking = FALSE
update_icon()
/obj/machinery/appliance/proc/predict_cooking(datum/cooking_item/CI)
var/datum/recipe/recipe = null
var/atom/C = null
if(CI.container)
C = CI.container
else
C = src
recipe = select_recipe(available_recipes, C)
var/list/results = list()
if(recipe)
var/obj/O = recipe.result
results += initial(O.name)
else if(CI.combine_target)
results += predict_combination(CI)
else
for(var/obj/item/I in CI.container)
results += predict_modification(I, CI)
return jointext(results, ", ")
/obj/machinery/appliance/proc/predict_combination(datum/cooking_item/CI)
var/obj/cook_path = output_options[CI.combine_target]
var/list/words = list()
var/list/cooktypes = list()
for(var/obj/item/reagent_containers/food/snacks/S in CI.container)
words |= splittext(S.name, " ")
cooktypes |= S.cooked
//Set the name.
words -= list("and", "the", "in", "is", "bar", "raw", "sticks", "boiled", "fried", "deep", "-o-", "warm", "two", "flavored")
//Remove common connecting words and unsuitable ones from the list. Unsuitable words include those describing
//the shape, cooked-ness/temperature or other state of an ingredient which doesn't apply to the finished product
var/name = initial(cook_path.name)
words.Remove(name)
shuffle(words)
var/num = 6 //Maximum number of words
while (num > 0)
num--
if (!words.len)
break
//Add prefixes from the ingredients in a random order until we run out or hit limit
name = "[pop(words)] [name]"
return name
/obj/machinery/appliance/proc/predict_modification(obj/item/input, datum/cooking_item/CI)
return "[cook_type] [input.name]"
/obj/machinery/appliance/proc/finish_cooking(var/datum/cooking_item/CI)
src.visible_message(span_infoplain(span_bold("\The [src]") + " pings!"))
if(cooked_sound)
playsound(get_turf(src), cooked_sound, 50, 1)

View File

@@ -14,13 +14,15 @@
mobdamagetype = BURN
can_burn_food = TRUE
var/tgui_id = "CookingAppliance"
/obj/machinery/appliance/cooker/attack_hand(mob/user)
tgui_interact(user)
/obj/machinery/appliance/cooker/tgui_interact(mob/user, datum/tgui/ui, datum/tgui/parent_ui)
ui = SStgui.try_update_ui(user, src, ui)
if(!ui)
ui = new(user, src, "CookingAppliance", name)
ui = new(user, src, tgui_id, name)
ui.open()
/obj/machinery/appliance/cooker/tgui_data(mob/user, datum/tgui/ui, datum/tgui_state/state)
@@ -45,6 +47,7 @@
our_contents[i] = list()
our_contents[i]["progress"] = 0
our_contents[i]["progressText"] = report_progress_tgui(CI)
our_contents[i]["prediction"] = predict_cooking(CI)
if(CI.max_cookwork)
our_contents[i]["progress"] = CI.cookwork / CI.max_cookwork
if(CI.container)

View File

@@ -31,6 +31,8 @@
stat = POWEROFF // Starts turned off
tgui_id = "CookingFryer"
var/datum/reagents/oil
var/optimal_oil = 9000 //90 litres of cooking oil

View File

@@ -26,6 +26,8 @@
max_contents = 3 // Arbitrary number, 3 grill 'racks'
container_type = /obj/item/reagent_containers/cooking_container/grill
tgui_id = "CookingGrill"
/obj/machinery/appliance/cooker/grill/Initialize(mapload)
. = ..()
grill_loop = new(list(src), FALSE)

View File

@@ -27,6 +27,8 @@
var/open = FALSE // Start closed just so people don't try to preheat with it open, lol.
tgui_id = "CookingOven"
output_options = list(
"Pizza" = /obj/item/reagent_containers/food/snacks/variable/pizza,
"Bread" = /obj/item/reagent_containers/food/snacks/variable/bread,