Files
Aurora.3/code/modules/library/lib_binder.dm
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

59 lines
2.1 KiB
Plaintext

/*
* Book Binder
*/
/obj/structure/machinery/bookbinder
name = "book binder"
desc = "A machine that takes paper and binds them into books. Fascinating!"
icon = 'icons/obj/library.dmi'
icon_state = "binder"
anchored = TRUE
density = TRUE
var/binding = FALSE
/obj/structure/machinery/bookbinder/attackby(obj/item/attacking_item, mob/user)
if(istype(attacking_item, /obj/item/paper))
var/obj/item/paper/paper = attacking_item
if(!anchored)
to_chat(user, SPAN_WARNING("\The [src] must be secured to the floor first!"))
return
if(binding)
to_chat(user, SPAN_WARNING("You must wait for \the [src] to finish its current operation!"))
return
var/turf/work_turf = get_turf(src)
user.drop_from_inventory(paper, src)
user.visible_message(
SPAN_NOTICE("\The [user] loads some paper into \the [src]."),
SPAN_NOTICE("You load some paper into \the [src]."))
visible_message(SPAN_NOTICE("\The [src] begins to hum as it warms up its printing drums."))
playsound(work_turf, 'sound/items/bureaucracy/binder.ogg', 75, 1)
binding = TRUE
sleep(rand(20 SECONDS, 40 SECONDS))
binding = FALSE
if(!anchored)
visible_message(SPAN_WARNING("\The [src] buzzes and flashes an error light."))
paper.forceMove(work_turf)
return
visible_message(SPAN_NOTICE("\The [src] whirs as it prints and binds a new book."))
playsound(work_turf, 'sound/items/bureaucracy/print.ogg', 75, 1)
var/obj/item/book/bound_book = new(work_turf)
bound_book.dat = paper.info
bound_book.name = "blank book"
bound_book.icon_state = "book[rand(1,7)]"
bound_book.item_state = icon_state
qdel(paper)
return
if(attacking_item.tool_behaviour == TOOL_WRENCH)
attacking_item.play_tool_sound(get_turf(src), 75)
if(anchored)
user.visible_message(
SPAN_NOTICE("\The [user] unsecures \the [src] from the floor."),
SPAN_NOTICE("You unsecure \the [src] from the floor."),
SPAN_WARNING("You hear a ratcheting noise."))
else
user.visible_message(
SPAN_NOTICE("\The [user] secures \the [src] to the floor."),
SPAN_NOTICE("You secure \the [src] to the floor."),
SPAN_WARNING("You hear a ratcheting noise."))
anchored = !anchored