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

161 lines
4.8 KiB
Plaintext

///SCI TELEPAD///
/obj/structure/machinery/telepad
name = "telepad"
desc = "A bluespace telepad used for creating bluespace portals."
icon = 'icons/obj/telescience.dmi'
icon_state = "pad-idle"
anchored = 1
use_power = POWER_USE_IDLE
idle_power_usage = 200
active_power_usage = 5000
var/efficiency
component_types = list(
/obj/item/circuitboard/telesci_pad,
/obj/item/bluespace_crystal/artificial = 2,
/obj/item/stock_parts/capacitor,
/obj/item/stock_parts/console_screen,
/obj/item/stack/cable_coil{amount = 1}
)
parts_power_mgmt = FALSE
/obj/structure/machinery/telepad/upgrade_hints(mob/user, distance, is_adjacent)
. += ..()
. += "Upgraded <b>capacitors</b> will improve the power efficiency of the telepad."
/obj/structure/machinery/telepad/RefreshParts()
..()
var/E
for(var/obj/item/stock_parts/capacitor/C in component_parts)
E += C.rating
efficiency = E
/obj/structure/machinery/telepad/attackby(obj/item/attacking_item, mob/user, params)
if(default_deconstruction_screwdriver(user, attacking_item))
return
if(panel_open)
if(attacking_item.tool_behaviour == TOOL_MULTITOOL)
var/obj/item/multitool/M = attacking_item
M.buffer = src
to_chat(user, "<span class='caution'>You save the data in the [attacking_item.name]'s buffer.</span>")
else
if(attacking_item.tool_behaviour == TOOL_MULTITOOL)
to_chat(user, "<span class='caution'>You should open [src]'s maintenance panel first.</span>")
default_deconstruction_crowbar(user, attacking_item)
/obj/structure/machinery/telepad/update_icon()
switch (panel_open)
if (1)
icon_state = "pad-idle-o"
if (0)
icon_state = "pad-idle"
//CARGO TELEPAD//
/obj/structure/machinery/telepad_cargo
name = "cargo telepad"
desc = "A telepad used by the Rapid Crate Sender."
icon = 'icons/obj/telescience.dmi'
icon_state = "pad-idle"
anchored = 1
use_power = POWER_USE_IDLE
idle_power_usage = 20
active_power_usage = 500
var/stage = 0
/obj/structure/machinery/telepad_cargo/attackby(obj/item/attacking_item, mob/user, params)
if(attacking_item.tool_behaviour == TOOL_WRENCH)
anchored = 0
attacking_item.play_tool_sound(get_turf(src), 50)
if(anchored)
anchored = 0
to_chat(user, "<span class='caution'>\The [src] can now be moved.</span>")
else if(!anchored)
anchored = 1
to_chat(user, "<span class='caution'>\The [src] is now secured.</span>")
if(attacking_item.tool_behaviour == TOOL_SCREWDRIVER)
if(stage == 0)
attacking_item.play_tool_sound(get_turf(src), 50)
to_chat(user, "<span class='caution'>You unscrew the telepad's tracking beacon.</span>")
stage = 1
else if(stage == 1)
attacking_item.play_tool_sound(get_turf(src), 50)
to_chat(user, "<span class='caution'>You screw in the telepad's tracking beacon.</span>")
stage = 0
if(attacking_item.tool_behaviour == TOOL_WELDER && stage == 1)
playsound(src, 'sound/items/Welder.ogg', 50, 1)
to_chat(user, "<span class='caution'>You disassemble the telepad.</span>")
new /obj/item/stack/material/steel(get_turf(src))
new /obj/item/stack/material/glass(get_turf(src))
qdel(src)
///TELEPAD CALLER///
/obj/item/telepad_beacon
name = "telepad beacon"
desc = "Use to warp in a cargo telepad."
icon = 'icons/obj/radio.dmi'
icon_state = "beacon"
item_state = "signaler"
origin_tech = list(TECH_BLUESPACE = 3)
/obj/item/telepad_beacon/attack_self(mob/user)
if(user)
to_chat(user, "<span class='caution'>Locked In</span>")
new /obj/structure/machinery/telepad_cargo(user.loc)
playsound(src, 'sound/effects/pop.ogg', 100, 1, 1)
qdel(src)
return
///HANDHELD TELEPAD USER///
/obj/item/rcs
name = "rapid-crate-sender (RCS)"
desc = "Use this to send crates and closets to cargo telepads."
icon = 'icons/obj/telescience.dmi'
icon_state = "rcs"
obj_flags = OBJ_FLAG_CONDUCTABLE
force = 15
throwforce = 10
throw_speed = 2
throw_range = 5
var/rcharges = 10
var/obj/structure/machinery/pad = null
var/last_charge = 30
var/mode = 0
var/rand_x = 0
var/rand_y = 0
var/emagged = 0
var/teleporting = 0
/obj/item/rcs/feedback_hints(mob/user, distance, is_adjacent)
. += ..()
. += "There are [rcharges] charge\s left."
/obj/item/rcs/process()
if(rcharges > 10)
rcharges = 10
if(last_charge == 0)
rcharges++
last_charge = 30
else
last_charge--
/obj/item/rcs/attack_self(mob/user)
if(emagged)
if(mode == 0)
mode = 1
playsound(src.loc, 'sound/effects/pop.ogg', 50, 0)
to_chat(user, "<span class='caution'>The telepad locator has become uncalibrated.</span>")
else
mode = 0
playsound(src.loc, 'sound/effects/pop.ogg', 50, 0)
to_chat(user, "<span class='caution'>You calibrate the telepad locator.</span>")
/obj/item/rcs/attackby(obj/item/attacking_item, mob/user)
if (istype(attacking_item, /obj/item/card/emag) && !emagged)
emagged = 1
spark(src, 5, GLOB.alldirs)
to_chat(user, "<span class='caution'>You emag the RCS. Click on it to toggle between modes.</span>")