Enable creation of cycling airlocks

This commit is contained in:
ShadowLarkens
2024-12-04 13:45:19 -08:00
parent 847fa11fd6
commit 9a940834b4
23 changed files with 662 additions and 164 deletions
+34
View File
@@ -8,6 +8,7 @@
holder_type = /obj/machinery/door/airlock
wire_count = 12
proper_name = "Airlock"
tgui_template = "WiresAirlock"
/datum/wires/airlock/interactable(mob/user)
var/obj/machinery/door/airlock/A = holder
@@ -41,6 +42,39 @@
. += "The 'Check Timing Mechanism' light is [(A.normalspeed == 0 && haspower) ? "on" : "off"]."
. += "The IDScan light is [(A.aiDisabledIdScanner == 0 && haspower) ? "on" : "off."]"
/datum/wires/airlock/tgui_data(mob/user)
var/list/data = ..()
var/obj/machinery/door/airlock/A = holder
data["id_tag"] = A.id_tag
data["frequency"] = A.radio_connection ? A.frequency : null
data["min_freq"] = RADIO_LOW_FREQ
data["max_freq"] = RADIO_HIGH_FREQ
return data
/datum/wires/airlock/tgui_act(action, list/params)
. = ..()
if(.)
return
var/obj/machinery/door/airlock/A = holder
switch(action)
if("set_id_tag")
var/new_id = tgui_input_text(usr, "Enter a new ID tag for [A]", "[A] ID Tag", A.id_tag, 30, FALSE, TRUE)
if(new_id)
A.id_tag = new_id
return TRUE
if("set_frequency")
A.set_frequency(sanitize_frequency(text2num(params["freq"]), RADIO_LOW_FREQ, RADIO_HIGH_FREQ))
return TRUE
if("clear_frequency")
A.set_frequency(null)
return TRUE
/datum/wires/airlock/on_cut(wire, mend)
var/obj/machinery/door/airlock/A = holder
switch(wire)
+3 -1
View File
@@ -9,6 +9,8 @@
/// The display name for the TGUI window. For example, given the var is "APC"...
/// When the TGUI window is opened, "wires" will be appended to it's title, and it would become "APC wires".
var/proper_name = "Unknown"
/// The template to use for TGUI.
var/tgui_template = "Wires"
/// The total number of wires that our holder atom has.
var/wire_count = NONE
/// A list of all wires. For a list of valid wires defines that can go here, see `code/__DEFINES/wires.dm`
@@ -92,7 +94,7 @@
/datum/wires/tgui_interact(mob/user, datum/tgui/ui = null)
ui = SStgui.try_update_ui(user, src, ui)
if(!ui)
ui = new(user, src, "Wires", "[proper_name] wires")
ui = new(user, src, tgui_template, "[proper_name] wires")
ui.open()
/datum/wires/tgui_state(mob/user)