Files
Cody Brittain ccbfbdc50a Ported the Microlathe from Bay, and began autolathe refactor: Take II (#21668)
Continued from #19839

> Part 1 of a refactor to try and make our various fabricators use the
same system and basic code. This adds the microlathe as a proof of
concept to the whole refactor, ported from Baystation. Currently not
mapped anywhere.

> This also ports over Nebula's autolathe working sound, however it is
adapted to fit our code. As such, I went to the original sound and
re-cut it, now including start and stop sounds.

Plan is overall to make it much easier to add new types of fabricators. 

### Asset Licenses
The following assets that **have not** been created by myself are
included in this PR:

| Path | Original Author | License |
| --- | --- | --- |
| icons/obj/machinery/fabricators/microlathe.dmi |
[BloodyMan](https://github.com/BloodyMan) (Baystation 12) | CC-BY-SA |
| sound/machines/fabricators/autolathe/ |
[pencilina](https://freesound.org/people/pencilina/) | CC-0 |

---------

Co-authored-by: Cody Brittain <cbrittain10@live.com>
2026-01-14 19:29:32 +00:00

77 lines
2.1 KiB
Plaintext

/datum/wires/fabricator
proper_name = "Fabricator"
holder_type = /obj/machinery/fabricator
/datum/wires/fabricator/New(atom/holder)
wires = list(
WIRE_HACK, WIRE_DISABLE,
WIRE_SHOCK
)
add_duds(2)
..()
/datum/wires/fabricator/get_status()
var/obj/machinery/fabricator/A = holder
. = ..()
. += "\The [A] [(A.fab_status_flags & FAB_DISABLED) ? "is dead quiet" : "has a soft electric whirr"]."
. += "\The [A] [(A.fab_status_flags & FAB_SHOCKED) ? "is making sparking noises" : "is cycling normally"]."
. += "\The [A] [(A.fab_status_flags & FAB_HACKED) ? "rarely" : "occasionally"] makes a beep boop noise."
/datum/wires/fabricator/interactable(mob/user)
if(!..())
return FALSE
var/obj/machinery/fabricator/A = holder
if(A.panel_open)
return TRUE
return FALSE
/datum/wires/fabricator/on_cut(wire, mend, source)
var/obj/machinery/fabricator/A = holder
switch(wire)
if(WIRE_HACK)
if(mend)
A.fab_status_flags &= ~FAB_HACKED
else
A.fab_status_flags |= FAB_HACKED
if(WIRE_SHOCK)
if(mend)
A.fab_status_flags &= ~FAB_SHOCKED
else
A.fab_status_flags |= FAB_SHOCKED
if(WIRE_DISABLE)
if(mend)
A.fab_status_flags &= ~FAB_DISABLED
else
A.fab_status_flags |= FAB_DISABLED
/datum/wires/fabricator/proc/reset_flag(wire, user, flag)
var/obj/machinery/fabricator/A = holder
if(A && !is_cut(wire) && flag)
A.fab_status_flags &= ~flag
interact(user)
/datum/wires/fabricator/on_pulse(wire, user)
if(is_cut(wire))
return
var/obj/machinery/fabricator/A = holder
switch(wire)
if(WIRE_HACK)
if(A.fab_status_flags & FAB_HACKED)
A.fab_status_flags &= ~FAB_HACKED
else
A.fab_status_flags |= FAB_HACKED
addtimer(CALLBACK(src, PROC_REF(reset_flag), wire, user, FAB_HACKED))
if(WIRE_SHOCK)
if(A.fab_status_flags & FAB_SHOCKED)
A.fab_status_flags &= ~FAB_SHOCKED
else
A.fab_status_flags |= FAB_SHOCKED
addtimer(CALLBACK(src, PROC_REF(reset_flag), wire, user, FAB_SHOCKED))
if(WIRE_DISABLE)
if(A.fab_status_flags & FAB_DISABLED)
A.fab_status_flags &= ~FAB_DISABLED
else
A.fab_status_flags |= FAB_DISABLED
addtimer(CALLBACK(src, PROC_REF(reset_flag), wire, user, FAB_DISABLED))