mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-09 16:12:17 +00:00
This ports Aurora Cooking, sometimes called Nanako Cooking, from CitRP, who got it from Aurora originally. https://github.com/Citadel-Station-13/Citadel-Station-13-RP/pull/608 Pulled from here with updates to to_chat() Ovens and fryers now work like the microwave, but also have special trays/baskets that can be inserted and removed with things on them. There's also a crapton of new recipes. Note that you can still use the oven to just bake things, or produce variable food items, to my knowledge. This was specifically kept in when it was originally implemented, IIRC. - Cooking now uses several machines to make recipes. Microwave, oven, deep fryer. - Recipes have been redone to reflect this. - Adds a reagent called Space Spice (used in Synnono's food recipes mostly, prevents recipe conflicts) - New foods! Lots of them. - You can cook using held mobs. Also, mouse/ratburgers. I can dump the recipes if you'd like. https://user-images.githubusercontent.com/40557659/52112070-10165a80-25cb-11e9-9a72-2c919f0033dd.png (From their PR, may not be accurate). This is WIP, and will not compile just yet.
157 lines
5.3 KiB
Plaintext
157 lines
5.3 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 = 'modular_citadel/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>"
|
|
user << span("notice", string)
|
|
if (reagents.total_volume)
|
|
user << span("notice", "It contains [reagents.total_volume]u of reagents.")
|
|
|
|
|
|
/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."
|
|
icon_state = "ovendish"
|
|
max_space = 30
|
|
max_reagents = 120
|
|
|
|
/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."
|
|
icon_state = "basket" |