Kitchen tweaks (#2570)

changes:

Reduced power usage of oven and fryer.
Reduced warm up time of oven and fryer.
Oven now heats up to exactly 200C instead of to 198.85C.
Fixed some issues with cooking appliances' sanity checks.
Recipe datums are now initialized once instead of per-appliance.
Moved some cooking verbs to the Objects tab instead of a null category.
This commit is contained in:
Lohikar
2017-06-05 03:20:55 -05:00
committed by skull132
parent 68415f6cf5
commit 95fdd6f925
16 changed files with 158 additions and 177 deletions

View File

@@ -63,3 +63,6 @@
// -- SSfalling --
#define ADD_FALLING_ATOM(atom) if (!atom.multiz_falling) { atom.multiz_falling = 1; SSfalling.falling[atom] = 0; }
// -- SSmachinery --
#define RECIPE_LIST(T) (SSmachinery.recipe_datums["[T]"])

View File

@@ -78,3 +78,8 @@ var/cmp_field = "name"
/proc/cmp_surgery(datum/surgery_step/a, datum/surgery_step/b)
return b.priority - a.priority
/proc/cmp_recipe_complexity_dsc(datum/recipe/A, datum/recipe/B)
var/a_score = LAZYLEN(A.items) + LAZYLEN(A.reagents) + LAZYLEN(A.fruit)
var/b_score = LAZYLEN(B.items) + LAZYLEN(B.reagents) + LAZYLEN(B.fruit)
return b_score - a_score

View File

@@ -133,7 +133,7 @@
Topic(src, list("command"="open", "activate" = "0"))
return 1
/atom/proc/AICtrlClick()
/atom/proc/AICtrlClick(mob/user)
return
/obj/machinery/door/airlock/AICtrlClick() // Bolts doors

View File

@@ -20,6 +20,9 @@
var/list/slept_in_process = list()
// Cooking stuff. Not substantial enough to get its own SS, so it's shoved in here.
var/list/recipe_datums = list()
/datum/controller/subsystem/machinery/Recover()
all_cameras = SSmachinery.all_cameras
@@ -29,10 +32,26 @@
/datum/controller/subsystem/machinery/New()
NEW_SS_GLOBAL(SSmachinery)
#define ADD_TO_RDATUMS(i,t) if (R.appliance & i) { LAZYADD(recipe_datums["[i]"], t); added++; }
/datum/controller/subsystem/machinery/Initialize(timeofday)
for (var/type in subtypesof(/datum/recipe))
var/datum/recipe/R = new type
var/added = 0
ADD_TO_RDATUMS(MICROWAVE, R)
ADD_TO_RDATUMS(FRYER, R)
ADD_TO_RDATUMS(OVEN, R)
ADD_TO_RDATUMS(CANDYMAKER, R)
ADD_TO_RDATUMS(CEREALMAKER, R)
if (!added)
log_debug("SSmachinery: warning: type '[type]' does not have a valid machine type.")
qdel(R)
fire(FALSE, TRUE) // Tick machinery once to pare down the list so we don't hammer the server on round-start.
..(timeofday)
#undef ADD_TO_RDATUMS
/datum/controller/subsystem/machinery/fire(resumed = 0, no_mc_tick = FALSE)
if (!resumed)
src.processing_machinery = machines.Copy()

View File

@@ -1,7 +1,8 @@
// This folder contains code that was originally ported from Apollo Station and then refactored/optimized/changed.
// Tracks precooked food to stop deep fried baked grilled grilled grilled diona nymph cereal.
/obj/item/weapon/reagent_containers/food/snacks/var/list/cooked = list()
/obj/item/weapon/reagent_containers/food/snacks
var/tmp/list/cooked = list()
// Root type for cooking machines. See following files for specific implementations.
/obj/machinery/appliance
@@ -16,7 +17,6 @@
idle_power_usage = 5 // Power used when turned on, but not processing anything
active_power_usage = 1000 // Power used when turned on and actively cooking something
var/cooking_power = 1
var/max_contents = 1 // Maximum number of things this appliance can simultaneously cook
var/on_icon // Icon state used when cooking.
@@ -34,7 +34,6 @@
// If the machine has multiple output modes, define them here.
var/selected_option
var/list/output_options = list()
var/list/datum/recipe/available_recipes // List of the recipes this appliance could possibly make
var/container_type = null
@@ -45,16 +44,6 @@
if(output_options.len)
verbs += /obj/machinery/appliance/proc/choose_output
if (!available_recipes)
available_recipes = new
for (var/type in subtypesof(/datum/recipe))
var/datum/recipe/test = new type
if ((appliancetype & test.appliance))
available_recipes += test
else
qdel(test)
/obj/machinery/appliance/Destroy()
for (var/a in cooking_objs)
var/datum/cooking_item/CI = a
@@ -111,65 +100,62 @@
/obj/machinery/appliance/verb/toggle_power()
set name = "Toggle Power"
set category = null
set src in view() //So that AI can operate it remotely
set category = "Object"
set src in view()
if (!isliving(usr))
usr << "Ghosts aren't allowed to toggle power switches"
attempt_toggle_power(usr)
/obj/machinery/appliance/proc/attempt_toggle_power(mob/user)
if (!isliving(user))
return
if (isanimal(usr))
usr << "You lack the dexterity to do that!"
if (!user.IsAdvancedToolUser())
user << "You lack the dexterity to do that!"
return
if (usr.stat || usr.restrained() || usr.incapacitated())
if (user.stat || user.restrained() || user.incapacitated())
return
if (!Adjacent(usr))
if (!issilicon(usr))
usr << "You can't reach the power switch from there, get closer!"
return
if (!Adjacent(user) && !issilicon(user))
user << "You can't reach [src] from here."
return
if (stat & POWEROFF)//Its turned off
stat &= ~POWEROFF
use_power = 1
if (usr)
usr.visible_message("[usr] turns the [src] on", "You turn on the [src]")
user.visible_message("[user] turns [src] on.", "You turn on [src].")
else //Its on, turn it off
stat |= POWEROFF
use_power = 0
if (usr)
usr.visible_message("[usr] turns the [src] off", "You turn off the [src]")
user.visible_message("[user] turns [src] off.", "You turn off [src].")
playsound(src, 'sound/machines/click.ogg', 40, 1)
update_icon()
/obj/machinery/appliance/AICtrlClick()
toggle_power()
/obj/machinery/appliance/AICtrlClick(mob/user)
attempt_toggle_power(user)
/obj/machinery/appliance/proc/choose_output()
set src in view()
set name = "Choose output"
set category = null
set category = "Object"
if (!isliving(usr))
usr << "Ghosts aren't allowed to mess with cooking machines!"
return
if (isanimal(usr))
if (!usr.IsAdvancedToolUser())
usr << "You lack the dexterity to do that!"
return
if (usr.stat || usr.restrained() || usr.incapacitated())
return
if (!Adjacent(usr))
if (!issilicon(usr))
usr << "You can't adjust the [src] from this distance, get closer!"
return
if (!Adjacent(usr) && !issilicon(usr))
usr << "You can't adjust the [src] from this distance, get closer!"
return
if(output_options.len)
var/choice = input("What specific food do you wish to make with \the [src]?") as null|anything in output_options+"Default"
if(!choice)
return
@@ -217,7 +203,7 @@
user << "<span class='warning'>That would probably break [src].</span>"
return 0
else if(istype(check, /obj/item/weapon/disk/nuclear))
user << "Central Command would kill you if you [cook_type] that."
user << "<span class='warning'>You can't cook that.</span>"
return 0
else if(!istype(check) && !istype(check, /obj/item/weapon/holder))
user << "<span class='warning'>That's not edible.</span>"
@@ -238,8 +224,6 @@
user << "<span class='warning'>\The [src] is not working.</span>"
return
var/result = can_insert(I, user)
if (!result)
return
@@ -250,18 +234,10 @@
cook_mob(G.affecting, user)
return
//From here we can start cooking food
add_content(I, user)
update_icon()
//Override for container mechanics
/obj/machinery/appliance/proc/add_content(var/obj/item/I, var/mob/user)
if(!user.unEquip(I))
@@ -286,7 +262,6 @@
if (selected_option)
CI.combine_target = selected_option
// We can actually start cooking now.
user.visible_message("<span class='notice'>\The [user] puts \the [I] into \the [src].</span>")
@@ -348,7 +323,6 @@
CI.max_cookwork += work
//Called every tick while we're cooking something
/obj/machinery/appliance/proc/do_cooking_tick(var/datum/cooking_item/CI)
if (!CI.max_cookwork)
@@ -381,7 +355,6 @@
do_cooking_tick(i)
/obj/machinery/appliance/proc/finish_cooking(var/datum/cooking_item/CI)
src.visible_message("<span class='notice'>\The [src] pings!</span>")
@@ -394,7 +367,7 @@
C = CI.container
else
C = src
recipe = select_recipe(available_recipes,C)
recipe = select_recipe(RECIPE_LIST(appliancetype), C)
if (recipe)
CI.result_type = 4//Recipe type, a specific recipe will transform the ingredients into a new food
@@ -406,26 +379,25 @@
AM.loc = temp
//making multiple copies of a recipe from one container. For example, tons of fries
while (select_recipe(available_recipes,C) == recipe)
while (select_recipe(RECIPE_LIST(appliancetype), C) == recipe)
var/list/TR = list()
TR.Add(recipe.make_food(C))
TR += recipe.make_food(C)
for (var/atom/movable/AM in TR) //Move results to buffer
AM.loc = temp
results.Add(TR)
results += TR
for (var/r in results)
var/obj/item/weapon/reagent_containers/food/snacks/R = r
R.loc = C //Move everything from the buffer back to the container
R.cooked |= cook_type.
R.cooked |= cook_type
qdel(temp) //delete buffer object
temp = null
.=1 //None of the rest of this function is relevant for recipe cooking
QDEL_NULL(temp) //delete buffer object
. = 1 //None of the rest of this function is relevant for recipe cooking
else if(CI.combine_target)
CI.result_type = 3//Combination type. We're making something out of our ingredients
.=combination_cook(CI)
. = combination_cook(CI)
else
@@ -461,8 +433,6 @@
words |= dd_text2List(S.name," ")
cooktypes |= S.cooked
if (S.reagents && S.reagents.total_volume > 0)
if (S.filling_color)
if (!totalcolour || !buffer.total_volume)
@@ -493,7 +463,7 @@
result.filling_color = totalcolour
//Set the name.
words.Remove(list("and", "the", "in", "is", "bar", "raw", "sticks", "boiled", "fried", "deep", "-o-", "warm", "two", "flavored"))
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
words.Remove(result.name)
@@ -524,7 +494,7 @@
if (!result)
return
result.cooked |= cook_type.
result.cooked |= cook_type
// Set icon and appearance.
change_product_appearance(result, CI)
@@ -600,7 +570,7 @@
/obj/machinery/appliance/proc/change_product_strings(var/obj/item/weapon/reagent_containers/food/snacks/product, var/datum/cooking_item/CI)
product.name = "[cook_type] [product.name]"
product.desc = "[product.desc] It has been [cook_type]."
product.desc = "[product.desc]\nIt has been [cook_type]."
/obj/machinery/appliance/proc/change_product_appearance(var/obj/item/weapon/reagent_containers/food/snacks/product, var/datum/cooking_item/CI)
@@ -608,9 +578,6 @@
product.color = food_color
product.filling_color = food_color
//This function creates a food item which represents a dead mob
/obj/machinery/appliance/proc/create_mob_food(var/obj/item/weapon/holder/H, var/datum/cooking_item/CI)
if (!istype(H) || !H.contained)
@@ -649,9 +616,7 @@
return result
/datum/cooking_item
//var/obj/object
var/max_cookwork
var/cookwork
var/overcook_mult = 3
@@ -674,10 +639,8 @@
/datum/cooking_item/New(var/obj/item/I)
container = I
//This is called for containers whose contents are ejected without removing the container
/datum/cooking_item/proc/reset()
//object = null
max_cookwork = 0
cookwork = 0
result_type = 0

View File

@@ -1,11 +1,11 @@
/obj/machinery/appliance/cooker
var/temperature = T20C
var/min_temp = 353//Minimum temperature to do any cooking
var/optimal_temp = 472//Temperature at which we have 100% efficiency. efficiency is lowered on either side of this
var/min_temp = 80 + T0C //Minimum temperature to do any cooking
var/optimal_temp = 200 + T0C //Temperature at which we have 100% efficiency. efficiency is lowered on either side of this
var/optimal_power = 0.1//cooking power at 100%
var/loss = 1//Temp lost per proc when equalising
var/resistance = 320000//Resistance to heating. combines with active power usage to determine how long heating takes
var/loss = 1 //Temp lost per proc when equalising
var/resistance = 320000 //Resistance to heating. combines with active power usage to determine how long heating takes
var/light_x = 0
var/light_y = 0
@@ -13,7 +13,7 @@
/obj/machinery/appliance/cooker/examine(var/mob/user)
. = ..()
if (.)//no need to duplicate adjacency check
if (.) //no need to duplicate adjacency check
if (!stat)
if (temperature < min_temp)
user << span("warning", "The [src] is still heating up and is too cold to cook anything yet.")
@@ -37,8 +37,7 @@
usr << span("notice","It is empty.")
/obj/machinery/appliance/cooker/proc/get_efficiency()
. = cooking_power / optimal_power
. *= 100
. = (cooking_power / optimal_power) * 100
/obj/machinery/appliance/cooker/Initialize()
. = ..()

View File

@@ -53,8 +53,6 @@
name = "[prefix] [name]"
/obj/item/weapon/reagent_containers/food/snacks/variable/pizza
name = "personal pizza"
desc = "A personalized pan pizza meant for only one person."
@@ -155,7 +153,7 @@
name = pick(list("flakes", "krispies", "crunch", "pops", "O's", "crisp", "loops", "jacks", "clusters"))
/obj/item/weapon/reagent_containers/food/snacks/variable/mob
desc = "Poor little thing"
desc = "Poor little thing."
size = 5
w_class = 1
var/kitchen_tag = "animal"

View File

@@ -22,18 +22,24 @@ fundamental differences
/obj/machinery/appliance/mixer/Initialize()
. = ..()
cooking_objs.Add(new /datum/cooking_item/(new /obj/item/weapon/reagent_containers/cooking_container(src)))
cooking_objs += new /datum/cooking_item(new /obj/item/weapon/reagent_containers/cooking_container(src))
cooking = 0
selected_option = pick(output_options)
//Mixers cannot-not do combining mode. So the default option is removed from this. A combine target must be chosen
/obj/machinery/appliance/mixer/choose_output()
set src in view()
set src in oview(1)
set name = "Choose output"
set category = "Object"
if(output_options.len)
if (!isliving(usr))
return
if (!usr.IsAdvancedToolUser())
usr << "<span class='notice'>You can't operate [src].</span>"
return
if(output_options.len)
var/choice = input("What specific food do you wish to make with \the [src]?") as null|anything in output_options
if(!choice)
return

View File

@@ -13,7 +13,7 @@
"Candy Bar" = /obj/item/weapon/reagent_containers/food/snacks/variable/candybar,
"Sucker" = /obj/item/weapon/reagent_containers/food/snacks/variable/sucker,
"Jelly" = /obj/item/weapon/reagent_containers/food/snacks/variable/jelly
)
)
/obj/machinery/appliance/mixer/candy/change_product_appearance(var/obj/item/weapon/reagent_containers/food/snacks/cooked/product)
food_color = get_random_colour(1)

View File

@@ -10,7 +10,7 @@
output_options = list(
"Cereal" = /obj/item/weapon/reagent_containers/food/snacks/variable/cereal
)
)
/*
/obj/machinery/appliance/cereal/change_product_strings(var/obj/item/weapon/reagent_containers/food/snacks/product, var/datum/cooking_item/CI)

View File

@@ -8,9 +8,11 @@
var/max_space = 20//Maximum sum of w-classes of foods in this container at once
var/max_reagents = 80//Maximum units of reagents
flags = OPENCONTAINER | NOREACT
var/list/insertable = list(/obj/item/weapon/reagent_containers/food/snacks,
/obj/item/weapon/holder,
/obj/item/weapon/paper)
var/list/insertable = list(
/obj/item/weapon/reagent_containers/food/snacks,
/obj/item/weapon/holder,
/obj/item/weapon/paper
)
/obj/item/weapon/reagent_containers/cooking_container/New()
..()
@@ -43,27 +45,34 @@
return
/obj/item/weapon/reagent_containers/cooking_container/verb/empty()
set src in view()
set src in oview(1)
set name = "Empty Container"
set category = "Object"
set desc = "Removes items from the container. does not remove reagents."
set desc = "Removes items from the container, excluding reagents."
if (!isliving(usr))
usr << "Ghosts can't mess with cooking containers"
do_empty(usr)
/obj/item/weapon/reagent_containers/cooking_container/proc/do_empty(mob/user)
if (!isliving(user))
//Here we only check for ghosts. Animals are intentionally allowed to remove things from oven trays so they can eat it
return
if (!Adjacent(usr))
usr << "You can't reach the [src] from there, get closer!"
if (user.stat || user.restrained())
user << "<span class='notice'>You are in no fit state to do this.</span>"
return
if (!Adjacent(user))
user << "You can't reach [src] from here."
return
if (!contents.len)
usr << span("warning", "Theres nothing in the [src] you can remove!")
user << span("warning", "There's nothing in the [src] you can remove!")
return
for (var/atom/movable/A in contents)
A.forceMove(get_turf(src))
usr << span("notice", "You remove all the solid items from the [src].")
user << span("notice", "You remove all the solid items from the [src].")
/obj/item/weapon/reagent_containers/cooking_container/proc/check_contents()
if (contents.len == 0)
@@ -75,10 +84,7 @@
return 2//Contains multiple objects and/or reagents
/obj/item/weapon/reagent_containers/cooking_container/AltClick(var/mob/user)
.=1
if(user.stat || user.restrained()) return
empty()
do_empty(user)
//Deletes contents of container.
//Used when food is burned, before replacing it with a burned mess
@@ -137,15 +143,15 @@
/obj/item/weapon/reagent_containers/cooking_container/oven
name = "Oven Dish"
name = "oven dish"
shortname = "shelf"
desc = "Put ingredients in this for cooking to a recipe,in an oven."
desc = "Put ingredients in this; designed for use with an oven. Warranty void if used."
icon_state = "ovendish"
max_space = 30
max_reagents = 120
/obj/item/weapon/reagent_containers/cooking_container/fryer
name = "Fryer basket"
name = "fryer basket"
shortname = "basket"
desc = "Belongs in a deep fryer, put ingredients in it for cooking to a recipe"
icon_state = "basket"
desc = "Put ingredients in this; designed for use with a deep fryer. Warranty void if used."
icon_state = "basket"

View File

@@ -9,17 +9,15 @@
food_color = "#FFAD33"
cooked_sound = 'sound/machines/ding.ogg'
appliancetype = FRYER
active_power_usage = 24000
//24 KW, based on real world values for a large commercial fryer.
active_power_usage = 12 KILOWATTS
optimal_power = 0.35
idle_power_usage = 6000
idle_power_usage = 3.6 KILOWATTS
//Power used to maintain temperature once it's heated.
//Going with 25% of the active power. This is a somewhat arbitrary value
resistance = 90000
//By default, about 15 mins to heat up.
resistance = 20000 // Approx. 8-9 minutes to heat up.
max_contents = 2
container_type = /obj/item/weapon/reagent_containers/cooking_container/fryer
@@ -34,7 +32,6 @@
if (..())//no need to duplicate adjacency check
user << "Oil Level: [oil.total_volume]/[optimal_oil]"
/obj/machinery/appliance/cooker/fryer/Initialize()
. = ..()
oil = new/datum/reagents(optimal_oil * 1.25, src)
@@ -206,16 +203,12 @@
//Coat the victim in some oil
oil.trans_to(victim, 40)
return
/obj/machinery/appliance/cooker/fryer/attackby(var/obj/item/I, var/mob/user)
if(istype(I, /obj/item/weapon/reagent_containers/glass) && I.reagents)
if (I.reagents.total_volume <= 0 && oil)
//Its empty, handle scooping some hot oil out of the fryer
oil.trans_to(I, I.reagents.maximum_volume)
user.visible_message("[user] scoops some oil out of \the [src]", span("notice","You scoop some oil out of \the [src]"))
user.visible_message("[user] scoops some oil out of \the [src].", span("notice","You scoop some oil out of \the [src]."))
return 1
else
//It contains stuff, handle pouring any oil into the fryer
@@ -231,8 +224,7 @@
I.reagents.remove_reagent(R.id, delta)
amount += delta
if (amount > 0)
user.visible_message("[user] pours some oil into \the [src]", span("notice","You pour [amount]u of oil into \the [src]"))
user.visible_message("[user] pours some oil into \the [src].", span("notice","You pour [amount]u of oil into \the [src]."), "<span class='notice'>You hear something viscous being poured into a metal container.</span>")
return 1
//If neither of the above returned, then call parent as normal
..()

View File

@@ -7,19 +7,19 @@
appliancetype = OVEN
food_color = "#A34719"
can_burn_food = 1
active_power_usage = 19000
active_power_usage = 6 KILOWATTS
//Based on a double deck electric convection oven
resistance = 72000
idle_power_usage = 6000
//uses 30% power to stay warm
resistance = 16000
idle_power_usage = 2 KILOWATTS
//uses ~30% power to stay warm
optimal_power = 0.2
light_x = 2
max_contents = 5
container_type = /obj/item/weapon/reagent_containers/cooking_container/oven
stat = POWEROFF//Starts turned off
stat = POWEROFF //Starts turned off
var/open = 1
@@ -33,7 +33,7 @@
"Waffles" = /obj/item/weapon/reagent_containers/food/snacks/variable/waffles,
"Cookie" = /obj/item/weapon/reagent_containers/food/snacks/variable/cookie,
"Donut" = /obj/item/weapon/reagent_containers/food/snacks/variable/donut
)
)
/obj/machinery/appliance/cooker/oven/update_icon()
@@ -46,33 +46,28 @@
icon_state = "ovenopen"
..()
/obj/machinery/appliance/cooker/oven/AltClick(var/mob/user)
.=1
if(user.stat || user.restrained()) return
user.setClickCooldown(DEFAULT_ATTACK_COOLDOWN)//No spamming the door, it makes a sound
toggle_door()
try_toggle_door(user)
user.setClickCooldown(DEFAULT_ATTACK_COOLDOWN)
/obj/machinery/appliance/cooker/oven/verb/toggle_door()
set src in view()
set src in oview(1)
set category = "Object"
set name = "Open/close oven door"
set category = null
try_toggle_door(usr)
if (!isliving(usr))
usr << "Ghosts can't mess with ovens."
/obj/machinery/appliance/cooker/oven/proc/try_toggle_door(mob/user)
if (!isliving(usr) || isAI(user))
return
if (isanimal(usr))
if (!usr.IsAdvancedToolUser())
usr << "You lack the dexterity to do that."
return
if (!Adjacent(usr))
if (!issilicon(usr))
usr << "You can't reach the [src] from there, get closer!"
return
usr << "You can't reach the [src] from there, get closer!"
return
if (open)
open = 0
@@ -85,7 +80,6 @@
playsound(src, 'sound/machines/hatch_open.ogg', 20, 1)
update_icon()
/obj/machinery/appliance/cooker/oven/can_insert(var/obj/item/I, var/mob/user)
if (!open)
user << "<span class='warning'>You can't put anything in while the door is closed!</span>"

View File

@@ -13,7 +13,6 @@
var/operating = 0 // Is it on?
var/dirty = 0 // = {0..100} Does it need cleaning?
var/broken = 0 // ={0,1,2} How broken is it???
var/global/list/datum/recipe/available_recipes // List of the recipes you can use
var/global/list/acceptable_items // List of the items you can put in
var/global/list/acceptable_reagents // List of the reagents you can put in
var/global/max_n_of_items = 20
@@ -25,30 +24,31 @@
* Initialising
********************/
/obj/machinery/microwave/Initialize()
/obj/machinery/microwave/Initialize(mapload)
. = ..()
reagents = new/datum/reagents(100)
reagents.my_atom = src
if (!available_recipes)
available_recipes = new
for (var/type in (typesof(/datum/recipe)-/datum/recipe))
var/datum/recipe/test = new type
if ((test.appliance & appliancetype))
available_recipes += test
else
qdel(test)
acceptable_items = new
acceptable_reagents = new
for (var/datum/recipe/recipe in available_recipes)
if (mapload)
addtimer(CALLBACK(src, .proc/setup_recipes), 0)
else
setup_recipes()
/obj/machinery/microwave/proc/setup_recipes()
if (!LAZYLEN(acceptable_items))
acceptable_items = list()
acceptable_reagents = list()
for (var/datum/recipe/recipe in RECIPE_LIST(appliancetype))
for (var/item in recipe.items)
acceptable_items |= item
acceptable_items[item] = TRUE
for (var/reagent in recipe.reagents)
acceptable_reagents |= reagent
acceptable_reagents[reagent] = TRUE
// This will do until I can think of a fun recipe to use dionaea in -
// will also allow anything using the holder item to be microwaved into
// impure carbon. ~Z
acceptable_items |= /obj/item/weapon/holder
acceptable_items |= /obj/item/weapon/reagent_containers/food/snacks/grown
acceptable_items[/obj/item/weapon/holder] = TRUE
acceptable_items[/obj/item/weapon/reagent_containers/food/snacks/grown] = TRUE
/*******************
* Item Adding
@@ -247,7 +247,7 @@
stop()
return
var/datum/recipe/recipe = select_recipe(available_recipes,src)
var/datum/recipe/recipe = select_recipe(RECIPE_LIST(appliancetype),src)
var/obj/cooked
if (!recipe)
dirty += 1
@@ -303,7 +303,7 @@
AM.loc = temp
valid = 0
recipe = select_recipe(available_recipes,src)
recipe = select_recipe(RECIPE_LIST(appliancetype),src)
if (recipe && recipe.result == result)
sleep(2)
valid = 1

View File

@@ -280,28 +280,19 @@
return results
//When exact is false, extraneous ingredients are ignored
//When exact is true, extraneous ingredients will fail the recipe
//In both cases, the full complement of required inredients is still needed
/proc/select_recipe(var/list/datum/recipe/available_recipes, var/obj/obj as obj, var/exact = 0)
var/list/datum/recipe/possible_recipes = new
var/list/datum/recipe/possible_recipes = list()
for (var/datum/recipe/recipe in available_recipes)
if((recipe.check_reagents(obj.reagents) < exact) || (recipe.check_items(obj) < exact) || (recipe.check_fruit(obj) < exact))
continue
possible_recipes |= recipe
if (possible_recipes.len==0)
if (!possible_recipes.len)
return null
else if (possible_recipes.len==1)
else if (possible_recipes.len == 1)
return possible_recipes[1]
else //okay, let's select the most complicated recipe
var/highest_count = 0
. = possible_recipes[1]
for (var/datum/recipe/recipe in possible_recipes)
var/count = ((recipe.items)?(recipe.items.len):0) + ((recipe.reagents)?(recipe.reagents.len):0) + ((recipe.fruit)?(recipe.fruit.len):0)
if (count >= highest_count)
highest_count = count
. = recipe
return .
sortTim(possible_recipes, /proc/cmp_recipe_complexity_dsc)
return possible_recipes[1]

View File

@@ -0,0 +1,5 @@
author: Lohikar
delete-after: True
changes:
- tweak: "NanoTrasen's equipment division has aquired more efficient ovens and fryers. Engineering departments galaxy-wide celebrate."
- spellcheck: "Cooking messages now have 100% more grammar."