From d8f5fcd9fdaa21479e6351969b2f5d10a1aa517d Mon Sep 17 00:00:00 2001 From: ArcaneMusic <41715314+ArcaneMusic@users.noreply.github.com> Date: Wed, 18 Nov 2020 03:33:27 -0500 Subject: [PATCH] Food processors and microwaves now respect food trays (#54927) Really it's a bandaid as it would be better to wait until the refactor is done, but it turned out to be a rather easy fix. Food trays may now once again mass insert both new and old food into the microwaves and food processors. Prevents any manual handing when cooking large quantities of food at once. Also, you get the switch gathering mode button when being given the serving tray again. --- code/datums/components/storage/storage.dm | 1 + code/game/objects/structures/displaycase.dm | 24 ++++++++++++------- .../kitchen_machinery/food_cart.dm | 8 ++++--- .../kitchen_machinery/microwave.dm | 4 +++- .../kitchen_machinery/processor.dm | 4 +++- 5 files changed, 28 insertions(+), 13 deletions(-) diff --git a/code/datums/components/storage/storage.dm b/code/datums/components/storage/storage.dm index cf1b005ebc9..95652fca993 100644 --- a/code/datums/components/storage/storage.dm +++ b/code/datums/components/storage/storage.dm @@ -91,6 +91,7 @@ RegisterSignal(parent, COMSIG_ITEM_PRE_ATTACK, .proc/preattack_intercept) RegisterSignal(parent, COMSIG_ITEM_ATTACK_SELF, .proc/attack_self) RegisterSignal(parent, COMSIG_ITEM_PICKUP, .proc/signal_on_pickup) + RegisterSignal(parent, COMSIG_ITEM_EQUIPPED, .proc/update_actions) RegisterSignal(parent, COMSIG_MOVABLE_POST_THROW, .proc/close_all) RegisterSignal(parent, COMSIG_MOVABLE_MOVED, .proc/on_move) diff --git a/code/game/objects/structures/displaycase.dm b/code/game/objects/structures/displaycase.dm index 7271d7d4a03..5af6bfb9cbd 100644 --- a/code/game/objects/structures/displaycase.dm +++ b/code/game/objects/structures/displaycase.dm @@ -146,13 +146,7 @@ to_chat(user, "You [open ? "close":"open"] [src].") toggle_lock(user) else if(open && !showpiece) - if(showpiece_type && !istype(W, showpiece_type)) - to_chat(user, "This doesn't belong in this kind of display.") - return TRUE - if(user.transferItemToLoc(W, src)) - showpiece = W - to_chat(user, "You put [W] on display.") - update_icon() + insert_showpiece(W, user) else if(glass_fix && broken && istype(W, /obj/item/stack/sheet/glass)) var/obj/item/stack/sheet/glass/G = W if(G.get_amount() < 2) @@ -167,6 +161,15 @@ else return ..() +/obj/structure/displaycase/proc/insert_showpiece(obj/item/wack, mob/user) + if(showpiece_type && !istype(wack, showpiece_type)) + to_chat(user, "This doesn't belong in this kind of display.") + return TRUE + if(user.transferItemToLoc(wack, src)) + showpiece = wack + to_chat(user, "You put [wack] on display.") + update_icon() + /obj/structure/displaycase/proc/toggle_lock(mob/user) open = !open update_icon() @@ -384,7 +387,6 @@ density = FALSE max_integrity = 100 req_access = null - showpiece_type = /obj/item/reagent_containers/food alert = FALSE //No, we're not calling the fire department because someone stole your cookie. glass_fix = FALSE //Fixable with tools instead. ///The price of the item being sold. Altered by grab intent ID use. @@ -577,3 +579,9 @@ /obj/structure/displaycase/forsale/kitchen desc = "A display case with an ID-card swiper. Use your ID to purchase the contents. Meant for the bartender and chef." req_one_access = list(ACCESS_KITCHEN, ACCESS_BAR) + +/obj/structure/displaycase/forsale/insert_showpiece(obj/item/wack, mob/user) + if(!IS_EDIBLE(wack)) + to_chat(user, "\The [src] smartly rejects [wack], as it only accepts food and drinks.") + return TRUE + . = ..() diff --git a/code/modules/food_and_drinks/kitchen_machinery/food_cart.dm b/code/modules/food_and_drinks/kitchen_machinery/food_cart.dm index c417f472307..ce66d11fd55 100644 --- a/code/modules/food_and_drinks/kitchen_machinery/food_cart.dm +++ b/code/modules/food_and_drinks/kitchen_machinery/food_cart.dm @@ -69,11 +69,11 @@ qdel(DG) glasses++ to_chat(user, "[src] accepts the drinking glass, sterilizing it.") - else if(istype(O, /obj/item/reagent_containers/food/snacks)) + else if(IS_EDIBLE(O)) if(isFull()) to_chat(user, "[src] is at full capacity.") else - var/obj/item/reagent_containers/food/snacks/S = O + var/obj/item/S = O if(!user.transferItemToLoc(S, src)) return if(stored_food[sanitize(S.name)]) @@ -88,11 +88,13 @@ to_chat(user, "[src] accepts a sheet of glass.") else if(istype(O, /obj/item/storage/bag/tray)) var/obj/item/storage/bag/tray/T = O - for(var/obj/item/reagent_containers/food/snacks/S in T.contents) + for(var/obj/item/S in T.contents) if(isFull()) to_chat(user, "[src] is at full capacity.") break else + if(!IS_EDIBLE(S)) + continue if(SEND_SIGNAL(T, COMSIG_TRY_STORAGE_TAKE, S, src)) if(stored_food[sanitize(S.name)]) stored_food[sanitize(S.name)]++ diff --git a/code/modules/food_and_drinks/kitchen_machinery/microwave.dm b/code/modules/food_and_drinks/kitchen_machinery/microwave.dm index 48164a5c218..17f96d13162 100644 --- a/code/modules/food_and_drinks/kitchen_machinery/microwave.dm +++ b/code/modules/food_and_drinks/kitchen_machinery/microwave.dm @@ -165,7 +165,9 @@ if(istype(O, /obj/item/storage/bag/tray)) var/obj/item/storage/T = O var/loaded = 0 - for(var/obj/item/reagent_containers/food/snacks/S in T.contents) + for(var/obj/S in T.contents) + if(!IS_EDIBLE(S)) + continue if(ingredients.len >= max_n_of_items) to_chat(user, "\The [src] is full, you can't put anything in!") return TRUE diff --git a/code/modules/food_and_drinks/kitchen_machinery/processor.dm b/code/modules/food_and_drinks/kitchen_machinery/processor.dm index ad8a7e1216b..48025db8bb6 100644 --- a/code/modules/food_and_drinks/kitchen_machinery/processor.dm +++ b/code/modules/food_and_drinks/kitchen_machinery/processor.dm @@ -62,7 +62,9 @@ if(istype(O, /obj/item/storage/bag/tray)) var/obj/item/storage/T = O var/loaded = 0 - for(var/obj/item/reagent_containers/food/snacks/S in T.contents) + for(var/obj/S in T.contents) + if(!IS_EDIBLE(S)) + continue var/datum/food_processor_process/P = select_recipe(S) if(P) if(SEND_SIGNAL(T, COMSIG_TRY_STORAGE_TAKE, S, src))