From 64e74d0d99fad3968b00821e4c8ef56efafd1470 Mon Sep 17 00:00:00 2001
From: AffectedArc07 <25063394+AffectedArc07@users.noreply.github.com>
Date: Tue, 2 Aug 2022 17:51:33 +0100
Subject: [PATCH 1/5] A mixed refactor
---
code/game/machinery/buttons.dm | 143 +++++--------
code/game/machinery/igniter.dm | 57 +++--
code/game/machinery/lightswitch.dm | 144 +++----------
code/game/machinery/machinery.dm | 2 +-
code/game/objects/structures/morgue.dm | 201 +++++++++++-------
code/modules/admin/verbs/atmosdebug.dm | 5 -
.../atmospherics/machinery/atmospherics.dm | 20 +-
7 files changed, 248 insertions(+), 324 deletions(-)
diff --git a/code/game/machinery/buttons.dm b/code/game/machinery/buttons.dm
index 318c0757e0ea..69a6dfdd27f4 100644
--- a/code/game/machinery/buttons.dm
+++ b/code/game/machinery/buttons.dm
@@ -5,11 +5,9 @@
/obj/machinery/driver_button
name = "mass driver button"
+ desc = "A remote control switch for a mass driver."
icon = 'icons/obj/objects.dmi'
icon_state = "launcherbtt"
- desc = "A remote control switch for a mass driver."
- var/id_tag = "default"
- var/active = FALSE
settagwhitelist = list("id_tag", "logic_id_tag")
anchored = TRUE
armor = list(melee = 50, bullet = 50, laser = 50, energy = 50, bomb = 10, bio = 100, rad = 100, fire = 90, acid = 70)
@@ -17,16 +15,19 @@
idle_power_usage = 2
active_power_usage = 4
resistance_flags = LAVA_PROOF | FIRE_PROOF
+ /// ID tag of the driver to hook to
+ var/id_tag = "default"
+ /// Are we active?
+ var/active = FALSE
+ /// Range of drivers + blast doors to hit
var/range = 7
- var/logic_id_tag = "default" //Defines the ID tag to send logic signals to, so you don't have to unlink from doors and stuff
- var/logic_connect = FALSE //Set this to allow the button to send out logic signals when pressed in addition to normal stuff
/obj/machinery/button/indestructible
resistance_flags = INDESTRUCTIBLE | LAVA_PROOF | FIRE_PROOF | UNACIDABLE | ACID_PROOF
-/obj/machinery/driver_button/New(turf/loc, w_dir=null)
- ..()
- switch(w_dir)
+/obj/machinery/driver_button/Initialize(mapload, place_dir)
+ . = ..()
+ switch(place_dir)
if(NORTH)
pixel_y = 25
if(SOUTH)
@@ -35,122 +36,79 @@
pixel_x = 25
if(WEST)
pixel_x = -25
- if(SSradio)
- set_frequency(frequency)
-
-/obj/machinery/driver_button/Initialize(mapload)
- . = ..()
- set_frequency(frequency)
-
-/obj/machinery/driver_button/set_frequency(new_frequency)
- SSradio.remove_object(src, frequency)
- frequency = new_frequency
- radio_connection = SSradio.add_object(src, frequency, RADIO_LOGIC)
- return
-
-/obj/machinery/driver_button/Destroy()
- if(SSradio)
- SSradio.remove_object(src, frequency)
- radio_connection = null
- return ..()
-
-/obj/machinery/driver_button/attack_ai(mob/user as mob)
- return attack_hand(user)
+/obj/machinery/driver_button/attack_ai(mob/user)
+ attack_hand(user)
/obj/machinery/driver_button/attack_ghost(mob/user)
if(user.can_advanced_admin_interact())
- return attack_hand(user)
+ attack_hand(user)
-/obj/machinery/driver_button/attackby(obj/item/W, mob/user as mob, params)
+/obj/machinery/driver_button/wrench_act(mob/user, obj/item/I)
+ . = TRUE
- if(istype(W, /obj/item/detective_scanner))
+ if(!I.tool_use_check(user, 0))
return
- if(istype(W, /obj/item/multitool))
- update_multitool_menu(user)
- return 1
-
- if(istype(W, /obj/item/wrench))
- playsound(get_turf(src), W.usesound, 50, 1)
- if(do_after(user, 30 * W.toolspeed, target = src))
- to_chat(user, "You detach \the [src] from the wall.")
- new/obj/item/mounted/frame/driver_button(get_turf(src))
- qdel(src)
- return 1
-
- return ..()
-
-/obj/machinery/driver_button/multitool_menu(mob/user, obj/item/multitool/P)
- return {"
-
- - ID Tag: [format_tag("ID Tag","id_tag","set_id")]
- - Logic Connection: [logic_connect ? "On" : "Off"]
- - Logic ID Tag: [format_tag("Logic ID Tag", "logic_id_tag")]
-
"}
+ user.visible_message("[user] starts unwrenching [src] from the wall...", "You are unwrenching [src] from the wall...", "You hear ratcheting.")
+ if(!I.use_tool(src, user, 30, volume = I.tool_volume))
+ return
-/obj/machinery/driver_button/attack_hand(mob/user as mob)
+ WRENCH_UNANCHOR_WALL_MESSAGE
+ new/obj/item/mounted/frame/driver_button(get_turf(src))
+ qdel(src)
+/obj/machinery/driver_button/attack_hand(mob/user)
add_fingerprint(usr)
+
if(stat & (NOPOWER|BROKEN))
return
+
if(active)
return
+
add_fingerprint(user)
use_power(5)
+ // Start us off
launch_sequence()
/obj/machinery/driver_button/proc/launch_sequence()
active = TRUE
icon_state = "launcheract"
- if(logic_connect)
- if(!radio_connection) //can't output without this
- return
+ // Time sequence
+ // OPEN DOORS
+ // Wait 2 seconds
+ // LAUNCH
+ // Wait 5 seconds
+ // CLOSE
+ // Then make not active
- if(logic_id_tag == null) //Don't output to an undefined id_tag
- return
-
- var/datum/signal/signal = new
- signal.transmission_method = 1 //radio signal
- signal.source = src
-
- signal.data = list(
- "tag" = logic_id_tag,
- "sigtype" = "logic",
- "state" = LOGIC_FLICKER, //Buttons are a FLICKER source, since they only register as ON when you press it, then turn OFF after you release
- )
-
- radio_connection.post_signal(src, signal, filter = RADIO_LOGIC)
-
- for(var/obj/machinery/door/poddoor/M in range(src,range))
+ for(var/obj/machinery/door/poddoor/M in range(src, range))
if(M.id_tag == id_tag && !M.protected)
- spawn()
- M.open()
+ INVOKE_ASYNC(M, /obj/machinery/door.proc/open)
- sleep(20)
+ // 2 seconds after previous invocation
- for(var/obj/machinery/mass_driver/M in range(src,range))
+ for(var/obj/machinery/mass_driver/M in range(src, range))
if(M.id_tag == id_tag)
- M.drive()
+ addtimer(CALLBACK(M, /obj/machinery/mass_driver.proc/drive), 2 SECONDS)
- sleep(50)
+ // We want this 5 seconds after open, so the delay is 7 seconds from this proc
- for(var/obj/machinery/door/poddoor/M in range(src,range))
+ for(var/obj/machinery/door/poddoor/M in range(src, range))
if(M.id_tag == id_tag && !M.protected)
- spawn()
- M.close()
- return
+ addtimer(CALLBACK(M, /obj/machinery/door.proc/close), 7 SECONDS)
+
+ // And rearm us
+ addtimer(CALLBACK(src, .proc/rearm), 7 SECONDS)
+/obj/machinery/driver_button/proc/rearm()
icon_state = "launcherbtt"
active = FALSE
-/obj/machinery/driver_button/multitool_topic(mob/user, list/href_list, obj/O)
- ..()
- if("toggle_logic" in href_list)
- logic_connect = !logic_connect
//////////////////////////////////////
// Ignition Switch //
@@ -178,6 +136,7 @@
/obj/machinery/ignition_switch/attack_hand(mob/user)
if(stat & (NOPOWER|BROKEN))
return
+
if(active)
return
@@ -188,16 +147,16 @@
for(var/obj/machinery/sparker/M in GLOB.machines)
if(M.id == id)
- spawn( 0 )
- M.spark()
+ INVOKE_ASYNC(M, /obj/machinery/sparker.proc/spark)
for(var/obj/machinery/igniter/M in GLOB.machines)
if(M.id == id)
use_power(50)
- M.on = !( M.on )
- M.icon_state = text("igniter[]", M.on)
+ M.on = !M.on
+ M.icon_state = "igniter[M.on]"
- sleep(50)
+ addtimer(CALLBACK(src, .proc/rearm), 5 SECONDS)
+/obj/machinery/ignition_switch/proc/rearm()
icon_state = "launcherbtt"
active = FALSE
diff --git a/code/game/machinery/igniter.dm b/code/game/machinery/igniter.dm
index 530e24a8c83c..6cd443af52d2 100755
--- a/code/game/machinery/igniter.dm
+++ b/code/game/machinery/igniter.dm
@@ -7,33 +7,36 @@
max_integrity = 300
armor = list(melee = 50, bullet = 30, laser = 70, energy = 50, bomb = 20, bio = 0, rad = 0, fire = 100, acid = 70)
resistance_flags = FIRE_PROOF
- var/id = null
- var/on = FALSE
anchored = TRUE
use_power = IDLE_POWER_USE
idle_power_usage = 2
active_power_usage = 4
+ /// ID to hook buttons into
+ var/id = null
+ /// Are we on?
+ var/on = FALSE
/obj/machinery/igniter/on
on = TRUE
/obj/machinery/igniter/attack_ai(mob/user as mob)
- return src.attack_hand(user)
-
+ attack_hand(user)
/obj/machinery/igniter/attack_hand(mob/user as mob)
if(..())
return
+
add_fingerprint(user)
use_power(50)
on = !on
update_icon()
+
if(on)
set_light(1, 1, "#ff821c")
else
set_light(0)
- return
+
/obj/machinery/igniter/update_icon_state()
. = ..()
@@ -51,12 +54,12 @@
if(on)
underlays += emissive_appearance(icon, "igniter_lightmask")
-/obj/machinery/igniter/process() //ugh why is this even in process()?
- if(src.on && !(stat & NOPOWER) )
- var/turf/location = src.loc
+/obj/machinery/igniter/process() //ugh why is this even in process()? // AA 2022-08-02 - I guess it cant go anywhere else?
+ if(on && !(stat & NOPOWER))
+ var/turf/location = get_turf(src)
if(isturf(location))
- location.hotspot_expose(1000,500,1)
- return 1
+ location.hotspot_expose(1000, 500, 1)
+ return TRUE
/obj/machinery/igniter/Initialize(mapload)
. = ..()
@@ -86,26 +89,21 @@
if(powered() && !disable)
stat &= ~NOPOWER
icon_state = "[base_state]"
-// src.sd_set_light(2)
else
stat |= ~NOPOWER
icon_state = "[base_state]-p"
-// src.sd_set_light(0)
-
-/obj/machinery/sparker/attackby(obj/item/I, mob/user, params)
- if(istype(I, /obj/item/detective_scanner))
- return
- return ..()
/obj/machinery/sparker/screwdriver_act(mob/user, obj/item/I)
. = TRUE
if(!I.use_tool(src, user, 0, volume = I.tool_volume))
return
+
disable = !disable
+
if(disable)
user.visible_message("[user] has disabled [src]!", "You disable the connection to [src].")
icon_state = "[base_state]-d"
- if(!disable)
+ else
user.visible_message("[user] has reconnected [src]!", "You fix the connection to [src].")
if(powered())
icon_state = "[base_state]"
@@ -113,31 +111,32 @@
icon_state = "[base_state]-p"
/obj/machinery/sparker/attack_ai()
- if(src.anchored)
- return src.spark()
- else
- return
+ if(anchored)
+ return spark()
+
/obj/machinery/sparker/proc/spark()
- if(!(powered()))
+ if(!powered())
return
- if((src.disable) || (src.last_spark && world.time < src.last_spark + 50))
+ if(disable || (last_spark && world.time < last_spark + 50))
return
-
flick("[base_state]-spark", src)
do_sparks(2, 1, src)
- src.last_spark = world.time
+ last_spark = world.time
use_power(1000)
- var/turf/location = src.loc
+
+ var/turf/location = get_turf(src)
if(isturf(location))
- location.hotspot_expose(1000,500,1)
- return 1
+ location.hotspot_expose(1000, 500, 1)
+
+ return TRUE
/obj/machinery/sparker/emp_act(severity)
if(stat & (BROKEN|NOPOWER))
..(severity)
return
+
spark()
..(severity)
diff --git a/code/game/machinery/lightswitch.dm b/code/game/machinery/lightswitch.dm
index d7db2a9c2c89..89a2360e57c6 100644
--- a/code/game/machinery/lightswitch.dm
+++ b/code/game/machinery/lightswitch.dm
@@ -1,25 +1,15 @@
// the light switch
// can have multiple per area
-// can also operate on non-loc area through "otherarea" var
/obj/machinery/light_switch
name = "light switch"
desc = "It turns lights on and off. What are you, simple?"
icon = 'icons/obj/power.dmi'
icon_state = "light1"
anchored = TRUE
- var/on = TRUE
- var/area/area = null
- var/otherarea = null
- // luminosity = 1
- settagwhitelist = list("logic_id_tag")
- var/light_connect = TRUE //Allows the switch to control lights in its associated areas. When set to FALSE, using the switch won't affect the lights.
- var/logic_id_tag = "default" //Defines the ID tag to send logic signals to.
- var/logic_connect = FALSE //Set this to allow the switch to send out logic signals.
-
-
-/obj/machinery/light_switch/New(turf/loc, w_dir=null)
- ..()
- switch(w_dir)
+
+/obj/machinery/light_switch/Initialize(mapload, build_dir)
+ . = ..()
+ switch(build_dir)
if(NORTH)
pixel_y = 25
dir = NORTH
@@ -32,42 +22,14 @@
if(WEST)
pixel_x = -25
dir = WEST
- if(SSradio)
- set_frequency(frequency)
- spawn(5)
- src.area = get_area(src)
-
- if(otherarea)
- src.area = locate(text2path("/area/[otherarea]"))
-
- if(!name)
- name = "light switch([area.name])"
-
- src.on = src.area.lightswitch
- update_icon(UPDATE_ICON_STATE)
-
-/obj/machinery/light_switch/Initialize()
- ..()
- set_frequency(frequency)
- name = "light switch"
-/obj/machinery/light_switch/set_frequency(new_frequency)
- SSradio.remove_object(src, frequency)
- frequency = new_frequency
- radio_connection = SSradio.add_object(src, frequency, RADIO_LOGIC)
- return
-
-/obj/machinery/light_switch/Destroy()
- if(SSradio)
- SSradio.remove_object(src, frequency)
- radio_connection = null
- return ..()
+ update_icon(UPDATE_ICON_STATE)
/obj/machinery/light_switch/update_icon_state()
if(stat & NOPOWER)
icon_state = "light-p"
return
- icon_state = "light[on]"
+ icon_state = "light[get_area(src).lightswitch]"
/obj/machinery/light_switch/update_overlays()
. = ..()
@@ -80,116 +42,62 @@
/obj/machinery/light_switch/examine(mob/user)
. = ..()
- . += "A light switch. It is [on ? "on" : "off"]."
+ . += "A light switch. It is [get_area(src).lightswitch ? "on" : "off"]."
/obj/machinery/light_switch/attack_ghost(mob/user)
if(user.can_advanced_admin_interact())
return attack_hand(user)
/obj/machinery/light_switch/attack_hand(mob/user)
- on = !on
playsound(src, 'sound/machines/lightswitch.ogg', 10, TRUE)
update_icon(UPDATE_ICON_STATE)
- if(light_connect)
- area.lightswitch = on
- area.update_icon(UPDATE_ICON_STATE)
-
- if(logic_connect && powered(LIGHT)) //Don't bother sending a signal if we aren't set to send them or we have no power to send with.
- handle_output()
-
- if(light_connect)
- for(var/obj/machinery/light_switch/L in area)
- L.on = on
- L.update_icon(UPDATE_ICON_STATE)
-
- area.power_change()
-
-/obj/machinery/light_switch/proc/handle_output()
- if(!radio_connection) //can't output without this
- return
+ var/area/A = get_area(src)
- if(logic_id_tag == null) //Don't output to an undefined id_tag
- return
+ A.lightswitch = !A.lightswitch
+ A.update_icon(UPDATE_ICON_STATE)
- var/datum/signal/signal = new
- signal.transmission_method = 1 //radio signal
- signal.source = src
-
- //Light switches are continuous signal sources, since they register as ON or OFF and stay that way until adjusted again
- if(on)
- signal.data = list(
- "tag" = logic_id_tag,
- "sigtype" = "logic",
- "state" = LOGIC_ON,
- )
- else
- signal.data = list(
- "tag" = logic_id_tag,
- "sigtype" = "logic",
- "state" = LOGIC_OFF,
- )
+ for(var/obj/machinery/light_switch/L in A)
+ L.update_icon(UPDATE_ICON_STATE)
- radio_connection.post_signal(src, signal, filter = RADIO_LOGIC)
- if(on)
- use_power(5, LIGHT) //Use a tiny bit of power every time we send an ON signal. Draws from the local APC's lighting circuit, since this is a LIGHT switch.
+ A.power_change()
/obj/machinery/light_switch/power_change()
- if(!otherarea)
- if(powered(LIGHT))
- stat &= ~NOPOWER
- set_light(1, LIGHTING_MINIMUM_POWER)
- else
- stat |= NOPOWER
- set_light(0)
+ if(powered(LIGHT))
+ stat &= ~NOPOWER
+ set_light(1, LIGHTING_MINIMUM_POWER)
+ else
+ stat |= NOPOWER
+ set_light(0)
- update_icon(UPDATE_ICON_STATE | UPDATE_OVERLAYS)
+ update_icon(UPDATE_ICON_STATE | UPDATE_OVERLAYS)
/obj/machinery/light_switch/emp_act(severity)
if(stat & (BROKEN|NOPOWER))
..(severity)
return
+
power_change()
..(severity)
-/obj/machinery/light_switch/process()
- if(logic_connect && powered(LIGHT)) //We won't send signals while unpowered, but the last signal will remain valid for anything that received it before we went dark
- handle_output()
-
-/obj/machinery/light_switch/attackby(obj/item/W as obj, mob/user as mob, params)
- if(istype(W, /obj/item/detective_scanner))
- return
- return ..()
-
/obj/machinery/light_switch/multitool_act(mob/user, obj/item/I)
. = TRUE
+
if(!I.use_tool(src, user, 0, volume = I.tool_volume))
return
+
update_multitool_menu(user)
/obj/machinery/light_switch/wrench_act(mob/user, obj/item/I)
. = TRUE
+
if(!I.tool_use_check(user, 0))
return
+
user.visible_message("[user] starts unwrenching [src] from the wall...", "You are unwrenching [src] from the wall...", "You hear ratcheting.")
- . = TRUE
if(!I.use_tool(src, user, 30, volume = I.tool_volume))
return
+
WRENCH_UNANCHOR_WALL_MESSAGE
new/obj/item/mounted/frame/light_switch(get_turf(src))
qdel(src)
-
-/obj/machinery/light_switch/multitool_menu(mob/user, obj/item/multitool/P)
- return {"
- "}
-
-/obj/machinery/light_switch/multitool_topic(mob/user, list/href_list, obj/O)
- ..()
- if("toggle_light_connect" in href_list)
- light_connect = !light_connect
- if("toggle_logic" in href_list)
- logic_connect = !logic_connect
diff --git a/code/game/machinery/machinery.dm b/code/game/machinery/machinery.dm
index 045dc9f4f176..9250c918c9ec 100644
--- a/code/game/machinery/machinery.dm
+++ b/code/game/machinery/machinery.dm
@@ -119,7 +119,7 @@ Class Procs:
atom_say_verb = "beeps"
var/siemens_strength = 0.7 // how badly will it shock you?
/// The frequency on which the machine can communicate. Used with `/datum/radio_frequency`.
- var/frequency = NONE
+ var/frequency = NONE // AA TODO - KILL THIS WRETCHED HAG
/// A reference to a `datum/radio_frequency`. Gives the machine the ability to interact with things using radio signals.
var/datum/radio_frequency/radio_connection
/// This is if the machinery is being repaired
diff --git a/code/game/objects/structures/morgue.dm b/code/game/objects/structures/morgue.dm
index 77c781b32805..d2caa51291f0 100644
--- a/code/game/objects/structures/morgue.dm
+++ b/code/game/objects/structures/morgue.dm
@@ -27,12 +27,12 @@
dir = EAST
var/obj/structure/m_tray/connected = null
var/static/status_descriptors = list(
- EXTENDED_TRAY = "The tray is currently extended.",
- EMPTY_MORGUE = "The tray is currently empty.",
- UNREVIVABLE = "The tray contains an unviable body.",
- REVIVABLE = "The tray contains a body that is responsive to revival techniques.",
- NOT_BODY = "The tray contains something that is not a body.",
- GHOST_CONNECTED = "The tray contains a body that might be responsive."
+ EXTENDED_TRAY = "The tray is currently extended.",
+ EMPTY_MORGUE = "The tray is currently empty.",
+ UNREVIVABLE = "The tray contains an unviable body.",
+ REVIVABLE = "The tray contains a body that is responsive to revival techniques.",
+ NOT_BODY = "The tray contains something that is not a body.",
+ GHOST_CONNECTED = "The tray contains a body that might be responsive."
)
anchored = TRUE
var/open_sound = 'sound/items/deconstruct.ogg'
@@ -45,35 +45,46 @@
/obj/structure/morgue/proc/update_state()
. = UPDATE_OVERLAYS
+
if(connected)
status = EXTENDED_TRAY
return
+
if(!length(contents))
status = EMPTY_MORGUE
return
+
var/mob/living/M = locate() in contents
var/obj/structure/closet/body_bag/B = locate() in contents
+
if(!M)
M = locate() in B
+
if(!M)
status = NOT_BODY
return
+
var/mob/dead/observer/G = M.get_ghost()
+
if(M.mind && !M.mind.suicided)
if(M.client)
status = REVIVABLE
return
+
if(G && G.client) //There is a ghost and it is connected to the server
status = GHOST_CONNECTED
return
+
status = UNREVIVABLE
/obj/structure/morgue/update_overlays()
. = ..()
underlays.Cut()
+
if(!connected)
. += "morgue_[status]"
underlays += emissive_appearance(icon, "morgue_[status]")
+
if(name != initial(name))
. += "morgue_label"
@@ -89,6 +100,7 @@
ex_act(severity)
qdel(src)
return
+
if(2.0)
if(prob(50))
for(var/atom/movable/A in src)
@@ -96,6 +108,7 @@
ex_act(severity)
qdel(src)
return
+
if(3.0)
if(prob(5))
for(var/atom/movable/A in src)
@@ -103,7 +116,6 @@
ex_act(severity)
qdel(src)
return
- return
/obj/structure/morgue/attack_hand(mob/user as mob)
if(connected)
@@ -115,6 +127,7 @@
else
playsound(loc, open_sound, 50, 1)
connect()
+
add_fingerprint(user)
update_icon(update_state())
return
@@ -122,11 +135,14 @@
/obj/structure/morgue/attackby(P as obj, mob/user as mob, params)
if(istype(P, /obj/item/pen))
var/t = rename_interactive(user, P)
+
if(isnull(t))
return
+
update_icon(UPDATE_OVERLAYS)
add_fingerprint(user)
return
+
return ..()
/obj/structure/morgue/wirecutter_act(mob/user)
@@ -136,25 +152,29 @@
update_icon(UPDATE_OVERLAYS)
return TRUE
-/obj/structure/morgue/relaymove(mob/user as mob)
+/obj/structure/morgue/relaymove(mob/user)
if(user.stat)
return
connect()
/obj/structure/morgue/proc/connect()
- connected = new /obj/structure/m_tray( loc )
+ connected = new /obj/structure/m_tray(loc)
step(connected, dir)
connected.layer = BELOW_OBJ_LAYER
var/turf/T = get_step(src, dir)
+
if(T.contents.Find(connected))
connected.connected = src
+
for(var/atom/movable/A in src)
if(A.move_resist != INFINITY)
A.forceMove(connected.loc)
+
connected.icon_state = "morgue_tray"
connected.dir = dir
- else
- QDEL_NULL(connected)
+ return
+
+ QDEL_NULL(connected)
/obj/structure/morgue/Destroy()
if(!connected)
@@ -163,12 +183,15 @@
A.forceMove(T)
else
QDEL_NULL(connected)
+
return ..()
/obj/structure/morgue/container_resist(mob/living/L)
var/mob/living/carbon/CM = L
+
if(!istype(CM))
return
+
if(CM.stat || CM.restrained())
return
@@ -195,7 +218,6 @@
pass_flags = LETPASSTHROW
max_integrity = 350
-
/obj/structure/m_tray/attack_hand(mob/user as mob)
if(connected)
for(var/atom/movable/A as mob|obj in loc)
@@ -206,36 +228,40 @@
add_fingerprint(user)
qdel(src)
return
- return
/obj/structure/m_tray/MouseDrop_T(atom/movable/O, mob/living/user)
- if((!( istype(O, /atom/movable) ) || O.anchored || get_dist(user, src) > 1 || get_dist(user, O) > 1 || user.contents.Find(src) || user.contents.Find(O)))
+ if((!(istype(O, /atom/movable)) || O.anchored || get_dist(user, src) > 1 || get_dist(user, O) > 1 || user.contents.Find(src) || user.contents.Find(O)))
return
+
if(!ismob(O) && !istype(O, /obj/structure/closet/body_bag))
return
+
if(!ismob(user) || HAS_TRAIT(user, TRAIT_HANDS_BLOCKED))
return
+
O.forceMove(loc)
+
if(user != O)
user.visible_message("[user] stuffs [O] into [src]!")
- return
+
/obj/structure/m_tray/Destroy()
if(connected && connected.connected == src)
connected.connected = null
+
connected = null
return ..()
/obj/structure/tray/m_tray/CanPass(atom/movable/mover, turf/target, height=0)
if(height == 0)
- return 1
+ return TRUE
if(istype(mover) && mover.checkpass(PASSTABLE))
- return 1
+ return TRUE
if(locate(/obj/structure/table) in get_turf(mover))
- return 1
- else
- return 0
+ return TRUE
+
+ return FALSE
/obj/structure/tray/m_tray/CanAStarPass(ID, dir, caller)
. = !density
@@ -247,6 +273,9 @@
* Crematorium
*/
+GLOBAL_LIST_EMPTY(crematoriums)
+// These have so much copypasted code from the above that they should really be made into subtypes
+// Someone please I beg
/obj/structure/crematorium
name = "crematorium"
desc = "A human incinerator. Works well on barbeque nights."
@@ -262,16 +291,20 @@
/obj/structure/crematorium/Initialize(mapload)
. = ..()
+ GLOB.crematoriums += src
update_icon(UPDATE_OVERLAYS)
/obj/structure/crematorium/update_overlays()
. = ..()
if(connected)
return
+
. += "crema_closed"
+
if(cremating)
. += "crema_active"
return
+
if(length(contents))
. += "crema_full"
@@ -283,6 +316,7 @@
ex_act(severity)
qdel(src)
return
+
if(2.0)
if(prob(50))
for(var/atom/movable/A in src)
@@ -290,6 +324,7 @@
ex_act(severity)
qdel(src)
return
+
if(3.0)
if(prob(5))
for(var/atom/movable/A in src)
@@ -297,21 +332,24 @@
ex_act(severity)
qdel(src)
return
- return
/obj/structure/crematorium/attack_hand(mob/user as mob)
if(cremating)
to_chat(usr, "It's locked.")
return
+
if(connected && !locked)
for(var/atom/movable/A in connected.loc)
if(!(A.anchored) && A.move_resist != INFINITY)
A.forceMove(src)
+
playsound(loc, open_sound, 50, 1)
QDEL_NULL(connected)
+
else if(!locked)
playsound(loc, open_sound, 50, 1)
connect()
+
add_fingerprint(user)
update_icon(UPDATE_OVERLAYS)
@@ -320,75 +358,92 @@
rename_interactive(user, P)
add_fingerprint(user)
return
+
return ..()
/obj/structure/crematorium/relaymove(mob/user as mob)
if(user.stat || locked)
return
+
connect()
+
/obj/structure/crematorium/proc/connect()
- connected = new /obj/structure/c_tray( loc )
+ connected = new /obj/structure/c_tray(loc)
step(connected, SOUTH)
connected.layer = BELOW_OBJ_LAYER
+
var/turf/T = get_step(src, SOUTH)
+
if(T.contents.Find(connected))
connected.connected = src
update_icon(UPDATE_OVERLAYS)
+
for(var/atom/movable/A in src)
A.forceMove(connected.loc)
+
connected.icon_state = "crema_tray"
- else
- QDEL_NULL(connected)
+ return
+
+ QDEL_NULL(connected)
/obj/structure/crematorium/proc/cremate(mob/user as mob)
if(cremating)
return //don't let you cremate something twice or w/e
- if(contents.len <= 0)
+ if(!length(contents))
for(var/mob/M in viewers(src))
- M.show_message("You hear a hollow crackle.", 1)
- return
+ M.show_message("You hear a hollow crackle.", EMOTE_VISIBLE)
- else
- for(var/mob/M in viewers(src))
- M.show_message("You hear a roar as the crematorium activates.", 1)
+ return
- cremating = TRUE
- locked = TRUE
- update_icon(UPDATE_OVERLAYS)
- for(var/mob/living/M in search_contents_for(/mob/living))
- if(QDELETED(M))
- continue
- if(M.stat!=2)
- M.emote("scream")
- if(istype(user))
- add_attack_logs(user, M, "Cremated")
- M.death(1)
- if(QDELETED(M))
- continue // Re-check for mobs that delete themselves on death
- M.ghostize()
- qdel(M)
-
- for(var/obj/O in contents) //obj instead of obj/item so that bodybags and ashes get destroyed. We dont want tons and tons of ash piling up
- qdel(O)
-
- new /obj/effect/decal/cleanable/ash(src)
- sleep(30)
- cremating = FALSE
- locked = FALSE
- update_icon(UPDATE_OVERLAYS)
- playsound(loc, 'sound/machines/ding.ogg', 50, 1)
- return
+ for(var/mob/M in viewers(src))
+ M.show_message("You hear a roar as the crematorium activates.", EMOTE_VISIBLE)
+
+ cremating = TRUE
+ locked = TRUE
+ update_icon(UPDATE_OVERLAYS)
+
+ for(var/mob/living/M in search_contents_for(/mob/living))
+ if(QDELETED(M))
+ continue
+
+ if(M.stat != DEAD)
+ M.emote("scream")
+
+ if(istype(user))
+ add_attack_logs(user, M, "Cremated")
+
+ M.death(TRUE)
+
+ if(QDELETED(M))
+ continue // Re-check for mobs that delete themselves on death
+
+ M.ghostize()
+ qdel(M)
+
+ for(var/obj/O in contents) //obj instead of obj/item so that bodybags and ashes get destroyed. We dont want tons and tons of ash piling up
+ qdel(O)
+
+ new /obj/effect/decal/cleanable/ash(src)
+ sleep(30)
+ cremating = FALSE
+ locked = FALSE
+ update_icon(UPDATE_OVERLAYS)
+ playsound(loc, 'sound/machines/ding.ogg', 50, 1)
+
/obj/structure/crematorium/Destroy()
+ GLOB.crematoriums -= src
+
if(!connected)
var/turf/T = loc
for(var/atom/movable/A in src)
A.forceMove(T)
else
QDEL_NULL(connected)
+
return ..()
/obj/structure/crematorium/container_resist(mob/living/L)
@@ -399,7 +454,7 @@
return
to_chat(CM, "You attempt to slide yourself out of \the [src]...")
- src.attack_hand(CM)
+ attack_hand(CM)
/obj/structure/crematorium/get_remote_view_fullscreens(mob/user)
if(user.stat == DEAD || !(user.sight & (SEEOBJS|SEEMOBS)))
@@ -421,16 +476,15 @@
/obj/structure/c_tray/attack_hand(mob/user as mob)
if(connected)
- for(var/atom/movable/A as mob|obj in loc)
- if(!( A.anchored ))
+ for(var/atom/movable/A in loc)
+ if(!A.anchored)
A.forceMove(connected)
- //Foreach goto(26)
+
connected.connected = null
connected.update_icon(UPDATE_OVERLAYS)
add_fingerprint(user)
qdel(src)
- return
- return
+
/obj/structure/c_tray/MouseDrop_T(atom/movable/O, mob/living/user)
if((!( istype(O, /atom/movable) ) || O.anchored || get_dist(user, src) > 1 || get_dist(user, O) > 1 || user.contents.Find(src) || user.contents.Find(O)))
@@ -463,9 +517,7 @@
active_power_usage = 5000
anchored = TRUE
req_access = list(ACCESS_CREMATORIUM)
- var/on = FALSE
- var/area/area = null
- var/otherarea = null
+ /// ID of the crematorium to hook into
var/id = 1
/obj/machinery/crema_switch/attack_ghost(mob/user)
@@ -473,17 +525,18 @@
return attack_hand(user)
/obj/machinery/crema_switch/attack_hand(mob/user)
- if(powered(power_channel)) // Do we have power?
- if(allowed(usr) || user.can_advanced_admin_interact())
- use_power(400000)
- for(var/obj/structure/crematorium/C in world)
- if(C.id == id)
- if(!C.cremating)
- C.cremate(user)
+ if(!powered(power_channel)) // Do we have power?
+ return
+
+ if(!(allowed(usr) || user.can_advanced_admin_interact()))
+ to_chat(usr, "Access denied.")
+ return
+ use_power(400000)
+ for(var/obj/structure/crematorium/C in GLOB.crematoriums)
+ if(C.id == id && !C.cremating)
+ C.cremate(user)
- else
- to_chat(usr, "Access denied.")
/mob/proc/update_morgue()
if(stat == DEAD)
diff --git a/code/modules/admin/verbs/atmosdebug.dm b/code/modules/admin/verbs/atmosdebug.dm
index 6ee18c9242d0..3595fb9dfc5d 100644
--- a/code/modules/admin/verbs/atmosdebug.dm
+++ b/code/modules/admin/verbs/atmosdebug.dm
@@ -10,11 +10,6 @@
return
to_chat(usr, "Checking for disconnected pipes...")
- //all plumbing - yes, some things might get stated twice, doesn't matter.
- for(var/thing in SSair.atmos_machinery)
- var/obj/machinery/atmospherics/plumbing = thing
- if(plumbing.nodealert)
- to_chat(usr, "Unconnected [plumbing.name] located at [plumbing.x],[plumbing.y],[plumbing.z] ([get_area(plumbing.loc)])")
//Manifolds
for(var/obj/machinery/atmospherics/pipe/manifold/pipe in SSair.atmos_machinery)
diff --git a/code/modules/atmospherics/machinery/atmospherics.dm b/code/modules/atmospherics/machinery/atmospherics.dm
index 0e303ff639a8..a7a56fc4bbbd 100644
--- a/code/modules/atmospherics/machinery/atmospherics.dm
+++ b/code/modules/atmospherics/machinery/atmospherics.dm
@@ -19,19 +19,29 @@ Pipelines + Other Objects -> Pipe network
power_channel = ENVIRON
on_blueprints = TRUE
armor = list(MELEE = 25, BULLET = 10, LASER = 10, ENERGY = 100, BOMB = 0, BIO = 100, RAD = 100, FIRE = 100, ACID = 70)
- var/nodealert = FALSE
+
+ /// Can this be unwrenched?
var/can_unwrench = FALSE
/// If the machine is currently operating or not.
var/on = FALSE
/// The amount of pressure the machine wants to operate at.
var/target_pressure = 0
- var/list/connect_types = list(CONNECT_TYPE_NORMAL)
- var/connected_to = 1 //same as above, currently not used for anything
- var/icon_connect_type = "" //"-supply" or "-scrubbers"
- var/initialize_directions = 0
+ // Vars below this point are all pipe related
+ // I know not all subtypes are pipes, but this helps
+
+ /// Type of pipes this machine can connect to
+ var/list/connect_types = list(CONNECT_TYPE_NORMAL)
+ /// What this machine is connected to
+ var/connected_to = CONNECT_TYPE_NORMAL
+ /// Icon suffix for connection, can be "-supply" or "-scrubbers"
+ var/icon_connect_type = ""
+ /// Directions to initialize in to grab pipes
+ var/initialize_directions = 0
+ /// Pipe colour, not used for all subtypes
var/pipe_color
+ /// Pipe image, not used for all subtypes
var/image/pipe_image
From 5912a499e28345f69057a8377415b3edb208cce3 Mon Sep 17 00:00:00 2001
From: AffectedArc07 <25063394+AffectedArc07@users.noreply.github.com>
Date: Tue, 2 Aug 2022 18:08:59 +0100
Subject: [PATCH 2/5] Re add link code
---
code/game/machinery/buttons.dm | 14 +++-
code/game/machinery/mass_driver.dm | 128 +++++++++++++++--------------
2 files changed, 78 insertions(+), 64 deletions(-)
diff --git a/code/game/machinery/buttons.dm b/code/game/machinery/buttons.dm
index 69a6dfdd27f4..e868cc3d9a24 100644
--- a/code/game/machinery/buttons.dm
+++ b/code/game/machinery/buttons.dm
@@ -8,7 +8,6 @@
desc = "A remote control switch for a mass driver."
icon = 'icons/obj/objects.dmi'
icon_state = "launcherbtt"
- settagwhitelist = list("id_tag", "logic_id_tag")
anchored = TRUE
armor = list(melee = 50, bullet = 50, laser = 50, energy = 50, bomb = 10, bio = 100, rad = 100, fire = 90, acid = 70)
use_power = IDLE_POWER_USE
@@ -109,6 +108,19 @@
icon_state = "launcherbtt"
active = FALSE
+/obj/machinery/driver_button/multitool_act(mob/user, obj/item/I)
+ . = TRUE
+ if(!I.use_tool(src, user, 0, volume = I.tool_volume))
+ return
+
+ if(!Adjacent(user))
+ return
+
+ var/new_tag = clean_input("Enter a new ID tag", "ID Tag", id_tag, user)
+
+ if(new_tag && Adjacent(user))
+ id_tag = new_tag
+
//////////////////////////////////////
// Ignition Switch //
diff --git a/code/game/machinery/mass_driver.dm b/code/game/machinery/mass_driver.dm
index 087701d5ed1d..2d2d7a682c16 100644
--- a/code/game/machinery/mass_driver.dm
+++ b/code/game/machinery/mass_driver.dm
@@ -8,61 +8,61 @@
idle_power_usage = 2
active_power_usage = 50
- var/power = 1.0
- var/code = 1.0
+ /// Throw power
+ var/power = 1
+ /// ID tag, used for buttons
var/id_tag = "default"
- settagwhitelist = list("id_tag")
- var/drive_range = 50 //this is mostly irrelevant since current mass drivers throw into space, but you could make a lower-range mass driver for interstation transport or something I guess.
-
-/obj/machinery/mass_driver/attackby(obj/item/W, mob/user as mob)
-
- if(istype(W, /obj/item/multitool))
- update_multitool_menu(user)
- return 1
-
- if(istype(W, /obj/item/screwdriver))
- to_chat(user, "You begin to unscrew the bolts off [src]...")
- playsound(get_turf(src), W.usesound, 50, 1)
- if(do_after(user, 30 * W.toolspeed, target = src))
- var/obj/machinery/mass_driver_frame/F = new(get_turf(src))
- F.dir = src.dir
- F.anchored = TRUE
- F.build = 4
- F.update_icon()
- qdel(src)
- return 1
+ /// This is mostly irrelevant since current mass drivers throw into space, but you could make a lower-range mass driver for interstation transport or something I guess.
+ var/drive_range = 50
- return ..()
+/obj/machinery/mass_driver/screwdriver_act(mob/living/user, obj/item/I)
+ . = TRUE
+ if(!I.use_tool(src, user, 30, volume = I.tool_volume))
+ return
+
+ var/obj/machinery/mass_driver_frame/F = new(get_turf(src))
+ F.dir = src.dir
+ F.anchored = TRUE
+ F.build = 4
+ F.update_icon()
+ qdel(src)
+
+/obj/machinery/mass_driver/multitool_act(mob/user, obj/item/I)
+ . = TRUE
+ if(!I.use_tool(src, user, 0, volume = I.tool_volume))
+ return
+
+ var/new_tag = clean_input("Enter a new ID tag", "ID Tag", id_tag, user)
-/obj/machinery/mass_driver/multitool_menu(mob/user, obj/item/multitool/P)
- return {"
-
- - [format_tag("ID Tag","id_tag","set_id")]
-
"}
+ if(new_tag && Adjacent(user))
+ id_tag = new_tag
/obj/machinery/mass_driver/proc/drive(amount)
if(stat & (BROKEN|NOPOWER))
return
- use_power(500*power)
+
+ use_power(500 * power)
var/O_limit = 0
var/atom/target = get_edge_target_turf(src, dir)
for(var/atom/movable/O in loc)
if((!O.anchored && O.move_resist != INFINITY) || istype(O, /obj/mecha)) //Mechs need their launch platforms. Also checks if something is anchored or has move resist INFINITY, which should stop ghost flinging.
O_limit++
+
if(O_limit >= 20)//so no more than 20 items are sent at a time, probably for counter-lag purposes
break
+
use_power(500)
- spawn()
- var/coef = 1
- if(emagged)
- coef = 5
- O.throw_at(target, drive_range * power * coef, power * coef)
+ var/coef = 1
+ if(emagged)
+ coef = 5
+ INVOKE_ASYNC(O, /atom/movable.proc/throw_at, target, (drive_range * power * coef), (power * coef))
+
flick("mass_driver1", src)
- return
/obj/machinery/mass_driver/emp_act(severity)
if(stat & (BROKEN|NOPOWER))
return
+
drive()
..(severity)
@@ -70,22 +70,8 @@
if(!emagged)
emagged = TRUE
to_chat(user, "You hack the Mass Driver, radically increasing the force at which it'll throw things. Better not stand in its way.")
- return 1
- return -1
-
-////////////////MASS BUMPER///////////////////
+ return TRUE
-/obj/machinery/mass_driver/bumper
- name = "mass bumper"
- desc = "Now you're here, now you're over there."
- density = TRUE
-
-/obj/machinery/mass_driver/bumper/Bumped(M as mob|obj)
- density = FALSE
- step(M, get_dir(M,src))
- spawn(1)
- density = TRUE
- drive()
return
////////////////MASS DRIVER FRAME///////////////////
@@ -108,8 +94,9 @@
to_chat(user, "You anchor \the [src]!")
anchored = TRUE
build++
- return 1
- return
+ return TRUE
+ return FALSE
+
if(1) // Fixed to the floor
if(istype(W, /obj/item/wrench))
to_chat(user, "You begin to de-anchor \the [src] from the floor.")
@@ -118,7 +105,9 @@
build--
anchored = FALSE
to_chat(user, "You de-anchored \the [src]!")
- return 1
+ return TRUE
+ return FALSE
+
if(2) // Welded to the floor
if(istype(W, /obj/item/stack/cable_coil))
var/obj/item/stack/cable_coil/C = W
@@ -128,7 +117,9 @@
C.use(2)
to_chat(user, "You've added cables to \the [src].")
build++
- return
+ return TRUE
+ return FALSE
+
if(3) // Wired
if(istype(W, /obj/item/wirecutters))
to_chat(user, "You begin to remove the wiring from \the [src].")
@@ -137,7 +128,8 @@
playsound(get_turf(src), W.usesound, 50, 1)
to_chat(user, "You've removed the cables from \the [src].")
build--
- return 1
+ return TRUE
+
if(istype(W, /obj/item/stack/rods))
var/obj/item/stack/rods/R = W
to_chat(user, "You begin to complete \the [src]...")
@@ -146,8 +138,10 @@
R.use(2)
to_chat(user, "You've added the grille to \the [src].")
build++
- return 1
- return
+ return TRUE
+
+ return FALSE
+
if(4) // Grille in place
if(istype(W, /obj/item/crowbar))
to_chat(user, "You begin to pry off the grille from \the [src]...")
@@ -155,34 +149,43 @@
if(do_after(user, 30 * W.toolspeed, target = src) && (build == 4))
new /obj/item/stack/rods(loc,2)
build--
- return 1
+ return TRUE
+
if(istype(W, /obj/item/screwdriver))
to_chat(user, "You finalize the Mass Driver...")
playsound(get_turf(src), W.usesound, 50, 1)
var/obj/machinery/mass_driver/M = new(get_turf(src))
M.dir = src.dir
qdel(src)
- return 1
- return
+ return TRUE
+
+ return FALSE
+
+
return ..()
/obj/machinery/mass_driver_frame/welder_act(mob/user, obj/item/I)
if(build != 0 && build != 1 && build != 2)
return
+
. = TRUE
+
if(!I.tool_use_check(user, 0))
return
+
if(build == 0) //can deconstruct
WELDER_ATTEMPT_SLICING_MESSAGE
if(I.use_tool(src, user, 30, volume = I.tool_volume))
WELDER_SLICING_SUCCESS_MESSAGE
new /obj/item/stack/sheet/plasteel(drop_location(),3)
qdel(src)
+
else if(build == 1) //wrenched but not welded down
WELDER_ATTEMPT_FLOOR_WELD_MESSAGE
if(I.use_tool(src, user, 40, volume = I.tool_volume) && build == 1)
WELDER_FLOOR_WELD_SUCCESS_MESSAGE
build = 2
+
else if(build == 2) //welded down
WELDER_ATTEMPT_FLOOR_SLICE_MESSAGE
if(I.use_tool(src, user, 40, volume = I.tool_volume) && build == 2)
@@ -194,8 +197,7 @@
set name = "Rotate Frame"
set src in view(1)
- if( usr.stat || usr.restrained() || HAS_TRAIT(usr, TRAIT_FAKEDEATH))
+ if(usr.stat || usr.restrained() || HAS_TRAIT(usr, TRAIT_FAKEDEATH))
return
- src.dir = turn(src.dir, -90)
- return
+ dir = turn(dir, -90)
From d883798e9f838a1f634b9b0673d1c8e3233bf081 Mon Sep 17 00:00:00 2001
From: AffectedArc07 <25063394+AffectedArc07@users.noreply.github.com>
Date: Tue, 16 Aug 2022 11:30:28 +0100
Subject: [PATCH 3/5] tweak
---
code/game/machinery/buttons.dm | 2 --
1 file changed, 2 deletions(-)
diff --git a/code/game/machinery/buttons.dm b/code/game/machinery/buttons.dm
index e868cc3d9a24..5e8bd2e56870 100644
--- a/code/game/machinery/buttons.dm
+++ b/code/game/machinery/buttons.dm
@@ -58,8 +58,6 @@
qdel(src)
/obj/machinery/driver_button/attack_hand(mob/user)
- add_fingerprint(usr)
-
if(stat & (NOPOWER|BROKEN))
return
From eda20c6dd85dbe56ab1356e6b0ae9f8ec7ea08b5 Mon Sep 17 00:00:00 2001
From: AffectedArc07 <25063394+AffectedArc07@users.noreply.github.com>
Date: Fri, 19 Aug 2022 15:35:58 +0100
Subject: [PATCH 4/5] well thats embarassing
---
code/game/machinery/lightswitch.dm | 1 +
code/game/machinery/machinery.dm | 95 ------------------------------
2 files changed, 1 insertion(+), 95 deletions(-)
diff --git a/code/game/machinery/lightswitch.dm b/code/game/machinery/lightswitch.dm
index 89a2360e57c6..157e27c4a6ca 100644
--- a/code/game/machinery/lightswitch.dm
+++ b/code/game/machinery/lightswitch.dm
@@ -9,6 +9,7 @@
/obj/machinery/light_switch/Initialize(mapload, build_dir)
. = ..()
+ name = "light switch" // Needed to remove the "(dir) bump" naming
switch(build_dir)
if(NORTH)
pixel_y = 25
diff --git a/code/game/machinery/machinery.dm b/code/game/machinery/machinery.dm
index 9250c918c9ec..b0b0beb72e8a 100644
--- a/code/game/machinery/machinery.dm
+++ b/code/game/machinery/machinery.dm
@@ -1,98 +1,3 @@
-/*
-Overview:
- Used to create objects that need a per step proc call. Default definition of 'New()'
- stores a reference to src machine in global 'machines list'. Default definition
- of 'Del' removes reference to src machine in global 'machines list'.
-
-Class Variables:
- use_power (num)
- current state of auto power use.
- Possible Values:
- 0 -- no auto power use
- 1 -- machine is using power at its idle power level
- 2 -- machine is using power at its active power level
-
- active_power_usage (num)
- Value for the amount of power to use when in active power mode
-
- idle_power_usage (num)
- Value for the amount of power to use when in idle power mode
-
- power_channel (num)
- What channel to draw from when drawing power for power mode
- Possible Values:
- EQUIP:0 -- Equipment Channel
- LIGHT:2 -- Lighting Channel
- ENVIRON:3 -- Environment Channel
-
- component_parts (list)
- A list of component parts of machine used by frame based machines.
-
- uid (num)
- Unique id of machine across all machines.
-
- gl_uid (global num)
- Next uid value in sequence
-
- stat (bitflag)
- Machine status bit flags.
- Possible bit flags:
- BROKEN:1 -- Machine is broken
- NOPOWER:2 -- No power is being supplied to machine.
- POWEROFF:4 -- tbd
- MAINT:8 -- machine is currently under going maintenance.
- EMPED:16 -- temporary broken by EMP pulse
-
- manual (num)
- Currently unused.
-
-Class Procs:
- initialize() 'game/machinery/machine.dm'
-
- Destroy() 'game/machinery/machine.dm'
-
- auto_use_power() 'game/machinery/machine.dm'
- This proc determines how power mode power is deducted by the machine.
- 'auto_use_power()' is called by the 'master_controller' game_controller every
- tick.
-
- Return Value:
- return:1 -- if object is powered
- return:0 -- if object is not powered.
-
- Default definition uses 'use_power', 'power_channel', 'active_power_usage',
- 'idle_power_usage', 'powered()', and 'use_power()' implement behavior.
-
- powered(chan = EQUIP) 'modules/power/power.dm'
- Checks to see if area that contains the object has power available for power
- channel given in 'chan'.
-
- use_power(amount, chan=EQUIP, autocalled) 'modules/power/power.dm'
- Deducts 'amount' from the power channel 'chan' of the area that contains the object.
- If it's autocalled then everything is normal, if something else calls use_power we are going to
- need to recalculate the power two ticks in a row.
-
- power_change() 'modules/power/power.dm'
- Called by the area that contains the object when ever that area under goes a
- power state change (area runs out of power, or area channel is turned off).
-
- RefreshParts() 'game/machinery/machine.dm'
- Called to refresh the variables in the machine that are contributed to by parts
- contained in the component_parts list. (example: glass and material amounts for
- the autolathe)
-
- Default definition does nothing.
-
- assign_uid() 'game/machinery/machine.dm'
- Called by machine to assign a value to the uid variable.
-
- process() 'game/machinery/machine.dm'
- Called by the 'master_controller' once per game tick for each machine that is listed in the 'machines' list.
-
-
- Compiled by Aygar
-*/
-
#define MACHINE_FLICKER_CHANCE 0.05 // roughly 1/2000 chance of a machine flickering on any given tick. That means in a two hour round each machine will flicker on average a little less than two times.
/obj/machinery
From 0ee208df08ece1a30fc06f8a1754166f55815466 Mon Sep 17 00:00:00 2001
From: AffectedArc07 <25063394+AffectedArc07@users.noreply.github.com>
Date: Tue, 23 Aug 2022 22:25:54 +0100
Subject: [PATCH 5/5] Apply suggestions from code review
Co-authored-by: Charlie <69320440+hal9000PR@users.noreply.github.com>
---
code/game/machinery/buttons.dm | 2 +-
code/game/machinery/igniter.dm | 4 ++--
code/game/machinery/mass_driver.dm | 2 +-
3 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/code/game/machinery/buttons.dm b/code/game/machinery/buttons.dm
index 5e8bd2e56870..b07c5f127297 100644
--- a/code/game/machinery/buttons.dm
+++ b/code/game/machinery/buttons.dm
@@ -50,7 +50,7 @@
return
user.visible_message("[user] starts unwrenching [src] from the wall...", "You are unwrenching [src] from the wall...", "You hear ratcheting.")
- if(!I.use_tool(src, user, 30, volume = I.tool_volume))
+ if(!I.use_tool(src, user, 3 SECONDS, volume = I.tool_volume))
return
WRENCH_UNANCHOR_WALL_MESSAGE
diff --git a/code/game/machinery/igniter.dm b/code/game/machinery/igniter.dm
index 6cd443af52d2..4b88c8bcbc3c 100755
--- a/code/game/machinery/igniter.dm
+++ b/code/game/machinery/igniter.dm
@@ -19,7 +19,7 @@
/obj/machinery/igniter/on
on = TRUE
-/obj/machinery/igniter/attack_ai(mob/user as mob)
+/obj/machinery/igniter/attack_ai(mob/user)
attack_hand(user)
/obj/machinery/igniter/attack_hand(mob/user as mob)
@@ -119,7 +119,7 @@
if(!powered())
return
- if(disable || (last_spark && world.time < last_spark + 50))
+ if(disable || (last_spark && world.time < last_spark + 5 SECONDS))
return
flick("[base_state]-spark", src)
diff --git a/code/game/machinery/mass_driver.dm b/code/game/machinery/mass_driver.dm
index 2d2d7a682c16..7bed58361501 100644
--- a/code/game/machinery/mass_driver.dm
+++ b/code/game/machinery/mass_driver.dm
@@ -20,7 +20,7 @@
if(!I.use_tool(src, user, 30, volume = I.tool_volume))
return
- var/obj/machinery/mass_driver_frame/F = new(get_turf(src))
+ var/obj/machinery/mass_driver_frame/F = new (get_turf(src))
F.dir = src.dir
F.anchored = TRUE
F.build = 4