From 5fb4a9d383e813b140701ba41bf77e0d037d1e36 Mon Sep 17 00:00:00 2001 From: FalloutFalcon <86381784+FalloutFalcon@users.noreply.github.com> Date: Thu, 29 Feb 2024 16:33:59 -0600 Subject: [PATCH] Moves behaviors in microwave attackby into procs (#2771) ## About The Pull Request Sorts welder, wire cutter, and washing tools into there respective procs ## Why It's Good For The Game We should uh use the atom/procs where they should be used i think. Also lets you clean microwaves with things other then soap and spray bottles (rags was my goal but should apply to some other odd methods) ## Changelog :cl: tweak: you can clean microwaves with a rag refactor: microwave attackby behaviors moved into smarter procs /:cl: --- .../food_and_drinks/drinks/drinks/modglass.dm | 1 + .../kitchen_machinery/microwave.dm | 65 +++++++++---------- 2 files changed, 31 insertions(+), 35 deletions(-) diff --git a/code/modules/food_and_drinks/drinks/drinks/modglass.dm b/code/modules/food_and_drinks/drinks/drinks/modglass.dm index 01ec56b6ca86..056ece3409ae 100644 --- a/code/modules/food_and_drinks/drinks/drinks/modglass.dm +++ b/code/modules/food_and_drinks/drinks/drinks/modglass.dm @@ -99,6 +99,7 @@ GLOBAL_LIST_EMPTY(glass_variants) //clear garnishes on wash /obj/item/reagent_containers/food/drinks/modglass/wash(clean_types) + . = ..() garnishes = list() update_appearance() diff --git a/code/modules/food_and_drinks/kitchen_machinery/microwave.dm b/code/modules/food_and_drinks/kitchen_machinery/microwave.dm index 13a35b579679..4a739d2ab7fc 100644 --- a/code/modules/food_and_drinks/kitchen_machinery/microwave.dm +++ b/code/modules/food_and_drinks/kitchen_machinery/microwave.dm @@ -125,43 +125,11 @@ return TRUE if(broken > 0) - if(broken == 2 && O.tool_behaviour == TOOL_WIRECUTTER) // If it's broken and they're using a screwdriver - user.visible_message("[user] starts to fix part of \the [src].", "You start to fix part of \the [src]...") - if(O.use_tool(src, user, 20)) - user.visible_message("[user] fixes part of \the [src].", "You fix part of \the [src].") - broken = 1 // Fix it a bit - else if(broken == 1 && O.tool_behaviour == TOOL_WELDER) // If it's broken and they're doing the wrench - user.visible_message("[user] starts to fix part of \the [src].", "You start to fix part of \the [src]...") - if(O.use_tool(src, user, 20)) - user.visible_message("[user] fixes \the [src].", "You fix \the [src].") - broken = 0 - update_appearance() - return FALSE //to use some fuel - else - to_chat(user, "It's broken!") - return TRUE - return - - if(istype(O, /obj/item/reagent_containers/spray)) - var/obj/item/reagent_containers/spray/clean_spray = O - if(clean_spray.reagents.has_reagent(/datum/reagent/space_cleaner, clean_spray.amount_per_transfer_from_this)) - clean_spray.reagents.remove_reagent(/datum/reagent/space_cleaner, clean_spray.amount_per_transfer_from_this,1) - playsound(loc, 'sound/effects/spray3.ogg', 50, TRUE, -6) - user.visible_message("[user] cleans \the [src].", "You clean \the [src].") - dirty = 0 - update_appearance() - else - to_chat(user, "You need more space cleaner!") + to_chat(user, "It's broken!") return TRUE - if(istype(O, /obj/item/soap)) - var/obj/item/soap/P = O - user.visible_message("[user] starts to clean \the [src].", "You start to clean \the [src]...") - if(do_after(user, P.cleanspeed, target = src)) - user.visible_message("[user] cleans \the [src].", "You clean \the [src].") - dirty = 0 - update_appearance() - return TRUE + if(istype(O, /obj/item/reagent_containers/spray) || istype(O, /obj/item/soap) || istype(O, /obj/item/reagent_containers/glass/rag)) + return if(dirty == 100) // The microwave is all dirty so can't be used! to_chat(user, "\The [src] is dirty!") @@ -195,6 +163,33 @@ ..() +/obj/machinery/microwave/welder_act(mob/living/user, obj/item/I) + . = ..() + if(broken == 1) + user.visible_message("[user] starts to fix part of \the [src].", "You start to fix part of \the [src]...") + if(I.use_tool(src, user, 20)) + user.visible_message("[user] fixes \the [src].", "You fix \the [src].") + broken = 0 + update_appearance() + return TRUE + +/obj/machinery/microwave/wirecutter_act(mob/living/user, obj/item/I) + . = ..() + if(broken == 2) + user.visible_message("[user] starts to fix part of \the [src].", "You start to fix part of \the [src]...") + if(I.use_tool(src, user, 20)) + user.visible_message("[user] fixes part of \the [src].", "You fix part of \the [src].") + broken = 1 + update_appearance() + return TRUE + +/obj/machinery/microwave/wash(clean_types) + . = ..() + if(dirty) + dirty = 0 + update_appearance() + return TRUE + /obj/machinery/microwave/AltClick(mob/user) if(user.canUseTopic(src, !issilicon(usr))) cook()