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

72 lines
2.3 KiB
Plaintext

/obj/structure/machinery/mineral/rigpress
name = "hardsuit module press"
desc = "This machine converts certain items permanently into hardsuit modules."
icon = 'icons/obj/stationobjs.dmi'
icon_state = "coinpress0"
density = TRUE
anchored = TRUE
idle_power_usage = 15
active_power_usage = 50
var/pressing
var/list/press_types = list(
/obj/item/tank/jetpack = /obj/item/rig_module/maneuvering_jets,
/obj/item/mining_scanner = /obj/item/rig_module/device/orescanner,
/obj/item/pickaxe/drill = /obj/item/rig_module/device/basicdrill,
/obj/item/gun/energy/plasmacutter = /obj/item/rig_module/mounted/plasmacutter,
/obj/item/pickaxe/diamond = /obj/item/rig_module/device/drill,
/obj/item/gun/energy/vaurca/thermaldrill = /obj/item/rig_module/mounted/thermalldrill
)
/obj/structure/machinery/mineral/rigpress/mechanics_hints(mob/user, distance, is_adjacent)
. += ..()
. += "The following devices can be made:"
for(var/press_type in press_types)
var/obj/item/base = press_type
var/obj/item/product = press_types[press_type]
. += "[initial(base.name)] -> [initial(product.name)]"
/obj/structure/machinery/mineral/rigpress/update_icon()
if(pressing)
icon_state = "coinpress1"
else
icon_state = "coinpress0"
/**
* If a compatible item is fed into the machine, begin conversion. Only allow one at a time.
*/
/obj/structure/machinery/mineral/rigpress/attackby(obj/item/attacking_item, mob/user)
if(!pressing)
var/outcome_path
// Check that the item is compatible.
for(var/press_type in press_types)
if(istype(attacking_item, press_type))
outcome_path = press_types[press_type]
break
// It's not.
if(!outcome_path)
..()
return
to_chat(user, SPAN_NOTICE("You start feeding [attacking_item] into \the [src]"))
if(do_after(user, 30))
// Extra !pressing check here to protect against button-mashers. Naughty naughty.
if(!pressing)
src.visible_message(SPAN_NOTICE("\The [src] begins to print out a modsuit."))
pressing = TRUE
update_icon()
use_power_oneoff(500)
qdel(attacking_item)
spawn(300)
ping("\The [src] pings, \"Module successfuly produced!\"")
new outcome_path(get_turf(src))
use_power_oneoff(500)
pressing = FALSE
update_icon()
else
src.visible_message(SPAN_WARNING("\The [src] is already printing something!"))
else
..()