mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-10 10:12:45 +00:00
[MIRROR] R-UST rises again.
This commit is contained in:
committed by
Darlantan
parent
611a6d1238
commit
2204cba6d8
73
code/modules/tgui/modules/gyrotron_control.dm
Normal file
73
code/modules/tgui/modules/gyrotron_control.dm
Normal file
@@ -0,0 +1,73 @@
|
||||
/datum/tgui_module/gyrotron_control
|
||||
name = "Gyrotron Control"
|
||||
tgui_id = "GyrotronControl"
|
||||
|
||||
var/gyro_tag = ""
|
||||
|
||||
/datum/tgui_module/gyrotron_control/tgui_act(action, params)
|
||||
if(..())
|
||||
return TRUE
|
||||
|
||||
for(var/parameter in params)
|
||||
to_world("[parameter] - [params[parameter]]")
|
||||
|
||||
switch(action)
|
||||
if("toggle_active")
|
||||
var/obj/machinery/power/emitter/gyrotron/G = locate(params["gyro"])
|
||||
if(!istype(G))
|
||||
return 0
|
||||
|
||||
G.activate(usr)
|
||||
|
||||
return 1
|
||||
|
||||
if("set_tag")
|
||||
var/new_ident = sanitize_text(input("Enter a new ident tag.", "Gyrotron Control", gyro_tag) as null|text)
|
||||
if(new_ident)
|
||||
gyro_tag = new_ident
|
||||
|
||||
if("set_str")
|
||||
var/obj/machinery/power/emitter/gyrotron/G = locate(params["gyro"])
|
||||
if(!istype(G))
|
||||
return 0
|
||||
|
||||
var/new_strength = params["str"]
|
||||
|
||||
G.mega_energy = new_strength
|
||||
|
||||
return 1
|
||||
|
||||
if("set_rate")
|
||||
var/obj/machinery/power/emitter/gyrotron/G = locate(params["gyro"])
|
||||
if(!istype(G))
|
||||
return 0
|
||||
|
||||
var/new_delay = params["rate"]
|
||||
|
||||
G.rate = new_delay
|
||||
|
||||
return 1
|
||||
|
||||
/datum/tgui_module/gyrotron_control/tgui_data(mob/user)
|
||||
var/list/data = list()
|
||||
var/list/gyros = list()
|
||||
|
||||
for(var/obj/machinery/power/emitter/gyrotron/G in GLOB.gyrotrons)
|
||||
if(G.id_tag == gyro_tag)
|
||||
gyros.Add(list(list(
|
||||
"name" = G.name,
|
||||
"active" = G.active,
|
||||
"strength" = G.mega_energy,
|
||||
"fire_delay" = G.rate,
|
||||
"deployed" = (G.state == 2),
|
||||
"x" = G.x,
|
||||
"y" = G.y,
|
||||
"z" = G.z,
|
||||
"ref" = "\ref[G]"
|
||||
)))
|
||||
|
||||
data["gyros"] = gyros
|
||||
return data
|
||||
|
||||
/datum/tgui_module/gyrotron_control/ntos
|
||||
ntos = TRUE
|
||||
84
code/modules/tgui/modules/rustcore_monitor.dm
Normal file
84
code/modules/tgui/modules/rustcore_monitor.dm
Normal file
@@ -0,0 +1,84 @@
|
||||
/datum/tgui_module/rustcore_monitor
|
||||
name = "R-UST Core Monitoring"
|
||||
tgui_id = "RustCoreMonitor"
|
||||
|
||||
var/core_tag = ""
|
||||
|
||||
/datum/tgui_module/rustcore_monitor/tgui_act(action, params)
|
||||
if(..())
|
||||
return TRUE
|
||||
|
||||
for(var/parameter in params)
|
||||
to_world("[parameter] - [params[parameter]]")
|
||||
|
||||
switch(action)
|
||||
if("toggle_active")
|
||||
var/obj/machinery/power/fusion_core/C = locate(params["core"])
|
||||
if(!istype(C))
|
||||
return FALSE
|
||||
if(!C.Startup()) //Startup() whilst the device is active will return null.
|
||||
C.Shutdown()
|
||||
return TRUE
|
||||
|
||||
if("toggle_reactantdump")
|
||||
var/obj/machinery/power/fusion_core/C = locate(params["core"])
|
||||
if(!istype(C))
|
||||
return FALSE
|
||||
C.reactant_dump = !C.reactant_dump
|
||||
return TRUE
|
||||
|
||||
if("set_tag")
|
||||
var/new_ident = sanitize_text(input("Enter a new ident tag.", "Core Control", core_tag) as null|text)
|
||||
if(new_ident)
|
||||
core_tag = new_ident
|
||||
|
||||
if("set_fieldstr")
|
||||
var/obj/machinery/power/fusion_core/C = locate(params["core"])
|
||||
if(!istype(C))
|
||||
return FALSE
|
||||
|
||||
var/new_strength = params["fieldstr"]
|
||||
|
||||
C.target_field_strength = new_strength
|
||||
|
||||
return TRUE
|
||||
|
||||
/datum/tgui_module/rustcore_monitor/tgui_data(mob/user)
|
||||
var/list/data = list()
|
||||
var/list/cores = list()
|
||||
|
||||
for(var/obj/machinery/power/fusion_core/C in GLOB.fusion_cores)
|
||||
if(C.id_tag == core_tag)
|
||||
|
||||
var/list/reactants = list()
|
||||
|
||||
if(C.owned_field)
|
||||
for(var/reagent in C.owned_field.dormant_reactant_quantities)
|
||||
reactants.Add(list(list(
|
||||
"name" = reagent,
|
||||
"amount" = C.owned_field.dormant_reactant_quantities[reagent]
|
||||
)))
|
||||
|
||||
for(var/list/reactant in reactants)
|
||||
to_world("[reactant[1]] [reactant[2]]")
|
||||
|
||||
cores.Add(list(list(
|
||||
"name" = C.name,
|
||||
"has_field" = C.owned_field ? TRUE : FALSE,
|
||||
"reactant_dump" = C.reactant_dump,
|
||||
"core_operational" = C.check_core_status(),
|
||||
"field_instability" = (C.owned_field ? "[C.owned_field.percent_unstable * 100]%" : "ERROR"),
|
||||
"field_temperature" = (C.owned_field ? "[C.owned_field.plasma_temperature + 295]K" : "ERROR"),
|
||||
"field_strength" = C.field_strength,
|
||||
"target_field_strength" = C.target_field_strength,
|
||||
"x" = C.x,
|
||||
"y" = C.y,
|
||||
"z" = C.z,
|
||||
"ref" = "\ref[C]"
|
||||
)))
|
||||
|
||||
data["cores"] = cores
|
||||
return data
|
||||
|
||||
/datum/tgui_module/rustcore_monitor/ntos
|
||||
ntos = TRUE
|
||||
54
code/modules/tgui/modules/rustfuel_control.dm
Normal file
54
code/modules/tgui/modules/rustfuel_control.dm
Normal file
@@ -0,0 +1,54 @@
|
||||
/datum/tgui_module/rustfuel_control
|
||||
name = "Fuel Injector Control"
|
||||
tgui_id = "RustFuelControl"
|
||||
|
||||
var/fuel_tag = ""
|
||||
|
||||
/datum/tgui_module/rustfuel_control/tgui_act(action, params)
|
||||
if(..())
|
||||
return TRUE
|
||||
|
||||
for(var/parameter in params)
|
||||
to_world("[parameter] - [params[parameter]]")
|
||||
|
||||
switch(action)
|
||||
if("toggle_active")
|
||||
var/obj/machinery/fusion_fuel_injector/FI = locate(params["fuel"])
|
||||
if(!istype(FI))
|
||||
return FALSE
|
||||
|
||||
if(FI.injecting)
|
||||
FI.StopInjecting()
|
||||
else
|
||||
FI.BeginInjecting()
|
||||
|
||||
return TRUE
|
||||
|
||||
if("set_tag")
|
||||
var/new_ident = sanitize_text(input("Enter a new ident tag.", "Gyrotron Control", fuel_tag) as null|text)
|
||||
if(new_ident)
|
||||
fuel_tag = new_ident
|
||||
|
||||
/datum/tgui_module/rustfuel_control/tgui_data(mob/user)
|
||||
var/list/data = list()
|
||||
var/list/fuels = list()
|
||||
|
||||
for(var/obj/machinery/fusion_fuel_injector/FI in GLOB.fuel_injectors)
|
||||
if(FI.id_tag == fuel_tag)
|
||||
fuels.Add(list(list(
|
||||
"name" = FI.name,
|
||||
"active" = FI.injecting,
|
||||
"fuel_type" = (FI.cur_assembly ? FI.cur_assembly.fuel_type : "NONE"),
|
||||
"fuel_amt" = (FI.cur_assembly ? "[FI.cur_assembly.percent_depleted * 100]%" : "NONE"),
|
||||
"deployed" = FI.anchored,
|
||||
"x" = FI.x,
|
||||
"y" = FI.y,
|
||||
"z" = FI.z,
|
||||
"ref" = "\ref[FI]"
|
||||
)))
|
||||
|
||||
data["fuels"] = fuels
|
||||
return data
|
||||
|
||||
/datum/tgui_module/rustfuel_control/ntos
|
||||
ntos = TRUE
|
||||
@@ -10,19 +10,19 @@
|
||||
if("toggle_enable")
|
||||
var/obj/machinery/atmospherics/valve/shutoff/S = locate(params["valve"])
|
||||
if(!istype(S))
|
||||
return 0
|
||||
return FALSE
|
||||
S.close_on_leaks = !S.close_on_leaks
|
||||
return 1
|
||||
return TRUE
|
||||
|
||||
if("toggle_open")
|
||||
var/obj/machinery/atmospherics/valve/shutoff/S = locate(params["valve"])
|
||||
if(!istype(S))
|
||||
return 0
|
||||
return FALSE
|
||||
if(S.open)
|
||||
S.close()
|
||||
else
|
||||
S.open()
|
||||
return 1
|
||||
return TRUE
|
||||
|
||||
/datum/tgui_module/shutoff_monitor/tgui_data(mob/user)
|
||||
var/list/data = list()
|
||||
|
||||
Reference in New Issue
Block a user