mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-07-19 11:05:03 +01:00
f9ade844c9
* 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>
91 lines
3.2 KiB
Plaintext
91 lines
3.2 KiB
Plaintext
/datum/autochef_task/make_item
|
|
var/obj/item/target_type
|
|
|
|
/datum/autochef_task/make_item/New(obj/machinery/autochef_, obj/item/target_type_)
|
|
autochef = autochef_
|
|
target_type = target_type_
|
|
|
|
/datum/autochef_task/make_item/resume()
|
|
var/list/possible_recipes = autochef.find_recipes(target_type)
|
|
if(!length(possible_recipes))
|
|
autochef.atom_say("No recipes found for [target_type::name].")
|
|
current_state = AUTOCHEF_ACT_FAILED
|
|
return
|
|
|
|
var/list/capable_recipes = list()
|
|
for(var/datum/cooking/recipe/recipe in possible_recipes)
|
|
var/can_use_recipe = handle_recipe(recipe)
|
|
if(can_use_recipe)
|
|
capable_recipes.Add(recipe)
|
|
|
|
if(length(capable_recipes))
|
|
autochef.task_queue.Insert(autochef.task_queue.Find(src), new/datum/autochef_task/follow_recipe(autochef, capable_recipes[1]))
|
|
current_state = AUTOCHEF_ACT_COMPLETE
|
|
return
|
|
|
|
autochef.atom_say("Cannot make [target_type::name].")
|
|
current_state = AUTOCHEF_ACT_FAILED
|
|
|
|
/datum/autochef_task/make_item/proc/handle_recipe(datum/cooking/recipe/recipe)
|
|
var/container_count = 0
|
|
for(var/obj/item/reagent_containers/container in autochef.linked_cooking_containers)
|
|
if(istype(container, recipe.container_type))
|
|
container_count++
|
|
|
|
if(!container_count)
|
|
autochef.atom_say("No linked [recipe.container_type::name].")
|
|
return FALSE
|
|
|
|
for(var/datum/cooking/recipe_step/step in recipe.steps)
|
|
if(step.optional)
|
|
continue
|
|
var/result = handle_step(step)
|
|
if(!result)
|
|
return FALSE
|
|
|
|
return TRUE
|
|
|
|
/datum/autochef_task/make_item/proc/handle_step(datum/cooking/recipe_step/step)
|
|
var/prep_result = step.attempt_autochef_prepare(autochef)
|
|
switch(prep_result)
|
|
if(AUTOCHEF_ACT_VALID)
|
|
return TRUE
|
|
if(AUTOCHEF_ACT_MISSING_INGREDIENT)
|
|
if(autochef.upgrade_level > 2)
|
|
handle_missing_item(step)
|
|
else
|
|
return FALSE
|
|
if(AUTOCHEF_ACT_MISSING_REAGENT)
|
|
return FALSE
|
|
if(AUTOCHEF_ACT_FAILED)
|
|
autochef.atom_say("Unknown error.")
|
|
return FALSE
|
|
if(AUTOCHEF_ACT_NO_AVAILABLE_STORAGE)
|
|
autochef.atom_say("No linked storage.")
|
|
return FALSE
|
|
if(AUTOCHEF_ACT_NO_AVAILABLE_MACHINES)
|
|
var/datum/cooking/recipe_step/use_machine/use_machine_step = step
|
|
autochef.atom_say("No available [use_machine_step.machine_type::name].")
|
|
return FALSE
|
|
|
|
return TRUE
|
|
|
|
/datum/autochef_task/make_item/proc/handle_missing_item(datum/cooking/recipe_step/step)
|
|
var/datum/cooking/recipe_step/add_item/add_item_step = step
|
|
if(istype(add_item_step))
|
|
for(var/container_type in GLOB.pcwj_recipe_dictionary)
|
|
for(var/datum/cooking/recipe/next_recipe in GLOB.pcwj_recipe_dictionary[container_type])
|
|
if(next_recipe.product_type == add_item_step.item_type)
|
|
autochef.task_queue.Insert(autochef.task_queue.Find(src), new/datum/autochef_task/make_item(autochef, add_item_step.item_type))
|
|
autochef.atom_say("Making [add_item_step.item_type::name] first.")
|
|
return AUTOCHEF_ACT_ADDED_TASK
|
|
autochef.atom_say("Cannot find [add_item_step.item_type::name].")
|
|
return AUTOCHEF_ACT_MISSING_INGREDIENT
|
|
var/datum/cooking/recipe_step/add_produce/add_produce_step = step
|
|
if(istype(add_produce_step))
|
|
autochef.atom_say("Cannot find [add_produce_step.produce_type::name].")
|
|
return AUTOCHEF_ACT_MISSING_INGREDIENT
|
|
|
|
autochef.atom_say("Unknown failure. Please contact customer support.")
|
|
return AUTOCHEF_ACT_FAILED
|