mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-01-18 21:42:23 +00:00
* Kitchen rework part 1: machines and recipes. * update oldstation * update updatepaths script number * fix blank icon test * remove old deep fryer completely * fix duped recipes and recipe datum names * add chef PDA cart to chefdrobe * nerf grill wood consumption rate * multiply food for cooking machine rating * fix runtime * add cookware to syndie base and oldstation * remove dupe burger recipe, update syndie/oldstation setups * nerf potency quality award * buff burn/ignite times, remove pointless on_fire flag * more grill woodburn nerf * meh * try and unfuck timing issues * more fixes and icon updates * more fixes * more review changes * fix linter * disable pcwj debug * fix grill and deep fryer overlays * fix timers with no containers * attempt to fix reagent adding issues * more cleanups * allow rped usage * grammar, null checks, reagent display * PDA updates, map updates * fix mats values * new panel sprites * recipe fixes, add prep bowl * revert unused icon file changes * move this to mesh with smith TM * remove food quality for now * New sprites, autochef. * fix examine text * reduce oven cook times * lots of fixes * fix autochef recipes that start with reagents * prevent shenanigans * megapatch 1 * block ingredients behind oven door * PDA app improvements * remove unused proc * fixes for cookbook, descontructions, completed steps * allow empty containers with a tracker to be claimed * allow reclaiming * autochef reliability fixes * autochef reliability fixes * fix quality product count * update updatepaths script * better stack handling * more fixes for stacks and reagents * timers no longer turn off burners automatically * autochef turn offs and make sure we can see output storage * add microwave recipe for roundremoving player brains * Apply suggestions from code review Co-authored-by: Burzah <116982774+Burzah@users.noreply.github.com> Signed-off-by: warriorstar-orion <orion@snowfrost.garden> * burza review 1 * Apply suggestions from code review Co-authored-by: Burzah <116982774+Burzah@users.noreply.github.com> Signed-off-by: warriorstar-orion <orion@snowfrost.garden> * fix berry muffin name while i'm here * grill -> microwave in new tests * grill -> microwave in new tests, but actually for realsies * i definitely know what i'm doing * redundant attack chain setting * add examine text about clearing buffer * remove unused vars and start improving docs --------- Signed-off-by: warriorstar-orion <orion@snowfrost.garden> Co-authored-by: Burzah <116982774+Burzah@users.noreply.github.com>
145 lines
4.1 KiB
Plaintext
145 lines
4.1 KiB
Plaintext
RESTRICT_TYPE(/datum/cooking_surface)
|
|
|
|
/**
|
|
* Cooking surfaces are representations of the available "slots" on a cooking machine
|
|
* that can hold a cooking container.
|
|
*/
|
|
/datum/cooking_surface
|
|
var/surface_name = "surface"
|
|
var/cooker_id
|
|
var/obj/machinery/cooking/parent
|
|
var/temperature = J_LO
|
|
var/timer = 0
|
|
var/cooktime
|
|
var/obj/item/reagent_containers/cooking/container
|
|
var/on = FALSE
|
|
var/prob_quality_decrease = 0
|
|
var/allow_temp_change = TRUE
|
|
VAR_PRIVATE/burn_callback
|
|
VAR_PRIVATE/fire_callback
|
|
VAR_PRIVATE/alarm_callback
|
|
|
|
/datum/cooking_surface/New(obj/machinery/cooking/parent_)
|
|
. = ..()
|
|
parent = parent_
|
|
|
|
/datum/cooking_surface/proc/container_examine(datum/source, mob/user, list/examine_list)
|
|
SIGNAL_HANDLER // COMSIG_PARENT_EXAMINE
|
|
examine_list += "<span class='notice'>[examine_text()]</span>"
|
|
if(timer)
|
|
examine_list += "<span class='notice'>Its alarm is configured for [timer / (1 SECONDS)] seconds.</span>"
|
|
|
|
/datum/cooking_surface/proc/examine_text()
|
|
return "This [surface_name] will cook at [temperature] temperature."
|
|
|
|
/datum/cooking_surface/proc/handle_cooking(mob/user)
|
|
if(container)
|
|
if(isnull(container.get_cooker_time(cooker_id, temperature)))
|
|
reset_cooktime()
|
|
|
|
#ifdef PCWJ_DEBUG
|
|
log_debug("timer=[timer] cooktime=[cooktime] stopwatch=[stop_watch(cooktime)]")
|
|
#endif
|
|
|
|
container.set_cooker_data(src, stop_watch(cooktime) SECONDS)
|
|
var/process_result = container.process_item(user, parent)
|
|
if(process_result == PCWJ_COMPLETE)
|
|
SEND_SIGNAL(container, COMSIG_COOK_MACHINE_STEP_COMPLETE, src)
|
|
|
|
/datum/cooking_surface/proc/handle_switch(mob/user)
|
|
playsound(parent, 'sound/items/lighter.ogg', 100, TRUE, 0)
|
|
if(on)
|
|
turn_off()
|
|
else
|
|
turn_on()
|
|
|
|
parent.update_appearance(UPDATE_ICON)
|
|
return on
|
|
|
|
/datum/cooking_surface/proc/set_burn_ignite_callbacks()
|
|
if(container)
|
|
var/burn_time = PCWJ_BURN_TIME_LOW
|
|
var/fire_time = PCWJ_IGNITE_TIME_LOW
|
|
switch(temperature)
|
|
if(J_MED)
|
|
burn_time = PCWJ_BURN_TIME_MEDIUM
|
|
fire_time = PCWJ_IGNITE_TIME_MEDIUM
|
|
if(J_HI)
|
|
burn_time = PCWJ_BURN_TIME_HIGH
|
|
fire_time = PCWJ_IGNITE_TIME_HIGH
|
|
|
|
burn_callback = addtimer(CALLBACK(src, PROC_REF(handle_burn)), burn_time, TIMER_STOPPABLE)
|
|
fire_callback = addtimer(CALLBACK(src, PROC_REF(handle_fire)), fire_time, TIMER_STOPPABLE)
|
|
|
|
/datum/cooking_surface/proc/turn_on(mob/user)
|
|
on = TRUE
|
|
set_burn_ignite_callbacks()
|
|
restart_timer()
|
|
reset_cooktime()
|
|
|
|
/datum/cooking_surface/proc/restart_timer()
|
|
if(alarm_callback)
|
|
deltimer(alarm_callback)
|
|
if(timer)
|
|
alarm_callback = addtimer(CALLBACK(src, PROC_REF(handle_alarm)), timer, TIMER_STOPPABLE)
|
|
|
|
/datum/cooking_surface/proc/turn_off(mob/user)
|
|
playsound(parent, 'sound/items/lighter.ogg', 100, TRUE, 0)
|
|
on = FALSE
|
|
unset_callbacks()
|
|
deltimer(alarm_callback)
|
|
cooktime = -1
|
|
parent.update_appearance(UPDATE_ICON)
|
|
|
|
/datum/cooking_surface/proc/handle_burn()
|
|
if(istype(container))
|
|
container.handle_burning()
|
|
|
|
/datum/cooking_surface/proc/handle_fire()
|
|
if(istype(container) && container.handle_ignition())
|
|
parent.ignite()
|
|
|
|
/datum/cooking_surface/proc/handle_alarm()
|
|
parent.atom_emote("dings.")
|
|
playsound(parent.loc, 'sound/machines/bell.ogg', 50, FALSE)
|
|
|
|
/datum/cooking_surface/proc/unset_callbacks()
|
|
deltimer(burn_callback)
|
|
deltimer(fire_callback)
|
|
|
|
/datum/cooking_surface/proc/handle_timer(mob/user)
|
|
var/old_time = timer ? timer / (1 SECONDS) : 1
|
|
var/timer_input = tgui_input_number(
|
|
user,
|
|
message = "Enter an alarm for the burner in seconds. Enter zero to disable alarm.",
|
|
title = "Set Alarm",
|
|
default = old_time,
|
|
max_value = 60)
|
|
if(!isnull(timer_input))
|
|
timer = timer_input SECONDS
|
|
if(on)
|
|
restart_timer()
|
|
|
|
parent.update_appearance(UPDATE_ICON)
|
|
|
|
/datum/cooking_surface/proc/handle_temperature(mob/user)
|
|
var/old_temp = temperature
|
|
var/choice = tgui_input_list(
|
|
user,
|
|
"Select a heat setting for the burner.\nCurrent temp: [old_temp]",
|
|
"Select Temperature",
|
|
items = list(J_HI, J_MED, J_LO, "Cancel"),
|
|
default = old_temp
|
|
)
|
|
if(choice && choice != "Cancel" && choice != old_temp)
|
|
temperature = choice
|
|
if(on)
|
|
reset_cooktime()
|
|
handle_cooking(user)
|
|
|
|
/datum/cooking_surface/proc/reset_cooktime()
|
|
cooktime = start_watch()
|
|
#ifdef PCWJ_DEBUG
|
|
log_debug("reset_cooktime")
|
|
#endif
|