Re-structure tgui's ui_act

This commit is contained in:
Bjorn Neergaard
2016-01-22 19:25:36 -06:00
parent 4c192d705a
commit 1599742f7e
47 changed files with 713 additions and 621 deletions
@@ -1,4 +1,3 @@
/*
Passive gate is similar to the regular pump except:
@@ -11,7 +10,7 @@ Passive gate is similar to the regular pump except:
icon_state = "passgate_map"
name = "passive gate"
desc = "A one-way air valve that does not require power"
desc = "A one-way air valve that does not require power."
can_unwrench = 1
@@ -103,24 +102,32 @@ Passive gate is similar to the regular pump except:
/obj/machinery/atmospherics/components/binary/passive_gate/get_ui_data()
var/data = list()
data["on"] = on
data["set_pressure"] = round(target_pressure)
data["pressure"] = round(target_pressure)
data["max_pressure"] = round(MAX_OUTPUT_PRESSURE)
return data
/obj/machinery/atmospherics/components/binary/passive_gate/ui_act(action, params)
if(..())
return
switch(action)
if("power")
on = !on
investigate_log("was turned [on ? "on" : "off"] by [key_name(usr)]", "atmos")
. = TRUE
if("pressure")
switch(params["pressure"])
if ("max")
target_pressure = MAX_OUTPUT_PRESSURE
if ("custom")
target_pressure = max(0, min(MAX_OUTPUT_PRESSURE, safe_input("Pressure control", "Enter new output pressure (0-[MAX_OUTPUT_PRESSURE] kPa)", target_pressure)))
investigate_log("was set to [target_pressure] kPa by [key_name(usr)]", "atmos")
var/pressure = params["pressure"]
if(pressure == "max")
target_pressure = MAX_OUTPUT_PRESSURE
. = TRUE
else if(pressure == "input")
pressure = input("New output pressure (0-[MAX_OUTPUT_PRESSURE] kPa):", name, target_pressure) as num|null
. = .(action, list("pressure" = pressure))
else if(text2num(pressure) != null)
target_pressure = Clamp(text2num(pressure), 0, MAX_OUTPUT_PRESSURE)
. = TRUE
if(.)
investigate_log("was set to [target_pressure] kPa by [key_name(usr)]", "atmos")
update_icon()
return 1
/obj/machinery/atmospherics/components/binary/passive_gate/atmosinit()
..()
@@ -146,12 +153,10 @@ Passive gate is similar to the regular pump except:
investigate_log("was turned [on ? "on" : "off"] by a remote signal", "atmos")
if("status" in signal.data)
spawn(2)
broadcast_status()
return //do not update_icon
spawn(2)
broadcast_status()
return
broadcast_status()
update_icon()
return
@@ -15,7 +15,7 @@ Thus, the two variables affect pump operation are set in New():
/obj/machinery/atmospherics/components/binary/pump
icon_state = "pump_map"
name = "gas pump"
desc = "A pump"
desc = "A pump that moves gas by pressure."
can_unwrench = 1
@@ -114,24 +114,32 @@ Thus, the two variables affect pump operation are set in New():
/obj/machinery/atmospherics/components/binary/pump/get_ui_data()
var/data = list()
data["on"] = on
data["set_pressure"] = round(target_pressure)
data["pressure"] = round(target_pressure)
data["max_pressure"] = round(MAX_OUTPUT_PRESSURE)
return data
/obj/machinery/atmospherics/components/binary/pump/ui_act(action, params)
if(..())
return
switch(action)
if("power")
on = !on
investigate_log("was turned [on ? "on" : "off"] by [key_name(usr)]", "atmos")
. = TRUE
if("pressure")
switch(params["pressure"])
if("max")
target_pressure = MAX_OUTPUT_PRESSURE
if("custom")
target_pressure = max(0, min(MAX_OUTPUT_PRESSURE, safe_input("Pressure control", "Enter new output pressure (0-[MAX_OUTPUT_PRESSURE] kPa)", target_pressure)))
investigate_log("was set to [target_pressure] kPa by [key_name(usr)]", "atmos")
var/pressure = params["pressure"]
if(pressure == "max")
target_pressure = MAX_OUTPUT_PRESSURE
. = TRUE
else if(pressure == "input")
pressure = input("New output pressure (0-[MAX_OUTPUT_PRESSURE] kPa):", name, target_pressure) as num|null
. = .(action, list("pressure" = pressure))
else if(text2num(pressure) != null)
target_pressure = Clamp(text2num(pressure), 0, MAX_OUTPUT_PRESSURE)
. = TRUE
if(.)
investigate_log("was set to [target_pressure] kPa by [key_name(usr)]", "atmos")
update_icon()
return 1
/obj/machinery/atmospherics/components/binary/pump/atmosinit()
..()
@@ -157,12 +165,10 @@ Thus, the two variables affect pump operation are set in New():
investigate_log("was turned [on ? "on" : "off"] by a remote signal", "atmos")
if("status" in signal.data)
spawn(2)
broadcast_status()
return //do not update_icon
spawn(2)
broadcast_status()
return
broadcast_status()
update_icon()
return
@@ -15,7 +15,7 @@ Thus, the two variables affect pump operation are set in New():
/obj/machinery/atmospherics/components/binary/volume_pump
icon_state = "volpump_map"
name = "volumetric gas pump"
desc = "A volumetric pump"
desc = "A pump that moves gas by volume."
can_unwrench = 1
@@ -110,7 +110,7 @@ Thus, the two variables affect pump operation are set in New():
/obj/machinery/atmospherics/components/binary/volume_pump/get_ui_data()
var/data = list()
data["on"] = on
data["transfer_rate"] = round(transfer_rate)
data["rate"] = round(transfer_rate)
data["max_rate"] = round(MAX_TRANSFER_RATE)
return data
@@ -120,19 +120,27 @@ Thus, the two variables affect pump operation are set in New():
set_frequency(frequency)
/obj/machinery/atmospherics/components/binary/volume_pump/ui_act(action, params)
if(..())
return
switch(action)
if("power")
on = !on
investigate_log("was turned [on ? "on" : "off"] by [key_name(usr)]", "atmos")
if("transfer")
switch(params["rate"])
if("max")
transfer_rate = MAX_TRANSFER_RATE
if("custom")
transfer_rate = max(0, min(MAX_TRANSFER_RATE, safe_input("Pressure control", "Enter new transfer rate (0-[MAX_TRANSFER_RATE] L/s)", transfer_rate)))
investigate_log("was set to [transfer_rate] L/s by [key_name(usr)]", "atmos")
. = TRUE
if("rate")
var/rate = params["rate"]
if(rate == "max")
transfer_rate = MAX_TRANSFER_RATE
. = TRUE
else if(rate == "input")
rate = input("New transfer rate (0-[MAX_TRANSFER_RATE] L/s):", name, transfer_rate) as num|null
. = .(action, list("rate" = rate))
else if(text2num(rate) != null)
transfer_rate = Clamp(text2num(rate), 0, MAX_TRANSFER_RATE)
. = TRUE
if(.)
investigate_log("was set to [transfer_rate] L/s by [key_name(usr)]", "atmos")
update_icon()
return 1
/obj/machinery/atmospherics/components/binary/volume_pump/receive_signal(datum/signal/signal)
if(!signal.data["tag"] || (signal.data["tag"] != id) || (signal.data["sigtype"]!="command"))
@@ -1,11 +1,3 @@
#define FILTER_NOTHING ""
//very cleverly using the gas IDs so as to simplify a bunch of logic
#define FILTER_PLASMA "plasma"
#define FILTER_OXYGEN "o2"
#define FILTER_NITROGEN "n2"
#define FILTER_CARBONDIOXIDE "co2"
#define FILTER_NITROUSOXIDE "n2o"
/obj/machinery/atmospherics/components/trinary/filter
name = "gas filter"
icon_state = "filter_off"
@@ -13,7 +5,7 @@
can_unwrench = 1
var/on = 0
var/target_pressure = ONE_ATMOSPHERE
var/filter_type = FILTER_PLASMA
var/filter_type = ""
var/frequency = 0
var/datum/radio_frequency/radio_connection
@@ -98,10 +90,6 @@
filtered_out.assert_gas(filter_type)
filtered_out.gases[filter_type][MOLES] = removed.gases[filter_type][MOLES]
removed.gases[filter_type][MOLES] = 0
if(filter_type == FILTER_PLASMA && removed.gases["agent_b"])
filtered_out.assert_gas("agent_b")
filtered_out.gases["agent_b"][MOLES] = removed.gases["agent_b"][MOLES]
removed.gases["agent_b"][MOLES] = 0
removed.garbage_collect()
else
filtered_out = null
@@ -133,37 +121,39 @@
/obj/machinery/atmospherics/components/trinary/filter/get_ui_data()
var/data = list()
data["on"] = on
data["set_pressure"] = round(target_pressure)
data["pressure"] = round(target_pressure)
data["max_pressure"] = round(MAX_OUTPUT_PRESSURE)
data["filter_type"] = filter_type
return data
/obj/machinery/atmospherics/components/trinary/filter/ui_act(action, params)
if(..())
return
switch(action)
if("power")
on = !on
investigate_log("was turned [on ? "on" : "off"] by [key_name(usr)]", "atmos")
. = TRUE
if("pressure")
switch(params["pressure"])
if("max")
target_pressure = MAX_OUTPUT_PRESSURE
if("custom")
target_pressure = max(0, min(MAX_OUTPUT_PRESSURE, safe_input("Pressure control", "Enter new output pressure (0-[MAX_OUTPUT_PRESSURE] kPa):", target_pressure)))
investigate_log("was set to [target_pressure] kPa by [key_name(usr)]", "atmos")
var/pressure = params["pressure"]
if(pressure == "max")
target_pressure = MAX_OUTPUT_PRESSURE
. = TRUE
else if(pressure == "input")
pressure = input("New output pressure (0-[MAX_OUTPUT_PRESSURE] kPa):", name, target_pressure) as num|null
. = .(action, list("pressure" = pressure))
else if(text2num(pressure) != null)
target_pressure = Clamp(text2num(pressure), 0, MAX_OUTPUT_PRESSURE)
. = TRUE
if(.)
investigate_log("was set to [target_pressure] kPa by [key_name(usr)]", "atmos")
if("filter")
filter_type = params["mode"]
var/filtering_name = "nothing"
switch(filter_type)
if(FILTER_PLASMA)
filtering_name = "plasma"
if(FILTER_OXYGEN)
filtering_name = "oxygen"
if(FILTER_NITROGEN)
filtering_name = "nitrogen"
if(FILTER_CARBONDIOXIDE)
filtering_name = "carbon dioxide"
if(FILTER_NITROUSOXIDE)
filtering_name = "nitrous oxide"
investigate_log("was set to filter [filtering_name] by [key_name(usr)]", "atmos")
filter_type = ""
var/filter_name = "nothing"
var/mode = params["mode"]
if(mode in meta_gas_info)
filter_type = mode
filter_name = meta_gas_info[mode][META_GAS_NAME]
investigate_log("was set to filter [filter_name] by [key_name(usr)]", "atmos")
. = TRUE
update_icon()
return 1
@@ -139,26 +139,36 @@
return data
/obj/machinery/atmospherics/components/trinary/mixer/ui_act(action, params)
if(..())
return
switch(action)
if("power")
on = !on
investigate_log("was turned [on ? "on" : "off"] by [key_name(usr)]", "atmos")
. = TRUE
if("pressure")
switch(params["pressure"])
if("max")
target_pressure = MAX_OUTPUT_PRESSURE
if("custom")
target_pressure = max(0, min(MAX_OUTPUT_PRESSURE, safe_input("Pressure control", "Enter new output pressure (0-[MAX_OUTPUT_PRESSURE] kPa):", target_pressure)))
investigate_log("was set to [target_pressure] kPa by [key_name(usr)]", "atmos")
var/pressure = params["pressure"]
if(pressure == "max")
target_pressure = MAX_OUTPUT_PRESSURE
. = TRUE
else if(pressure == "input")
pressure = input("New output pressure (0-[MAX_OUTPUT_PRESSURE] kPa):", name, target_pressure) as num|null
. = .(action, list("pressure" = pressure))
else if(text2num(pressure) != null)
target_pressure = Clamp(text2num(pressure), 0, MAX_OUTPUT_PRESSURE)
. = TRUE
if(.)
investigate_log("was set to [target_pressure] kPa by [key_name(usr)]", "atmos")
if("node1")
var/value = text2num(params["concentration"])
src.node1_concentration = max(0, min(1, src.node1_concentration + value))
src.node2_concentration = max(0, min(1, src.node2_concentration - value))
node1_concentration = max(0, min(1, node1_concentration + value))
node2_concentration = max(0, min(1, node2_concentration - value))
investigate_log("was set to [node1_concentration] % on node 1 by [key_name(usr)]", "atmos")
. = TRUE
if("node2")
var/value = text2num(params["concentration"])
src.node2_concentration = max(0, min(1, src.node2_concentration + value))
src.node1_concentration = max(0, min(1, src.node1_concentration - value))
node2_concentration = max(0, min(1, node2_concentration + value))
node1_concentration = max(0, min(1, node1_concentration - value))
investigate_log("was set to [node2_concentration] % on node 2 by [key_name(usr)]", "atmos")
update_icon()
return 1
. = TRUE
update_icon()
@@ -230,23 +230,25 @@
/obj/machinery/atmospherics/components/unary/cryo_cell/ui_act(action, params)
if(..())
return
switch(action)
if("power")
if(on)
on = FALSE
else if(!state_open)
on = TRUE
. = TRUE
if("door")
if(state_open)
close_machine()
else
open_machine()
. = TRUE
if("autoeject")
autoeject = !autoeject
. = TRUE
if("ejectbeaker")
if(beaker)
beaker.loc = loc
beaker = null
. = TRUE
update_icon()
return 1
@@ -51,8 +51,8 @@
/obj/machinery/atmospherics/components/unary/thermomachine/process_atmos()
..()
if(!on)
return 0
if(!on || !NODE1)
return
var/datum/gas_mixture/air_contents = AIR1
var/air_heat_capacity = air_contents.heat_capacity()
@@ -100,7 +100,7 @@
data["min"] = min_temperature
data["max"] = max_temperature
data["target"] = target_temperature
data["initial"] = T20C
data["initial"] = initial(target_temperature)
var/datum/gas_mixture/air1 = AIR1
data["temperature"] = air1.temperature
@@ -114,15 +114,24 @@
if("power")
on = !on
use_power = 1 + on
update_icon()
return 1
investigate_log("was turned [on ? "on" : "off"] by [key_name(usr)]", "atmos")
. = TRUE
if("target")
target_temperature += text2num(params["adjust"])
if(min_temperature)
target_temperature = Clamp(target_temperature, min_temperature, T20C)
else if(max_temperature)
target_temperature = Clamp(target_temperature, T20C, max_temperature)
return 1
var/target = params["target"]
var/adjust = text2num(params["adjust"])
if(target == "input")
target = input("Set new target ([min_temperature]-[max_temperature] K):", name, target_temperature) as num|null
. = .(action, list("target" = target))
else if(text2num(target) != null)
target_temperature = text2num(target)
. = TRUE
else if(adjust)
target_temperature += adjust
. = TRUE
if(.)
target_temperature = Clamp(target_temperature, min_temperature, max_temperature)
investigate_log("was set to [target_temperature] K by [key_name(usr)]", "atmos")
update_icon()
/obj/machinery/atmospherics/components/unary/thermomachine/freezer
name = "freezer"
@@ -130,6 +139,8 @@
icon_state = "freezer"
icon_state_on = "freezer_1"
icon_state_open = "freezer-o"
max_temperature = T20C
min_temperature = 170
/obj/machinery/atmospherics/components/unary/thermomachine/freezer/New()
..()
@@ -140,7 +151,7 @@
var/L
for(var/obj/item/weapon/stock_parts/micro_laser/M in component_parts)
L += M.rating
min_temperature = max(T0C - (170 + L * 15), TCMB)
min_temperature = max(T0C - (initial(min_temperature) + L * 15), TCMB)
/obj/machinery/atmospherics/components/unary/thermomachine/heater
name = "heater"
@@ -148,6 +159,8 @@
icon_state = "heater"
icon_state_on = "heater_1"
icon_state_open = "heater-o"
max_temperature = 140
min_temperature = T20C
/obj/machinery/atmospherics/components/unary/thermomachine/heater/New()
..()
@@ -158,4 +171,4 @@
var/L
for(var/obj/item/weapon/stock_parts/micro_laser/M in component_parts)
L += M.rating
max_temperature = T20C + (140 * L)
max_temperature = T20C + (initial(max_temperature) * L)
+5 -5
View File
@@ -6,11 +6,11 @@ var/list/hardcoded_gases = list("o2","n2","co2","plasma") //the main four gases,
var/list/gas_info = new(4)
var/datum/gas/g = gas_path
gas_info[1] = initial(g.specific_heat)
gas_info[2] = initial(g.name)
gas_info[3] = initial(g.moles_visible)
if(gas_info[3] != null)
gas_info[4] = new /obj/effect/overlay/gas(initial(g.gas_overlay))
gas_info[META_GAS_SPECIFIC_HEAT] = initial(g.specific_heat)
gas_info[META_GAS_NAME] = initial(g.name)
gas_info[META_GAS_MOLES_VISIBLE] = initial(g.moles_visible)
if(gas_info[META_GAS_MOLES_VISIBLE] != null)
gas_info[META_GAS_OVERLAY] = new /obj/effect/overlay/gas(initial(g.gas_overlay))
meta_list[initial(g.id)] = gas_info
. = meta_list
+8 -4
View File
@@ -13,10 +13,14 @@
#define ARCHIVE 2
#define GAS_META 3
//this is kinda hacky... but it means I don't have to change every single time they're called.
#define SPECIFIC_HEAT GAS_META][1
#define GAS_NAME GAS_META][2
#define GAS_OVERLAY GAS_META][4
#define MOLES_VISIBLE GAS_META][3
#define META_GAS_SPECIFIC_HEAT 1
#define META_GAS_NAME 2
#define META_GAS_OVERLAY 4
#define META_GAS_MOLES_VISIBLE 3
#define SPECIFIC_HEAT GAS_META][META_GAS_SPECIFIC_HEAT
#define GAS_NAME GAS_META][META_GAS_NAME
#define GAS_OVERLAY GAS_META][META_GAS_OVERLAY
#define MOLES_VISIBLE GAS_META][META_GAS_MOLES_VISIBLE
//stuff you should probably leave well alone!
//ATMOS
-5
View File
@@ -26,11 +26,6 @@
return text("#[][][]", textr, textg, textb)
return
//Returns the middle-most value
/proc/dd_range(low, high, num)
return max(low,min(high,num))
/proc/Get_Angle(atom/movable/start,atom/movable/end)//For beams.
if(!start || !end) return 0
var/dy
+5 -3
View File
@@ -326,9 +326,8 @@ var/list/wire_color_directory = list()
return data
/datum/wires/ui_act(action, params)
if(!interactable(usr))
if(..() || !interactable(usr))
return
var/target_wire = params["wire"]
var/mob/living/L = usr
var/obj/item/I = L.get_active_hand()
@@ -336,11 +335,13 @@ var/list/wire_color_directory = list()
if("cut")
if(istype(I, /obj/item/weapon/wirecutters) || IsAdminGhost(usr))
cut_color(target_wire)
. = TRUE
else
L << "<span class='warning'>You need wirecutters!</span>"
if("pulse")
if(istype(I, /obj/item/device/multitool) || IsAdminGhost(usr))
pulse_color(target_wire)
. = TRUE
else
L << "<span class='warning'>You need a multitool!</span>"
if("attach")
@@ -348,6 +349,7 @@ var/list/wire_color_directory = list()
var/obj/item/O = detach_assembly(target_wire)
if(O)
L.put_in_hands(O)
. = TRUE
else
if(istype(I, /obj/item/device/assembly))
var/obj/item/device/assembly/A = I
@@ -355,6 +357,6 @@ var/list/wire_color_directory = list()
if(!L.drop_item())
return
attach_assembly(target_wire, A)
. = TRUE
else
L << "<span class='warning'>You need an attachable assembly!</span>"
return 1
+32 -35
View File
@@ -308,7 +308,7 @@
if(!(gas_id in TLV)) // We're not interested in this gas, it seems.
continue
selected = TLV[gas_id]
thresholds += list(list("name" = meta_gas_info[gas_id][2], "settings" = list()))
thresholds += list(list("name" = meta_gas_info[gas_id][META_GAS_NAME], "settings" = list()))
thresholds[thresholds.len]["settings"] += list(list("env" = gas_id, "val" = "min2", "selected" = selected.min2))
thresholds[thresholds.len]["settings"] += list(list("env" = gas_id, "val" = "min1", "selected" = selected.min1))
thresholds[thresholds.len]["settings"] += list(list("env" = gas_id, "val" = "max1", "selected" = selected.max1))
@@ -317,71 +317,68 @@
data["thresholds"] = thresholds
/obj/machinery/alarm/ui_act(action, params)
if(buildstage != 2)
if(..() || buildstage != 2)
return
if(locked && !usr.has_unlimited_silicon_privilege)
if((locked && !usr.has_unlimited_silicon_privilege) || (usr.has_unlimited_silicon_privilege && aidisabled))
return
if(usr.has_unlimited_silicon_privilege && aidisabled)
return
var/device_id = params["id_tag"]
switch(action)
if("lock")
if(usr.has_unlimited_silicon_privilege && !wires.is_cut(WIRE_IDSCAN))
locked = !locked
if(
"power",
"co2_scrub",
"tox_scrub",
"n2o_scrub",
"widenet",
"scrubbing"
)
. = TRUE
if("power", "co2_scrub", "tox_scrub", "n2o_scrub", "widenet", "scrubbing")
send_signal(device_id, list("[action]" = text2num(params["val"])))
. = TRUE
if("excheck")
send_signal(device_id, list("checks" = text2num(params["val"])^1))
. = TRUE
if("incheck")
send_signal(device_id, list("checks" = text2num(params["val"])^2))
. = TRUE
if("set_external_pressure")
var/input_pressure = input("Enter target pressure:", "Pressure Controls") as num|null
if(isnum(input_pressure))
send_signal(device_id, list("set_external_pressure" = input_pressure))
var/value = text2num(params["value"])
if(value != null)
send_signal(device_id, list("set_external_pressure" = value))
. = TRUE
else
value = input("New target pressure:", name, alarm_area.air_vent_info[device_id]["external"]) as num|null
. = .(action, params + list("value" = value))
if("reset_external_pressure")
send_signal(device_id, list("reset_external_pressure"))
. = TRUE
if("threshold")
var/env = params["env"]
var/varname = params["var"]
var/name = params["var"]
var/value = text2num(params["value"])
var/datum/tlv/tlv = TLV[env]
var/newval = input("Enter [varname] for [env]:", "Alarm Triggers", tlv.vars[varname]) as num|null
if (isnull(newval))
if(isnull(tlv))
return
if (newval<0)
tlv.vars[varname] = -1
else if (env=="temperature" && newval>5000)
tlv.vars[varname] = 5000
else if (env=="pressure" && newval>50*ONE_ATMOSPHERE)
tlv.vars[varname] = 50*ONE_ATMOSPHERE
else if (env!="temperature" && env!="pressure" && newval>200)
tlv.vars[varname] = 200
if(value != null)
if(value < 0)
tlv.vars[name] = -1
else
tlv.vars[name] = round(value, 0.01)
. = TRUE
else
newval = round(newval,0.01)
tlv.vars[varname] = newval
value = input("New [name] for [env]:", name, tlv.vars[name]) as num|null
. = .(action, params + list("value" = value))
if("screen")
screen = text2num(params["screen"])
. = TRUE
if("mode")
mode = text2num(params["mode"])
apply_mode()
. = TRUE
if("alarm")
if(alarm_area.atmosalert(2, src))
post_alert(2)
update_icon()
. = TRUE
if("reset")
if(alarm_area.atmosalert(0, src))
post_alert(0)
update_icon()
return 1
. = TRUE
update_icon()
/obj/machinery/alarm/proc/shock(mob/user, prb)
if((stat & (NOPOWER))) // unpowered, no shock
+66 -58
View File
@@ -30,37 +30,40 @@
"air" = /obj/machinery/portable_atmospherics/canister/air
)
/obj/machinery/portable_atmospherics/canister/nitrous_oxide
name = "n2o canister"
desc = "Nitrous oxide gas. Known to cause drowsiness."
icon_state = "redws"
canister_color = "redws"
gas_type = "n2o"
/obj/machinery/portable_atmospherics/canister/nitrogen
name = "n2 canister"
desc = "Nitrogen gas. Reportedly useful for something."
icon_state = "red"
canister_color = "red"
gas_type = "n2"
/obj/machinery/portable_atmospherics/canister/oxygen
name = "o2 canister"
desc = "Oxygen. Necessary for human life."
icon_state = "blue"
canister_color = "blue"
gas_type = "o2"
/obj/machinery/portable_atmospherics/canister/toxins
name = "plasma canister"
desc = "Plasma gas. The reason YOU are here. Highly toxic."
icon_state = "orange"
canister_color = "orange"
gas_type = "plasma"
/obj/machinery/portable_atmospherics/canister/nitrogen
name = "n2 canister"
desc = "Nitrogen gas. Reportedly useful for something."
icon_state = "red"
canister_color = "red"
gas_type = "n2"
/obj/machinery/portable_atmospherics/canister/carbon_dioxide
name = "co2 canister"
desc = "Carbon dioxide. What the fuck is carbon dioxide?"
icon_state = "black"
canister_color = "black"
gas_type = "co2"
/obj/machinery/portable_atmospherics/canister/toxins
name = "plasma canister"
desc = "Plasma gas. The reason YOU are here. Highly toxic."
icon_state = "orange"
canister_color = "orange"
gas_type = "plasma"
/obj/machinery/portable_atmospherics/canister/agent_b
name = "agent b canister"
desc = "Oxygen Agent B. You're not quite sure what it does."
gas_type = "agent_b"
/obj/machinery/portable_atmospherics/canister/nitrous_oxide
name = "n2o canister"
desc = "Nitrous oxide gas. Known to cause drowsiness."
icon_state = "redws"
canister_color = "redws"
gas_type = "n2o"
/obj/machinery/portable_atmospherics/canister/air
name = "air canister"
desc = "Pre-mixed air."
@@ -289,59 +292,63 @@ update_flag
return data
/obj/machinery/portable_atmospherics/canister/ui_act(action, params)
if(..())
return
switch(action)
if("relabel")
var/label = input("Label canister:", "Gas Canister") as null|anything in label2types
var/newtype = label2types[label]
if(newtype)
var/obj/machinery/portable_atmospherics/canister/replacement = new newtype(loc)
replacement.air_contents.copy_from(air_contents)
replacement.update_icon()
replacement.interact(usr)
qdel(src)
var/label = params["label"]
if(label)
var/newtype = label2types[label]
if(newtype)
var/obj/machinery/portable_atmospherics/canister/replacement = new newtype(loc)
replacement.air_contents.copy_from(air_contents)
replacement.update_icon()
replacement.interact(usr)
qdel(src)
else
label = input("New canister label:", name) as null|anything in label2types
.(action, list("label" = label))
if("pressure")
switch(params["pressure"])
if("custom")
var/custom = input(usr, "What rate do you set the regulator to? The dial reads from [CAN_MIN_RELEASE_PRESSURE] to [CAN_MAX_RELEASE_PRESSURE].") as null|num
if(custom)
release_pressure = custom
if("reset")
release_pressure = CAN_DEFAULT_RELEASE_PRESSURE
if("min")
release_pressure = CAN_MIN_RELEASE_PRESSURE
if("max")
release_pressure = CAN_MAX_RELEASE_PRESSURE
release_pressure = Clamp(round(release_pressure), CAN_MIN_RELEASE_PRESSURE, CAN_MAX_RELEASE_PRESSURE)
var/pressure = params["pressure"]
if(pressure == "reset")
release_pressure = CAN_DEFAULT_RELEASE_PRESSURE
. = TRUE
else if(pressure == "min")
release_pressure = CAN_MIN_RELEASE_PRESSURE
. = TRUE
else if(pressure == "max")
release_pressure = CAN_MAX_RELEASE_PRESSURE
. = TRUE
else if(pressure == "input")
pressure = input("New release pressure ([CAN_MIN_RELEASE_PRESSURE]-[CAN_MAX_RELEASE_PRESSURE] kPa):", name, release_pressure) as num|null
. = .(action, list("pressure" = pressure))
else if(text2num(pressure) != null)
release_pressure = Clamp(round(text2num(pressure)), CAN_MIN_RELEASE_PRESSURE, CAN_MAX_RELEASE_PRESSURE)
. = TRUE
if("valve")
var/logmsg
valve_open = !valve_open
if(valve_open)
if(holding)
logmsg = "Valve was <b>closed</b> by [key_name(usr)], stopping the transfer into the [holding]<br>"
else
logmsg = "Valve was <b>closed</b> by [key_name(usr)], stopping the transfer into the <span class='boldannounce'>air</span><br>"
logmsg = "Valve was <b>opened</b> by [key_name(usr)], starting a transfer into \the [holding || "air"].<br>"
if(!holding)
var/plasma = air_contents.gases["plasma"]
var/n2o = air_contents.gases["n2o"]
if(n2o || plasma)
message_admins("[key_name_admin(usr)] (<A HREF='?_src_=holder;adminmoreinfo=\ref[usr]'>?</A>) (<A HREF='?_src_=holder;adminplayerobservefollow=\ref[usr]'>FLW</A>) opened a canister that contains [n2o ? "N2O" : ""][n2o && plasma ? " & " : ""][plasma ? "Plasma" : ""]! (<A HREF='?_src_=holder;adminplayerobservecoodjump=1;X=[x];Y=[y];Z=[z]'>JMP</a>)")
log_admin("[key_name(usr)] opened a canister that contains [n2o ? "N2O" : ""][n2o && plasma ? " & " : ""][plasma ? "Plasma" : ""] at [x], [y], [z]")
else
if(holding)
logmsg = "Valve was <b>opened</b> by [key_name(usr)], starting the transfer into the [holding]<br>"
else
logmsg = "Valve was <b>opened</b> by [key_name(usr)], starting the transfer into the <span class='boldannounce'>air</span><br>"
if(air_contents.gases["plasma"])
message_admins("[key_name_admin(usr)] (<A HREF='?_src_=holder;adminmoreinfo=\ref[usr]'>?</A>) (<A HREF='?_src_=holder;adminplayerobservefollow=\ref[usr]'>FLW</A>) opened a canister that contains plasma! (<A HREF='?_src_=holder;adminplayerobservecoodjump=1;X=[x];Y=[y];Z=[z]'>JMP</a>)")
log_admin("[key_name(usr)] opened a canister that contains plasma at [x], [y], [z]")
if(air_contents.gases["n2o"])
message_admins("[key_name_admin(usr)] (<A HREF='?_src_=holder;adminmoreinfo=\ref[usr]'>?</A>) (<A HREF='?_src_=holder;adminplayerobservefollow=\ref[usr]'>FLW</A>) opened a canister that contains N2O! (<A HREF='?_src_=holder;adminplayerobservecoodjump=1;X=[x];Y=[y];Z=[z]'>JMP</a>)")
log_admin("[key_name(usr)] opened a canister that contains N2O at [x], [y], [z]")
logmsg = "Valve was <b>closed</b> by [key_name(usr)], stopping the transfer into \the [holding || "air"].<br>"
investigate_log(logmsg, "atmos")
release_log += logmsg
valve_open = !valve_open
. = TRUE
if("eject")
if(holding)
if(valve_open)
investigate_log("[key_name(usr)] removed the [holding], leaving the valve open and transfering into the <span class='boldannounce'>air</span><br>", "atmos")
holding.loc = loc
holding = null
add_fingerprint(usr)
. = TRUE
update_icon()
return 1
/obj/machinery/portable_atmospherics/canister/New(loc)
..()
@@ -371,5 +378,6 @@ update_flag
/obj/machinery/portable_atmospherics/canister/air/create_gas()
air_contents.assert_gases("o2","n2")
air_contents.gases["o2"][MOLES] = (O2STANDARD*src.maximum_pressure*filled)*air_contents.volume/(R_IDEAL_GAS_EQUATION*air_contents.temperature)
air_contents.gases["n2"][MOLES] = (N2STANDARD*src.maximum_pressure*filled)*air_contents.volume/(R_IDEAL_GAS_EQUATION*air_contents.temperature)
// PV = nRT
air_contents.gases["o2"][MOLES] = (O2STANDARD * maximum_pressure * filled) * air_contents.volume / (R_IDEAL_GAS_EQUATION * air_contents.temperature)
air_contents.gases["n2"][MOLES] = (N2STANDARD * maximum_pressure * filled) * air_contents.volume / (R_IDEAL_GAS_EQUATION * air_contents.temperature)
+8 -5
View File
@@ -38,17 +38,20 @@
return data
/obj/machinery/computer/atmos_alert/ui_act(action, params)
if(..())
return
switch(action)
if("clear")
var/zone = params["zone"]
if(zone in priority_alarms)
usr << "Priority Alarm for [zone] cleared."
usr << "Priority alarm for [zone] cleared."
priority_alarms -= zone
. = TRUE
if(zone in minor_alarms)
usr << "Minor Alarm for [zone] cleared."
usr << "Minor alarm for [zone] cleared."
minor_alarms -= zone
. = TRUE
update_icon()
return 1
/obj/machinery/computer/atmos_alert/proc/set_frequency(new_frequency)
SSradio.remove_object(src, receive_frequency)
@@ -65,9 +68,9 @@
minor_alarms -= zone
priority_alarms -= zone
if(severity=="severe")
if(severity == "severe")
priority_alarms += zone
else if (severity=="minor")
else if (severity == "minor")
minor_alarms += zone
update_icon()
return
@@ -130,7 +130,6 @@
/obj/machinery/computer/atmos_control/ui_act(action, params)
if(..())
return
switch(action)
if("initialize")
if(name != initial(name))
@@ -157,8 +156,7 @@
"n2o_sensor" = "Nitrous Oxide Tank",
"mix_sensor" = "Mix Tank"
)
return 1
. = TRUE
/////////////////////////////////////////////////////////////
// LARGE TANK CONTROL
@@ -218,11 +216,12 @@
datum/tgui/master_ui = null, datum/ui_state/state = default_state)
ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open)
if(!ui)
ui = new(user, src, ui_key, "atmos_control/tank", name, 400, 425, master_ui, state)
ui = new(user, src, ui_key, "atmos_control", name, 400, 425, master_ui, state)
ui.open()
/obj/machinery/computer/atmos_control/tank/get_ui_data(mob/user)
var/list/data = ..()
data["tank"] = TRUE
data["inputting"] = input_info ? input_info["power"] : FALSE
data["inputRate"] = input_info ? input_info["volume_rate"] : 0
data["outputting"] = output_info ? output_info["power"] : FALSE
@@ -231,29 +230,32 @@
return data
/obj/machinery/computer/atmos_control/tank/ui_act(action, params)
if(!radio_connection)
if(..() || !radio_connection)
return
var/datum/signal/signal = new
signal.transmission_method = 1
signal.source = src
signal.data = list("sigtype" = "command")
switch(action)
if("reconnect")
reconnect(usr)
. = TRUE
if("input")
signal.data += list("tag" = input_tag, "power_toggle" = TRUE)
. = TRUE
if("output")
signal.data += list("tag" = output_tag, "power_toggle" = TRUE)
if("output_pressure")
var/custom = input(usr, "Adjust output pressure:", name) as null|num
if(isnum(custom))
var/pressure = Clamp(custom, 0, 50 * ONE_ATMOSPHERE)
signal.data += list("tag" = output_tag, "set_internal_pressure" = "[pressure]")
. = TRUE
if("pressure")
var/pressure = text2num(params["pressure"])
if(pressure != null)
pressure = Clamp(pressure, 0, 50 * ONE_ATMOSPHERE)
signal.data += list("tag" = output_tag, "set_internal_pressure" = pressure)
. = TRUE
else
pressure = input("New output pressure:", name, input_info["internal"]) as num|null
. = .(action, params + list("pressure" = pressure))
radio_connection.post_signal(src, signal, filter = RADIO_ATMOSIA)
return 1
/obj/machinery/computer/atmos_control/tank/receive_signal(datum/signal/signal)
if(!signal || signal.encryption) return
@@ -34,16 +34,20 @@
return data
/obj/item/weapon/electronics/airlock/ui_act(action, params)
if(..())
return
switch(action)
if("clear")
accesses = list()
one_access = 0
. = TRUE
if("one_access")
one_access = !one_access
. = TRUE
if("set")
var/access = text2num(params["access"])
if (!(access in accesses))
accesses += access
else
accesses -= access
return 1
. = TRUE
+1 -2
View File
@@ -212,9 +212,8 @@ Class Procs:
/obj/machinery/ui_act(action, params)
..()
if(!can_be_used_by(usr))
return 1
return TRUE
add_fingerprint(usr)
return 0
/obj/machinery/proc/can_be_used_by(mob/user)
if(!interact_offline && stat & (NOPOWER|BROKEN))
+51 -44
View File
@@ -76,9 +76,9 @@
settableTemperatureRange = cap * 30
efficiency = (cap + 1) * 10000
var/minTemp = max(settableTemperatureMedian - settableTemperatureRange, TCMB)
var/maxTemp = settableTemperatureMedian + settableTemperatureRange
targetTemperature = dd_range(minTemp, maxTemp, targetTemperature)
targetTemperature = Clamp(targetTemperature,
max(settableTemperatureMedian - settableTemperatureRange, TCMB),
settableTemperatureMedian + settableTemperatureRange)
/obj/machinery/space_heater/emp_act(severity)
if(stat & (BROKEN|NOPOWER))
@@ -88,32 +88,6 @@
cell.emp_act(severity)
..(severity)
/obj/machinery/space_heater/get_ui_data()
var/list/data = list()
data["open"] = panel_open
data["on"] = on
data["mode"] = setMode
data["hasPowercell"] = !!cell
if(cell)
data["powerLevel"] = round(cell.percent(), 1)
data["targetTemp"] = round(targetTemperature - T0C, 1)
data["minTemp"] = max(settableTemperatureMedian - settableTemperatureRange - T0C, TCMB)
data["maxTemp"] = settableTemperatureMedian + settableTemperatureRange - T0C
var/turf/simulated/L = get_turf(loc)
var/curTemp
if(istype(L))
var/datum/gas_mixture/env = L.return_air()
curTemp = env.temperature
else if(isturf(L))
curTemp = L.temperature
if(isnull(curTemp))
data["currentTemp"] = "N/A"
else
data["currentTemp"] = round(curTemp - T0C, 1)
return data
/obj/machinery/space_heater/attackby(obj/item/I, mob/user, params)
add_fingerprint(user)
if(istype(I, /obj/item/weapon/stock_parts/cell))
@@ -154,34 +128,67 @@
ui = new(user, src, ui_key, "space_heater", name, 400, 305, master_ui, state)
ui.open()
/obj/machinery/space_heater/get_ui_data()
var/list/data = list()
data["open"] = panel_open
data["on"] = on
data["mode"] = setMode
data["hasPowercell"] = !!cell
if(cell)
data["powerLevel"] = round(cell.percent(), 1)
data["targetTemp"] = round(targetTemperature - T0C, 1)
data["minTemp"] = max(settableTemperatureMedian - settableTemperatureRange - T0C, TCMB)
data["maxTemp"] = settableTemperatureMedian + settableTemperatureRange - T0C
var/turf/simulated/L = get_turf(loc)
var/curTemp
if(istype(L))
var/datum/gas_mixture/env = L.return_air()
curTemp = env.temperature
else if(isturf(L))
curTemp = L.temperature
if(isnull(curTemp))
data["currentTemp"] = "N/A"
else
data["currentTemp"] = round(curTemp - T0C, 1)
return data
/obj/machinery/space_heater/ui_act(action, params)
if(..())
return
switch(action)
if("power")
on = !on
mode = HEATER_MODE_STANDBY
usr.visible_message("[usr] switches [on ? "on" : "off"] \the [src].", "<span class='notice'>You switch [on ? "on" : "off"] \the [src].</span>")
update_icon()
. = TRUE
if("mode")
setMode = params["mode"]
. = TRUE
if("target")
if(panel_open)
var/value
if(params["target"] == "custom")
value = input("Please input the target temperature", name) as num|null
if(isnull(value))
return
value += T0C
else
value = targetTemperature + text2num(params["target"])
var/minTemp = max(settableTemperatureMedian - settableTemperatureRange, TCMB)
var/maxTemp = settableTemperatureMedian + settableTemperatureRange
targetTemperature = dd_range(minTemp, maxTemp, round(value, 1))
if(!panel_open)
return
var/target = params["target"]
var/adjust = text2num(params["adjust"])
if(target == "input")
target = input("New target temperature", name, round(targetTemperature - T0C, 1)) as num|null
. = .(action, list("target" = target))
else if(text2num(target) != null)
targetTemperature = text2num(target) + T0C
. = TRUE
else if(adjust)
targetTemperature += adjust
. = TRUE
if(.)
targetTemperature = Clamp(round(targetTemperature, 1),
max(settableTemperatureMedian - settableTemperatureRange, TCMB),
settableTemperatureMedian + settableTemperatureRange)
if("eject")
if(cell)
if(panel_open && cell)
cell.loc = get_turf(src)
cell = null
return 1
. = TRUE
/obj/machinery/space_heater/process()
if(!on || (stat & BROKEN))
+5 -1
View File
@@ -226,12 +226,16 @@ var/global/image/fire_overlay = image("icon" = 'icons/effects/fire.dmi', "icon_s
interact(user)
/obj/item/interact(mob/user)
add_fingerprint(user)
if(hidden_uplink && hidden_uplink.active)
hidden_uplink.interact(user)
return 1
add_fingerprint(user)
ui_interact(user)
/obj/item/ui_act(action, params)
..()
add_fingerprint(usr)
/obj/item/attack_hand(mob/user)
if(!user)
return
+25 -13
View File
@@ -117,7 +117,7 @@
datum/tgui/master_ui = null, datum/ui_state/state = inventory_state)
ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open)
if(!ui)
ui = new(user, src, ui_key, "radio", name, 830, 275, master_ui, state)
ui = new(user, src, ui_key, "radio", name, 370, 220 + channels.len * 22, master_ui, state)
ui.open()
/obj/item/device/radio/get_ui_data(mob/user)
@@ -141,27 +141,37 @@
return data
/obj/item/device/radio/ui_act(action, params)
if(..())
return
switch(action)
if("frequency")
if(!freqlock)
switch(params["change"])
if("custom")
var/min = format_frequency(freerange ? MIN_FREE_FREQ : MIN_FREQ)
var/max = format_frequency(freerange ? MAX_FREE_FREQ : MAX_FREQ)
var/custom = input(usr, "Adjust frequency ([min]-[max]):", name) as null|num
if(custom)
frequency = custom * 10
else
frequency = frequency + text2num(params["change"])
if(freqlock)
return
var/tune = params["tune"]
var/adjust = text2num(params["adjust"])
if(tune == "input")
var/min = format_frequency(freerange ? MIN_FREE_FREQ : MIN_FREQ)
var/max = format_frequency(freerange ? MAX_FREE_FREQ : MAX_FREQ)
tune = input("Tune frequency ([min]-[max]):", name, format_frequency(frequency)) as null|num
. = .(action, list("tune" = tune))
else if(text2num(tune) != null)
frequency = tune * 10
. = TRUE
else if(adjust)
frequency += adjust * 10
. = TRUE
if(.)
frequency = sanitize_frequency(frequency, freerange)
set_frequency(frequency)
if(hidden_uplink && (frequency == traitor_frequency))
if(frequency == traitor_frequency && hidden_uplink)
hidden_uplink.interact(usr)
SStgui.close_uis(src)
if("listen")
listening = !listening
. = TRUE
if("broadcast")
broadcasting = !broadcasting
. = TRUE
if("channel")
var/channel = params["channel"]
if(!(channel in channels))
@@ -170,8 +180,10 @@
channels[channel] &= ~FREQ_LISTENING
else
channels[channel] |= FREQ_LISTENING
. = TRUE
if("command")
use_command = !use_command
. = TRUE
if("subspace")
if(subspace_switchable)
subspace_transmission = !subspace_transmission
@@ -179,7 +191,7 @@
channels = list()
else
recalculateChannels()
return 1
. = TRUE
/obj/item/device/radio/talk_into(atom/movable/M, message, channel, list/spans)
if(!on) return // the device has to be on
+48 -51
View File
@@ -114,71 +114,68 @@
ui.open()
/obj/item/weapon/tank/get_ui_data()
var/mob/living/carbon/location = null
if(istype(loc, /mob/living/carbon))
location = loc
else if(istype(loc.loc, /mob/living/carbon))
location = loc.loc
var/data = list()
var/list/data = list()
data["tankPressure"] = round(air_contents.return_pressure() ? air_contents.return_pressure() : 0)
data["releasePressure"] = round(distribute_pressure ? distribute_pressure : 0)
data["defaultReleasePressure"] = round(TANK_DEFAULT_RELEASE_PRESSURE)
data["minReleasePressure"] = round(TANK_MIN_RELEASE_PRESSURE)
data["maxReleasePressure"] = round(TANK_MAX_RELEASE_PRESSURE)
data["valveOpen"] = 0
data["maskConnected"] = 0
data["valveOpen"] = FALSE
data["maskConnected"] = FALSE
if(istype(location))
var/mask_check = 0
if(location.internal == src) // if tank is current internal
mask_check = 1
data["valveOpen"] = 1
else if(src in location) // or if tank is in the mobs possession
if(!location.internal) // and they do not have any active internals
mask_check = 1
if(mask_check)
if(location.wear_mask && (location.wear_mask.flags & MASKINTERNALS))
data["maskConnected"] = 1
var/mob/living/carbon/user = loc
var/mask = FALSE
if(!istype(user))
user = loc.loc
if(!istype(user))
user = null
if(!isnull(user) && user.internal == src)
mask = TRUE
data["valveOpen"] = TRUE
else if(src in user && !user.internal)
mask = TRUE
if(mask && user.wear_mask && (user.wear_mask.flags & MASKINTERNALS))
data["maskConnected"] = TRUE
return data
/obj/item/weapon/tank/ui_act(action, params)
if (..())
if(..())
return
switch(action)
if("pressure")
switch(params["pressure"])
if("custom")
var/custom = input(usr, "What rate do you set the regulator to? The dial reads from 0 to [TANK_MAX_RELEASE_PRESSURE].") as null|num
if(isnum(custom))
distribute_pressure = custom
if("reset")
distribute_pressure = TANK_DEFAULT_RELEASE_PRESSURE
if("min")
distribute_pressure = TANK_MIN_RELEASE_PRESSURE
if("max")
distribute_pressure = TANK_MAX_RELEASE_PRESSURE
distribute_pressure = Clamp(round(distribute_pressure), TANK_MIN_RELEASE_PRESSURE, TANK_MAX_RELEASE_PRESSURE)
var/pressure = params["pressure"]
if(pressure == "reset")
distribute_pressure = TANK_DEFAULT_RELEASE_PRESSURE
. = TRUE
else if(pressure == "min")
distribute_pressure = TANK_MIN_RELEASE_PRESSURE
. = TRUE
else if(pressure == "max")
distribute_pressure = TANK_MAX_RELEASE_PRESSURE
. = TRUE
else if(pressure == "input")
pressure = input("New release pressure ([TANK_MIN_RELEASE_PRESSURE]-[TANK_MAX_RELEASE_PRESSURE] kPa):", name, distribute_pressure) as num|null
. = .(action, list("pressure" = pressure))
else if(text2num(pressure) != null)
distribute_pressure = Clamp(round(text2num(pressure)), TANK_MIN_RELEASE_PRESSURE, TANK_MAX_RELEASE_PRESSURE)
. = TRUE
if("valve")
if(istype(loc,/mob/living/carbon))
var/mob/living/carbon/location = loc
if(location.internal == src)
location.internal = null
location.internals.icon_state = "internal0"
usr << "<span class='notice'>You close the tank release valve.</span>"
if (location.internals)
location.internals.icon_state = "internal0"
var/mob/living/carbon/user = loc
if(!istype(user))
return
if(user.internal == src)
user.internal = null
user.internals.icon_state = "internal0"
usr << "<span class='notice'>You close the tank release valve.</span>"
. = TRUE
else
if(user.wear_mask && (user.wear_mask.flags & MASKINTERNALS))
user.internal = src
user.internals.icon_state = "internal1"
usr << "<span class='notice'>You open [src] valve.</span>"
. = TRUE
else
if(location.wear_mask && (location.wear_mask.flags & MASKINTERNALS))
location.internal = src
usr << "<span class='notice'>You open \the [src] valve.</span>"
if (location.internals)
location.internals.icon_state = "internal1"
else
usr << "<span class='warning'>You need something to connect to \the [src]!</span>"
return 1
usr << "<span class='warning'>You need something to connect to [src]!</span>"
/obj/item/weapon/tank/remove_air(amount)
+1 -1
View File
@@ -1748,7 +1748,7 @@
return
var/list/offset = text2list(href_list["offset"],",")
var/number = dd_range(1, 100, text2num(href_list["object_count"]))
var/number = Clamp(text2num(href_list["object_count"]), 1, 100)
var/X = offset.len > 0 ? text2num(offset[1]) : 0
var/Y = offset.len > 1 ? text2num(offset[2]) : 0
var/Z = offset.len > 2 ? text2num(offset[3]) : 0
@@ -190,13 +190,13 @@ var/global/mulebot_count = 0
return data
/mob/living/simple_animal/bot/mulebot/ui_act(action, params)
if(locked && !usr.has_unlimited_silicon_privilege)
if(..() || (locked && !usr.has_unlimited_silicon_privilege))
return
switch(action)
if("lock")
if(usr.has_unlimited_silicon_privilege)
locked = !locked
. = TRUE
if("power")
if(on)
turn_off()
@@ -204,12 +204,13 @@ var/global/mulebot_count = 0
if(!turn_on())
usr << "<span class='warning'>You can't switch on [src]!</span>"
return
. = TRUE
else
bot_control(action, usr)
return 1
bot_control(action, usr) // Kill this later.
. = TRUE
/mob/living/simple_animal/bot/mulebot/bot_control(command, mob/user, pda = 0)
if(pda && wires.is_cut(WIRE_RX)) //MULE wireless is controlled by wires.
if(pda && wires.is_cut(WIRE_RX)) // MULE wireless is controlled by wires.
return
switch(command)
+53 -57
View File
@@ -710,7 +710,7 @@
/obj/machinery/power/apc/proc/can_use(mob/user, loud = 0) //used by attack_hand() and Topic()
if(IsAdminGhost(user))
return 1
return TRUE
if(user.has_unlimited_silicon_privilege)
var/mob/living/silicon/ai/AI = user
var/mob/living/silicon/robot/robot = user
@@ -723,20 +723,13 @@
) \
)
if(!loud)
user << "<span class='danger'>\The [src] have AI control disabled!</span>"
return 0
else
if ((!in_range(src, user) || !istype(src.loc, /turf)))
return 0
return 1
user << "<span class='danger'>\The [src] has AI control disabled!</span>"
return FALSE
return TRUE
/obj/machinery/power/apc/ui_act(action, params)
if(!can_use(usr, 1))
if(..() || !can_use(usr, 1) || (locked && !usr.has_unlimited_silicon_privilege))
return
if(locked && !usr.has_unlimited_silicon_privilege)
return
switch(action)
if("lock")
if(usr.has_unlimited_silicon_privilege)
@@ -745,71 +738,83 @@
else
locked = !locked
update_icon()
. = TRUE
if("cover")
coverlocked = !coverlocked
. = TRUE
if("breaker")
toggle_breaker()
. = TRUE
if("charge")
chargemode = !chargemode
if(!chargemode)
charging = 0
update_icon()
. = TRUE
if("channel")
if (params["eqp"])
var/val = text2num(params["eqp"])
equipment = setsubsystem(val)
if(params["eqp"])
equipment = setsubsystem(text2num(params["eqp"]))
update_icon()
update()
else if (params["lgt"])
var/val = text2num(params["lgt"])
lighting = setsubsystem(val)
else if(params["lgt"])
lighting = setsubsystem(text2num(params["lgt"]))
update_icon()
update()
else if (params["env"])
var/val = text2num(params["env"])
environ = setsubsystem(val)
else if(params["env"])
environ = setsubsystem(text2num(params["env"]))
update_icon()
update()
. = TRUE
if("overload")
if(usr.has_unlimited_silicon_privilege)
src.overload_lighting()
overload_lighting()
. = TRUE
if("hack")
var/mob/living/silicon/ai/malfai = usr
if(get_malf_status(malfai) == 1)
if (malfai.malfhacking)
malfai << "You are already hacking an APC."
return 1
malfai << "Beginning override of APC systems. This takes some time, and you cannot perform other actions during the process."
malfai.malfhack = src
malfai.malfhacking = 1
sleep(600)
if(src)
if (!src.aidisabled)
malfai.malfhack = null
malfai.malfhacking = 0
locked = 1
malfhack = 1
malfai.malf_picker.processing_time += 10
if(usr:parent)
src.malfai = usr:parent
else
src.malfai = usr
malfai << "Hack complete. The APC is now under your exclusive control."
update_icon()
if(get_malf_status(usr))
malfhack(usr)
if("occupy")
if(get_malf_status(usr))
malfoccupy(usr)
if("deoccupy")
if(get_malf_status(usr))
malfvacate()
return 1
/obj/machinery/power/apc/proc/toggle_breaker()
operating = !operating
src.update()
update()
update_icon()
/obj/machinery/power/apc/proc/malfhack(mob/living/silicon/ai/malf)
if(!istype(malf))
return
if(get_malf_status(malf) != 1)
return
if(malf.malfhacking)
malf << "You are already hacking an APC."
return
malf << "Beginning override of APC systems. This takes some time, and you cannot perform other actions during the process."
malf.malfhack = src
malf.malfhacking = TRUE
addtimer(src, "malfhacked", 600, FALSE, malf)
/obj/machinery/power/apc/proc/malfhacked(mob/living/silicon/ai/malf)
if(!istype(malf))
return
if(src && !src.aidisabled)
malf.malfhack = null
malf.malfhacking = FALSE
malf.malf_picker.processing_time += 10
if(malf:parent)
malfai = malf:parent
else
malfai = malf
malfhack = TRUE
locked = TRUE
malf << "Hack complete. The APC is now under your exclusive control."
update_icon()
/obj/machinery/power/apc/proc/malfoccupy(mob/living/silicon/ai/malf)
if(!istype(malf))
return
@@ -889,7 +894,6 @@
if(!area.requires_power)
return
/*
if (equipment > 1) // off=0, off auto=1, on=2, on auto=3
use_power(src.equip_consumption, EQUIP)
@@ -928,8 +932,6 @@
// world.log << "Status: [main_status] - Excess: [excess] - Last Equip: [lastused_equip] - Last Light: [lastused_light] - Longterm: [longtermpower]"
if(cell && !shorted)
// draw power from cell as before to power the area
var/cellused = min(cell.charge, CELLRATE * lastused_total) // clamp deduction to a max, amount left in cell
cell.use(cellused)
@@ -941,9 +943,7 @@
else // no excess, and not enough per-apc
if( (cell.charge/CELLRATE + excess) >= lastused_total) // can we draw enough from cell+grid to cover last usage?
if((cell.charge/CELLRATE + excess) >= lastused_total) // can we draw enough from cell+grid to cover last usage?
cell.charge = min(cell.maxcharge, cell.charge + CELLRATE * excess) //recharge with what we can
add_load(excess) // so draw what we can from the grid
charging = 0
@@ -989,7 +989,6 @@
area.poweralert(1, src)
// now trickle-charge the cell
if(chargemode && charging == 1 && operating)
if(excess > 0) // check to make sure we have enough to charge
// Max charge is capped to % per second constant
@@ -1048,15 +1047,12 @@
return 0
else if(val==3) // if auto-on, return auto-off
return 1
else if(on==1)
if(val==1) // if auto-off, return auto-on
return 3
else if(on==2)
if(val==3) // if auto-on, return auto-off
return 1
return val
/obj/machinery/power/apc/proc/reset(wire)
+45 -32
View File
@@ -355,51 +355,64 @@
return data
/obj/machinery/power/smes/ui_act(action, params)
if(..())
return
switch(action)
if("tryinput")
input_attempt = !input_attempt
log_smes(usr.ckey)
update_icon()
. = TRUE
if("tryoutput")
output_attempt = !output_attempt
log_smes(usr.ckey)
update_icon()
. = TRUE
if("input")
switch(params["input"])
if("custom")
var/custom = input(usr, "What rate would you like this SMES to attempt to charge at? Max is [input_level_max].") as null|num
if(custom)
input_level = custom
if("min")
input_level = 0
if("max")
input_level = input_level_max
if("plus")
input_level += 10000
if("minus")
input_level -= 10000
input_level = Clamp(input_level, 0, input_level_max)
log_smes(usr.ckey)
var/target = params["target"]
var/adjust = text2num(params["adjust"])
if(target == "input")
target = input("New input target (0-[input_level_max]):", name, input_level) as num|null
. = .(action, list("target" = target))
else if(target == "min")
input_level = 0
. = TRUE
else if(target == "max")
input_level = input_level_max
. = TRUE
else if(text2num(target) != null)
input_level = text2num(target)
. = TRUE
else if(adjust)
input_level += adjust
. = TRUE
if(.)
input_level = Clamp(input_level, 0, input_level_max)
log_smes(usr.ckey)
if("output")
switch(params["output"])
if("custom")
var/custom = input(usr, "What rate would you like this SMES to attempt to output at? Max is [output_level_max].") as null|num
if(custom)
output_level = custom
if("min")
output_level = 0
if("max")
output_level = output_level_max
if("plus")
output_level += 10000
if("minus")
output_level -= 10000
output_level = Clamp(output_level, 0, output_level_max)
log_smes(usr.ckey)
return 1
var/target = params["target"]
var/adjust = text2num(params["adjust"])
if(target == "input")
target = input("New output target (0-[output_level_max]):", name, output_level) as num|null
. = .(action, list("target" = target))
else if(target == "min")
output_level = 0
. = TRUE
else if(target == "max")
output_level = input_level_max
. = TRUE
else if(text2num(target) != null)
output_level = text2num(target)
. = TRUE
else if(adjust)
output_level += adjust
. = TRUE
if(.)
output_level = Clamp(output_level, 0, output_level_max)
log_smes(usr.ckey)
/obj/machinery/power/smes/proc/log_smes(user = "")
investigate_log("input/output; [input_level>output_level?"<font color='green'>":"<font color='red'>"][input_level]/[output_level]</font> | Charge: [charge] | Output-mode: [output_attempt?"<font color='green'>on</font>":"<font color='red'>off</font>"] | Input-mode: [input_attempt?"<font color='green'>auto</font>":"<font color='red'>off</font>"] by [user]","singulo")
investigate_log("input/output; [input_level>output_level?"<font color='green'>":"<font color='red'>"][input_level]/[output_level]</font> | Charge: [charge] | Output-mode: [output_attempt?"<font color='green'>on</font>":"<font color='red'>off</font>"] | Input-mode: [input_attempt?"<font color='green'>auto</font>":"<font color='red'>off</font>"] by [user]", "singulo")
/obj/machinery/power/smes/emp_act(severity)
+49 -44
View File
@@ -53,8 +53,6 @@
health *= 2 //this need to be placed here, because panels already on the map don't have an assembly linked to
update_icon()
/obj/machinery/power/solar/attackby(obj/item/weapon/W, mob/user, params)
if(istype(W, /obj/item/weapon/crowbar))
playsound(src.loc, 'sound/machines/click.ogg', 50, 1)
@@ -275,7 +273,7 @@
var/icon_screen = "solar"
var/icon_keyboard = "power_key"
var/id = 0
var/cdir = 0
var/currentdir = 0
var/targetdir = 0 // target angle in manual tracking (since it updates every game minute)
var/gen = 0
var/lastgen = 0
@@ -331,19 +329,19 @@
switch(track)
if(1)
if(trackrate) //we're manual tracking. If we set a rotation speed...
cdir = targetdir //...the current direction is the targetted one (and rotates panels to it)
currentdir = targetdir //...the current direction is the targetted one (and rotates panels to it)
if(2) // auto-tracking
if(connected_tracker)
connected_tracker.set_angle(SSsun.angle)
set_panels(cdir)
set_panels(currentdir)
updateDialog()
/obj/machinery/power/solar_control/initialize()
..()
if(!powernet) return
set_panels(cdir)
set_panels(currentdir)
/obj/machinery/power/solar_control/update_icon()
overlays.Cut()
@@ -355,22 +353,22 @@
overlays += "[icon_state]_broken"
else
overlays += icon_screen
if(cdir > -1)
overlays += image('icons/obj/computer.dmi', "solcon-o", FLY_LAYER, angle2dir(cdir))
if(currentdir > -1)
overlays += image('icons/obj/computer.dmi', "solcon-o", FLY_LAYER, angle2dir(currentdir))
/obj/machinery/power/solar_control/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = 0, \
datum/tgui/master_ui = null, datum/ui_state/state = default_state)
ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open)
if(!ui)
ui = new(user, src, ui_key, "solar_control", name, 465, 400, master_ui, state)
ui = new(user, src, ui_key, "solar_control", name, 500, 400, master_ui, state)
ui.open()
/obj/machinery/power/solar_control/get_ui_data()
var/data = list()
data["generated"] = round(lastgen)
data["angle"] = cdir
data["direction"] = angle2text(cdir)
data["angle"] = currentdir
data["direction"] = angle2text(currentdir)
data["tracking_state"] = track
data["tracking_rate"] = trackrate
@@ -380,6 +378,44 @@
data["connected_tracker"] = (connected_tracker ? 1 : 0)
return data
/obj/machinery/power/solar_control/ui_act(action, params)
if(..())
return
switch(action)
if("direction")
var/adjust = text2num(params["adjust"])
if(adjust)
currentdir = Clamp((360 + adjust + currentdir) % 360, 0, 359)
targetdir = currentdir
set_panels(currentdir)
. = TRUE
if("rate")
var/adjust = text2num(params["adjust"])
if(adjust)
trackrate = Clamp(trackrate + adjust, -7200, 7200)
if(trackrate)
nexttime = world.time + 36000 / abs(trackrate)
. = TRUE
if("tracking")
var/mode = text2num(params["mode"])
if(mode)
track = mode
. = TRUE
if(mode == 2 && connected_tracker)
connected_tracker.set_angle(SSsun.angle)
set_panels(currentdir)
else if(mode == 1)
targetdir = currentdir
if(trackrate)
nexttime = world.time + 36000 / abs(trackrate)
set_panels(targetdir)
if("refresh")
search_for_connected()
if(connected_tracker && track == 2)
connected_tracker.set_angle(SSsun.angle)
set_panels(currentdir)
. = TRUE
/obj/machinery/power/solar_control/attackby(obj/item/I, mob/user, params)
if(istype(I, /obj/item/weapon/screwdriver))
playsound(src.loc, 'sound/items/Screwdriver.ogg', 50, 1)
@@ -427,42 +463,11 @@
targetdir = (targetdir + trackrate/abs(trackrate) + 360) % 360 //... do it
nexttime += 36000/abs(trackrate) //reset the counter for the next 1°
/obj/machinery/power/solar_control/ui_act(action, params)
switch(action)
if("control")
if(params["cdir"])
src.cdir = dd_range(0,359,(360+src.cdir+text2num(params["cdir"]))%360)
src.targetdir = src.cdir
if(track == 2) //manual update, so losing auto-tracking
track = 0
spawn(1)
set_panels(cdir)
if(params["tdir"])
src.trackrate = dd_range(-7200,7200,src.trackrate+text2num(params["tdir"]))
if(src.trackrate) nexttime = world.time + 36000/abs(trackrate)
if("tracking")
track = text2num(params["mode"])
if(track == 2)
if(connected_tracker)
connected_tracker.set_angle(SSsun.angle)
set_panels(cdir)
else if (track == 1) //begin manual tracking
src.targetdir = src.cdir
if(src.trackrate) nexttime = world.time + 36000/abs(trackrate)
set_panels(targetdir)
if("refresh")
search_for_connected()
if(connected_tracker && track == 2)
connected_tracker.set_angle(SSsun.angle)
set_panels(cdir)
return 1
//rotates the panel to the passed angle
/obj/machinery/power/solar_control/proc/set_panels(cdir)
/obj/machinery/power/solar_control/proc/set_panels(currentdir)
for(var/obj/machinery/power/solar/S in connected_panels)
S.adir = cdir //instantly rotates the panel
S.adir = currentdir //instantly rotates the panel
S.occlusion()//and
S.update_icon() //update it
+1 -1
View File
@@ -56,7 +56,7 @@
dir = turn(NORTH, -angle - 22.5) // 22.5 deg bias ensures, e.g. 67.5-112.5 is EAST
if(powernet && (powernet == control.powernet)) //update if we're still in the same powernet
control.cdir = angle
control.currentdir = angle
/obj/machinery/power/tracker/attackby(obj/item/weapon/W, mob/user, params)
@@ -120,29 +120,35 @@
return data
/obj/machinery/chem_dispenser/ui_act(action, params)
if(..())
return
switch(action)
if("amount")
var/amount = text2num(params["amount"])
if(amount in beaker.possible_transfer_amounts)
src.amount = amount
var/target = text2num(params["target"])
if(target in beaker.possible_transfer_amounts)
amount = target
. = TRUE
if("dispense")
if(beaker && dispensable_reagents.Find(params["reagent"]))
var/reagent = params["reagent"]
if(beaker && dispensable_reagents.Find(reagent))
var/datum/reagents/R = beaker.reagents
var/space = R.maximum_volume - R.total_volume
var/free = R.maximum_volume - R.total_volume
var/actual = min(amount, energy * 10, free)
R.add_reagent(params["reagent"], min(amount, energy * 10, space))
energy = max(energy - min(amount, energy * 10, space) / 10, 0)
R.add_reagent(reagent, actual)
energy = max(energy - actual / 10, 0)
. = TRUE
if("remove")
if(beaker)
var/amount = text2num(params["amount"])
if(isnum(amount) && (amount > 0) && (amount in beaker.possible_transfer_amounts))
beaker.reagents.remove_all(amount)
var/amount = text2num(params["amount"])
if(beaker && amount in beaker.possible_transfer_amounts)
beaker.reagents.remove_all(amount)
. = TRUE
if("eject")
if(beaker)
beaker.loc = loc
beaker = null
overlays.Cut()
return 1
. = TRUE
/obj/machinery/chem_dispenser/attackby(obj/item/I, mob/user, params)
if(default_unfasten_wrench(user, I))
@@ -7,7 +7,7 @@
use_power = 1
idle_power_usage = 40
var/obj/item/weapon/reagent_containers/beaker = null
var/desired_temp = 300
var/target_temp = 300
var/heater_coefficient = 0.10
var/on = FALSE
@@ -30,10 +30,10 @@
return
if(on)
if(beaker)
if(beaker.reagents.chem_temp > desired_temp)
beaker.reagents.chem_temp += min(-1, (desired_temp - beaker.reagents.chem_temp) * heater_coefficient)
if(beaker.reagents.chem_temp < desired_temp)
beaker.reagents.chem_temp += max(1, (desired_temp - beaker.reagents.chem_temp) * heater_coefficient)
if(beaker.reagents.chem_temp > target_temp)
beaker.reagents.chem_temp += min(-1, (target_temp - beaker.reagents.chem_temp) * heater_coefficient)
if(beaker.reagents.chem_temp < target_temp)
beaker.reagents.chem_temp += max(1, (target_temp - beaker.reagents.chem_temp) * heater_coefficient)
beaker.reagents.chem_temp = round(beaker.reagents.chem_temp) //stops stuff like 456.12312312302
beaker.reagents.handle_reactions()
@@ -72,17 +72,6 @@
default_deconstruction_crowbar(I)
return 1
/obj/machinery/chem_heater/ui_act(action, params)
switch(action)
if("power")
on = !on
if("temperature")
desired_temp = Clamp(input("Please input the target temperature", name) as num, 0, 1000)
if("eject")
on = FALSE
eject_beaker()
return 1
/obj/machinery/chem_heater/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = 0, \
datum/tgui/master_ui = null, datum/ui_state/state = default_state)
ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open)
@@ -92,7 +81,7 @@
/obj/machinery/chem_heater/get_ui_data()
var/data = list()
data["targetTemp"] = desired_temp
data["targetTemp"] = target_temp
data["isActive"] = on
data["isBeakerLoaded"] = beaker ? 1 : 0
@@ -107,6 +96,26 @@
data["beakerContents"] = beakerContents
return data
/obj/machinery/chem_heater/ui_act(action, params)
if(..())
return
switch(action)
if("power")
on = !on
. = TRUE
if("temperature")
var/target = text2num(params["target"])
if(target != null)
target_temp = Clamp(target, 0, 1000)
. = TRUE
else
target = input("New target temperature:", name, target_temp) as num|null
. = .(action, list("target" = target))
if("eject")
on = FALSE
eject_beaker()
. = TRUE
/obj/machinery/chem_heater/proc/eject_beaker()
if(beaker)
beaker.loc = get_turf(src)
+3 -2
View File
@@ -45,8 +45,9 @@
*
* return bool If the UI should be updated or not.
**/
/datum/proc/ui_act(action, list/params)
return 0 // Not implemented.
/datum/proc/ui_act(action, list/params, datum/tgui/ui, datum/ui_state/state)
if(!ui || ui.status != UI_INTERACTIVE)
return 1 // If UI is not interactive or usr calling Topic is not the UI user, bail.
/**
+16 -12
View File
@@ -16,17 +16,18 @@
var/width = 0 // The window width.
var/height = 0 // The window height
var/window_options = list( // Extra options to winset().
"focus" = 0,
"titlebar" = 1,
"can_resize" = 1,
"can_minimize" = 1,
"can_maximize" = 0,
"can_close" = 1,
"auto_format" = 0
"focus" = FALSE,
"titlebar" = TRUE,
"can_resize" = TRUE,
"can_minimize" = TRUE,
"can_maximize" = FALSE,
"can_close" = TRUE,
"auto_format" = FALSE
)
var/style = "nanotrasen" // The style to be used for this UI.
var/interface // The interface (template) to be used for this UI.
var/auto_update = 1 // Update the UI every MC tick.
var/auto_update = TRUE // Update the UI every MC tick.
var/initialized = FALSE // If the UI has been initialized yet.
var/list/initial_data // The data (and datastructure) used to initialize the UI.
var/status = UI_INTERACTIVE // The status/visibility of the UI.
var/datum/ui_state/state = null // Topic state used to determine status/interactability.
@@ -258,6 +259,9 @@
* If the src_object's ui_act() returns 1, update all UIs attacked to it.
**/
/datum/tgui/Topic(href, href_list)
if(user != usr)
return // Something is not right here.
var/action = href_list["action"]
var/params = href_list; params -= "action"
@@ -265,6 +269,7 @@
switch(action)
if("tgui:initialize")
user << output(url_encode(get_json(initial_data)), "[window_id].browser:initialize")
initialized = TRUE
return
if("tgui:link")
user << link(params["url"])
@@ -277,10 +282,7 @@
return
update_status(push = 0) // Update the window state.
if(status != UI_INTERACTIVE || user != usr)
return // If UI is not interactive or usr calling Topic is not the UI user.
var/update = src_object.ui_act(action, params, state) // Call ui_act() on the src_object.
var/update = src_object.ui_act(action, params, src, state) // Call ui_act() on the src_object.
if(src_object && update)
SStgui.update_uis(src_object) // If we have a src_object and its ui_act() told us to update.
@@ -313,6 +315,8 @@
**/
/datum/tgui/proc/push_data(data, force = 0)
update_status(push = 0) // Update the window state.
if(!initialized)
return // Cannot upadte UI if it is not set up yet.
if(status <= UI_DISABLED && !force)
return // Cannot update UI, we have no visibility.
+1 -1
View File
@@ -427,7 +427,6 @@
#include "code\game\machinery\airlock_control.dm"
#include "code\game\machinery\alarm.dm"
#include "code\game\machinery\announcement_system.dm"
#include "code\game\machinery\atmos_control.dm"
#include "code\game\machinery\autolathe.dm"
#include "code\game\machinery\Beacon.dm"
#include "code\game\machinery\buttons.dm"
@@ -484,6 +483,7 @@
#include "code\game\machinery\computer\aifixer.dm"
#include "code\game\machinery\computer\arcade.dm"
#include "code\game\machinery\computer\atmos_alert.dm"
#include "code\game\machinery\computer\atmos_control.dm"
#include "code\game\machinery\computer\buildandrepair.dm"
#include "code\game\machinery\computer\camera.dm"
#include "code\game\machinery\computer\camera_advanced.dm"
+4 -4
View File
File diff suppressed because one or more lines are too long
+23 -2
View File
@@ -1,6 +1,6 @@
<ui-display title='{{data.sensors.length == 1 ? data.sensors[0].long_name : null}}'> {{! When there is just one entry make it full size. }}
<ui-display title='{{tank ? data.sensors[0].long_name : null}}'>
{{#each adata.sensors}}
<ui-subdisplay title='{{data.sensors.length > 1 ? long_name : null}}'>
<ui-subdisplay title='{{!tank ? long_name : null}}'>
<ui-section label='Pressure'>
<span>{{Math.fixed(pressure, 2)}} kPa</span>
</ui-section>
@@ -22,3 +22,24 @@
</ui-section>
{{/each}}
</ui-display>
{{#if tank}}
<ui-display title='Controls' button>
{{#partial button}}
<ui-button icon='refresh' action='reconnect'>Reconnect</ui-button>
{{/partial}}
<ui-section label='Input Injector'>
<ui-button icon='{{data.inputting ? "power-off" : "close"}}' style='{{data.inputting ? "selected" : null}}' action='input'>
{{data.inputting ? "Injecting": "Off"}}</ui-button>
</ui-section>
<ui-section label='Input Rate'>
<span>{{Math.fixed(adata.inputRate)}} L/s</span>
</ui-section>
<ui-section label='Output Regulator'>
<ui-button icon='{{data.outputting ? "power-off" : "close"}}' style='{{data.outputting ? "selected" : null}}' action='output'>
{{data.outputting ? "Open": "Closed"}}</ui-button>
</ui-section>
<ui-section label='Output Pressure'>
<ui-button icon='pencil' action='pressure'>{{Math.round(adata.outputPressure)}} kPa</ui-button>
</ui-section>
</ui-display>
{{/if tank}}
@@ -1,22 +0,0 @@
<link rel='ractive' href='../atmos_control.ract' name='atmos-control'>
<atmos-control/>
<ui-display title='Controls' button>
{{#partial button}}
<ui-button icon='refresh' action='reconnect'>Reconnect</ui-button>
{{/partial}}
<ui-section label='Input Injector'>
<ui-button icon='{{data.inputting ? "power-off" : "close"}}' style='{{data.inputting ? "selected" : null}}' action='input'>
{{data.inputting ? "Injecting": "Off"}}</ui-button>
</ui-section>
<ui-section label='Input Rate'>
<span>{{Math.fixed(adata.inputRate)}} L/s</span>
</ui-section>
<ui-section label='Output Regulator'>
<ui-button icon='{{data.outputting ? "power-off" : "close"}}' style='{{data.outputting ? "selected" : null}}' action='output'>
{{data.outputting ? "Open": "Closed"}}</ui-button>
</ui-section>
<ui-section label='Output Pressure'>
<ui-button icon='pencil' action='output_pressure'>{{Math.round(adata.outputPressure)}} kPa</ui-button>
</ui-section>
</ui-display>
+1 -1
View File
@@ -4,7 +4,7 @@
action='power'>{{data.on ? "On" : "Off"}}</ui-button>
</ui-section>
<ui-section label='Output Pressure'>
<ui-button icon='pencil' action='pressure' params='{"pressure": "custom"}'>Set</ui-button>
<ui-button icon='pencil' action='pressure' params='{"pressure": "input"}'>Set</ui-button>
<ui-button icon='plus' state='{{data.set_pressure == data.max_pressure ? "disabled" : null}}' action='pressure' params='{"pressure": "max"}'>Max</ui-button>
<span>{{Math.round(adata.set_pressure)}} kPa</span>
</ui-section>
+1 -1
View File
@@ -4,7 +4,7 @@
action='power'>{{data.on ? "On" : "Off"}}</ui-button>
</ui-section>
<ui-section label='Output Pressure'>
<ui-button icon='pencil' action='pressure' params='{"pressure": "custom"}'>Set</ui-button>
<ui-button icon='pencil' action='pressure' params='{"pressure": "input"}'>Set</ui-button>
<ui-button icon='plus' state='{{data.set_pressure == data.max_pressure ? "disabled" : null}}' action='pressure' params='{"pressure": "max"}'>Max</ui-button>
<span>{{Math.round(adata.set_pressure)}} kPa</span>
</ui-section>
+6 -6
View File
@@ -5,15 +5,15 @@
</ui-section>
{{#if data.max_rate}}
<ui-section label='Transfer Rate'>
<ui-button icon='pencil' action='transfer' params='{"rate": "custom"}'>Set</ui-button>
<ui-button icon='plus' state='{{data.transfer_rate == data.max_rate ? "disabled" : null}}' action='transfer' params='{"rate": "max"}'>Max</ui-button>
<span>{{Math.round(adata.transfer_rate)}} L/s</span>
<ui-button icon='pencil' action='rate' params='{"rate": "input"}'>Set</ui-button>
<ui-button icon='plus' state='{{data.rate == data.max_rate ? "disabled" : null}}' action='transfer' params='{"rate": "max"}'>Max</ui-button>
<span>{{Math.round(adata.rate)}} L/s</span>
</ui-section>
{{else}}
<ui-section label='Output Pressure'>
<ui-button icon='pencil' action='pressure' params='{"pressure": "custom"}'>Set</ui-button>
<ui-button icon='plus' state='{{data.set_pressure == data.max_pressure ? "disabled" : null}}' action='pressure' params='{"pressure": "max"}'>Max</ui-button>
<span>{{Math.round(adata.set_pressure)}} kPa</span>
<ui-button icon='pencil' action='pressure' params='{"pressure": "input"}'>Set</ui-button>
<ui-button icon='plus' state='{{data.pressure == data.max_pressure ? "disabled" : null}}' action='pressure' params='{"pressure": "max"}'>Max</ui-button>
<span>{{Math.round(adata.pressure)}} kPa</span>
</ui-section>
{{/if}}
</ui-display>
+1 -1
View File
@@ -22,7 +22,7 @@
action='pressure' params='{"pressure": "reset"}'>Reset</ui-button>
<ui-button icon='minus' state='{{data.releasePressure > data.minReleasePressure ? null : "disabled"}}'
action='pressure' params='{"pressure": "min"}'>Min</ui-button>
<ui-button icon='pencil' action='pressure' params='{"pressure": "custom"}'>Set</ui-button>
<ui-button icon='pencil' action='pressure' params='{"pressure": "input"}'>Set</ui-button>
<ui-button icon='plus' state='{{data.releasePressure < data.maxReleasePressure ? null : "disabled"}}'
action='pressure' params='{"pressure": "max"}'>Max</ui-button>
</ui-section>
+1 -1
View File
@@ -6,7 +6,7 @@
<ui-display title='Dispense' button>
{{#partial button}}
{{#each data.beakerTransferAmounts}}
<ui-button icon='plus' state='{{data.amount == . ? "selected" : null}}' action='amount' params='{"amount": {{.}}}'>{{.}}</ui-button>
<ui-button icon='plus' state='{{data.amount == . ? "selected" : null}}' action='amount' params='{"target": {{.}}}'>{{.}}</ui-button>
{{/each}}
{{/partial}}
<ui-section>
+6 -6
View File
@@ -40,11 +40,11 @@
{{#if data.freqlock}}
<span>{{readableFrequency}}</span>
{{else}}
<ui-button icon='fast-backward' state='{{data.frequency == data.minFrequency ? "disabled": null}}' action='frequency' params='{"change": -10}'/>
<ui-button icon='backward' state='{{data.frequency == data.minFrequency ? "disabled": null}}' action='frequency' params='{"change": -2}'/>
<ui-button icon='pencil' action='frequency' params='{"change": "custom"}'>{{readableFrequency}}</ui-button>
<ui-button icon='forward' state='{{data.frequency == data.maxFrequency ? "disabled": null}}' action='frequency' params='{"change": 2}'/>
<ui-button icon='fast-forward' state='{{data.frequency == data.maxFrequency ? "disabled": null}}' action='frequency' params='{"change": 10}'/>
<ui-button icon='fast-backward' state='{{data.frequency == data.minFrequency ? "disabled": null}}' action='frequency' params='{"adjust": -1}'/>
<ui-button icon='backward' state='{{data.frequency == data.minFrequency ? "disabled": null}}' action='frequency' params='{"adjust": -.2}'/>
<ui-button icon='pencil' action='frequency' params='{"tune": "input"}'>{{readableFrequency}}</ui-button>
<ui-button icon='forward' state='{{data.frequency == data.maxFrequency ? "disabled": null}}' action='frequency' params='{"adjust": .2}'/>
<ui-button icon='fast-forward' state='{{data.frequency == data.maxFrequency ? "disabled": null}}' action='frequency' params='{"adjust": 1}'/>
{{/if}}
</ui-section>
{{#if data.subspaceSwitchable}}
@@ -59,7 +59,7 @@
<ui-button icon='{{. ? "check-square-o" : "square-o"}}'
style='{{. ? "selected" : null}}'
action='channel' params='{"channel": "{{channel}}"}'>
{{channel}}</ui-button>
{{channel}}</ui-button><br/>
{{/each}}
</ui-section>
{{/if}}
+10 -10
View File
@@ -37,11 +37,11 @@ component.exports = {
<ui-bar min='0' max='{{data.inputLevelMax}}' value='{{data.inputLevel}}'>{{Math.round(adata.inputLevel)}}W</ui-bar>
</ui-section>
<ui-section label='Adjust Input'>
<ui-button icon='fast-backward' state='{{data.inputLevel == 0 ? "disabled" : null}}' action='input' params='{"input": "min"}'/>
<ui-button icon='backward' state='{{data.inputLevel == 0 ? "disabled" : null}}' action='input' params='{"input": "minus"}'/>
<ui-button icon='pencil' action='input' params='{"input": "custom"}'>Set</ui-button>
<ui-button icon='forward' state='{{data.inputLevel == data.inputLevelMax ? "disabled" : null}}' action='input' params='{"input": "plus"}'/>
<ui-button icon='fast-forward' state='{{data.inputLevel == data.inputLevelMax ? "disabled" : null}}' action='input' params='{"input": "max"}'/>
<ui-button icon='fast-backward' state='{{data.inputLevel == 0 ? "disabled" : null}}' action='input' params='{"target": "min"}'/>
<ui-button icon='backward' state='{{data.inputLevel == 0 ? "disabled" : null}}' action='input' params='{"adjust": -10000}'/>
<ui-button icon='pencil' action='input' params='{"target": "input"}'>Set</ui-button>
<ui-button icon='forward' state='{{data.inputLevel == data.inputLevelMax ? "disabled" : null}}' action='input' params='{"adjust": 10000}'/>
<ui-button icon='fast-forward' state='{{data.inputLevel == data.inputLevelMax ? "disabled" : null}}' action='input' params='{"target": "max"}'/>
</ui-section>
<ui-section label='Available'>
<span>{{Math.round(adata.inputAvailable)}}W</span>
@@ -58,11 +58,11 @@ component.exports = {
<ui-bar min='0' max='{{data.outputLevelMax}}' value='{{data.outputLevel}}'>{{Math.round(adata.outputLevel)}}W</ui-bar>
</ui-section>
<ui-section label='Adjust Output'>
<ui-button icon='fast-backward' state='{{data.outputLevel == 0 ? "disabled" : null}}' action='output' params='{"output": "min"}'/>
<ui-button icon='backward' state='{{data.outputLevel == 0 ? "disabled" : null}}' action='output' params='{"output": "minus"}'/>
<ui-button icon='pencil' action='output' params='{"output": "custom"}'>Set</ui-button>
<ui-button icon='forward' state='{{data.outputLevel == data.outputLevelMax ? "disabled" : null}}' action='output' params='{"output": "plus"}'/>
<ui-button icon='fast-forward' state='{{data.outputLevel == data.outputLevelMax ? "disabled" : null}}' action='output' params='{"output": "max"}'/>
<ui-button icon='fast-backward' state='{{data.outputLevel == 0 ? "disabled" : null}}' action='output' params='{"target": "min"}'/>
<ui-button icon='backward' state='{{data.outputLevel == 0 ? "disabled" : null}}' action='output' params='{"adjust": -10000}'/>
<ui-button icon='pencil' action='output' params='{"target": "input"}'>Set</ui-button>
<ui-button icon='forward' state='{{data.outputLevel == data.outputLevelMax ? "disabled" : null}}' action='output' params='{"adjust": 10000}'/>
<ui-button icon='fast-forward' state='{{data.outputLevel == data.outputLevelMax ? "disabled" : null}}' action='output' params='{"target": "max"}'/>
</ui-section>
<ui-section label='Outputting'>
<span>{{Math.round(adata.outputUsed)}}W</span>
+10 -10
View File
@@ -6,10 +6,10 @@
<span>{{Math.round(adata.angle)}}&deg; ({{data.direction}})</span>
</ui-section>
<ui-section label='Adjust Angle'>
<ui-button icon='step-backward' action='control' params='{"cdir": -15}'>15&deg;</ui-button>
<ui-button icon='backward' action='control' params='{"cdir": -5}'>5&deg;</ui-button>
<ui-button icon='forward' action='control' params='{"cdir": 5}'>5&deg;</ui-button>
<ui-button icon='step-forward' action='control' params='{"cdir": 15}'>15&deg;</ui-button>
<ui-button icon='step-backward' action='angle' params='{"adjust": -15}'>15&deg;</ui-button>
<ui-button icon='backward' action='angle' params='{"adjust": -5}'>5&deg;</ui-button>
<ui-button icon='forward' action='angle' params='{"adjust": 5}'>5&deg;</ui-button>
<ui-button icon='step-forward' action='angle' params='{"adjust": 15}'>15&deg;</ui-button>
</ui-section>
</ui-display>
<ui-display title='Tracking'>
@@ -25,12 +25,12 @@
<span>{{Math.round(adata.tracking_rate)}}&deg;/h ({{data.rotating_way}})</span>
</ui-section>
<ui-section label='Adjust Rate'>
<ui-button icon='fast-backward' action='control' params='{"tdir": -180}'>180&deg;</ui-button>
<ui-button icon='step-backward' action='control' params='{"tdir": -30}'>30&deg;</ui-button>
<ui-button icon='backward' action='control' params='{"tdir": -5}'>5&deg;</ui-button>
<ui-button icon='forward' action='control' params='{"tdir": 5}'>5&deg;</ui-button>
<ui-button icon='step-forward' action='control' params='{"tdir": 30}'>30&deg;</ui-button>
<ui-button icon='fast-forward' action='control' params='{"tdir": 180}'>180&deg;</ui-button>
<ui-button icon='fast-backward' action='rate' params='{"adjust": -180}'>180&deg;</ui-button>
<ui-button icon='step-backward' action='rate' params='{"adjust": -30}'>30&deg;</ui-button>
<ui-button icon='backward' action='rate' params='{"adjust": -5}'>5&deg;</ui-button>
<ui-button icon='forward' action='rate' params='{"adjust": 5}'>5&deg;</ui-button>
<ui-button icon='step-forward' action='rate' params='{"adjust": 30}'>30&deg;</ui-button>
<ui-button icon='fast-forward' action='rate' params='{"adjust": 180}'>180&deg;</ui-button>
</ui-section>
</ui-display>
<ui-display title="Devices" button>
+5 -5
View File
@@ -34,11 +34,11 @@ component.exports = {
</ui-section>
{{#if data.open}}
<ui-section label='Adjust Target'>
<ui-button icon='fast-backward' state='{{data.targetTemp > data.minTemp ? null : "disabled"}}' action='target' params='{"target": -20}'/>
<ui-button icon='backward' state='{{data.targetTemp > data.minTemp ? null : "disabled"}}' action='target' params='{"target": -5}'/>
<ui-button icon='pencil' action='target' params='{"target": "custom"}'>Set</ui-button>
<ui-button icon='forward' state='{{data.targetTemp < data.maxTemp ? null : "disabled"}}' action='target' params='{"target": 5}'/>
<ui-button icon='fast-forward' state='{{data.targetTemp < data.maxTemp ? null : "disabled"}}' action='target' params='{"target": 20}'/>
<ui-button icon='fast-backward' state='{{data.targetTemp > data.minTemp ? null : "disabled"}}' action='target' params='{"adjust": -20}'/>
<ui-button icon='backward' state='{{data.targetTemp > data.minTemp ? null : "disabled"}}' action='target' params='{"adjust": -5}'/>
<ui-button icon='pencil' action='target' params='{"target": "input"}'>Set</ui-button>
<ui-button icon='forward' state='{{data.targetTemp < data.maxTemp ? null : "disabled"}}' action='target' params='{"adjust": 5}'/>
<ui-button icon='fast-forward' state='{{data.targetTemp < data.maxTemp ? null : "disabled"}}' action='target' params='{"adjust": 20}'/>
</ui-section>
{{/if}}
<ui-section label='Mode'>
+1 -1
View File
@@ -28,7 +28,7 @@ component.exports = {
action='pressure' params='{"pressure": "reset"}'>Reset</ui-button>
<ui-button icon='minus' state='{{data.releasePressure > data.minReleasePressure ? null : "disabled"}}'
action='pressure' params='{"pressure": "min"}'>Min</ui-button>
<ui-button icon='pencil' action='pressure' params='{"pressure": "custom"}'>Set</ui-button>
<ui-button icon='pencil' action='pressure' params='{"pressure": "input"}'>Set</ui-button>
<ui-button icon='plus' state='{{data.releasePressure < data.maxReleasePressure ? null : "disabled"}}'
action='pressure' params='{"pressure": "max"}'>Max</ui-button>
</ui-section>
+5 -18
View File
@@ -1,16 +1,3 @@
<script>
component.exports = {
computed: {
heater () {
if (this.get('data.max')) return true
},
freezer () {
if (this.get('data.min')) return true
}
}
}
</script>
<ui-display title='Status'>
<ui-section label='Temperature'>
<span>{{Math.fixed(adata.temperature, 2)}} K</span>
@@ -25,14 +12,14 @@ component.exports = {
action='power'>{{data.on ? "On": "Off"}}</ui-button>
</ui-section>
<ui-section label='Target Temperature'>
<ui-button icon='fast-backward' style='{{data.target == (freezer ? data.min : data.initial) ? "disabled" : null}}'
<ui-button icon='fast-backward' style='{{data.target == data.min ? "disabled" : null}}'
action='target' params='{"adjust": -20}'/>
<ui-button icon='backward' style='{{data.target == (freezer ? data.min : data.initial) ? "disabled" : null}}'
<ui-button icon='backward' style='{{data.target == data.min ? "disabled" : null}}'
action='target' params='{"adjust": -5}'/>
<span>{{Math.fixed(adata.target, 2)}}</span>
<ui-button icon='forward' style='{{data.target == (heater ? data.max : data.initial) ? "disabled" : null}}'
<ui-button icon='pencil' action='target' params='{"target": "input"}'>{{Math.fixed(adata.target, 2)}}</ui-button>
<ui-button icon='forward' style='{{data.target == data.max ? "disabled" : null}}'
action='target' params='{"adjust": 5}'/>
<ui-button icon='fast-forward' style='{{data.target == (heater ? data.max : data.initial) ? "disabled" : null}}'
<ui-button icon='fast-forward' style='{{data.target == data.max ? "disabled" : null}}'
action='target' params='{"adjust": 20}'/>
</ui-section>
</ui-display>
+10 -7
View File
@@ -31,13 +31,16 @@ window.initialize = (dataString) => {
return Object.assign(base, server)
}
})
window.initialize = function () {}
}
const holder = document.getElementById('data')
const data = holder.textContent
const ref = holder.getAttribute('data-ref')
if (data !== '{}') { // If the JSON was inlined, load it.
window.initialize(data)
holder.remove()
}
import { act } from 'util/byond'
const holder = document.getElementById('data')
if (holder.textContent !== '{}') { // If the JSON was inlined, load it.
window.initialize(holder.textContent)
} else {
act(holder.getAttribute('data-ref'), 'tgui:initialize')
holder.remove()
}
act(ref, 'tgui:initialize')