Files
CHOMPStation2/code/modules/food/kitchen/cooking_machines/container.dm
Rykka 886ab72289 Huge Bundle of Fixes, Update Cooking to current Aurora
Cooking times are now no longer 10-15 minutes per item, the LARGEST items will take around ~4-5 minutes, 6 at the maximum in the case of the superbigbite (one of the most filling food items in the game).
Cooking oil tanks added
Appliances are now constructible instead of being eldritch black magic
Recipes are now reorganized to either fryer/oven/grill based on where they're made (Although recipes_microwave still needs a LOT more sorting)
Critical time bug with cooking fixed, AND you can now upgrade your appliances for even higher efficiencies!
2020-07-22 21:34:13 -04:00

172 lines
5.9 KiB
Plaintext

//Cooking containers are used in ovens and fryers, to hold multiple ingredients for a recipe.
//They work fairly similar to the microwave - acting as a container for objects and reagents,
//which can be checked against recipe requirements in order to cook recipes that require several things
/obj/item/weapon/reagent_containers/cooking_container
icon = 'icons/obj/cooking_machines.dmi'
var/shortname
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
)
/obj/item/weapon/reagent_containers/cooking_container/Initialize()
. = ..()
create_reagents(max_reagents)
flags |= OPENCONTAINER | NOREACT
/obj/item/weapon/reagent_containers/cooking_container/examine(var/mob/user)
. = ..()
if (contents.len)
var/string = "It contains....</br>"
for (var/atom/movable/A in contents)
string += "[A.name] </br>"
. += "<span class='notice'>[string]</span>"
if (reagents.total_volume)
. += "<span class='notice'>It contains [reagents.total_volume]u of reagents.</span>"
/obj/item/weapon/reagent_containers/cooking_container/attackby(var/obj/item/I as obj, var/mob/user as mob)
for (var/possible_type in insertable)
if (istype(I, possible_type))
if (!can_fit(I))
to_chat(user, "<span class='warning'>There's no more space in the [src] for that!</span>")
return 0
if(!user.unEquip(I))
return
I.forceMove(src)
to_chat(user, "<span class='notice'>You put the [I] into the [src].</span>")
return
/obj/item/weapon/reagent_containers/cooking_container/verb/empty()
set src in oview(1)
set name = "Empty Container"
set category = "Object"
set desc = "Removes items from the container, excluding reagents."
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 (user.stat || user.restrained())
to_chat(user, "<span class='notice'>You are in no fit state to do this.</span>")
return
if (!Adjacent(user))
to_chat(user, "You can't reach [src] from here.")
return
if (!contents.len)
to_chat(user, "<span class='warning'>There's nothing in the [src] you can remove!</span>")
return
for (var/atom/movable/A in contents)
A.forceMove(get_turf(src))
to_chat(user, "<span class='notice'>You remove all the solid items from the [src].</span>")
/obj/item/weapon/reagent_containers/cooking_container/proc/check_contents()
if (contents.len == 0)
if (!reagents || reagents.total_volume == 0)
return 0//Completely empty
else if (contents.len == 1)
if (!reagents || reagents.total_volume == 0)
return 1//Contains only a single object which can be extracted alone
return 2//Contains multiple objects and/or reagents
/obj/item/weapon/reagent_containers/cooking_container/AltClick(var/mob/user)
do_empty(user)
//Deletes contents of container.
//Used when food is burned, before replacing it with a burned mess
/obj/item/weapon/reagent_containers/cooking_container/proc/clear()
for (var/atom/a in contents)
qdel(a)
if (reagents)
reagents.clear_reagents()
/obj/item/weapon/reagent_containers/cooking_container/proc/label(var/number, var/CT = null)
//This returns something like "Fryer basket 1 - empty"
//The latter part is a brief reminder of contents
//This is used in the removal menu
. = shortname
if (!isnull(number))
.+= " [number]"
.+= " - "
if (CT)
.+=CT
else if (contents.len)
for (var/obj/O in contents)
.+=O.name//Just append the name of the first object
return
else if (reagents && reagents.total_volume > 0)
var/datum/reagent/R = reagents.get_master_reagent()
.+=R.name//Append name of most voluminous reagent
return
else
. += "empty"
/obj/item/weapon/reagent_containers/cooking_container/proc/can_fit(var/obj/item/I)
var/total = 0
for (var/obj/item/J in contents)
total += J.w_class
if((max_space - total) >= I.w_class)
return 1
//Takes a reagent holder as input and distributes its contents among the items in the container
//Distribution is weighted based on the volume already present in each item
/obj/item/weapon/reagent_containers/cooking_container/proc/soak_reagent(var/datum/reagents/holder)
var/total = 0
var/list/weights = list()
for (var/obj/item/I in contents)
if (I.reagents && I.reagents.total_volume)
total += I.reagents.total_volume
weights[I] = I.reagents.total_volume
if (total > 0)
for (var/obj/item/I in contents)
if (weights[I])
holder.trans_to(I, weights[I] / total)
/obj/item/weapon/reagent_containers/cooking_container/oven
name = "oven dish"
shortname = "shelf"
desc = "Put ingredients in this; designed for use with an oven. Warranty void if used incorrectly."
icon_state = "ovendish"
max_space = 30
max_reagents = 120
/obj/item/weapon/reagent_containers/cooking_container/oven/Initialize()
. = ..()
// We add to the insertable list specifically for the oven trays, to allow specialty cakes.
insertable += list(
/obj/item/clothing/head/cakehat, // This is because we want to allow birthday cakes to be makeable.
/obj/item/organ/internal/brain // As before, needed for braincake
)
/obj/item/weapon/reagent_containers/cooking_container/fryer
name = "fryer basket"
shortname = "basket"
desc = "Put ingredients in this; designed for use with a deep fryer. Warranty void if used incorrectly."
icon_state = "basket"
/obj/item/weapon/reagent_containers/cooking_container/grill
name = "grill rack"
shortname = "rack"
desc = "Put ingredients 'in'/on this; designed for use with a grill. Warranty void if used incorrectly."
icon_state = "grillrack"