Files
Batrachophreno 4ecb0bc21c Repath obj/machinery to obj/structure/machinery [MDB Ignore] (#22500)
Repaths obj/machinery to obj/structure/machinery. **Note for
reviewers:** the only meaningful changed code exists within
**code/game/objects/structures.dm** and
**code/game/objects/structures/_machinery.dm**, largely concerning
damage procs. With the exception of moving airlock defines to their own
file, ALL OTHER CHANGES ARE STRICTLY PATH CHANGES.

Objects, _categorically_, are largely divided between those you can hold
in your hand/inventory and those you can't. Machinery objects are
already subtypes of Structures behaviorally, this PR just makes their
pathing reflect that, and allows for future work (tool actions, more
health/destruction functionality) to be developed without unnecessary
code duplication.

I have tested this PR by loading up the Horizon and dismantling various
machines and structures with tools, shooting guns of various types
throughout the ship, and detonating a bunch of explosions throughout the
ship.
2026-05-26 19:35:48 +00:00

75 lines
1.9 KiB
Plaintext

// Wires for cameras.
/datum/wires/camera
proper_name = "Camera"
holder_type = /obj/structure/machinery/camera
/datum/wires/camera/New(atom/holder)
wires = list(
WIRE_POWER, WIRE_FOCUS,
WIRE_LIGHT, WIRE_ALARM
)
add_duds(1)
..()
/datum/wires/camera/get_status()
var/obj/structure/machinery/camera/C = holder
. = ..()
. += "[(C.view_range == initial(C.view_range) ? "The focus light is on." : "The focus light is off.")]"
. += "[(C.can_use() ? "The power link light is on." : "The power link light is off.")]"
. += "[(C.light_disabled ? "The camera light is off." : "The camera light is on.")]"
. += "[(C.alarm_on ? "The alarm light is on." : "The alarm light is off.")]"
/datum/wires/camera/interactable(mob/user)
if(!..())
return FALSE
var/obj/structure/machinery/camera/C = holder
return C.panel_open
/datum/wires/camera/on_cut(wire, mend, source)
var/obj/structure/machinery/camera/C = holder
switch(wire)
if(WIRE_FOCUS)
var/range = (mend ? initial(C.view_range) : C.short_range)
C.setViewRange(range)
if(WIRE_POWER)
if(C.status && !mend || !C.status && mend)
C.deactivate(usr, 1)
if(WIRE_LIGHT)
C.light_disabled = !mend
if(WIRE_ALARM)
if(!mend)
C.triggerCameraAlarm()
else
C.cancelCameraAlarm()
return
/datum/wires/camera/on_pulse(wire)
var/obj/structure/machinery/camera/C = holder
if(is_cut(wire))
return
switch(wire)
if(WIRE_FOCUS)
var/new_range = (C.view_range == initial(C.view_range) ? C.short_range : initial(C.view_range))
C.setViewRange(new_range)
if(WIRE_POWER)
C.kick_viewers() // Kicks anyone watching the camera
if(WIRE_LIGHT)
C.light_disabled = !C.light_disabled
if(WIRE_ALARM)
C.visible_message("[icon2html(C, viewers(get_turf(C)))] *beep*", "[icon2html(C, viewers(get_turf(C)))] *beep*")
return
/datum/wires/camera/proc/CanDeconstruct()
if(is_cut(WIRE_POWER) && is_cut(WIRE_FOCUS) && is_cut(WIRE_LIGHT))
return TRUE
else
return FALSE