anchor.diff: +#define MICROWAVE_NORMAL 0
  +#define MICROWAVE_MUCK 1
  +#define MICROWAVE_PRE 2
  +
  +//Microwaving doesn't use recipes, instead it calls the microwave_act of the objects. For food, this creates something based on the food's cooked_type
  +
   /obj/machinery/microwave
   	name = "microwave oven"
   	desc = "Cooks and boils stuff."
  
positive.code: 	popup.set_content(dat)
  	popup.open()
  
  /***********************************
  *   Microwave Menu Handling/Cooking
  ************************************/
  
  /obj/machinery/microwave/proc/cook()
  	if(stat & (NOPOWER|BROKEN))
  		return
  	start()
  
  	if (prob(max(5/efficiency-5,dirty*5))) //a clean unupgraded microwave has no risk of failure
  		muck_start()
  		if (!microwaving(4))
  			muck_finish()
  			return
  		muck_finish()
  		return
  
  	else
  		if(has_extra_item() && prob(min(dirty*5,100)) && !microwaving(4))
  			broke()
  			return
  
  		if(!microwaving(10))
  			abort()
  			return
  		stop()
  
  		var/metal = 0
  		for(var/obj/item/O in contents)
  			O.microwave_act(src)
  			if(O.materials[MAT_METAL])
  				metal += O.materials[MAT_METAL]
  
  		if(metal)
  			visible_message("<span class='warning'>Sparks fly around [src]!</span>")
  			if(prob(max(metal/2, 33)))
  				explosion(loc,0,1,2)
  			broke()
  			return
  
  		dropContents()
  		return
  
  /obj/machinery/microwave/proc/microwaving(seconds as num)
  	for (var/i=1 to seconds)
  		if (stat & (NOPOWER|BROKEN))
  			return 0
  		use_power(500)
  		sleep(max(12-2*efficiency,2)) // standard microwave means sleep(10). The better the efficiency, the faster the cooking
  	return 1
  
  /obj/machinery/microwave/proc/has_extra_item()
  	for (var/obj/O in contents)
  		if ( \
  				!istype(O, /obj/item/reagent_containers/food) && \
  				!istype(O, /obj/item/grown) \
  			)
  			return 1
  	return 0
  
  /obj/machinery/microwave/proc/start()
  	visible_message("The microwave turns on.", "<span class='italics'>You hear a microwave humming.</span>")
  	soundloop.start()
  	operating = TRUE
  	icon_state = "mw1"
  	updateUsrDialog()
  	set_light(1.5)
  
  /obj/machinery/microwave/proc/abort()
  	operating = FALSE // Turn it off again aferwards
  	icon_state = "mw"
  	updateUsrDialog()
  	set_light(0)
  	soundloop.stop()
  
  /obj/machinery/microwave/proc/stop()
  	abort()
  
  /obj/machinery/microwave/proc/dispose()
  	for (var/obj/O in contents)
  		O.forceMove(drop_location())
  	to_chat(usr, "<span class='notice'>You dispose of the microwave contents.</span>")
  	updateUsrDialog()
  
  /obj/machinery/microwave/proc/muck_start()
  	playsound(src.loc, 'sound/effects/splat.ogg', 50, 1) // Play a splat sound
  	icon_state = "mwbloody1" // Make it look dirty!!
  
  /obj/machinery/microwave/proc/muck_finish()
  	visible_message("<span class='warning'>The microwave gets covered in muck!</span>")
  	dirty = 100 // Make it dirty so it can't be used util cleaned
  	icon_state = "mwbloody" // Make it look dirty too
  	operating = FALSE // Turn it off again aferwards
  	updateUsrDialog()
  	for(var/obj/item/reagent_containers/food/snacks/S in src)
  		if(prob(50))
  			new /obj/item/reagent_containers/food/snacks/badrecipe(src)
  			qdel(S)
  	set_light(0)
  	soundloop.stop()
  
  /obj/machinery/microwave/proc/broke()
  	var/datum/effect_system/spark_spread/s = new
  	s.set_up(2, 1, src)
  	s.start()
  	icon_state = "mwb" // Make it look all busted up and shit
  	visible_message("<span class='warning'>The microwave breaks!</span>") //Let them know they're stupid
  	broken = 2 // Make it broken so it can't be used util fixed
  	operating = FALSE // Turn it off again aferwards
  	updateUsrDialog()
  	set_light(0)
  	soundloop.stop()
  
  /obj/machinery/microwave/Topic(href, href_list)
  	if(..() || panel_open)
  		return
  
  	usr.set_machine(src)
  	if(operating)
  		updateUsrDialog()
  		return
  
  	switch(href_list["action"])
  		if ("cook")
  			cook()
  
  		if ("dispose")
  			dispose()
  	updateUsrDialog()
  
negative.code: 	pass_flags = PASSTABLE
  	light_color = LIGHT_COLOR_YELLOW
  	light_power = 3
  	var/operating = FALSE
  	var/dirty = 0 // 0 to 100 // Does it need cleaning?
  	var/dirty_anim_playing = FALSE
  	var/broken = 0 // 0, 1 or 2 // How broken is it???
  	var/max_n_of_items = 10
  	var/efficiency = 0
  	var/datum/looping_sound/microwave/soundloop
  
  /obj/machinery/microwave/Initialize()
  	. = ..()
  