Files
BatrachophrenoandGitHub 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

50 lines
1.8 KiB
Plaintext

// This should probably be something cooler than a button, eventually.
/obj/structure/machinery/button/distress
name = "distress beacon launcher"
desc = "Press this button to launch a distress beacon."
var/recorded_message
/obj/structure/machinery/button/distress/Initialize(mapload, d, populate_components, is_internal)
..()
return INITIALIZE_HINT_LATELOAD
/obj/structure/machinery/button/distress/LateInitialize()
. = ..()
if(SSatlas.current_map.use_overmap && !linked)
var/my_sector = GLOB.map_sectors["[z]"]
if (istype(my_sector, /obj/effect/overmap/visitable))
attempt_hook_up(my_sector)
/obj/structure/machinery/button/distress/hear_talk(mob/M, text, verb, datum/language/speaking)
recorded_message = text
/obj/structure/machinery/button/distress/attack_hand(var/mob/user)
if(..())
return
if(!linked)
return
if(linked.has_called_distress_beacon)
to_chat(user, SPAN_WARNING("The distress beacon has already been launched!"))
return
use_power_oneoff(10)
active = TRUE
var/choice = alert(user, "Are you sure you want to launch a distress beacon?", "Distress Beacon", "Yes", "No")
if(choice == "No" || !choice)
active = FALSE
return
var/distress_message = tgui_input_text(user, "Enter a distress message that other vessels will receive.", "Distress Beacon", multiline = TRUE)
if(distress_message)
become_hearing_sensitive()
user.say(distress_message)
lose_hearing_sensitivity()
else
to_chat(user, SPAN_WARNING("The beacon refuses to launch without a message!"))
active = FALSE
return
if(use_check_and_message(user)) //Lots of inputs, user may have moved.
return
SSdistress.trigger_overmap_distress_beacon(linked, distress_message, user)
to_chat(user, SPAN_NOTICE("Distress beacon launched."))
playsound(src, 'sound/effects/alert.ogg', 50)
active = FALSE