Skip to content

Commit

Permalink
Adds various quality of life changes for cooking to make it less clic…
Browse files Browse the repository at this point in the history
…k intensive. (tgstation#82566)

## About The Pull Request

- Increases tray item size by 1 item.

- Ranges and griddles can now be fed from trays.

Click when closed => fill soup pot.
Click when open => fill associated oven tray.
Right click when open => fill tray from oven tray
Click griddle => fill griddle surface.
Right click => fill tray from griddle surface

- Martian batter is now 5u of each ingredient into 10u of batter.

Hopefully will make it bug out less where it makes far fewer reagents
than it is supposed to, fixing reagents, or well soups specifically...
is out of scope for this PR.

- Adds the ability to print soup pots and large trays from the service
lathe

Soup pot: 5 Iron sheets, 0.4 bluespace crystal (given their size of
200U)
Large serving tray: 2 iron sheets

## Why It's Good For The Game

Makes cooking a lot less tedious. Especially for people with low
precision when it comes to filling oven trays. This also bring the
behavior up to parity with how you can click microwaves with trays to
fill them, ditto for the food processor. It also allows chef to use the
whole capacity of an oven, as previously you couldn't easily click 6
cake batters or other giant sprites onto the tiny tray.

The tray is now sized to be able to easily feed a griddle 8 items.

## Changelog

:cl:
qol: chef equipment can now deposit and withdraw to/from trays!
qol: chef now has access to griddle and oven sized trays!
qol: service can now print soup pots
/:cl:

---------

Co-authored-by: MrMelbert <[email protected]>
Co-authored-by: Jeremiah <[email protected]>
  • Loading branch information
3 people authored Apr 12, 2024
1 parent 9ec3163 commit df11ec8
Show file tree
Hide file tree
Showing 8 changed files with 169 additions and 24 deletions.
39 changes: 23 additions & 16 deletions code/game/objects/items/storage/bags.dm
Original file line number Diff line number Diff line change
Expand Up @@ -360,23 +360,30 @@
/obj/item/storage/bag/tray/Initialize(mapload)
. = ..()
atom_storage.max_specific_storage = WEIGHT_CLASS_BULKY //Plates are required bulky to keep them out of backpacks
atom_storage.set_holdable(list(
/obj/item/clothing/mask/cigarette,
/obj/item/food,
/obj/item/kitchen,
/obj/item/lighter,
/obj/item/organ,
/obj/item/plate,
/obj/item/reagent_containers/condiment,
/obj/item/reagent_containers/cup,
/obj/item/rollingpaper,
/obj/item/storage/box/gum,
/obj/item/storage/box/matches,
/obj/item/storage/fancy,
/obj/item/trash,
)) //Should cover: Bottles, Beakers, Bowls, Booze, Glasses, Food, Food Containers, Food Trash, Organs, Tobacco Products, Lighters, and Kitchen Tools.
atom_storage.set_holdable(
can_hold_list = list(
/obj/item/clothing/mask/cigarette,
/obj/item/food,
/obj/item/kitchen,
/obj/item/lighter,
/obj/item/organ,
/obj/item/plate,
/obj/item/reagent_containers/condiment,
/obj/item/reagent_containers/cup,
/obj/item/rollingpaper,
/obj/item/storage/box/gum,
/obj/item/storage/box/matches,
/obj/item/storage/fancy,
/obj/item/trash,
),
cant_hold_list = list(
/obj/item/plate/oven_tray,
/obj/item/reagent_containers/cup/soup_pot,
),
) //Should cover: Bottles, Beakers, Bowls, Booze, Glasses, Food, Food Containers, Food Trash, Organs, Tobacco Products, Lighters, and Kitchen Tools.
atom_storage.insert_preposition = "on"
atom_storage.max_slots = 7
atom_storage.max_slots = 8
atom_storage.max_total_storage = 16

/obj/item/storage/bag/tray/attack(mob/living/M, mob/living/user)
. = ..()
Expand Down
39 changes: 39 additions & 0 deletions code/modules/food_and_drinks/machinery/griddle.dm
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@


/obj/machinery/griddle/attackby(obj/item/I, mob/user, params)

if(griddled_objects.len >= max_items)
to_chat(user, span_notice("[src] can't fit more items!"))
return
Expand All @@ -79,6 +80,44 @@
else
return ..()

/obj/machinery/griddle/item_interaction(mob/living/user, obj/item/item, list/modifiers, is_right_clicking)
. = ..()
if(. & ITEM_INTERACT_ANY_BLOCKER)
return

if(isnull(item.atom_storage))
return

if(is_right_clicking)
var/obj/item/storage/tray = item

for(var/obj/tray_item in griddled_objects)
tray.atom_storage?.attempt_insert(tray_item, user, TRUE)
return ITEM_INTERACT_SUCCESS

var/obj/item/storage/tray = item
var/loaded = 0

if(!istype(item, /obj/item/storage/bag/tray))
// Non-tray dumping requires a do_after
to_chat(user, span_notice("You start dumping out the contents of [item] into [src]..."))
if(!do_after(user, 2 SECONDS, target = tray))
return ITEM_INTERACT_BLOCKING

for(var/obj/tray_item in tray.contents)
if(!IS_EDIBLE(tray_item))
continue
if(contents.len >= max_items)
balloon_alert(user, "it's full!")
return ITEM_INTERACT_BLOCKING
if(tray.atom_storage.attempt_remove(tray_item, src))
loaded++
AddToGrill(tray_item, user)
if(loaded)
to_chat(user, span_notice("You insert [loaded] items into \the [src]."))
update_appearance()
return ITEM_INTERACT_SUCCESS

/obj/machinery/griddle/attack_hand(mob/user, list/modifiers)
. = ..()
toggle_mode()
Expand Down
54 changes: 48 additions & 6 deletions code/modules/food_and_drinks/machinery/oven.dm
Original file line number Diff line number Diff line change
Expand Up @@ -100,13 +100,18 @@
use_energy(active_power_usage)


/obj/machinery/oven/attackby(obj/item/I, mob/user, params)
if(open && !used_tray && istype(I, /obj/item/plate/oven_tray))
if(user.transferItemToLoc(I, src, silent = FALSE))
to_chat(user, span_notice("You put [I] in [src]."))
add_tray_to_oven(I, user)
else
/obj/machinery/oven/attackby(obj/item/item, mob/user, params)
if(!open || used_tray || !item.atom_storage)
return ..()

if(user.transferItemToLoc(item, src, silent = FALSE))
to_chat(user, span_notice("You put [item] in [src]."))
add_tray_to_oven(item, user)

/obj/machinery/oven/item_interaction(mob/living/user, obj/item/item, list/modifiers, is_right_clicking)
if(open && used_tray && item.atom_storage)
return used_tray.item_interaction(user, item, modifiers, is_right_clicking)
return ..()

///Adds a tray to the oven, making sure the shit can get baked.
/obj/machinery/oven/proc/add_tray_to_oven(obj/item/plate/oven_tray, mob/baker)
Expand Down Expand Up @@ -243,6 +248,43 @@
max_items = 6
biggest_w_class = WEIGHT_CLASS_BULKY

/obj/item/plate/oven_tray/item_interaction(mob/living/user, obj/item/item, list/modifiers, is_right_clicking)
. = ..()

if(isnull(item.atom_storage))
return

if(is_right_clicking)
var/obj/item/storage/tray = item

for(var/obj/tray_item in contents)
tray.atom_storage?.attempt_insert(tray_item, user, TRUE)

return ITEM_INTERACT_SUCCESS

var/obj/item/storage/tray = item
var/loaded = 0

if(!istype(item, /obj/item/storage/bag/tray))
// Non-tray dumping requires a do_after
to_chat(user, span_notice("You start dumping out the contents of [item] into [src]..."))
if(!do_after(user, 2 SECONDS, target = tray))
return ITEM_INTERACT_BLOCKING

for(var/obj/tray_item in tray.contents)
if(!IS_EDIBLE(tray_item))
continue
if(contents.len >= max_items)
balloon_alert(user, "it's full!")
return ITEM_INTERACT_BLOCKING
if(tray.atom_storage.attempt_remove(tray_item, src))
loaded++
AddToPlate(tray_item, user)
if(loaded)
to_chat(user, span_notice("You insert [loaded] items into \the [src]."))
update_appearance()
return ITEM_INTERACT_SUCCESS

#undef OVEN_SMOKE_STATE_NONE
#undef OVEN_SMOKE_STATE_GOOD
#undef OVEN_SMOKE_STATE_NEUTRAL
Expand Down
35 changes: 35 additions & 0 deletions code/modules/food_and_drinks/machinery/stove.dm
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,34 @@
. = ..()
LAZYREMOVE(added_ingredients, gone)

/**
* Adds items to a soup pot without invoking any procs that call sleep() when using in a component.
*
* Args:
* * transfer_from: The container that's being used to add items to the soup pot. Must not be null.
* * user: the entity adding ingredients via a container to a soup pot. Must not be null.
*/
/obj/item/reagent_containers/cup/soup_pot/proc/transfer_from_container_to_pot(obj/item/transfer_from, mob/user)
if(!transfer_from.atom_storage)
return

var/obj/item/storage/tray = transfer_from
var/loaded = 0

for(var/obj/tray_item in tray.contents)
if(!can_add_ingredient(tray_item))
continue
if(LAZYLEN(added_ingredients) >= max_ingredients)
balloon_alert(user, "it's full!")
return TRUE
if(tray.atom_storage.attempt_remove(tray_item, src))
loaded++
LAZYADD(added_ingredients, tray_item)
if(loaded)
to_chat(user, span_notice("You insert [loaded] items into \the [src]."))
update_appearance(UPDATE_OVERLAYS)
return TRUE

/obj/item/reagent_containers/cup/soup_pot/attackby(obj/item/attacking_item, mob/user, params)
. = ..()
if(.)
Expand All @@ -140,6 +168,13 @@
update_appearance(UPDATE_OVERLAYS)
return TRUE

/obj/item/reagent_containers/cup/soup_pot/item_interaction(mob/living/user, obj/item/item, list/modifiers, is_right_clicking)

if(!is_right_clicking)
return transfer_from_container_to_pot(item, user)
else
return ..()

/obj/item/reagent_containers/cup/soup_pot/attack_hand_secondary(mob/user, list/modifiers)
if(!LAZYLEN(added_ingredients))
return SECONDARY_ATTACK_CALL_NORMAL
Expand Down
8 changes: 8 additions & 0 deletions code/modules/food_and_drinks/machinery/stove_component.dm
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,14 @@
/datum/component/stove/proc/on_attackby(obj/machinery/source, obj/item/attacking_item, mob/user, params)
SIGNAL_HANDLER

if(istype(source, /obj/machinery/oven/range) && istype(attacking_item, /obj/item/storage/bag/tray) && container)
var/obj/machinery/oven/range/range = source
var/obj/item/reagent_containers/cup/soup_pot/soup_pot = container

if(!range.open)
soup_pot.transfer_from_container_to_pot(attacking_item, user)
return COMPONENT_NO_AFTERATTACK

if(!attacking_item.is_open_container())
return
if(!isnull(container))
Expand Down
4 changes: 2 additions & 2 deletions code/modules/food_and_drinks/recipes/food_mixtures.dm
Original file line number Diff line number Diff line change
Expand Up @@ -276,8 +276,8 @@
reaction_flags = REACTION_INSTANT

/datum/chemical_reaction/food/martian_batter
results = list(/datum/reagent/consumable/martian_batter = 2)
required_reagents = list(/datum/reagent/consumable/flour = 1, /datum/reagent/consumable/nutriment/soup/dashi = 1)
results = list(/datum/reagent/consumable/martian_batter = 10)
required_reagents = list(/datum/reagent/consumable/flour = 5, /datum/reagent/consumable/nutriment/soup/dashi = 5)
mix_message = "A smooth batter forms."
reaction_flags = REACTION_INSTANT

Expand Down
13 changes: 13 additions & 0 deletions code/modules/research/designs/autolathe/service_designs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,19 @@
)
departmental_flags = DEPARTMENT_BITFLAG_SERVICE

/datum/design/soup_pot
name = "Soup Pot"
id = "souppot"
build_type = AUTOLATHE | PROTOLATHE | AWAY_LATHE
materials = list(/datum/material/iron =SHEET_MATERIAL_AMOUNT*5, /datum/material/bluespace =SMALL_MATERIAL_AMOUNT*4)
category = list(RND_CATEGORY_INITIAL, RND_CATEGORY_EQUIPMENT)
build_path = /obj/item/reagent_containers/cup/soup_pot
category = list(
RND_CATEGORY_INITIAL,
RND_CATEGORY_EQUIPMENT + RND_SUBCATEGORY_EQUIPMENT_KITCHEN,
)
departmental_flags = DEPARTMENT_BITFLAG_SERVICE

/datum/design/bowl
name = "Bowl"
id = "bowl"
Expand Down
1 change: 1 addition & 0 deletions code/modules/research/techweb/all_nodes.dm
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@
"slime_scanner",
"solar_panel",
"solar_tracker",
"souppot",
"space_heater",
"spoon",
"status_display_frame",
Expand Down

0 comments on commit df11ec8

Please sign in to comment.