mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-25 14:08:31 +01:00
Microwaves now have a single wire (#41822)
cl coiax add: Microwaves have a single wire accessible when open, the activation wire. When cut, the microwave will no longer function, when pulsed, the microwave will turn on. add: Stabilized dark purple extracts now cook items in your hands, rather than dropping the cooked item on the floor. /cl Previously microwaves just worked on their contents, now they keep a subset of contents called ingredients, because otherwise it would explode whenever you put a signaler inside. Someone asked me to do it. It seemed like a neat idea. God knows what horrible things people will do with this.
This commit is contained in:
@@ -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
|
||||
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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
|
||||
|
||||
/*
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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, "<span class='notice'>Alt-click [src] to turn it on.</span>")
|
||||
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].", "<span class='notice'>You start to fix part of \the [src]...</span>")
|
||||
@@ -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, "<span class='warning'>\The [src] is full, you can't put anything in!</span>")
|
||||
return TRUE
|
||||
if(SEND_SIGNAL(T, COMSIG_TRY_STORAGE_TAKE, S, src))
|
||||
loaded++
|
||||
ingredients += S
|
||||
if(loaded)
|
||||
to_chat(user, "<span class='notice'>You insert [loaded] items into \the [src].</span>")
|
||||
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, "<span class='warning'>\The [src] is full, you can't put anything in!</span>")
|
||||
return TRUE
|
||||
if(!user.transferItemToLoc(O, src))
|
||||
to_chat(user, "<span class='warning'>\The [O] is stuck to your hand, you cannot put it in \the [src]!</span>")
|
||||
return FALSE
|
||||
|
||||
ingredients += O
|
||||
user.visible_message("[user] has added \the [O] to \the [src].", "<span class='notice'>You add \the [O] to \the [src].</span>")
|
||||
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<BR>Contact your operator of the device manufacturer support.</div>"
|
||||
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, "<span class='notice'>You dispose of \the [src] contents.</span>")
|
||||
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()
|
||||
|
||||
|
||||
@@ -558,7 +558,9 @@ datum/status_effect/stabilized/blue/on_remove()
|
||||
if(istype(F))
|
||||
if(F.cooked_type)
|
||||
to_chat(owner, "<span class='warning'>[linked_extract] flares up brightly, and your hands alone are enough cook [F]!</span>")
|
||||
F.microwave_act()
|
||||
var/obj/item/result = F.microwave_act()
|
||||
if(istype(result))
|
||||
owner.put_in_hands(result)
|
||||
else
|
||||
I.attackby(fire, owner)
|
||||
return ..()
|
||||
|
||||
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user