diff --git a/code/datums/wires/microwave.dm b/code/datums/wires/microwave.dm
new file mode 100644
index 00000000000..8c74abfa46c
--- /dev/null
+++ b/code/datums/wires/microwave.dm
@@ -0,0 +1,27 @@
+/datum/wires/microwave
+ holder_type = /obj/machinery/microwave
+ proper_name = "Microwave"
+
+/datum/wires/microwave/New(atom/holder)
+ wires = list(
+ WIRE_ACTIVATE
+ )
+ ..()
+
+/datum/wires/microwave/interactable(mob/user)
+ . = FALSE
+ var/obj/machinery/microwave/M = holder
+ if(M.panel_open)
+ . = TRUE
+
+/datum/wires/microwave/on_pulse(wire)
+ var/obj/machinery/microwave/M = holder
+ switch(wire)
+ if(WIRE_ACTIVATE)
+ M.cook()
+
+/datum/wires/microwave/on_cut(wire, mend)
+ var/obj/machinery/microwave/M = holder
+ switch(wire)
+ if(WIRE_ACTIVATE)
+ M.wire_disabled = !mend
diff --git a/code/game/machinery/_machinery.dm b/code/game/machinery/_machinery.dm
index 049877a9cc4..077818cb91f 100644
--- a/code/game/machinery/_machinery.dm
+++ b/code/game/machinery/_machinery.dm
@@ -172,9 +172,11 @@ Class Procs:
update_icon()
updateUsrDialog()
-/obj/machinery/proc/dropContents()
+/obj/machinery/proc/dropContents(list/subset = null)
var/turf/T = get_turf(src)
for(var/atom/movable/A in contents)
+ if(subset && !(A in subset))
+ continue
A.forceMove(T)
if(isliving(A))
var/mob/living/L = A
diff --git a/code/game/objects/items.dm b/code/game/objects/items.dm
index 2e880c3390b..3b20fa8e242 100644
--- a/code/game/objects/items.dm
+++ b/code/game/objects/items.dm
@@ -650,7 +650,7 @@ GLOBAL_VAR_INIT(rpg_loot_items, FALSE)
..()
/obj/item/proc/microwave_act(obj/machinery/microwave/M)
- if(M && M.dirty < 100)
+ if(istype(M) && M.dirty < 100)
M.dirty++
/obj/item/proc/on_mob_death(mob/living/L, gibbed)
diff --git a/code/game/objects/items/stacks/stack.dm b/code/game/objects/items/stacks/stack.dm
index 1390172fa5e..f4756a9f872 100644
--- a/code/game/objects/items/stacks/stack.dm
+++ b/code/game/objects/items/stacks/stack.dm
@@ -396,7 +396,7 @@
//TODO bloody overlay
/obj/item/stack/microwave_act(obj/machinery/microwave/M)
- if(M && M.dirty < 100)
+ if(istype(M) && M.dirty < 100)
M.dirty += amount
/*
diff --git a/code/modules/food_and_drinks/food/snacks.dm b/code/modules/food_and_drinks/food/snacks.dm
index 7a7055d8893..b91086b0467 100644
--- a/code/modules/food_and_drinks/food/snacks.dm
+++ b/code/modules/food_and_drinks/food/snacks.dm
@@ -291,19 +291,24 @@ All foods are distributed among various categories. Use common sense.
S.reagents.add_reagent(r_id, amount)
/obj/item/reagent_containers/food/snacks/microwave_act(obj/machinery/microwave/M)
+ var/turf/T = get_turf(src)
+ var/obj/item/result
+
if(cooked_type)
- var/obj/item/reagent_containers/food/snacks/S = new cooked_type(get_turf(src))
- if(M)
- initialize_cooked_food(S, M.efficiency)
+ result = new cooked_type(T)
+ if(istype(M))
+ initialize_cooked_food(result, M.efficiency)
else
- initialize_cooked_food(S, 1)
- SSblackbox.record_feedback("tally", "food_made", 1, type)
+ initialize_cooked_food(result, 1)
+ SSblackbox.record_feedback("tally", "food_made", 1, result.type)
else
- new /obj/item/reagent_containers/food/snacks/badrecipe(src)
- if(M && M.dirty < 100)
+ result = new /obj/item/reagent_containers/food/snacks/badrecipe(T)
+ if(istype(M) && M.dirty < 100)
M.dirty++
qdel(src)
+ return result
+
/obj/item/reagent_containers/food/snacks/Destroy()
if(contents)
for(var/atom/movable/something in contents)
diff --git a/code/modules/food_and_drinks/kitchen_machinery/microwave.dm b/code/modules/food_and_drinks/kitchen_machinery/microwave.dm
index 2d200a09a11..c959798edc3 100644
--- a/code/modules/food_and_drinks/kitchen_machinery/microwave.dm
+++ b/code/modules/food_and_drinks/kitchen_machinery/microwave.dm
@@ -18,6 +18,7 @@
pass_flags = PASSTABLE
light_color = LIGHT_COLOR_YELLOW
light_power = 3
+ var/wire_disabled = FALSE // is its internal wire cut?
var/operating = FALSE
var/dirty = 0 // 0 to 100 // Does it need cleaning?
var/dirty_anim_playing = FALSE
@@ -25,12 +26,20 @@
var/max_n_of_items = 10
var/efficiency = 0
var/datum/looping_sound/microwave/soundloop
+ var/list/ingredients
/obj/machinery/microwave/Initialize()
. = ..()
+ wires = new /datum/wires/microwave(src)
+ ingredients = list()
create_reagents(100)
soundloop = new(list(src), FALSE)
+/obj/machinery/microwave/Destroy()
+ QDEL_NULL(wires)
+ ingredients.Cut()
+ . = ..()
+
/obj/machinery/microwave/RefreshParts()
efficiency = 0
for(var/obj/item/stock_parts/micro_laser/M in component_parts)
@@ -40,7 +49,7 @@
break
/obj/machinery/microwave/examine(mob/user)
- ..()
+ . = ..()
if(!operating)
to_chat(user, "Alt-click [src] to turn it on.")
if(in_range(user, src) || isobserver(user))
@@ -66,6 +75,15 @@
if(default_deconstruction_crowbar(O))
return
+ if(dirty < 100)
+ if(default_deconstruction_screwdriver(user, "", "", O) || default_unfasten_wrench(user, O))
+ update_icon()
+ return
+
+ if(panel_open && is_wire_tool(O))
+ wires.interact(user)
+ 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]...")
@@ -118,37 +136,35 @@
var/obj/item/storage/T = O
var/loaded = 0
for(var/obj/item/reagent_containers/food/snacks/S in T.contents)
- if(contents.len >= max_n_of_items)
+ if(ingredients.len >= max_n_of_items)
to_chat(user, "\The [src] is full, you can't put anything in!")
return TRUE
if(SEND_SIGNAL(T, COMSIG_TRY_STORAGE_TAKE, S, src))
loaded++
+ ingredients += S
if(loaded)
to_chat(user, "You insert [loaded] items into \the [src].")
updateUsrDialog()
return
if(O.w_class <= WEIGHT_CLASS_NORMAL && !istype(O, /obj/item/storage) && user.a_intent == INTENT_HELP)
- if(contents.len >= max_n_of_items)
+ if(ingredients.len >= max_n_of_items)
to_chat(user, "\The [src] is full, you can't put anything in!")
return TRUE
if(!user.transferItemToLoc(O, src))
to_chat(user, "\The [O] is stuck to your hand, you cannot put it in \the [src]!")
return FALSE
+
+ ingredients += O
user.visible_message("[user] has added \the [O] to \the [src].", "You add \the [O] to \the [src].")
updateUsrDialog()
return
- if(dirty < 100)
- if(default_deconstruction_screwdriver(user, "", "", O) || default_unfasten_wrench(user, O))
- update_icon()
- return
-
..()
updateUsrDialog()
/obj/machinery/microwave/AltClick(mob/user)
- if(user.canUseTopic(src, BE_CLOSE) && !(operating || broken > 0 || panel_open || !anchored || dirty == 100))
+ if(user.canUseTopic(src, BE_CLOSE))
cook()
/obj/machinery/microwave/ui_interact(mob/user)
@@ -164,7 +180,7 @@
dat += "ERROR: >> 0 --Response input zero
Contact your operator of the device manufacturer support."
else
var/list/items_counts = new
- for (var/obj/O in contents)
+ for (var/obj/O in ingredients)
if(istype(O, /obj/item/stack/))
var/obj/item/stack/S = O
items_counts[O.name] += S.amount
@@ -201,7 +217,7 @@
updateUsrDialog()
/obj/machinery/microwave/proc/dispose()
- for(var/obj/O in contents)
+ for(var/obj/O in ingredients)
O.forceMove(drop_location())
to_chat(usr, "You dispose of \the [src] contents.")
updateUsrDialog()
@@ -209,10 +225,18 @@
/obj/machinery/microwave/proc/cook()
if(stat & (NOPOWER|BROKEN))
return
+ if(operating || broken > 0 || panel_open || !anchored || dirty == 100)
+ return
+
+ if(wire_disabled)
+ audible_message("[src] buzzes.")
+ playsound(src, 'sound/machines/buzz-sigh.ogg', 50, 0)
+ return
+
if(prob(max((5 / efficiency) - 5, dirty * 5))) //a clean unupgraded microwave has no risk of failure
muck()
return
- for(var/obj/O in contents)
+ for(var/obj/O in ingredients)
if(istype(O, /obj/item/reagent_containers/food) || istype(O, /obj/item/grown))
continue
if(prob(min(dirty * 5, 100)))
@@ -273,7 +297,7 @@
operating = FALSE
var/metal = 0
- for(var/obj/item/O in contents)
+ for(var/obj/item/O in ingredients)
O.microwave_act(src)
if(O.materials[MAT_METAL])
metal += O.materials[MAT_METAL]
@@ -284,7 +308,8 @@
if(prob(max(metal / 2, 33)))
explosion(loc, 0, 1, 2)
else
- dropContents()
+ dropContents(ingredients)
+ ingredients.Cut()
after_finish_loop()
diff --git a/code/modules/research/xenobiology/crossbreeding/_status_effects.dm b/code/modules/research/xenobiology/crossbreeding/_status_effects.dm
index c205e41c527..d47555ea16b 100644
--- a/code/modules/research/xenobiology/crossbreeding/_status_effects.dm
+++ b/code/modules/research/xenobiology/crossbreeding/_status_effects.dm
@@ -558,7 +558,9 @@ datum/status_effect/stabilized/blue/on_remove()
if(istype(F))
if(F.cooked_type)
to_chat(owner, "[linked_extract] flares up brightly, and your hands alone are enough cook [F]!")
- F.microwave_act()
+ var/obj/item/result = F.microwave_act()
+ if(istype(result))
+ owner.put_in_hands(result)
else
I.attackby(fire, owner)
return ..()
diff --git a/tgstation.dme b/tgstation.dme
index f7bfa7b00c2..93a247b09d0 100755
--- a/tgstation.dme
+++ b/tgstation.dme
@@ -494,6 +494,7 @@
#include "code\datums\wires\autolathe.dm"
#include "code\datums\wires\emitter.dm"
#include "code\datums\wires\explosive.dm"
+#include "code\datums\wires\microwave.dm"
#include "code\datums\wires\mulebot.dm"
#include "code\datums\wires\particle_accelerator.dm"
#include "code\datums\wires\r_n_d.dm"