From 5a5c0aa0be88802cef5d2d8919f0f6d0b4217cbc Mon Sep 17 00:00:00 2001 From: SmArtKar <44720187+SmArtKar@users.noreply.github.com> Date: Fri, 16 Aug 2024 21:35:00 +0300 Subject: [PATCH] Dumping things into microwave en-masse is done via RMB or drag'n'drop (#85530) ## About The Pull Request Closes #85523 Subjective but feels like a better solution to just blacklisting RPEDs and leaving everything else in. Drag'n'drop won't work until #85512 gets merged but this PR should be good to go even without it ## Changelog :cl: qol: Dumping things into microwave en-masse is done via RMB (drag'n'drop support coming soon!) fix: RPEDs can now upgrade microwaves fix: Spies can finally steal microwaves (Use RMB!) /:cl: --- .../food_and_drinks/machinery/microwave.dm | 64 +++++++++++-------- 1 file changed, 38 insertions(+), 26 deletions(-) diff --git a/code/modules/food_and_drinks/machinery/microwave.dm b/code/modules/food_and_drinks/machinery/microwave.dm index 2b790306b5a..4fa586401ff 100644 --- a/code/modules/food_and_drinks/machinery/microwave.dm +++ b/code/modules/food_and_drinks/machinery/microwave.dm @@ -416,32 +416,7 @@ balloon_alert(user, "max 1 device!") return ITEM_INTERACT_BLOCKING - if(istype(item, /obj/item/storage)) - 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(ingredients.len >= max_n_of_items) - balloon_alert(user, "it's full!") - return ITEM_INTERACT_BLOCKING - if(tray.atom_storage.attempt_remove(tray_item, src)) - loaded++ - ingredients += tray_item - if(loaded) - open(autoclose = 0.6 SECONDS) - to_chat(user, span_notice("You insert [loaded] items into \the [src].")) - update_appearance() - return ITEM_INTERACT_SUCCESS - - if(item.w_class <= WEIGHT_CLASS_NORMAL && !user.combat_mode) + if(item.w_class <= WEIGHT_CLASS_NORMAL && !user.combat_mode && isnull(item.atom_storage)) if(ingredients.len >= max_n_of_items) balloon_alert(user, "it's full!") return ITEM_INTERACT_BLOCKING @@ -455,6 +430,43 @@ update_appearance() return ITEM_INTERACT_SUCCESS +/obj/machinery/microwave/item_interaction_secondary(mob/living/user, obj/item/tool, list/modifiers) + if (isnull(tool.atom_storage)) + return + handle_dumping(user, tool) + return ITEM_INTERACT_BLOCKING + +/obj/machinery/microwave/proc/handle_dumping(mob/living/user, obj/item/tool) + if(isnull(tool.atom_storage)) + return + + var/loaded = 0 + if(!istype(tool, /obj/item/storage/bag/tray)) + // Non-tray dumping requires a do_after + to_chat(user, span_notice("You start dumping out the contents of [tool] into [src]...")) + if(!do_after(user, 2 SECONDS, target = tool)) + return + + for(var/obj/tray_item in tool.contents) + if(!IS_EDIBLE(tray_item)) + continue + if(ingredients.len >= max_n_of_items) + balloon_alert(user, "it's full!") + return + if(tool.atom_storage.attempt_remove(tray_item, src)) + loaded++ + ingredients += tray_item + + if(loaded) + open(autoclose = 0.6 SECONDS) + to_chat(user, span_notice("You insert [loaded] items into \the [src].")) + update_appearance() + +/obj/machinery/microwave/mouse_drop_receive(obj/item/tool, mob/user, params) + if (!istype(tool) || isnull(tool.atom_storage)) + return + handle_dumping(user, tool) + /obj/machinery/microwave/attack_hand_secondary(mob/user, list/modifiers) if(user.can_perform_action(src, ALLOW_SILICON_REACH)) if(!length(ingredients))