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

80 lines
2.7 KiB
Plaintext

GLOBAL_LIST_INIT_TYPED(doppler_arrays, /obj/structure/machinery/doppler_array, list())
/obj/structure/machinery/doppler_array
name = "tachyon-doppler array"
desc = "A highly precise sensor array which measures the release of quants from decaying tachyons. The doppler shifting of the mirror-image formed by these quants can reveal the size, location and temporal affects of energetic disturbances within a large radius ahead of the array."
icon = 'icons/obj/modular_computers/modular_console.dmi'
icon_state = "computer"
anchored = TRUE
density = TRUE
var/active = TRUE
/obj/structure/machinery/doppler_array/feedback_hints(mob/user, distance, is_adjacent)
. += ..()
. += SPAN_NOTICE("\The [src] is [active ? "listening for explosions" : "inactive"].")
/obj/structure/machinery/doppler_array/Initialize()
. = ..()
GLOB.doppler_arrays += src
update_icon()
/obj/structure/machinery/doppler_array/Destroy()
GLOB.doppler_arrays -= src
return ..()
/obj/structure/machinery/doppler_array/attack_hand(mob/user)
active = !active
to_chat(user, SPAN_NOTICE("\The [src] is now [active ? "listening for explosions" : "[SPAN_WARNING("inactive")]"]."))
/obj/structure/machinery/doppler_array/update_icon()
icon_state = initial(icon_state)
set_light(0)
if(stat & BROKEN)
icon_state = "broken"
else
ClearOverlays()
if(!(stat & NOPOWER))
set_light(2, 1, COLOR_CYAN)
AddOverlays(image(icon, src, "teleport"))
/obj/structure/machinery/doppler_array/proc/sense_explosion(var/x0,var/y0,var/z0,var/devastation_range,var/heavy_impact_range,var/light_impact_range)
if(!active)
return
if(stat & NOPOWER)
return
if(z != z0)
return
var/dx = abs(x0-x)
var/dy = abs(y0-y)
var/distance
if(dx > dy)
distance = dx
else
distance = dy
if(distance > 100)
return
var/message = "Explosive disturbance detected - Epicenter at: grid ([x0],[y0],[z0]). Epicenter radius: [devastation_range]. Outer radius: [heavy_impact_range]. Shockwave radius: [light_impact_range]."
GLOB.global_announcer.autosay(message, "Tachyon-Doppler Array", "Science")
var/list/gained_tech
switch(devastation_range)
if(-INFINITY to 1) // minimum
gained_tech = list(TECH_BLUESPACE = 1, TECH_COMBAT = 2, TECH_MATERIAL = 2)
if(1 to 2) // starter bombs
gained_tech = list(TECH_BLUESPACE = 2, TECH_PHORON = 2, TECH_COMBAT = 3, TECH_MATERIAL = 3)
if(2 to 4) // max toxins can get
gained_tech = list(TECH_BLUESPACE = 3, TECH_PHORON = 3, TECH_COMBAT = 3, TECH_MATERIAL = 3, TECH_ENGINEERING = 3)
else
gained_tech = list(TECH_BLUESPACE = 4, TECH_PHORON = 4, TECH_COMBAT = 4, TECH_MATERIAL = 4, TECH_ENGINEERING = 4)
new /obj/item/research_slip(get_turf(src), gained_tech)
/obj/structure/machinery/doppler_array/power_change()
..()
update_icon()