Skip to content

Commit

Permalink
Moves behaviors in microwave attackby into procs (#2771)
Browse files Browse the repository at this point in the history
<!-- Write **BELOW** The Headers and **ABOVE** The comments else it may
not be viewable. -->
<!-- You can view Contributing.MD for a detailed description of the pull
request process. -->

## About The Pull Request

Sorts welder, wire cutter, and washing tools into there respective procs
<!-- Describe The Pull Request. Please be sure every change is
documented or this can delay review and even discourage maintainers from
merging your PR! -->

## 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)
<!-- Please add a short description of why you think these changes would
benefit the game. If you can't justify it in words, it might not be
worth adding. -->

## Changelog

:cl:
tweak: you can clean microwaves with a rag
refactor: microwave attackby behaviors moved into smarter procs
/:cl:

<!-- Both :cl:'s are required for the changelog to work! You can put
your name to the right of the first :cl: if you want to overwrite your
GitHub username as author ingame. -->
<!-- You can use multiple of the same prefix (they're only used for the
icon ingame) and delete the unneeded ones. Despite some of the tags,
changelogs should generally represent how a player might be affected by
the changes rather than a summary of the PR's contents. -->
  • Loading branch information
FalloutFalcon authored Feb 29, 2024
1 parent 665992b commit 5fb4a9d
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 35 deletions.
1 change: 1 addition & 0 deletions code/modules/food_and_drinks/drinks/drinks/modglass.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down
65 changes: 30 additions & 35 deletions code/modules/food_and_drinks/kitchen_machinery/microwave.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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("<span class='notice'>[user] starts to fix part of \the [src].</span>", "<span class='notice'>You start to fix part of \the [src]...</span>")
if(O.use_tool(src, user, 20))
user.visible_message("<span class='notice'>[user] fixes part of \the [src].</span>", "<span class='notice'>You fix part of \the [src].</span>")
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("<span class='notice'>[user] starts to fix part of \the [src].</span>", "<span class='notice'>You start to fix part of \the [src]...</span>")
if(O.use_tool(src, user, 20))
user.visible_message("<span class='notice'>[user] fixes \the [src].</span>", "<span class='notice'>You fix \the [src].</span>")
broken = 0
update_appearance()
return FALSE //to use some fuel
else
to_chat(user, "<span class='warning'>It's broken!</span>")
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("<span class='notice'>[user] cleans \the [src].</span>", "<span class='notice'>You clean \the [src].</span>")
dirty = 0
update_appearance()
else
to_chat(user, "<span class='warning'>You need more space cleaner!</span>")
to_chat(user, "<span class='warning'>It's broken!</span>")
return TRUE

if(istype(O, /obj/item/soap))
var/obj/item/soap/P = O
user.visible_message("<span class='notice'>[user] starts to clean \the [src].</span>", "<span class='notice'>You start to clean \the [src]...</span>")
if(do_after(user, P.cleanspeed, target = src))
user.visible_message("<span class='notice'>[user] cleans \the [src].</span>", "<span class='notice'>You clean \the [src].</span>")
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, "<span class='warning'>\The [src] is dirty!</span>")
Expand Down Expand Up @@ -195,6 +163,33 @@

..()

/obj/machinery/microwave/welder_act(mob/living/user, obj/item/I)
. = ..()
if(broken == 1)
user.visible_message("<span class='notice'>[user] starts to fix part of \the [src].</span>", "<span class='notice'>You start to fix part of \the [src]...</span>")
if(I.use_tool(src, user, 20))
user.visible_message("<span class='notice'>[user] fixes \the [src].</span>", "<span class='notice'>You fix \the [src].</span>")
broken = 0
update_appearance()
return TRUE

/obj/machinery/microwave/wirecutter_act(mob/living/user, obj/item/I)
. = ..()
if(broken == 2)
user.visible_message("<span class='notice'>[user] starts to fix part of \the [src].</span>", "<span class='notice'>You start to fix part of \the [src]...</span>")
if(I.use_tool(src, user, 20))
user.visible_message("<span class='notice'>[user] fixes part of \the [src].</span>", "<span class='notice'>You fix part of \the [src].</span>")
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()
Expand Down

0 comments on commit 5fb4a9d

Please sign in to comment.