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

75 lines
2.7 KiB
Plaintext

/obj/structure/machinery/transformer
name = "Automatic Robotic Factory 5000"
desc = "A large, complicated machine with thousands of moving parts and sharp instruments. There is an entrance and exit: large enough to fit someone inside"
icon = 'icons/obj/recycling.dmi'
icon_state = "separator-AO1"
layer = MOB_LAYER+1 // Overhead
anchored = 1
density = 1
var/transform_dead = 0
var/transform_standing = 0
var/canuse = 1
/obj/structure/machinery/transformer/Initialize()
// On us
. = ..()
if(loc)
MakeConveyor()
else
addtimer(CALLBACK(src, PROC_REF(MakeConveyor)), 5)
/obj/structure/machinery/transformer/proc/MakeConveyor()
if (!loc)
return
new /obj/structure/machinery/conveyor(loc, WEST, 1)
var/turf/T = get_turf(src)
if(T)// Spawn Conveyour Belts
//East
var/turf/east = get_step(src, EAST)
if(istype(east, /turf/simulated/floor))
new /obj/structure/machinery/conveyor(east, WEST, 1)
// West
var/turf/west = get_step(src, WEST)
if(istype(west, /turf/simulated/floor))
new /obj/structure/machinery/conveyor(west, WEST, 1)
/obj/structure/machinery/transformer/CollidedWith(atom/bumped_atom)
. = ..()
// HasEntered didn't like people lying down.
if(ishuman(bumped_atom))
// Only humans can enter from the west side, while lying down.
var/move_dir = get_dir(loc, bumped_atom.loc)
var/mob/living/carbon/human/H = bumped_atom
if((transform_standing || H.lying) && move_dir == EAST)
H.forceMove(src.loc)
make_robot(H)
/obj/structure/machinery/transformer/proc/make_robot(var/mob/living/carbon/human/H)
if(stat & (BROKEN|NOPOWER))
return
if(!transform_dead && H.stat == DEAD)
playsound(src.loc, 'sound/machines/buzz-sigh.ogg', 50, 0)
return
if(canuse)
playsound(src.loc, 'sound/items/Welder.ogg', 50, 1)
use_power_oneoff(6000) // Use a lot of power.
message_admins("[key_name(H)] has been borgified by the Autoborger 5000.")
visible_message(SPAN_DANGER("The machine makes a series of loud sounds as it starts to replace [H]'s organs and limbs with robotic parts!"))
to_chat(H, SPAN_DANGER("You feel a horrible pain as the machine you entered starts to rip you apart and replace your limbs and organs!"))
to_chat(H, SPAN_DANGER(" You lose consciousness for a brief moment before waking up with a whole new body..."))
playsound(src.loc, 'sound/machines/ping.ogg', 50, 0)
canuse = FALSE
addtimer(CALLBACK(src, PROC_REF(rearm)), 120 SECONDS)
H.Robotize()
else
playsound(src.loc, 'sound/machines/buzz-sigh.ogg', 50, 0)
visible_message(SPAN_NOTICE("The machine displays an error message reading it is still making the required parts."))
return
/obj/structure/machinery/transformer/proc/rearm()
src.visible_message(SPAN_NOTICE("\The [src] pings!"))
playsound(src.loc, 'sound/machines/ping.ogg', 50, 0)
canuse = TRUE