mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-08-28 22:47:59 +01:00
/vg/ Multitool menu port!
With 100% better squashing. I hope.
This commit is contained in:
@@ -5,13 +5,15 @@
|
||||
//node2 is output port
|
||||
//node1 is input port
|
||||
|
||||
req_one_access_txt = "24;10"
|
||||
|
||||
name = "Dual Port Air Vent"
|
||||
desc = "Has a valve and pump attached to it. There are two ports."
|
||||
|
||||
level = 1
|
||||
|
||||
connect_types = list(1,2,3) //connects to regular, supply and scrubbers pipes
|
||||
|
||||
connect_types = list(1,2,3) //connects to regular, supply and scrubbers pipes
|
||||
|
||||
var/on = 0
|
||||
var/pump_direction = 1 //0 = siphoning, 1 = releasing
|
||||
|
||||
@@ -19,17 +21,49 @@
|
||||
var/input_pressure_min = 0
|
||||
var/output_pressure_max = 0
|
||||
|
||||
var/frequency = 0
|
||||
var/id = null
|
||||
var/frequency = 1439
|
||||
var/id_tag = null
|
||||
var/datum/radio_frequency/radio_connection
|
||||
var/advcontrol = 0//does this device listen to the AAC
|
||||
|
||||
settagwhitelist = list("id_tag")
|
||||
|
||||
var/pressure_checks = 1
|
||||
//1: Do not pass external_pressure_bound
|
||||
//2: Do not pass input_pressure_min
|
||||
//4: Do not pass output_pressure_max
|
||||
|
||||
/obj/machinery/atmospherics/binary/volume_pump/update_underlays()
|
||||
if(..())
|
||||
underlays.Cut()
|
||||
var/turf/T = get_turf(src)
|
||||
if(!istype(T))
|
||||
return
|
||||
add_underlay(T, node1, turn(dir, -180))
|
||||
add_underlay(T, node2, dir)
|
||||
|
||||
/obj/machinery/atmospherics/binary/dp_vent_pump/multitool_menu(var/mob/user,var/obj/item/device/multitool/P)
|
||||
return {"
|
||||
<ul>
|
||||
<li><b>Frequency:</b> <a href="?src=\ref[src];set_freq=-1">[format_frequency(frequency)] GHz</a> (<a href="?src=\ref[src];set_freq=[1439]">Reset</a>)</li>
|
||||
<li><b>ID Tag:</b> <a href="?src=\ref[src];set_id=1">[id_tag]</a></li>
|
||||
<li><b>AAC Acces:</b> <a href="?src=\ref[src];toggleadvcontrol=1">[advcontrol ? "Allowed" : "Blocked"]</a></li>
|
||||
</ul>
|
||||
"}
|
||||
|
||||
/obj/machinery/atmospherics/binary/dp_vent_pump/multitool_topic(var/mob/user, var/list/href_list, var/obj/O)
|
||||
. = ..()
|
||||
if(.)
|
||||
return .
|
||||
if("toggleadvcontrol" in href_list)
|
||||
advcontrol = !advcontrol
|
||||
return MT_UPDATE
|
||||
|
||||
/obj/machinery/atmospherics/binary/dp_vent_pump/New()
|
||||
..()
|
||||
if (!id_tag)
|
||||
assign_uid()
|
||||
id_tag = num2text(uid)
|
||||
icon = null
|
||||
|
||||
/obj/machinery/atmospherics/binary/dp_vent_pump/high_volume
|
||||
@@ -45,7 +79,7 @@
|
||||
return
|
||||
|
||||
overlays.Cut()
|
||||
|
||||
|
||||
var/vent_icon = "vent"
|
||||
|
||||
var/turf/T = get_turf(src)
|
||||
@@ -54,7 +88,7 @@
|
||||
|
||||
if(T.intact && node1 && node2 && node1.level == 1 && node2.level == 1 && istype(node1, /obj/machinery/atmospherics/pipe) && istype(node2, /obj/machinery/atmospherics/pipe))
|
||||
vent_icon += "h"
|
||||
|
||||
|
||||
if(!powered())
|
||||
vent_icon += "off"
|
||||
else
|
||||
@@ -150,7 +184,7 @@
|
||||
signal.source = src
|
||||
|
||||
signal.data = list(
|
||||
"tag" = id,
|
||||
"tag" = id_tag,
|
||||
"device" = "ADVP",
|
||||
"power" = on,
|
||||
"direction" = pump_direction?("release"):("siphon"),
|
||||
@@ -170,7 +204,7 @@
|
||||
set_frequency(frequency)
|
||||
|
||||
/obj/machinery/atmospherics/binary/dp_vent_pump/receive_signal(datum/signal/signal)
|
||||
if(!signal.data["tag"] || (signal.data["tag"] != id) || (signal.data["sigtype"]!="command"))
|
||||
if(!signal.data["tag"] || (signal.data["tag"] != id_tag) || (signal.data["sigtype"]!="command") || (signal.data["advcontrol"] && !advcontrol))
|
||||
return 0
|
||||
if(signal.data["power"])
|
||||
on = text2num(signal.data["power"])
|
||||
@@ -188,7 +222,7 @@
|
||||
pressure_checks &= ~1
|
||||
pump_direction = 0
|
||||
|
||||
if(signal.data["stabalize"])
|
||||
if(signal.data["stabilize"])//the fact that this was "stabalize" shows how many fucks people give about these wonders, none
|
||||
pressure_checks |= 1
|
||||
pump_direction = 1
|
||||
|
||||
@@ -220,4 +254,54 @@
|
||||
|
||||
spawn(2)
|
||||
broadcast_status()
|
||||
update_icon()
|
||||
update_icon()
|
||||
|
||||
/obj/machinery/atmospherics/binary/dp_vent_pump/attackby(var/obj/item/W as obj, var/mob/user as mob)
|
||||
/*
|
||||
if(istype(W, /obj/item/weapon/weldingtool))
|
||||
var/obj/item/weapon/weldingtool/WT = W
|
||||
if (WT.remove_fuel(0,user))
|
||||
user << "\blue Now welding the vent."
|
||||
if(do_after(user, 20))
|
||||
if(!src || !WT.isOn()) return
|
||||
playsound(get_turf(src), 'sound/items/Welder2.ogg', 50, 1)
|
||||
if(!welded)
|
||||
user.visible_message("[user] welds the vent shut.", "You weld the vent shut.", "You hear welding.")
|
||||
welded = 1
|
||||
update_icon()
|
||||
else
|
||||
user.visible_message("[user] unwelds the vent.", "You unweld the vent.", "You hear welding.")
|
||||
welded = 0
|
||||
update_icon()
|
||||
else
|
||||
user << "\blue The welding tool needs to be on to start this task."
|
||||
else
|
||||
user << "\blue You need more welding fuel to complete this task."
|
||||
return 1*/
|
||||
if(istype(W, /obj/item/device/multitool))
|
||||
update_multitool_menu(user)
|
||||
return 1
|
||||
if (!istype(W, /obj/item/weapon/wrench))
|
||||
return ..()
|
||||
if (!(stat & NOPOWER) && on)
|
||||
user << "\red You cannot unwrench this [src], turn it off first."
|
||||
return 1
|
||||
var/turf/T = src.loc
|
||||
if (level==1 && isturf(T) && T.intact)
|
||||
user << "\red You must remove the plating first."
|
||||
return 1
|
||||
var/datum/gas_mixture/int_air = return_air()
|
||||
var/datum/gas_mixture/env_air = loc.return_air()
|
||||
if ((int_air.return_pressure()-env_air.return_pressure()) > 2*ONE_ATMOSPHERE)
|
||||
user << "\red You cannot unwrench this [src], it too exerted due to internal pressure."
|
||||
add_fingerprint(user)
|
||||
return 1
|
||||
playsound(get_turf(src), 'sound/items/Ratchet.ogg', 50, 1)
|
||||
user << "\blue You begin to unfasten \the [src]..."
|
||||
if (do_after(user, 40))
|
||||
user.visible_message( \
|
||||
"[user] unfastens \the [src].", \
|
||||
"\blue You have unfastened \the [src].", \
|
||||
"You hear ratchet.")
|
||||
new /obj/item/pipe(loc, make_from=src)
|
||||
del(src)
|
||||
|
||||
@@ -7,17 +7,27 @@
|
||||
name = "Air Injector"
|
||||
desc = "Has a valve and pump attached to it"
|
||||
|
||||
req_one_access_txt = "24;10"
|
||||
|
||||
var/on = 0
|
||||
var/injecting = 0
|
||||
|
||||
var/volume_rate = 50
|
||||
|
||||
var/frequency = 0
|
||||
var/id = null
|
||||
var/id
|
||||
var/id_tag = null
|
||||
var/datum/radio_frequency/radio_connection
|
||||
Mtoollink = 1
|
||||
settagwhitelist = list("id_tag")
|
||||
|
||||
level = 1
|
||||
|
||||
/obj/machinery/atmospherics/unary/outlet_injector/New()
|
||||
..()
|
||||
if(id && !id_tag)//I'm not dealing with any more merge conflicts
|
||||
id_tag = id
|
||||
|
||||
/obj/machinery/atmospherics/unary/outlet_injector/update_icon()
|
||||
if(!powered())
|
||||
icon_state = "off"
|
||||
@@ -91,7 +101,7 @@
|
||||
signal.source = src
|
||||
|
||||
signal.data = list(
|
||||
"tag" = id,
|
||||
"tag" = id_tag,
|
||||
"device" = "AO",
|
||||
"power" = on,
|
||||
"volume_rate" = volume_rate,
|
||||
@@ -104,11 +114,10 @@
|
||||
|
||||
/obj/machinery/atmospherics/unary/outlet_injector/initialize()
|
||||
..()
|
||||
|
||||
set_frequency(frequency)
|
||||
|
||||
/obj/machinery/atmospherics/unary/outlet_injector/receive_signal(datum/signal/signal)
|
||||
if(!signal.data["tag"] || (signal.data["tag"] != id) || (signal.data["sigtype"]!="command"))
|
||||
if(!signal.data["tag"] || (signal.data["tag"] != id_tag) || (signal.data["sigtype"]!="command"))
|
||||
return 0
|
||||
|
||||
if(signal.data["power"])
|
||||
@@ -136,5 +145,57 @@
|
||||
broadcast_status()
|
||||
update_icon()
|
||||
|
||||
/*hide(var/i) //to make the little pipe section invisible, the icon changes.
|
||||
if(node)
|
||||
if(on)
|
||||
icon_state = "[i == 1 && istype(loc, /turf/simulated) ? "h" : "" ]on"
|
||||
else
|
||||
icon_state = "[i == 1 && istype(loc, /turf/simulated) ? "h" : "" ]off"
|
||||
else
|
||||
icon_state = "[i == 1 && istype(loc, /turf/simulated) ? "h" : "" ]exposed"
|
||||
on = 0
|
||||
return*/
|
||||
|
||||
/obj/machinery/atmospherics/unary/outlet_injector/multitool_menu(var/mob/user,var/obj/item/device/multitool/P)
|
||||
return {"
|
||||
<ul>
|
||||
<li><b>Frequency:</b> <a href="?src=\ref[src];set_freq=-1">[format_frequency(frequency)] GHz</a> (<a href="?src=\ref[src];set_freq=[1439]">Reset</a>)</li>
|
||||
<li>[format_tag("ID Tag","id_tag","set_id")]</a></li>
|
||||
</ul>
|
||||
"}
|
||||
|
||||
/obj/machinery/atmospherics/unary/outlet_injector/attackby(var/obj/item/weapon/W as obj, var/mob/user as mob)
|
||||
if(istype(W, /obj/item/device/multitool))
|
||||
interact(user)
|
||||
return 1
|
||||
if (!istype(W, /obj/item/weapon/wrench))
|
||||
return ..()
|
||||
if (!(stat & NOPOWER) && on)
|
||||
user << "\red You cannot unwrench this [src], turn it off first."
|
||||
return 1
|
||||
var/turf/T = src.loc
|
||||
if (level==1 && isturf(T) && T.intact)
|
||||
user << "\red You must remove the plating first."
|
||||
return 1
|
||||
var/datum/gas_mixture/int_air = return_air()
|
||||
var/datum/gas_mixture/env_air = loc.return_air()
|
||||
if ((int_air.return_pressure()-env_air.return_pressure()) > 2*ONE_ATMOSPHERE)
|
||||
user << "\red You cannot unwrench this [src], it too exerted due to internal pressure."
|
||||
add_fingerprint(user)
|
||||
return 1
|
||||
playsound(get_turf(src), 'sound/items/Ratchet.ogg', 50, 1)
|
||||
user << "\blue You begin to unfasten \the [src]..."
|
||||
if (do_after(user, 40))
|
||||
user.visible_message( \
|
||||
"[user] unfastens \the [src].", \
|
||||
"\blue You have unfastened \the [src].", \
|
||||
"You hear ratchet.")
|
||||
new /obj/item/pipe(loc, make_from=src)
|
||||
del(src)
|
||||
|
||||
/obj/machinery/atmospherics/unary/outlet_injector/interact(mob/user as mob)
|
||||
update_multitool_menu(user)
|
||||
|
||||
/obj/machinery/atmospherics/unary/outlet_injector/hide(var/i)
|
||||
update_underlays()
|
||||
update_underlays()
|
||||
|
||||
|
||||
@@ -16,6 +16,8 @@
|
||||
var/area_uid
|
||||
var/id_tag = null
|
||||
|
||||
req_one_access_txt = "24;10"
|
||||
|
||||
var/on = 0
|
||||
var/pump_direction = 1 //0 = siphoning, 1 = releasing
|
||||
|
||||
@@ -36,6 +38,9 @@
|
||||
|
||||
var/frequency = 1439
|
||||
var/datum/radio_frequency/radio_connection
|
||||
Mtoollink = 1
|
||||
settagwhitelist = list("id_tag")
|
||||
var/advcontrol = 0//does this device listen to the AAC
|
||||
|
||||
var/radio_filter_out
|
||||
var/radio_filter_in
|
||||
@@ -227,14 +232,14 @@
|
||||
if(stat & (NOPOWER|BROKEN))
|
||||
return
|
||||
//log_admin("DEBUG \[[world.timeofday]\]: /obj/machinery/atmospherics/unary/vent_pump/receive_signal([signal.debug_print()])")
|
||||
if(!signal.data["tag"] || (signal.data["tag"] != id_tag) || (signal.data["sigtype"]!="command"))
|
||||
if(!signal.data["tag"] || (signal.data["tag"] != id_tag) || (signal.data["sigtype"]!="command") || (signal.data["advcontrol"] && !advcontrol))
|
||||
return 0
|
||||
|
||||
if(signal.data["purge"] != null)
|
||||
pressure_checks &= ~1
|
||||
pump_direction = 0
|
||||
|
||||
if(signal.data["stabalize"] != null)
|
||||
if(signal.data["stabilize"] != null)
|
||||
pressure_checks |= 1
|
||||
pump_direction = 1
|
||||
|
||||
@@ -327,10 +332,14 @@
|
||||
welded = 0
|
||||
update_icon()
|
||||
else
|
||||
|
||||
user << "\blue The welding tool needs to be on to start this task."
|
||||
else
|
||||
user << "\blue You need more welding fuel to complete this task."
|
||||
return 1
|
||||
else if(istype(W, /obj/item/device/multitool))
|
||||
update_multitool_menu(user)
|
||||
return 1
|
||||
else
|
||||
..()
|
||||
|
||||
@@ -346,7 +355,31 @@
|
||||
if(old_stat != stat)
|
||||
update_icon()
|
||||
|
||||
|
||||
/obj/machinery/atmospherics/unary/vent_pump/interact(mob/user as mob)
|
||||
update_multitool_menu(user)
|
||||
|
||||
/obj/machinery/atmospherics/unary/vent_pump/multitool_menu(var/mob/user,var/obj/item/device/multitool/P)
|
||||
return {"
|
||||
<ul>
|
||||
<li><b>Frequency:</b> <a href="?src=\ref[src];set_freq=-1">[format_frequency(frequency)] GHz</a> (<a href="?src=\ref[src];set_freq=[1439]">Reset</a>)</li>
|
||||
<li>[format_tag("ID Tag","id_tag","set_id")]</li>
|
||||
<li><b>AAC Acces:</b> <a href="?src=\ref[src];toggleadvcontrol=1">[advcontrol ? "Allowed" : "Blocked"]</a>
|
||||
</ul>
|
||||
"}
|
||||
|
||||
/obj/machinery/atmospherics/unary/vent_pump/multitool_topic(var/mob/user, var/list/href_list, var/obj/O)
|
||||
. = ..()
|
||||
if(.)
|
||||
return .
|
||||
|
||||
if("toggleadvcontrol" in href_list)
|
||||
advcontrol = !advcontrol
|
||||
return MT_UPDATE
|
||||
|
||||
/obj/machinery/atmospherics/unary/vent_pump/attackby(var/obj/item/weapon/W as obj, var/mob/user as mob, params)
|
||||
if (istype(W, /obj/item/device/multitool))
|
||||
update_multitool_menu(user)
|
||||
if (!istype(W, /obj/item/weapon/wrench))
|
||||
return ..()
|
||||
if (!(stat & NOPOWER) && on)
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
icon = 'icons/atmos/vent_scrubber.dmi'
|
||||
icon_state = "map_scrubber"
|
||||
|
||||
req_one_access_txt = "24;10"
|
||||
|
||||
name = "Air Scrubber"
|
||||
desc = "Has a valve and pump attached to it"
|
||||
use_power = 1
|
||||
@@ -12,6 +14,8 @@
|
||||
var/id_tag = null
|
||||
var/frequency = 1439
|
||||
var/datum/radio_frequency/radio_connection
|
||||
settagwhitelist = list("id_tag")
|
||||
var/advcontrol = 0//does this device listen to the AAC?
|
||||
|
||||
var/on = 0
|
||||
var/scrubbing = 1 //0 = siphoning, 1 = scrubbing
|
||||
@@ -203,7 +207,7 @@
|
||||
/obj/machinery/atmospherics/unary/vent_scrubber/receive_signal(datum/signal/signal)
|
||||
if(stat & (NOPOWER|BROKEN))
|
||||
return
|
||||
if(!signal.data["tag"] || (signal.data["tag"] != id_tag) || (signal.data["sigtype"]!="command"))
|
||||
if(!signal.data["tag"] || (signal.data["tag"] != id_tag) || (signal.data["sigtype"]!="command") || (signal.data["advcontrol"] && !advcontrol))
|
||||
return 0
|
||||
|
||||
if(signal.data["power"] != null)
|
||||
@@ -281,8 +285,23 @@
|
||||
if(old_stat != stat)
|
||||
update_icon()
|
||||
|
||||
/obj/machinery/atmospherics/unary/vent_scrubber/can_crawl_through()
|
||||
return !welded
|
||||
/obj/machinery/atmospherics/unary/vent_scrubber/multitool_menu(var/mob/user,var/obj/item/device/multitool/P)
|
||||
return {"
|
||||
<ul>
|
||||
<li><b>Frequency:</b> <a href="?src=\ref[src];set_freq=-1">[format_frequency(frequency)] GHz</a> (<a href="?src=\ref[src];set_freq=[1439]">Reset</a>)</li>
|
||||
<li>[format_tag("ID Tag","id_tag")]</li>
|
||||
<li><b>AAC Acces:</b> <a href="?src=\ref[src];toggleadvcontrol=1">[advcontrol ? "Allowed" : "Blocked"]</a>
|
||||
</ul>
|
||||
"}
|
||||
|
||||
/obj/machinery/atmospherics/unary/vent_scrubber/multitool_topic(var/mob/user, var/list/href_list, var/obj/O)
|
||||
. = ..()
|
||||
if(.)
|
||||
return .
|
||||
if("toggleadvcontrol" in href_list)
|
||||
advcontrol = !advcontrol
|
||||
return MT_UPDATE
|
||||
|
||||
|
||||
/obj/machinery/atmospherics/unary/vent_scrubber/attackby(var/obj/item/weapon/W as obj, var/mob/user as mob, params)
|
||||
if(istype(W, /obj/item/weapon/weldingtool))
|
||||
@@ -305,6 +324,9 @@
|
||||
else
|
||||
user << "<span class='notice'>You need more welding fuel to complete this task.</span>"
|
||||
return 1
|
||||
if(istype(W, /obj/item/device/multitool))
|
||||
update_multitool_menu(user)
|
||||
return 1
|
||||
if (!istype(W, /obj/item/weapon/wrench))
|
||||
return ..()
|
||||
if (!(stat & NOPOWER) && on)
|
||||
|
||||
@@ -18,6 +18,8 @@
|
||||
var/datum/pipe_network/network_node1
|
||||
var/datum/pipe_network/network_node2
|
||||
|
||||
req_one_access_txt = "24;10"
|
||||
|
||||
/obj/machinery/atmospherics/valve/open
|
||||
open = 1
|
||||
icon_state = "map_valve1"
|
||||
@@ -179,7 +181,7 @@
|
||||
break
|
||||
|
||||
build_network()
|
||||
|
||||
|
||||
update_icon()
|
||||
update_underlays()
|
||||
|
||||
@@ -238,10 +240,11 @@
|
||||
name = "digital valve"
|
||||
desc = "A digitally controlled valve."
|
||||
icon = 'icons/atmos/digital_valve.dmi'
|
||||
|
||||
var/frequency = 0
|
||||
var/id = null
|
||||
|
||||
var/frequency = 1439
|
||||
var/id_tag = null
|
||||
var/datum/radio_frequency/radio_connection
|
||||
settagwhitelist = list("id_tag")
|
||||
|
||||
/obj/machinery/atmospherics/valve/digital/attack_ai(mob/user as mob)
|
||||
return src.attack_hand(user)
|
||||
@@ -281,7 +284,7 @@
|
||||
set_frequency(frequency)
|
||||
|
||||
/obj/machinery/atmospherics/valve/digital/receive_signal(datum/signal/signal)
|
||||
if(!signal.data["tag"] || (signal.data["tag"] != id))
|
||||
if(!signal.data["tag"] || (signal.data["tag"] != id_tag))
|
||||
return 0
|
||||
|
||||
switch(signal.data["command"])
|
||||
@@ -298,13 +301,24 @@
|
||||
close()
|
||||
else
|
||||
open()
|
||||
if("valve_set")
|
||||
if(signal.data["valve_set"] == 1)
|
||||
if(!open)
|
||||
open()
|
||||
else
|
||||
if(open)
|
||||
close()
|
||||
|
||||
/obj/machinery/atmospherics/valve/digital/attackby(var/obj/item/weapon/W as obj, var/mob/user as mob)
|
||||
if(istype(W, /obj/item/device/multitool))
|
||||
update_multitool_menu(user)
|
||||
return 1
|
||||
..()
|
||||
|
||||
/obj/machinery/atmospherics/valve/attackby(var/obj/item/weapon/W as obj, var/mob/user as mob, params)
|
||||
if (!istype(W, /obj/item/weapon/wrench))
|
||||
return ..()
|
||||
if (istype(src, /obj/machinery/atmospherics/valve/digital) && src:frequency)
|
||||
user << "\red You cannot unwrench this [src], it's too complicated."
|
||||
return 1
|
||||
|
||||
var/datum/gas_mixture/int_air = return_air()
|
||||
var/datum/gas_mixture/env_air = loc.return_air()
|
||||
if ((int_air.return_pressure()-env_air.return_pressure()) > 2*ONE_ATMOSPHERE)
|
||||
@@ -319,4 +333,12 @@
|
||||
"\blue You have unfastened \the [src].", \
|
||||
"You hear ratchet.")
|
||||
new /obj/item/pipe(loc, make_from=src)
|
||||
del(src)
|
||||
del(src)
|
||||
|
||||
/obj/machinery/atmospherics/valve/digital/multitool_menu(var/mob/user,var/obj/item/device/multitool/P)
|
||||
return {"
|
||||
<ul>
|
||||
<li><b>Frequency:</b> <a href="?src=\ref[src];set_freq=-1">[format_frequency(frequency)] GHz</a> (<a href="?src=\ref[src];set_freq=[1439]">Reset</a>)</li>
|
||||
<li>[format_tag("ID Tag","id_tag","set_id")]</a></li>
|
||||
</ul>
|
||||
"}
|
||||
|
||||
@@ -1428,3 +1428,23 @@
|
||||
dir = get_dir(src, node1)
|
||||
else
|
||||
icon_state = "exposed"
|
||||
|
||||
/obj/machinery/atmospherics/pipe/vent/attackby(var/obj/item/weapon/W, var/mob/user)
|
||||
if (!istype(W, /obj/item/weapon/wrench))
|
||||
return ..()
|
||||
var/turf/T = get_turf(src)
|
||||
var/datum/gas_mixture/int_air = return_air()
|
||||
var/datum/gas_mixture/env_air = T.return_air()
|
||||
if ((int_air.return_pressure()-env_air.return_pressure()) > 2*ONE_ATMOSPHERE)
|
||||
user << "\red You cannot unwrench this [src], it too exerted due to internal pressure."
|
||||
add_fingerprint(user)
|
||||
return 1
|
||||
playsound(T, 'sound/items/Ratchet.ogg', 50, 1)
|
||||
user << "\blue You begin to unfasten \the [src]..."
|
||||
if (do_after(user, 40))
|
||||
user.visible_message( \
|
||||
"[user] unfastens \the [src].", \
|
||||
"\blue You have unfastened \the [src].", \
|
||||
"You hear ratchet.")
|
||||
new /obj/item/pipe(T, make_from=src)
|
||||
del(src)
|
||||
|
||||
@@ -24,4 +24,9 @@
|
||||
|
||||
#define HYDRO_SPEED_MULTIPLIER 1
|
||||
|
||||
#define NANO_IGNORE_DISTANCE 1
|
||||
#define NANO_IGNORE_DISTANCE 1
|
||||
|
||||
// multitool_topic() shit
|
||||
#define MT_ERROR -1
|
||||
#define MT_UPDATE 1
|
||||
#define MT_REINIT 2
|
||||
@@ -2,12 +2,16 @@ obj/machinery/air_sensor
|
||||
icon = 'icons/obj/stationobjs.dmi'
|
||||
icon_state = "gsensor1"
|
||||
name = "Gas Sensor"
|
||||
req_one_access_txt = "24;10"
|
||||
|
||||
anchored = 1
|
||||
var/state = 0
|
||||
var/bolts = 1
|
||||
|
||||
var/id_tag
|
||||
var/frequency = 1439
|
||||
Mtoollink = 1
|
||||
settagwhitelist = list("id_tag")
|
||||
|
||||
var/on = 1
|
||||
var/output = 3
|
||||
@@ -25,6 +29,62 @@ obj/machinery/air_sensor
|
||||
update_icon()
|
||||
icon_state = "gsensor[on]"
|
||||
|
||||
multitool_menu(var/mob/user, var/obj/item/device/multitool/P)
|
||||
return {"
|
||||
<b>Main</b>
|
||||
<ul>
|
||||
<li><b>Frequency:</b> <a href="?src=\ref[src];set_freq=-1">[format_frequency(frequency)] GHz</a> (<a href="?src=\ref[src];set_freq=[initial(frequency)]">Reset</a>)</li>
|
||||
<li>[format_tag("ID Tag","id_tag")]</li>
|
||||
<li>Floor Bolts: <a href="?src=\ref[src];toggle_bolts=1">[bolts ? "Enabled" : "Disabled"]</a>
|
||||
<li>Monitor Pressure: <a href="?src=\ref[src];toggle_out_flag=1">[output&1 ? "Yes" : "No"]</a>
|
||||
<li>Monitor Temperature: <a href="?src=\ref[src];toggle_out_flag=2">[output&2 ? "Yes" : "No"]</a>
|
||||
<li>Monitor Oxygen Concentration: <a href="?src=\ref[src];toggle_out_flag=4">[output&4 ? "Yes" : "No"]</a>
|
||||
<li>Monitor Plasma Concentration: <a href="?src=\ref[src];toggle_out_flag=8">[output&8 ? "Yes" : "No"]</a>
|
||||
<li>Monitor Nitrogen Concentration: <a href="?src=\ref[src];toggle_out_flag=16">[output&16 ? "Yes" : "No"]</a>
|
||||
<li>Monitor Carbon Dioxide Concentration: <a href="?src=\ref[src];toggle_out_flag=32">[output&32 ? "Yes" : "No"]</a>
|
||||
</ul>"}
|
||||
|
||||
multitool_topic(var/mob/user, var/list/href_list, var/obj/O)
|
||||
. = ..()
|
||||
if(.)
|
||||
return .
|
||||
|
||||
if("toggle_out_flag" in href_list)
|
||||
var/bitflag_value = text2num(href_list["toggle_out_flag"])//this is a string normally
|
||||
if(!(bitflag_value in list(1, 2, 4, 8, 16, 32))) //Here to prevent breaking the sensors with HREF exploits
|
||||
return 0
|
||||
if(output&bitflag_value)//the bitflag is on ATM
|
||||
output &= ~bitflag_value
|
||||
else//can't not be off
|
||||
output |= bitflag_value
|
||||
return MT_UPDATE
|
||||
if("toggle_bolts" in href_list)
|
||||
bolts = !bolts
|
||||
if(bolts)
|
||||
visible_message("You hear a quite click as the [src] bolts to the floor", "You hear a quite click")
|
||||
else
|
||||
visible_message("You hear a quite click as the [src]'s floor bolts raise", "You hear a quite click")
|
||||
return MT_UPDATE
|
||||
|
||||
|
||||
attackby(var/obj/item/W as obj, var/mob/user as mob)
|
||||
if(istype(W, /obj/item/device/multitool))
|
||||
update_multitool_menu(user)
|
||||
return 1
|
||||
if(istype(W, /obj/item/weapon/wrench))
|
||||
if(bolts)
|
||||
usr << "The [src] is bolted to the floor! You can't detach it like this."
|
||||
return 1
|
||||
playsound(src.loc, 'sound/items/Ratchet.ogg', 50, 1)
|
||||
user << "\blue You begin to unfasten \the [src]..."
|
||||
if(do_after(user, 40))
|
||||
user.visible_message("[user] unfastens \the [src].", "\blue You have unfastened \the [src].", "You hear ratchet.")
|
||||
new /obj/item/pipe_gsensor(src.loc)
|
||||
del(src)
|
||||
return 1
|
||||
if(..())
|
||||
return 1
|
||||
|
||||
process()
|
||||
if(on)
|
||||
var/datum/signal/signal = new
|
||||
@@ -77,11 +137,15 @@ obj/machinery/air_sensor
|
||||
/obj/machinery/computer/general_air_control
|
||||
icon = 'icons/obj/computer.dmi'
|
||||
icon_state = "tank"
|
||||
circuit = "/obj/item/weapon/circuitboard/air_management"
|
||||
req_one_access_txt = "24;10"
|
||||
|
||||
name = "Computer"
|
||||
|
||||
var/frequency = 1439
|
||||
var/show_sensors=1
|
||||
var/list/sensors = list()
|
||||
Mtoollink = 1
|
||||
|
||||
var/list/sensor_information = list()
|
||||
var/datum/radio_frequency/radio_connection
|
||||
@@ -97,42 +161,16 @@ obj/machinery/air_sensor
|
||||
process()
|
||||
..()
|
||||
if(!sensors)
|
||||
warning("[src.type] at [x],[y],[z] has null sensors. Please fix.")
|
||||
//warning("[src.type] at [x],[y],[z] has null sensors. Please fix.")//commenting this line out because the admins will get a warning like this every time somebody builds another GAC
|
||||
sensors = list()
|
||||
src.updateUsrDialog()
|
||||
|
||||
attackby(I as obj, user as mob, params)
|
||||
if(istype(I, /obj/item/weapon/screwdriver))
|
||||
playsound(get_turf(src), 'sound/items/Screwdriver.ogg', 50, 1)
|
||||
if(do_after(user, 20))
|
||||
if (src.stat & BROKEN)
|
||||
user << "\blue The broken glass falls out."
|
||||
var/obj/structure/computerframe/A = new /obj/structure/computerframe( src.loc )
|
||||
getFromPool(/obj/item/weapon/shard, loc)
|
||||
var/obj/item/weapon/circuitboard/air_management/M = new /obj/item/weapon/circuitboard/air_management( A )
|
||||
for (var/obj/C in src)
|
||||
C.loc = src.loc
|
||||
M.frequency = src.frequency
|
||||
A.circuit = M
|
||||
A.state = 3
|
||||
A.icon_state = "3"
|
||||
A.anchored = 1
|
||||
del(src)
|
||||
else
|
||||
user << "\blue You disconnect the monitor."
|
||||
var/obj/structure/computerframe/A = new /obj/structure/computerframe( src.loc )
|
||||
var/obj/item/weapon/circuitboard/air_management/M = new /obj/item/weapon/circuitboard/air_management( A )
|
||||
for (var/obj/C in src)
|
||||
C.loc = src.loc
|
||||
M.frequency = src.frequency
|
||||
A.circuit = M
|
||||
A.state = 4
|
||||
A.icon_state = "4"
|
||||
A.anchored = 1
|
||||
del(src)
|
||||
else
|
||||
src.attack_hand(user)
|
||||
return
|
||||
if(istype(I, /obj/item/device/multitool))
|
||||
update_multitool_menu(user)
|
||||
if(..())
|
||||
return 1
|
||||
|
||||
|
||||
receive_signal(datum/signal/signal)
|
||||
if(!signal || signal.encryption) return
|
||||
@@ -231,9 +269,96 @@ legend {
|
||||
initialize()
|
||||
set_frequency(frequency)
|
||||
|
||||
multitool_menu(var/mob/user, var/obj/item/device/multitool/P)
|
||||
var/dat= {"
|
||||
<b>Main</b>
|
||||
<ul>
|
||||
<li><b>Frequency:</b> <a href="?src=\ref[src];set_freq=-1">[format_frequency(frequency)] GHz</a> (<a href="?src=\ref[src];set_freq=[initial(frequency)]">Reset</a>)</li>
|
||||
</ul>
|
||||
<b>Sensors:</b>
|
||||
<ul>"}
|
||||
for(var/id_tag in sensors)
|
||||
dat += {"<li><a href="?src=\ref[src];edit_sensor=[id_tag]">[sensors[id_tag]]</a></li>"}
|
||||
dat += {"<li><a href="?src=\ref[src];add_sensor=1">\[+\]</a></li></ul>"}
|
||||
return dat
|
||||
|
||||
multitool_topic(var/mob/user,var/list/href_list,var/obj/O)
|
||||
. = ..()
|
||||
if(.) return .
|
||||
if("add_sensor" in href_list)
|
||||
|
||||
// Make a list of all available sensors on the same frequency
|
||||
var/list/sensor_list = list()
|
||||
for(var/obj/machinery/air_sensor/G in machines)
|
||||
if(!isnull(G.id_tag) && G.frequency == frequency)
|
||||
sensor_list|=G.id_tag
|
||||
if(!sensor_list.len)
|
||||
user << "<span class=\"warning\">No sensors on this frequency.</span>"
|
||||
return MT_ERROR
|
||||
|
||||
// Have the user pick one of them and name its label
|
||||
var/sensor = input(user, "Select a sensor:", "Sensor Data") as null|anything in sensor_list
|
||||
if(!sensor)
|
||||
return MT_ERROR
|
||||
var/label = reject_bad_name( input(user, "Choose a sensor label:", "Sensor Label") as text|null, allow_numbers=1)
|
||||
if(!label)
|
||||
return MT_ERROR
|
||||
|
||||
// Add the sensor's information to general_air_controler
|
||||
sensors[sensor] = label
|
||||
return MT_UPDATE
|
||||
|
||||
if("edit_sensor" in href_list)
|
||||
var/list/sensor_list = list()
|
||||
for(var/obj/machinery/air_sensor/G in machines)
|
||||
if(!isnull(G.id_tag) && G.frequency == frequency)
|
||||
sensor_list|=G.id_tag
|
||||
if(!sensor_list.len)
|
||||
user << "<span class=\"warning\">No sensors on this frequency.</span>"
|
||||
return MT_ERROR
|
||||
var/label = sensors[href_list["edit_sensor"]]
|
||||
var/sensor = input(user, "Select a sensor:", "Sensor Data", href_list["edit_sensor"]) as null|anything in sensor_list
|
||||
if(!sensor)
|
||||
return MT_ERROR
|
||||
sensors.Remove(href_list["edit_sensor"])
|
||||
sensors[sensor] = label
|
||||
return MT_UPDATE
|
||||
|
||||
unlinkFrom(var/mob/user, var/obj/O)
|
||||
..()
|
||||
if("id_tag" in O.vars && (istype(O,/obj/machinery/air_sensor) || istype(O, /obj/machinery/meter)))
|
||||
sensors.Remove(O:id_tag)
|
||||
return 1
|
||||
return 0
|
||||
|
||||
linkMenu(var/obj/O)
|
||||
if(isLinkedWith(O))
|
||||
return
|
||||
|
||||
var/dat=""
|
||||
|
||||
if(istype(O,/obj/machinery/air_sensor) || istype(O, /obj/machinery/meter))
|
||||
dat += " <a href='?src=\ref[src];link=1'>\[New Sensor\]</a> "
|
||||
return dat
|
||||
|
||||
canLink(var/obj/O, var/list/context)
|
||||
if(istype(O,/obj/machinery/air_sensor) || istype(O, /obj/machinery/meter))
|
||||
return O:id_tag
|
||||
|
||||
isLinkedWith(var/obj/O)
|
||||
if(istype(O,/obj/machinery/air_sensor) || istype(O, /obj/machinery/meter))
|
||||
return O:id_tag in sensors
|
||||
|
||||
linkWith(var/mob/user, var/obj/O, var/link/context)
|
||||
sensors[O:id_tag] = reject_bad_name(input(user, "Choose a sensor label:", "Sensor Label") as text|null, allow_numbers=1)
|
||||
return 1
|
||||
|
||||
large_tank_control
|
||||
icon = 'icons/obj/computer.dmi'
|
||||
icon_state = "tank"
|
||||
circuit = "/obj/item/weapon/circuitboard/large_tank_control"
|
||||
req_one_access_txt = "24;10"
|
||||
settagwhitelist = list("input_tag", "output_tag")
|
||||
|
||||
var/input_tag
|
||||
var/output_tag
|
||||
@@ -241,8 +366,90 @@ legend {
|
||||
var/list/input_info
|
||||
var/list/output_info
|
||||
|
||||
var/list/input_linkable=list(
|
||||
/obj/machinery/atmospherics/unary/outlet_injector,
|
||||
/obj/machinery/atmospherics/unary/vent_pump
|
||||
)
|
||||
|
||||
var/list/output_linkable=list(
|
||||
/obj/machinery/atmospherics/unary/vent_pump
|
||||
)
|
||||
|
||||
var/pressure_setting = ONE_ATMOSPHERE * 45
|
||||
|
||||
attackby(I as obj, user as mob)
|
||||
if(istype(I, /obj/item/device/multitool))
|
||||
update_multitool_menu(user)
|
||||
if(..())
|
||||
return 1
|
||||
|
||||
|
||||
multitool_menu(var/mob/user, var/obj/item/device/multitool/P)
|
||||
var/dat= {"
|
||||
<ul>
|
||||
<li><b>Frequency:</b> <a href="?src=\ref[src];set_freq=-1">[format_frequency(frequency)] GHz</a> (<a href="?src=\ref[src];set_freq=[initial(frequency)]">Reset</a>)</li>
|
||||
<li>[format_tag("Input","input_tag")]</li>
|
||||
<li>[format_tag("Output","output_tag")]</li>
|
||||
</ul>
|
||||
<b>Sensors:</b>
|
||||
<ul>"}
|
||||
for(var/id_tag in sensors)
|
||||
dat += {"<li><a href="?src=\ref[src];edit_sensor=[id_tag]">[sensors[id_tag]]</a></li>"}
|
||||
dat += {"<li><a href="?src=\ref[src];add_sensor=1">\[+\]</a></li></ul>"}
|
||||
return dat
|
||||
|
||||
|
||||
linkWith(var/mob/user, var/obj/O, var/list/context)
|
||||
if(context["slot"]=="input" && is_type_in_list(O,input_linkable))
|
||||
input_tag = O:id_tag
|
||||
input_info = null
|
||||
if(istype(O,/obj/machinery/atmospherics/unary/vent_pump))
|
||||
send_signal(list("tag"=input_tag,
|
||||
"direction"=1, // Release
|
||||
"checks" =0 // No pressure checks.
|
||||
))
|
||||
return 1
|
||||
if(context["slot"]=="output" && is_type_in_list(O,output_linkable))
|
||||
output_tag = O:id_tag
|
||||
output_info = null
|
||||
if(istype(O,/obj/machinery/atmospherics/unary/vent_pump))
|
||||
send_signal(list("tag"=output_tag,
|
||||
"direction"=0, // Siphon
|
||||
"checks" =2 // Internal pressure checks.
|
||||
))
|
||||
return 1
|
||||
|
||||
unlinkFrom(var/mob/user, var/obj/O)
|
||||
if("id_tag" in O.vars)
|
||||
if(O:id_tag == input_tag)
|
||||
input_tag=null
|
||||
input_info=null
|
||||
return 1
|
||||
if(O:id_tag == output_tag)
|
||||
output_tag=null
|
||||
output_info=null
|
||||
return 1
|
||||
return 0
|
||||
|
||||
linkMenu(var/obj/O)
|
||||
var/dat=""
|
||||
if(canLink(O,list("slot"="input")))
|
||||
dat += " <a href='?src=\ref[src];link=1;slot=input'>\[Link @ Input\]</a> "
|
||||
if(canLink(O,list("slot"="output")))
|
||||
dat += " <a href='?src=\ref[src];link=1;slot=output'>\[Link @ Output\]</a> "
|
||||
return dat
|
||||
|
||||
canLink(var/obj/O, var/list/context)
|
||||
return (context["slot"]=="input" && is_type_in_list(O,input_linkable)) || (context["slot"]=="output" && is_type_in_list(O,output_linkable))
|
||||
|
||||
isLinkedWith(var/obj/O)
|
||||
if(O:id_tag == input_tag)
|
||||
return 1
|
||||
if(O:id_tag == output_tag)
|
||||
return 1
|
||||
return 0
|
||||
|
||||
|
||||
process()
|
||||
..()
|
||||
if(!input_info && input_tag)
|
||||
@@ -362,9 +569,9 @@ legend {
|
||||
else if(href_list["out_set_pressure"])
|
||||
output_info = null
|
||||
signal.data = list ("tag" = output_tag, "set_internal_pressure" = "[pressure_setting]")
|
||||
else
|
||||
/*else
|
||||
testing("Bad Topic() to GAC \"[src.name]\": [href]")
|
||||
return // NOPE.
|
||||
return*/ // NOPE. // disabling because it spams when multitool menus are used
|
||||
|
||||
signal.data["sigtype"]="command"
|
||||
radio_connection.post_signal(src, signal, filter = RADIO_ATMOSIA)
|
||||
@@ -373,6 +580,7 @@ legend {
|
||||
fuel_injection
|
||||
icon = 'icons/obj/computer.dmi'
|
||||
icon_state = "atmos"
|
||||
circuit = "/obj/item/weapon/circuitboard/injector_control"
|
||||
|
||||
var/device_tag
|
||||
var/list/device_info
|
||||
@@ -383,37 +591,10 @@ legend {
|
||||
var/on_temperature = 1200
|
||||
|
||||
attackby(I as obj, user as mob, params)
|
||||
if(istype(I, /obj/item/weapon/screwdriver))
|
||||
playsound(get_turf(src), 'sound/items/Screwdriver.ogg', 50, 1)
|
||||
if(do_after(user, 20))
|
||||
if (src.stat & BROKEN)
|
||||
user << "\blue The broken glass falls out."
|
||||
var/obj/structure/computerframe/A = new /obj/structure/computerframe( src.loc )
|
||||
getFromPool(/obj/item/weapon/shard, loc)
|
||||
var/obj/item/weapon/circuitboard/injector_control/M = new /obj/item/weapon/circuitboard/injector_control( A )
|
||||
for (var/obj/C in src)
|
||||
C.loc = src.loc
|
||||
M.frequency = src.frequency
|
||||
A.circuit = M
|
||||
A.state = 3
|
||||
A.icon_state = "3"
|
||||
A.anchored = 1
|
||||
del(src)
|
||||
else
|
||||
user << "\blue You disconnect the monitor."
|
||||
var/obj/structure/computerframe/A = new /obj/structure/computerframe( src.loc )
|
||||
var/obj/item/weapon/circuitboard/injector_control/M = new /obj/item/weapon/circuitboard/injector_control( A )
|
||||
for (var/obj/C in src)
|
||||
C.loc = src.loc
|
||||
M.frequency = src.frequency
|
||||
A.circuit = M
|
||||
A.state = 4
|
||||
A.icon_state = "4"
|
||||
A.anchored = 1
|
||||
del(src)
|
||||
else
|
||||
src.attack_hand(user)
|
||||
return
|
||||
if(istype(I, /obj/item/device/multitool))
|
||||
update_multitool_menu(user)
|
||||
if(..())
|
||||
return 1
|
||||
|
||||
process()
|
||||
if(automation)
|
||||
|
||||
@@ -8,13 +8,19 @@
|
||||
power_channel = ENVIRON
|
||||
var/frequency = 0
|
||||
var/id
|
||||
var/id_tag
|
||||
use_power = 1
|
||||
idle_power_usage = 2
|
||||
active_power_usage = 5
|
||||
req_one_access_txt = "24;10"
|
||||
Mtoollink = 1
|
||||
settagwhitelist = list("id_tag")
|
||||
|
||||
/obj/machinery/meter/New()
|
||||
..()
|
||||
src.target = locate(/obj/machinery/atmospherics/pipe) in loc
|
||||
if(id && !id_tag)//i'm not dealing with further merge conflicts, fuck it
|
||||
id_tag = id
|
||||
return 1
|
||||
|
||||
/obj/machinery/meter/initialize()
|
||||
@@ -59,7 +65,7 @@
|
||||
signal.source = src
|
||||
signal.transmission_method = 1
|
||||
signal.data = list(
|
||||
"tag" = id,
|
||||
"tag" = id_tag,
|
||||
"device" = "AM",
|
||||
"pressure" = round(env_pressure),
|
||||
"sigtype" = "status"
|
||||
@@ -106,6 +112,10 @@
|
||||
return ..()
|
||||
|
||||
/obj/machinery/meter/attackby(var/obj/item/weapon/W as obj, var/mob/user as mob, params)
|
||||
if(istype(W, /obj/item/device/multitool))
|
||||
update_multitool_menu(user)
|
||||
return 1
|
||||
|
||||
if (!istype(W, /obj/item/weapon/wrench))
|
||||
return ..()
|
||||
playsound(src.loc, 'sound/items/Ratchet.ogg', 50, 1)
|
||||
@@ -131,4 +141,12 @@
|
||||
src.target = loc
|
||||
|
||||
/obj/machinery/meter/turf/attackby(var/obj/item/weapon/W as obj, var/mob/user as mob, params)
|
||||
return
|
||||
return
|
||||
|
||||
/obj/machinery/meter/multitool_menu(var/mob/user, var/obj/item/device/multitool/P)
|
||||
return {"
|
||||
<b>Main</b>
|
||||
<ul>
|
||||
<li><b>Frequency:</b> <a href="?src=\ref[src];set_freq=-1">[format_frequency(frequency)] GHz</a> (<a href="?src=\ref[src];set_freq=[initial(frequency)]">Reset</a>)</li>
|
||||
<li>[format_tag("ID Tag","id_tag")]</li>
|
||||
</ul>"}
|
||||
@@ -227,6 +227,13 @@
|
||||
build_path = "/obj/machinery/computer/telescience"
|
||||
origin_tech = "programming=3;bluespace=2"
|
||||
|
||||
/obj/item/weapon/circuitboard/atmos_automation
|
||||
name = "Circuit board (Atmospherics Automation)"
|
||||
build_path = "/obj/machinery/computer/general_air_control/atmos_automation"
|
||||
/obj/item/weapon/circuitboard/large_tank_control
|
||||
name = "Circuit board (Atmospheric Tank Control)"
|
||||
build_path = "/obj/machinery/computer/general_air_control/large_tank_control"
|
||||
|
||||
/obj/item/weapon/circuitboard/HONKputer
|
||||
name = "Circuit board (HONKputer)"
|
||||
build_path = "/obj/machinery/computer/HONKputer"
|
||||
|
||||
@@ -114,6 +114,7 @@ Class Procs:
|
||||
var/area/myArea
|
||||
var/interact_offline = 0 // Can the machine be interacted with while de-powered.
|
||||
var/use_log = list()
|
||||
var/list/settagwhitelist = list()//WHITELIST OF VARIABLES THAT THE set_tag HREF CAN MODIFY, DON'T PUT SHIT YOU DON'T NEED ON HERE, AND IF YOU'RE GONNA USE set_tag (format_tag() proc), ADD TO THIS LIST.
|
||||
|
||||
/obj/machinery/New()
|
||||
addAtProcessing()
|
||||
@@ -184,6 +185,119 @@ Class Procs:
|
||||
use_power(active_power_usage,power_channel, 1)
|
||||
return 1
|
||||
|
||||
/obj/machinery/proc/multitool_topic(var/mob/user,var/list/href_list,var/obj/O)
|
||||
if("set_id" in href_list)
|
||||
if(!("id_tag" in vars))
|
||||
warning("set_id: [type] has no id_tag var.")
|
||||
var/newid = copytext(reject_bad_text(input(usr, "Specify the new ID tag for this machine", src, src:id_tag) as null|text),1,MAX_MESSAGE_LEN)
|
||||
if(newid)
|
||||
src:id_tag = newid
|
||||
return MT_UPDATE|MT_REINIT
|
||||
if("set_freq" in href_list)
|
||||
if(!("frequency" in vars))
|
||||
warning("set_freq: [type] has no frequency var.")
|
||||
return 0
|
||||
var/newfreq=src:frequency
|
||||
if(href_list["set_freq"]!="-1")
|
||||
newfreq=text2num(href_list["set_freq"])
|
||||
else
|
||||
newfreq = input(usr, "Specify a new frequency (GHz). Decimals assigned automatically.", src, src:frequency) as null|num
|
||||
if(newfreq)
|
||||
if(findtext(num2text(newfreq), "."))
|
||||
newfreq *= 10 // shift the decimal one place
|
||||
if(newfreq < 10000)
|
||||
src:frequency = newfreq
|
||||
return MT_UPDATE|MT_REINIT
|
||||
return 0
|
||||
|
||||
/obj/machinery/proc/handle_multitool_topic(var/href, var/list/href_list, var/mob/user)
|
||||
if(!allowed(user))//no, not even HREF exploits
|
||||
return 0
|
||||
var/obj/item/device/multitool/P = get_multitool(usr)
|
||||
if(P && istype(P))
|
||||
var/update_mt_menu=0
|
||||
var/re_init=0
|
||||
if("set_tag" in href_list)
|
||||
if(!(href_list["set_tag"] in settagwhitelist))//I see you're trying Href exploits, I see you're failing, I SEE ADMIN WARNING. (seriously though, this is a powerfull HREF, I originally found this loophole, I'm not leaving it in on my PR)
|
||||
message_admins("set_tag HREF (var attempted to edit: [href_list["set_tag"]]) exploit attempted by [key_name(user, user.client)] (<A HREF='?_src_=holder;adminmoreinfo=\ref[user]'>?</A>) on [src] ([x],[y],[z] - <A HREF='?_src_=holder;adminplayerobservecoodjump=1;X=[x];Y=[y];Z=[z]'>JMP</a>)")
|
||||
return 1
|
||||
if(!(href_list["set_tag"] in vars))
|
||||
usr << "\red Something went wrong: Unable to find [href_list["set_tag"]] in vars!"
|
||||
return 1
|
||||
var/current_tag = src.vars[href_list["set_tag"]]
|
||||
var/newid = copytext(reject_bad_text(input(usr, "Specify the new ID tag", src, current_tag) as null|text),1,MAX_MESSAGE_LEN)
|
||||
if(newid)
|
||||
vars[href_list["set_tag"]] = newid
|
||||
re_init=1
|
||||
|
||||
if("unlink" in href_list)
|
||||
var/idx = text2num(href_list["unlink"])
|
||||
if (!idx)
|
||||
return 1
|
||||
|
||||
var/obj/O = getLink(idx)
|
||||
if(!O)
|
||||
return 1
|
||||
if(!canLink(O))
|
||||
usr << "\red You can't link with that device."
|
||||
return 1
|
||||
|
||||
if(unlinkFrom(usr, O))
|
||||
usr << "\blue A green light flashes on \the [P], confirming the link was removed."
|
||||
else
|
||||
usr << "\red A red light flashes on \the [P]. It appears something went wrong when unlinking the two devices."
|
||||
update_mt_menu=1
|
||||
|
||||
if("link" in href_list)
|
||||
var/obj/O = P.buffer
|
||||
if(!O)
|
||||
return 1
|
||||
if(!canLink(O,href_list))
|
||||
usr << "\red You can't link with that device."
|
||||
return 1
|
||||
if (isLinkedWith(O))
|
||||
usr << "\red A red light flashes on \the [P]. The two devices are already linked."
|
||||
return 1
|
||||
|
||||
if(linkWith(usr, O, href_list))
|
||||
usr << "\blue A green light flashes on \the [P], confirming the link was added."
|
||||
else
|
||||
usr << "\red A red light flashes on \the [P]. It appears something went wrong when linking the two devices."
|
||||
update_mt_menu=1
|
||||
|
||||
if("buffer" in href_list)
|
||||
P.buffer = src
|
||||
usr << "\blue A green light flashes, and the device appears in the multitool buffer."
|
||||
update_mt_menu=1
|
||||
|
||||
if("flush" in href_list)
|
||||
usr << "\blue A green light flashes, and the device disappears from the multitool buffer."
|
||||
P.buffer = null
|
||||
update_mt_menu=1
|
||||
|
||||
var/ret = multitool_topic(usr,href_list,P.buffer)
|
||||
if(ret == MT_ERROR)
|
||||
return 1
|
||||
if(ret & MT_UPDATE)
|
||||
update_mt_menu=1
|
||||
if(ret & MT_REINIT)
|
||||
re_init=1
|
||||
|
||||
if(re_init)
|
||||
initialize()
|
||||
if(update_mt_menu)
|
||||
//usr.set_machine(src)
|
||||
update_multitool_menu(usr)
|
||||
return 1
|
||||
|
||||
/obj/machinery/Topic(href, href_list, var/nowindow = 0, var/checkrange = 1)
|
||||
if(..())
|
||||
return 1
|
||||
handle_multitool_topic(href,href_list,usr)
|
||||
add_fingerprint(usr)
|
||||
return 0
|
||||
|
||||
|
||||
/obj/machinery/CanUseTopic(var/mob/user, var/be_close)
|
||||
if(!interact_offline && (stat & (NOPOWER|BROKEN)))
|
||||
return STATUS_CLOSE
|
||||
|
||||
@@ -45,6 +45,12 @@ Buildable meters
|
||||
#define PIPE_SUPPLY_CAP 37
|
||||
#define PIPE_SCRUBBERS_CAP 38
|
||||
|
||||
///// /vg/ ported stuff
|
||||
#define PIPE_INJECTOR 39
|
||||
#define PIPE_DVALVE 40
|
||||
#define PIPE_DP_VENT 41
|
||||
#define PIPE_PASV_VENT 42
|
||||
|
||||
/obj/item/pipe
|
||||
name = "pipe"
|
||||
desc = "A pipe"
|
||||
@@ -103,6 +109,8 @@ Buildable meters
|
||||
src.pipe_type = PIPE_MANIFOLD
|
||||
else if(istype(make_from, /obj/machinery/atmospherics/unary/vent_pump))
|
||||
src.pipe_type = PIPE_UVENT
|
||||
else if(istype(make_from, /obj/machinery/atmospherics/valve/digital))
|
||||
src.pipe_type = PIPE_DVALVE
|
||||
else if(istype(make_from, /obj/machinery/atmospherics/valve))
|
||||
src.pipe_type = PIPE_MVALVE
|
||||
else if(istype(make_from, /obj/machinery/atmospherics/binary/pump))
|
||||
@@ -147,6 +155,15 @@ Buildable meters
|
||||
src.color = PIPE_COLOR_RED
|
||||
else if(istype(make_from, /obj/machinery/atmospherics/pipe/cap))
|
||||
src.pipe_type = PIPE_CAP
|
||||
|
||||
else if(istype(make_from, /obj/machinery/atmospherics/unary/outlet_injector))
|
||||
src.pipe_type = PIPE_INJECTOR
|
||||
else if(istype(make_from, /obj/machinery/atmospherics/binary/dp_vent_pump))
|
||||
src.pipe_type = PIPE_DP_VENT
|
||||
else if(istype(make_from, /obj/machinery/atmospherics/pipe/vent))
|
||||
src.pipe_type = PIPE_PASV_VENT
|
||||
|
||||
|
||||
else if(istype(make_from, /obj/machinery/atmospherics/omni/mixer))
|
||||
src.pipe_type = PIPE_OMNI_MIXER
|
||||
else if(istype(make_from, /obj/machinery/atmospherics/omni/filter))
|
||||
@@ -157,6 +174,7 @@ Buildable meters
|
||||
else if(istype(make_from, /obj/machinery/atmospherics/pipe/zpipe/down))
|
||||
src.pipe_type = PIPE_DOWN*/
|
||||
///// Z-Level stuff
|
||||
|
||||
else
|
||||
src.pipe_type = pipe_type
|
||||
src.dir = dir
|
||||
@@ -219,6 +237,11 @@ Buildable meters
|
||||
"scrubbers 4-way manifold", \
|
||||
"supply pipe cap", \
|
||||
"scrubbers pipe cap", \
|
||||
// /vg/ ported stuff
|
||||
"air injector", \
|
||||
"Digital Valve", \
|
||||
"dual-port vent", \
|
||||
"passive vent", \
|
||||
)
|
||||
name = nlist[pipe_type+1] + " fitting"
|
||||
var/list/islist = list( \
|
||||
@@ -264,11 +287,12 @@ Buildable meters
|
||||
"manifold4w", \
|
||||
"cap", \
|
||||
"cap", \
|
||||
"cap", \
|
||||
"cap", \
|
||||
"cap", \
|
||||
"cap", \
|
||||
)
|
||||
// /vg/ ported stuff
|
||||
"injector", \
|
||||
"dvalve", \
|
||||
"dual-port vent", \
|
||||
"passive vent", \
|
||||
)
|
||||
icon_state = islist[pipe_type + 1]
|
||||
|
||||
//called when a turf is attacked with a pipe item
|
||||
@@ -286,7 +310,7 @@ Buildable meters
|
||||
|
||||
src.dir = turn(src.dir, -90)
|
||||
|
||||
if (pipe_type in list (PIPE_SIMPLE_STRAIGHT, PIPE_SUPPLY_STRAIGHT, PIPE_SCRUBBERS_STRAIGHT, PIPE_UNIVERSAL, PIPE_HE_STRAIGHT, PIPE_INSULATED_STRAIGHT, PIPE_MVALVE))
|
||||
if (pipe_type in list (PIPE_SIMPLE_STRAIGHT, PIPE_SUPPLY_STRAIGHT, PIPE_SCRUBBERS_STRAIGHT, PIPE_UNIVERSAL, PIPE_HE_STRAIGHT, PIPE_INSULATED_STRAIGHT, PIPE_MVALVE, PIPE_DVALVE))
|
||||
if(dir==2)
|
||||
dir = 1
|
||||
else if(dir==8)
|
||||
@@ -301,7 +325,7 @@ Buildable meters
|
||||
if ((pipe_type in list (PIPE_SIMPLE_BENT, PIPE_SUPPLY_BENT, PIPE_SCRUBBERS_BENT, PIPE_HE_BENT, PIPE_INSULATED_BENT)) \
|
||||
&& (src.dir in cardinal))
|
||||
src.dir = src.dir|turn(src.dir, 90)
|
||||
else if (pipe_type in list (PIPE_SIMPLE_STRAIGHT, PIPE_SUPPLY_STRAIGHT, PIPE_SCRUBBERS_STRAIGHT, PIPE_UNIVERSAL, PIPE_HE_STRAIGHT, PIPE_INSULATED_STRAIGHT, PIPE_MVALVE))
|
||||
else if (pipe_type in list (PIPE_SIMPLE_STRAIGHT, PIPE_SUPPLY_STRAIGHT, PIPE_SCRUBBERS_STRAIGHT, PIPE_UNIVERSAL, PIPE_HE_STRAIGHT, PIPE_INSULATED_STRAIGHT, PIPE_MVALVE, PIPE_DVALVE))
|
||||
if(dir==2)
|
||||
dir = 1
|
||||
else if(dir==8)
|
||||
@@ -325,6 +349,9 @@ Buildable meters
|
||||
PIPE_PUMP ,\
|
||||
PIPE_VOLUME_PUMP ,\
|
||||
PIPE_PASSIVE_GATE ,\
|
||||
PIPE_MVALVE, \
|
||||
PIPE_DVALVE, \
|
||||
PIPE_DP_VENT, \
|
||||
PIPE_MVALVE ,\
|
||||
PIPE_SUPPLY_STRAIGHT, \
|
||||
PIPE_SCRUBBERS_STRAIGHT, \
|
||||
@@ -333,7 +360,7 @@ Buildable meters
|
||||
return dir|flip
|
||||
if(PIPE_SIMPLE_BENT, PIPE_INSULATED_BENT, PIPE_HE_BENT, PIPE_SUPPLY_BENT, PIPE_SCRUBBERS_BENT)
|
||||
return dir //dir|acw
|
||||
if(PIPE_CONNECTOR,PIPE_UVENT,PIPE_SCRUBBER,PIPE_HEAT_EXCHANGE)
|
||||
if(PIPE_CONNECTOR,PIPE_UVENT,PIPE_PASV_VENT,PIPE_SCRUBBER,PIPE_HEAT_EXCHANGE, PIPE_INJECTOR)
|
||||
return dir
|
||||
if(PIPE_MANIFOLD4W, PIPE_SUPPLY_MANIFOLD4W, PIPE_SCRUBBERS_MANIFOLD4W, PIPE_OMNI_MIXER, PIPE_OMNI_FILTER)
|
||||
return dir|flip|cw|acw
|
||||
@@ -395,7 +422,7 @@ Buildable meters
|
||||
return ..()
|
||||
if (!isturf(src.loc))
|
||||
return 1
|
||||
if (pipe_type in list (PIPE_SIMPLE_STRAIGHT, PIPE_SUPPLY_STRAIGHT, PIPE_SCRUBBERS_STRAIGHT, PIPE_HE_STRAIGHT, PIPE_INSULATED_STRAIGHT, PIPE_MVALVE))
|
||||
if (pipe_type in list (PIPE_SIMPLE_STRAIGHT, PIPE_SUPPLY_STRAIGHT, PIPE_SCRUBBERS_STRAIGHT, PIPE_HE_STRAIGHT, PIPE_INSULATED_STRAIGHT, PIPE_MVALVE, PIPE_DVALVE))
|
||||
if(dir==2)
|
||||
dir = 1
|
||||
else if(dir==8)
|
||||
@@ -1004,6 +1031,74 @@ Buildable meters
|
||||
C.node.build_network()
|
||||
machineReference = C
|
||||
|
||||
if(PIPE_INJECTOR) // air injector
|
||||
var/obj/machinery/atmospherics/unary/outlet_injector/P = new( src.loc )
|
||||
P.dir = dir
|
||||
P.initialize_directions = get_pipe_dir()
|
||||
if (pipename)
|
||||
name = pipename
|
||||
var/turf/T = loc
|
||||
P.level = T.intact ? 2 : 1
|
||||
P.initialize()
|
||||
P.build_network()
|
||||
if (P.node)
|
||||
P.node.initialize()
|
||||
P.node.build_network()
|
||||
machineReference = P
|
||||
|
||||
if(PIPE_DVALVE)
|
||||
var/obj/machinery/atmospherics/valve/digital/V = new( src.loc )
|
||||
V.dir = dir
|
||||
V.initialize_directions = pipe_dir
|
||||
if (pipename)
|
||||
V.name = pipename
|
||||
var/turf/T = V.loc
|
||||
V.level = T.intact ? 2 : 1
|
||||
V.initialize()
|
||||
V.build_network()
|
||||
if (V.node1)
|
||||
// world << "[V.node1.name] is connected to valve, forcing it to update its nodes."
|
||||
V.node1.initialize()
|
||||
V.node1.build_network()
|
||||
if (V.node2)
|
||||
// world << "[V.node2.name] is connected to valve, forcing it to update its nodes."
|
||||
V.node2.initialize()
|
||||
V.node2.build_network()
|
||||
machineReference = V
|
||||
|
||||
if(PIPE_DP_VENT)
|
||||
var/obj/machinery/atmospherics/binary/dp_vent_pump/P = new(src.loc)
|
||||
P.dir = dir
|
||||
P.initialize_directions = pipe_dir
|
||||
if (pipename)
|
||||
P.name = pipename
|
||||
var/turf/T = P.loc
|
||||
P.level = T.intact ? 2 : 1
|
||||
P.initialize()
|
||||
P.build_network()
|
||||
if (P.node1)
|
||||
P.node1.initialize()
|
||||
P.node1.build_network()
|
||||
if (P.node2)
|
||||
P.node2.initialize()
|
||||
P.node2.build_network()
|
||||
machineReference = P
|
||||
|
||||
if(PIPE_PASV_VENT)
|
||||
var/obj/machinery/atmospherics/pipe/vent/P = new(src.loc)
|
||||
P.dir = dir
|
||||
P.initialize_directions = get_pipe_dir()
|
||||
if (pipename)
|
||||
name = pipename
|
||||
var/turf/T = loc
|
||||
level = T.intact ? 2 : 1
|
||||
initialize()
|
||||
P.build_network()
|
||||
if (P.node1)
|
||||
P.node1.initialize()
|
||||
P.node1.build_network()
|
||||
machineReference = P
|
||||
|
||||
///// Z-Level stuff
|
||||
/* if(PIPE_UP)
|
||||
var/obj/machinery/atmospherics/pipe/zpipe/up/P = new(src.loc)
|
||||
@@ -1030,10 +1125,6 @@ Buildable meters
|
||||
var/turf/T = P.loc
|
||||
P.level = T.intact ? 2 : 1
|
||||
P.initialize()
|
||||
P.build_network()
|
||||
if (P.node1)
|
||||
P.node1.initialize()
|
||||
P.node1.build_network()
|
||||
if (P.node2)
|
||||
P.node2.initialize()
|
||||
P.node2.build_network()*/
|
||||
@@ -1091,6 +1182,23 @@ Buildable meters
|
||||
playsound(src.loc, 'sound/items/Ratchet.ogg', 50, 1)
|
||||
user << "\blue You have fastened the meter to the pipe"
|
||||
del(src)
|
||||
|
||||
/obj/item/pipe_gsensor
|
||||
name = "gas sensor"
|
||||
desc = "A sensor that can be hooked to a computer"
|
||||
icon = 'icons/obj/stationobjs.dmi'
|
||||
icon_state = "gsensor0"
|
||||
item_state = "buildpipe"
|
||||
w_class = 4
|
||||
|
||||
/obj/item/pipe_gsensor/attackby(var/obj/item/weapon/W as obj, var/mob/user as mob)
|
||||
..()
|
||||
if (!istype(W, /obj/item/weapon/wrench))
|
||||
return ..()
|
||||
new/obj/machinery/air_sensor( src.loc )
|
||||
playsound(get_turf(src), 'sound/items/Ratchet.ogg', 50, 1)
|
||||
user << "\blue You have fastened the gas sensor"
|
||||
del(src)
|
||||
//not sure why these are necessary
|
||||
#undef PIPE_SIMPLE_STRAIGHT
|
||||
#undef PIPE_SIMPLE_BENT
|
||||
@@ -1121,4 +1229,8 @@ Buildable meters
|
||||
#undef PIPE_SUPPLY_MANIFOLD
|
||||
#undef PIPE_SCRUBBERS_MANIFOLD
|
||||
#undef PIPE_UNIVERSAL
|
||||
#undef PIPE_INJECTOR
|
||||
#undef PIPE_DVALVE
|
||||
#undef PIPE_DP_VENT
|
||||
#undef PIPE_PASV_VENT
|
||||
//#undef PIPE_MANIFOLD4W
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
<A href='?src=\ref[src];make=1;dir=5'>Bent Pipe</A><BR>
|
||||
<A href='?src=\ref[src];make=5;dir=1'>Manifold</A><BR>
|
||||
<A href='?src=\ref[src];make=8;dir=1'>Manual Valve</A><BR>
|
||||
<A href='?src=\ref[src];make=40;dir=1'>Digital Valve</A><BR>
|
||||
<A href='?src=\ref[src];make=20;dir=1'>Pipe Cap</A><BR>
|
||||
<A href='?src=\ref[src];make=19;dir=1'>4-Way Manifold</A><BR>
|
||||
<A href='?src=\ref[src];make=18;dir=1'>Manual T-Valve</A><BR>
|
||||
@@ -43,8 +44,12 @@
|
||||
<A href='?src=\ref[src];make=16;dir=1'>Volume Pump</A><BR>
|
||||
<A href='?src=\ref[src];make=10;dir=1'>Scrubber</A><BR>
|
||||
<A href='?src=\ref[src];makemeter=1'>Meter</A><BR>
|
||||
<A href='?src=\ref[src];makegsensor=1'>Gas Sensor</A><BR>
|
||||
<A href='?src=\ref[src];make=13;dir=1'>Gas Filter</A><BR>
|
||||
<A href='?src=\ref[src];make=14;dir=1'>Gas Mixer</A><BR>
|
||||
<A href='?src=\ref[src];make=39;dir=1'>Air Injector</A><BR>
|
||||
<A href='?src=\ref[src];make=41;dir=1'>Dual-Port Vent Pump</A><BR>
|
||||
<A href='?src=\ref[src];make=42;dir=1'>Passive Vent</A><BR>
|
||||
<b>Heat exchange:</b><BR>
|
||||
<A href='?src=\ref[src];make=2;dir=1'>Pipe</A><BR>
|
||||
<A href='?src=\ref[src];make=3;dir=5'>Bent Pipe</A><BR>
|
||||
@@ -56,6 +61,7 @@
|
||||
|
||||
"}
|
||||
//What number the make points to is in the define # at the top of construction.dm in same folder
|
||||
//which for some reason couldn't just be left defined, so it could be used here, top kek
|
||||
|
||||
user << browse("<HEAD><TITLE>[src]</TITLE></HEAD><TT>[dat]</TT>", "window=pipedispenser")
|
||||
onclose(user, "pipedispenser")
|
||||
@@ -85,6 +91,12 @@
|
||||
wait = 1
|
||||
spawn(15)
|
||||
wait = 0
|
||||
if(href_list["makegsensor"])
|
||||
if(!wait)
|
||||
new /obj/item/pipe_gsensor(/*usr.loc*/ src.loc)
|
||||
wait = 1
|
||||
spawn(15)
|
||||
wait = 0
|
||||
return
|
||||
|
||||
/obj/machinery/pipedispenser/attackby(var/obj/item/W as obj, var/mob/user as mob, params)
|
||||
|
||||
@@ -105,12 +105,19 @@
|
||||
F.loc = src.loc
|
||||
del(src)
|
||||
|
||||
/obj/machinery/telecomms/proc/formatInput(var/label,var/varname, var/input)
|
||||
var/value = vars[varname]
|
||||
if(!value || value=="")
|
||||
value="-----"
|
||||
return "<b>[label]:</b> <a href=\"?src=\ref[src];input=[varname]\">[value]</a>"
|
||||
|
||||
/obj/machinery/telecomms/attack_ai(var/mob/user as mob)
|
||||
attack_hand(user)
|
||||
|
||||
/obj/machinery/telecomms/attack_hand(var/mob/user as mob)
|
||||
update_multitool_menu(user)
|
||||
|
||||
/obj/machinery/telecomms/multitool_menu(var/mob/user,var/obj/item/device/multitool/P)
|
||||
// You need a multitool to use this, or be silicon
|
||||
if(!issilicon(user))
|
||||
// istype returns false if the value is null
|
||||
@@ -120,62 +127,62 @@
|
||||
if(stat & (BROKEN|NOPOWER))
|
||||
return
|
||||
|
||||
var/obj/item/device/multitool/P = get_multitool(user)
|
||||
|
||||
user.set_machine(src)
|
||||
var/dat
|
||||
dat = "<font face = \"Courier\"><HEAD><TITLE>[src.name]</TITLE></HEAD><center><H3>[src.name] Access</H3></center>"
|
||||
dat += "<br>[temp]<br>"
|
||||
dat += "<br>Power Status: <a href='?src=\ref[src];input=toggle'>[src.toggled ? "On" : "Off"]</a>"
|
||||
|
||||
dat = {"
|
||||
<p>[temp]</p>
|
||||
<p><b>Power Status:</b> <a href='?src=\ref[src];input=toggle'>[src.toggled ? "On" : "Off"]</a></p>"}
|
||||
if(on && toggled)
|
||||
if(id != "" && id)
|
||||
dat += "<br>Identification String: <a href='?src=\ref[src];input=id'>[id]</a>"
|
||||
else
|
||||
dat += "<br>Identification String: <a href='?src=\ref[src];input=id'>NULL</a>"
|
||||
dat += "<br>Network: <a href='?src=\ref[src];input=network'>[network]</a>"
|
||||
dat += "<br>Prefabrication: [autolinkers.len ? "TRUE" : "FALSE"]"
|
||||
if(hide) dat += "<br>Shadow Link: ACTIVE</a>"
|
||||
dat += {"
|
||||
<p>[formatInput("Identification String","id","id")]</p>
|
||||
<p>[formatInput("Network","network","network")]</p>
|
||||
<p><b>Prefabrication:</b> [autolinkers.len ? "TRUE" : "FALSE"]</p>
|
||||
"}
|
||||
if(hide)
|
||||
dat += "<p>Shadow Link: ACTIVE</p>"
|
||||
|
||||
//Show additional options for certain machines.
|
||||
dat += Options_Menu()
|
||||
|
||||
dat += "<br>Linked Network Entities: <ol>"
|
||||
|
||||
dat += {"<h2>Linked Network Entities:</h2> <ol>"}
|
||||
var/i = 0
|
||||
for(var/obj/machinery/telecomms/T in links)
|
||||
i++
|
||||
if(T.hide && !src.hide)
|
||||
continue
|
||||
dat += "<li>\ref[T] [T.name] ([T.id]) <a href='?src=\ref[src];unlink=[i]'>\[X\]</a></li>"
|
||||
dat += "</ol>"
|
||||
|
||||
dat += "<br>Filtering Frequencies: "
|
||||
|
||||
// AUTOFIXED BY fix_string_idiocy.py
|
||||
// C:\Users\Rob\Documents\Projects\vgstation13\code\game\machinery\telecomms\machine_interactions.dm:140: dat += "</ol>"
|
||||
dat += {"</ol>
|
||||
<h2>Filtering Frequencies:</h2>"}
|
||||
// END AUTOFIX
|
||||
i = 0
|
||||
if(length(freq_listening))
|
||||
dat += "<ul>"
|
||||
for(var/x in freq_listening)
|
||||
i++
|
||||
if(i < length(freq_listening))
|
||||
dat += "[format_frequency(x)] GHz<a href='?src=\ref[src];delete=[x]'>\[X\]</a>; "
|
||||
else
|
||||
dat += "[format_frequency(x)] GHz<a href='?src=\ref[src];delete=[x]'>\[X\]</a>"
|
||||
dat += "<li>[format_frequency(x)] GHz<a href='?src=\ref[src];delete=[x]'>\[X\]</a></li>"
|
||||
dat += "</ul>"
|
||||
else
|
||||
dat += "NONE"
|
||||
dat += "<li>NONE</li>"
|
||||
|
||||
dat += "<br> <a href='?src=\ref[src];input=freq'>\[Add Filter\]</a>"
|
||||
dat += "<hr>"
|
||||
|
||||
if(P)
|
||||
if(P.buffer)
|
||||
dat += "<br><br>MULTITOOL BUFFER: [P.buffer] ([P.buffer.id]) <a href='?src=\ref[src];link=1'>\[Link\]</a> <a href='?src=\ref[src];flush=1'>\[Flush\]"
|
||||
else
|
||||
dat += "<br><br>MULTITOOL BUFFER: <a href='?src=\ref[src];buffer=1'>\[Add Machine\]</a>"
|
||||
// AUTOFIXED BY fix_string_idiocy.py
|
||||
// C:\Users\Rob\Documents\Projects\vgstation13\code\game\machinery\telecomms\machine_interactions.dm:155: dat += "<br> <a href='?src=\ref[src];input=freq'>\[Add Filter\]</a>"
|
||||
dat += {"<p><a href='?src=\ref[src];input=freq'>\[Add Filter\]</a></p>
|
||||
<hr />"}
|
||||
// END AUTOFIX
|
||||
|
||||
dat += "</font>"
|
||||
temp = ""
|
||||
user << browse(dat, "window=tcommachine;size=520x500;can_resize=0")
|
||||
onclose(user, "dormitory")
|
||||
return dat
|
||||
|
||||
/obj/machinery/telecomms/canLink(var/obj/O)
|
||||
return istype(O,/obj/machinery/telecomms)
|
||||
|
||||
/obj/machinery/telecomms/isLinkedWith(var/obj/O)
|
||||
return O != null && O in links
|
||||
|
||||
/obj/machinery/telecomms/getLink(var/idx)
|
||||
return (idx >= 1 && idx <= links.len) ? links[idx] : null
|
||||
|
||||
// Off-Site Relays
|
||||
//
|
||||
@@ -368,8 +375,8 @@
|
||||
|
||||
if(P)
|
||||
if(P.buffer && P.buffer != src)
|
||||
if(!(src in P.buffer.links))
|
||||
P.buffer.links.Add(src)
|
||||
if(!(src in P.buffer:links))
|
||||
P.buffer:links.Add(src)
|
||||
|
||||
if(!(P.buffer in src.links))
|
||||
src.links.Add(P.buffer)
|
||||
|
||||
@@ -36,7 +36,7 @@ var/global/list/obj/machinery/telecomms/telecomms_list = list()
|
||||
var/circuitboard = null // string pointing to a circuitboard type
|
||||
var/hide = 0 // Is it a hidden machine?
|
||||
var/listening_level = 0 // 0 = auto set in New() - this is the z level that the machine is listening to.
|
||||
|
||||
Mtoollink = 1
|
||||
|
||||
/obj/machinery/telecomms/proc/relay_information(datum/signal/signal, filter, copysig, amount = 20)
|
||||
// relay signal to all linked machinery that are of type [filter]. If signal has been sent [amount] times, stop sending
|
||||
|
||||
@@ -18,7 +18,12 @@
|
||||
m_amt = 50
|
||||
g_amt = 20
|
||||
origin_tech = "magnets=1;engineering=1"
|
||||
var/obj/machinery/telecomms/buffer // simple machine buffer for device linkage
|
||||
var/obj/machinery/buffer // simple machine buffer for device linkage
|
||||
|
||||
/obj/item/device/multitool/proc/IsBufferA(var/typepath)
|
||||
if(!buffer)
|
||||
return 0
|
||||
return istype(buffer,typepath)
|
||||
|
||||
// Syndicate device disguised as a multitool; it will turn red when an AI camera is nearby.
|
||||
|
||||
|
||||
@@ -17,10 +17,12 @@
|
||||
var/damtype = "brute"
|
||||
var/force = 0
|
||||
|
||||
var/Mtoollink = 0 // variable to decide if an object should show the multitool menu linking menu, not all objects use it
|
||||
|
||||
// What reagents should be logged when transferred TO this object?
|
||||
// Reagent ID => friendly name
|
||||
var/list/reagents_to_log=list()
|
||||
|
||||
|
||||
/obj/Topic(href, href_list, var/nowindow = 0, var/datum/topic_state/custom_state = default_state)
|
||||
// Calling Topic without a corresponding window open causes runtime errors
|
||||
if(!nowindow && ..())
|
||||
@@ -161,3 +163,85 @@
|
||||
mo.show_message(rendered, 2)
|
||||
*/
|
||||
return
|
||||
|
||||
/obj/proc/multitool_menu(var/mob/user,var/obj/item/device/multitool/P)
|
||||
return "<b>NO MULTITOOL_MENU!</b>"
|
||||
|
||||
/obj/proc/linkWith(var/mob/user, var/obj/buffer, var/link/context)
|
||||
return 0
|
||||
|
||||
/obj/proc/unlinkFrom(var/mob/user, var/obj/buffer)
|
||||
return 0
|
||||
|
||||
/obj/proc/canLink(var/obj/O, var/link/context)
|
||||
return 0
|
||||
|
||||
/obj/proc/isLinkedWith(var/obj/O)
|
||||
return 0
|
||||
|
||||
/obj/proc/getLink(var/idx)
|
||||
return null
|
||||
|
||||
/obj/proc/linkMenu(var/obj/O)
|
||||
var/dat=""
|
||||
if(canLink(O, list()))
|
||||
dat += " <a href='?src=\ref[src];link=1'>\[Link\]</a> "
|
||||
return dat
|
||||
|
||||
/obj/proc/format_tag(var/label,var/varname, var/act="set_tag")
|
||||
var/value = vars[varname]
|
||||
if(!value || value=="")
|
||||
value="-----"
|
||||
return "<b>[label]:</b> <a href=\"?src=\ref[src];[act]=[varname]\">[value]</a>"
|
||||
|
||||
|
||||
/obj/proc/update_multitool_menu(mob/user as mob)
|
||||
var/obj/item/device/multitool/P = get_multitool(user)
|
||||
|
||||
if(!istype(P))
|
||||
return 0
|
||||
var/dat = {"<html>
|
||||
<head>
|
||||
<title>[name] Configuration</title>
|
||||
<style type="text/css">
|
||||
html,body {
|
||||
font-family:courier;
|
||||
background:#999999;
|
||||
color:#333333;
|
||||
}
|
||||
|
||||
a {
|
||||
color:#000000;
|
||||
text-decoration:none;
|
||||
border-bottom:1px solid black;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<h3>[name]</h3>
|
||||
"}
|
||||
if(allowed(user))//no, assistants, you're not ruining all vents on the station with just a multitool
|
||||
dat += multitool_menu(user,P)
|
||||
if(Mtoollink)
|
||||
if(P)
|
||||
if(P.buffer)
|
||||
var/id = null
|
||||
if(istype(P.buffer, /obj/machinery/telecomms))
|
||||
id=P.buffer:id
|
||||
else if("id_tag" in P.buffer.vars)
|
||||
id=P.buffer:id_tag
|
||||
dat += "<p><b>MULTITOOL BUFFER:</b> [P.buffer] [id ? "([id])" : ""]"
|
||||
|
||||
dat += linkMenu(P.buffer)
|
||||
|
||||
if(P.buffer)
|
||||
dat += "<a href='?src=\ref[src];flush=1'>\[Flush\]</a>"
|
||||
dat += "</p>"
|
||||
else
|
||||
dat += "<p><b>MULTITOOL BUFFER:</b> <a href='?src=\ref[src];buffer=1'>\[Add Machine\]</a></p>"
|
||||
else
|
||||
dat += "<b>ACCESS DENIED</a>"
|
||||
dat += "</body></html>"
|
||||
user << browse(dat, "window=mtcomputer")
|
||||
user.set_machine(src)
|
||||
onclose(user, "mtcomputer")
|
||||
|
||||
@@ -0,0 +1,450 @@
|
||||
/obj/machinery/computer/general_air_control/atmos_automation
|
||||
icon = 'icons/obj/computer.dmi'
|
||||
icon_state = "aac"
|
||||
circuit = "/obj/item/weapon/circuitboard/atmos_automation"
|
||||
req_one_access_txt = "24;10"
|
||||
Mtoollink = 1
|
||||
|
||||
show_sensors = 0
|
||||
var/on = 0
|
||||
|
||||
name = "Atmospherics Automations Console"
|
||||
|
||||
var/list/datum/automation/automations=list()
|
||||
|
||||
receive_signal(datum/signal/signal)
|
||||
if(!signal || signal.encryption) return
|
||||
|
||||
var/id_tag = signal.data["tag"]
|
||||
if(!id_tag)
|
||||
return
|
||||
|
||||
sensor_information[id_tag] = signal.data
|
||||
|
||||
process()
|
||||
if(on)
|
||||
for(var/datum/automation/A in automations)
|
||||
A.process()
|
||||
|
||||
update_icon()
|
||||
icon_state = initial(icon_state)
|
||||
// Broken
|
||||
if(stat & BROKEN)
|
||||
icon_state += "b"
|
||||
|
||||
// Powered
|
||||
else if(stat & NOPOWER)
|
||||
icon_state = initial(icon_state)
|
||||
icon_state += "0"
|
||||
else if(on)
|
||||
icon_state += "_active"
|
||||
|
||||
proc/request_device_refresh(var/device)
|
||||
send_signal(list("tag"=device, "status"))
|
||||
|
||||
proc/send_signal(var/list/data, var/filter = RADIO_ATMOSIA)//filter's here so the AAC can cross communicate to things like vents, which have a different filter
|
||||
var/datum/signal/signal = new
|
||||
signal.transmission_method = 1 //radio signal
|
||||
signal.source = src
|
||||
signal.data=data
|
||||
signal.data["sigtype"]="command"
|
||||
signal.data["advcontrol"]=1//AAC balancing, you need to manually get up to the machine to make it listen to this
|
||||
radio_connection.post_signal(src, signal, range = 8, filter = filter)
|
||||
|
||||
proc/selectValidChildFor(var/datum/automation/parent, var/mob/user, var/list/valid_returntypes)
|
||||
var/list/choices=list()
|
||||
for(var/childtype in automation_types)
|
||||
var/datum/automation/A = new childtype(src)
|
||||
if(A.returntype == null)
|
||||
continue
|
||||
if(!(A.returntype in valid_returntypes))
|
||||
continue
|
||||
choices[A.name]=A
|
||||
if (choices.len==0)
|
||||
testing("Unable to find automations with returntype in [english_list(valid_returntypes)]!")
|
||||
return 0
|
||||
var/label=input(user, "Select new automation:", "Automations", "Cancel") as null|anything in choices
|
||||
if(!label)
|
||||
return 0
|
||||
return choices[label]
|
||||
|
||||
return_text()
|
||||
var/out=..()
|
||||
|
||||
if(on)
|
||||
out += "<a href=\"?src=\ref[src];on=1\" style=\"font-size:large;font-weight:bold;color:red;\">RUNNING</a>"
|
||||
else
|
||||
out += "<a href=\"?src=\ref[src];on=1\" style=\"font-size:large;font-weight:bold;color:green;\">STOPPED</a>"
|
||||
|
||||
out += {"
|
||||
<h2>Automations</h2>
|
||||
<p>\[
|
||||
<a href="?src=\ref[src];add=1">
|
||||
Add
|
||||
</a>
|
||||
|
|
||||
<a href="?src=\ref[src];reset=*">
|
||||
Reset All
|
||||
</a>
|
||||
|
|
||||
<a href="?src=\ref[src];remove=*">
|
||||
Clear
|
||||
</a>
|
||||
\]</p>
|
||||
<p>\[
|
||||
<a href="?src=\ref[src];dump=1">
|
||||
Export
|
||||
</a>
|
||||
|
|
||||
<a href="?src=\ref[src];read=1">
|
||||
Import
|
||||
</a>
|
||||
\]</p>"}
|
||||
if(automations.len==0)
|
||||
out += "<i>No automations present.</i>"
|
||||
else
|
||||
for(var/datum/automation/A in automations)
|
||||
out += {"
|
||||
<fieldset>
|
||||
<legend>
|
||||
<a href="?src=\ref[src];label=\ref[A]">[A.label]</a>
|
||||
(<a href="?src=\ref[src];reset=\ref[A]">Reset</a> |
|
||||
<a href="?src=\ref[src];remove=\ref[A]">×</a>)
|
||||
</legend>
|
||||
[A.GetText()]
|
||||
</fieldset>
|
||||
"}
|
||||
return out
|
||||
|
||||
Topic(href,href_list)
|
||||
if(..())
|
||||
return
|
||||
if(href_list["on"])
|
||||
on = !on
|
||||
updateUsrDialog()
|
||||
update_icon()
|
||||
return 1
|
||||
|
||||
if(href_list["add"])
|
||||
var/new_child=selectValidChildFor(null,usr,list(0))
|
||||
if(!new_child)
|
||||
return 1
|
||||
automations += new_child
|
||||
updateUsrDialog()
|
||||
return 1
|
||||
|
||||
if(href_list["label"])
|
||||
var/datum/automation/A=locate(href_list["label"])
|
||||
if(!A) return 1
|
||||
var/nl=input(usr, "Please enter a label for this automation task.") as text|null
|
||||
if(!nl) return 1
|
||||
nl = copytext(sanitize(nl), 1, 50)
|
||||
A.label=nl
|
||||
updateUsrDialog()
|
||||
return 1
|
||||
|
||||
if(href_list["reset"])
|
||||
if(href_list["reset"]=="*")
|
||||
for(var/datum/automation/A in automations)
|
||||
if(!A) continue
|
||||
A.OnReset()
|
||||
else
|
||||
var/datum/automation/A=locate(href_list["reset"])
|
||||
if(!A) return 1
|
||||
A.OnReset()
|
||||
updateUsrDialog()
|
||||
return 1
|
||||
|
||||
if(href_list["remove"])
|
||||
if(href_list["remove"]=="*")
|
||||
var/confirm=alert("Are you sure you want to remove ALL automations?","Automations","Yes","No")
|
||||
if(confirm == "No") return 0
|
||||
for(var/datum/automation/A in automations)
|
||||
if(!A) continue
|
||||
A.OnRemove()
|
||||
automations.Remove(A)
|
||||
else
|
||||
var/datum/automation/A=locate(href_list["remove"])
|
||||
if(!A) return 1
|
||||
A.OnRemove()
|
||||
automations.Remove(A)
|
||||
updateUsrDialog()
|
||||
return 1
|
||||
|
||||
if(href_list["read"])
|
||||
var/code = input("Input exported AAC code.","Automations","") as message|null
|
||||
if(!code) return 0
|
||||
ReadCode(code)
|
||||
updateUsrDialog()
|
||||
return 1
|
||||
|
||||
if(href_list["dump"])
|
||||
input("Exported AAC code:","Automations",DumpCode()) as message|null
|
||||
return 0
|
||||
|
||||
proc/MakeCompare(var/datum/automation/a, var/datum/automation/b, var/comparetype)
|
||||
var/datum/automation/compare/compare=new(src)
|
||||
compare.comparator = comparetype
|
||||
compare.children[1] = a
|
||||
compare.children[2] = b
|
||||
return compare
|
||||
|
||||
proc/MakeNumber(var/value)
|
||||
var/datum/automation/static_value/val = new(src)
|
||||
val.value=value
|
||||
return val
|
||||
|
||||
proc/MakeGetSensorData(var/sns_tag,var/field)
|
||||
var/datum/automation/get_sensor_data/sensor=new(src)
|
||||
sensor.sensor=sns_tag
|
||||
sensor.field=field
|
||||
return sensor
|
||||
|
||||
proc/DumpCode()
|
||||
var/list/json[0]
|
||||
for(var/datum/automation/A in automations)
|
||||
json += list(A.Export())
|
||||
return list2json(json)
|
||||
|
||||
proc/ReadCode(var/jsonStr)
|
||||
automations.Cut()
|
||||
var/list/json=json2list(jsonStr)
|
||||
if(json.len>0)
|
||||
for(var/list/cData in json)
|
||||
if(isnull(cData) || !("type" in cData))
|
||||
testing("AAC: Null cData in root JS array.")
|
||||
continue
|
||||
var/Atype=text2path(cData["type"])
|
||||
if(!(Atype in automation_types))
|
||||
testing("AAC: Unrecognized Atype [Atype].")
|
||||
continue
|
||||
var/datum/automation/A = new Atype(src)
|
||||
A.Import(cData)
|
||||
automations += A
|
||||
|
||||
/obj/machinery/computer/general_air_control/atmos_automation/burnchamber
|
||||
var/injector_tag="inc_in"
|
||||
var/output_tag="inc_out"
|
||||
var/sensor_tag="inc_sensor"
|
||||
frequency=1449
|
||||
var/temperature=1000
|
||||
New()
|
||||
..()
|
||||
|
||||
// On State
|
||||
// Pretty much this:
|
||||
/*
|
||||
if(get_sensor("inc_sensor","temperature") < 200)
|
||||
set_injector_state("inc_in",1)
|
||||
set_vent_pump_power("inc_out",0)
|
||||
else
|
||||
set_vent_pump_power("inc_out",1
|
||||
*/
|
||||
|
||||
var/datum/automation/get_sensor_data/sensor=new(src)
|
||||
sensor.sensor=sensor_tag
|
||||
sensor.field="temperature"
|
||||
|
||||
var/datum/automation/static_value/val = new(src)
|
||||
val.value=temperature - 800
|
||||
|
||||
var/datum/automation/compare/compare=new(src)
|
||||
compare.comparator = "Less Than"
|
||||
compare.children[1] = sensor
|
||||
compare.children[2] = val
|
||||
|
||||
var/datum/automation/set_injector_power/inj_on=new(src)
|
||||
inj_on.injector=injector_tag
|
||||
inj_on.state=1
|
||||
|
||||
var/datum/automation/set_vent_pump_power/vp_on=new(src)
|
||||
vp_on.vent_pump=output_tag
|
||||
vp_on.state=1
|
||||
|
||||
var/datum/automation/set_vent_pump_power/vp_off=new(src)
|
||||
vp_off.vent_pump=output_tag
|
||||
vp_off.state=0
|
||||
|
||||
var/datum/automation/if_statement/i = new (src)
|
||||
i.label = "Fuel Injector On"
|
||||
i.condition = compare
|
||||
i.children_then.Add(inj_on)
|
||||
i.children_then.Add(vp_off)
|
||||
i.children_else.Add(vp_on)
|
||||
|
||||
automations += i
|
||||
|
||||
// Off state
|
||||
/*
|
||||
if(get_sensor("inc_sensor","temperature") > 1000)
|
||||
set_injector_state("inc_in",0)
|
||||
*/
|
||||
sensor=new(src)
|
||||
sensor.sensor=sensor_tag
|
||||
sensor.field="temperature"
|
||||
|
||||
val = new(src)
|
||||
val.value=temperature
|
||||
|
||||
compare=new(src)
|
||||
compare.comparator = "Greater Than"
|
||||
compare.children[1] = sensor
|
||||
compare.children[2] = val
|
||||
|
||||
var/datum/automation/set_injector_power/inj_off=new(src)
|
||||
inj_off.injector=injector_tag
|
||||
inj_off.state=0
|
||||
|
||||
i = new (src)
|
||||
i.label = "Fuel Injector Off"
|
||||
i.condition = compare
|
||||
i.children_then.Add(inj_off)
|
||||
|
||||
automations += i
|
||||
|
||||
/obj/machinery/computer/general_air_control/atmos_automation/air_mixing
|
||||
var/n2_injector_tag="air_n2_in"
|
||||
var/o2_injector_tag="air_o2_in"
|
||||
var/output_tag="air_out"
|
||||
var/sensor_tag="air_sensor"
|
||||
frequency=1443
|
||||
var/temperature=1000
|
||||
New()
|
||||
..()
|
||||
buildO2()
|
||||
buildN2()
|
||||
buildOutletVent()
|
||||
|
||||
proc/buildO2()
|
||||
///////////////////////////////////////////////////////////////
|
||||
// Oxygen Injection
|
||||
///////////////////////////////////////////////////////////////
|
||||
|
||||
var/datum/automation/set_injector_power/inj_on=new(src)
|
||||
inj_on.injector=o2_injector_tag
|
||||
inj_on.state=1
|
||||
|
||||
var/datum/automation/set_injector_power/inj_off=new(src)
|
||||
inj_off.injector=o2_injector_tag
|
||||
inj_off.state=0
|
||||
|
||||
var/datum/automation/if_statement/i = new (src)
|
||||
i.label = "Oxygen Injection"
|
||||
i.condition = MakeCompare(
|
||||
MakeGetSensorData(sensor_tag,"oxygen"),
|
||||
MakeNumber(20),
|
||||
"Less Than or Equal to"
|
||||
)
|
||||
i.children_then.Add(inj_on)
|
||||
i.children_else.Add(inj_off)
|
||||
|
||||
automations += i
|
||||
|
||||
proc/buildN2()
|
||||
///////////////////////////////////////////////////////////////
|
||||
// Nitrogen Injection
|
||||
///////////////////////////////////////////////////////////////
|
||||
/*
|
||||
if(get_sensor_data("pressure") < 100)
|
||||
injector_on()
|
||||
else
|
||||
if(get_sensor_data("pressure") > 5000)
|
||||
injector_off()
|
||||
*/
|
||||
|
||||
var/datum/automation/set_injector_power/inj_on=new(src)
|
||||
inj_on.injector=n2_injector_tag
|
||||
inj_on.state=1
|
||||
|
||||
var/datum/automation/set_injector_power/inj_off=new(src)
|
||||
inj_off.injector=n2_injector_tag
|
||||
inj_off.state=0
|
||||
|
||||
var/datum/automation/if_statement/if_on = new (src)
|
||||
if_on.label = "Nitrogen Injection"
|
||||
if_on.condition = MakeCompare(
|
||||
MakeGetSensorData(sensor_tag,"pressure"),
|
||||
MakeNumber(100),
|
||||
"Less Than"
|
||||
)
|
||||
if_on.children_then.Add(inj_on)
|
||||
|
||||
|
||||
var/datum/automation/if_statement/if_off=new(src)
|
||||
if_off.condition=MakeCompare(
|
||||
MakeGetSensorData(sensor_tag,"pressure"),
|
||||
MakeNumber(5000),
|
||||
"Greater Than"
|
||||
)
|
||||
if_off.children_then.Add(inj_off)
|
||||
|
||||
if_on.children_else.Add(if_off)
|
||||
|
||||
automations += if_on
|
||||
|
||||
proc/buildOutletVent()
|
||||
///////////////////////////////////////////////////////////////
|
||||
// Outlet Management
|
||||
///////////////////////////////////////////////////////////////
|
||||
/*
|
||||
if(get_sensor_data("pressure") >= 5000 && get_sensor_data("oxygen") >= 20)
|
||||
vent_on()
|
||||
else
|
||||
if(get_sensor_data("oxygen") < 20 || get_sensor_data("pressure") < 100)
|
||||
vent_off()
|
||||
*/
|
||||
|
||||
var/datum/automation/set_vent_pump_power/vp_on=new(src)
|
||||
vp_on.vent_pump=output_tag
|
||||
vp_on.state=1
|
||||
|
||||
var/datum/automation/set_vent_pump_power/vp_off=new(src)
|
||||
vp_off.vent_pump=output_tag
|
||||
vp_off.state=0
|
||||
|
||||
var/datum/automation/if_statement/if_on=new(src)
|
||||
if_on.label="Air Output"
|
||||
|
||||
var/datum/automation/and/and_on=new(src)
|
||||
and_on.children.Add(
|
||||
MakeCompare(
|
||||
MakeGetSensorData(sensor_tag,"pressure"),
|
||||
MakeNumber(5000),
|
||||
"Greater Than or Equal to"
|
||||
)
|
||||
)
|
||||
and_on.children.Add(
|
||||
MakeCompare(
|
||||
MakeGetSensorData(sensor_tag,"oxygen"),
|
||||
MakeNumber(20),
|
||||
"Greater Than or Equal to"
|
||||
)
|
||||
)
|
||||
if_on.condition=and_on
|
||||
if_on.children_then.Add(vp_on)
|
||||
|
||||
//////////////////////////////
|
||||
|
||||
var/datum/automation/if_statement/if_off=new(src)
|
||||
|
||||
var/datum/automation/or/or_off=new(src)
|
||||
or_off.children.Add(
|
||||
MakeCompare(
|
||||
MakeGetSensorData(sensor_tag,"pressure"),
|
||||
MakeNumber(100),
|
||||
"Less Than"
|
||||
)
|
||||
)
|
||||
or_off.children.Add(
|
||||
MakeCompare(
|
||||
MakeGetSensorData(sensor_tag,"oxygen"),
|
||||
MakeNumber(20),
|
||||
"Less Than"
|
||||
)
|
||||
)
|
||||
if_off.condition=or_off
|
||||
if_off.children_then.Add(vp_off)
|
||||
|
||||
if_on.children_else.Add(if_off)
|
||||
|
||||
automations += if_on
|
||||
@@ -0,0 +1,44 @@
|
||||
|
||||
|
||||
/datum/automation/set_valve_state
|
||||
name = "Digital Valve: Set Open/Closed"
|
||||
var/valve=null
|
||||
var/state=0
|
||||
|
||||
Export()
|
||||
var/list/json = ..()
|
||||
json["valve"]=valve
|
||||
json["state"]=state
|
||||
return json
|
||||
|
||||
Import(var/list/json)
|
||||
..(json)
|
||||
valve = json["valve"]
|
||||
state = text2num(json["state"])
|
||||
|
||||
process()
|
||||
if(valve)
|
||||
parent.send_signal(list ("tag" = valve, "command"="valve_set","valve_set"=state))
|
||||
return 0
|
||||
|
||||
GetText()
|
||||
return "Set digital valve <a href=\"?src=\ref[src];set_subject=1\">[fmtString(valve)]</a> to <a href=\"?src=\ref[src];set_state=1\">[state?"open":"closed"]</a>."
|
||||
|
||||
Topic(href,href_list)
|
||||
if(..())
|
||||
return 1
|
||||
if(href_list["set_state"])
|
||||
state=!state
|
||||
parent.updateUsrDialog()
|
||||
return 1
|
||||
if(href_list["set_subject"])
|
||||
var/list/valves=list()
|
||||
for(var/obj/machinery/atmospherics/valve/digital/V in world)
|
||||
if(!isnull(V.id_tag) && V.frequency == parent.frequency)
|
||||
valves|=V.id_tag
|
||||
if(valves.len==0)
|
||||
usr << "<span class='warning'>Unable to find any digital valves on this frequency.</span>"
|
||||
return
|
||||
valve = input("Select a valve:", "Sensor Data", valve) as null|anything in valves
|
||||
parent.updateUsrDialog()
|
||||
return 1
|
||||
@@ -0,0 +1,42 @@
|
||||
/datum/automation/set_emitter_power
|
||||
name = "Emitter: Set Power"
|
||||
var/emitter=null
|
||||
var/on=0
|
||||
|
||||
Export()
|
||||
var/list/json = ..()
|
||||
json["emitter"]=emitter
|
||||
json["on"]=on
|
||||
return json
|
||||
|
||||
Import(var/list/json)
|
||||
..(json)
|
||||
emitter = json["emitter"]
|
||||
on = text2num(json["on"])
|
||||
|
||||
process()
|
||||
if(emitter)
|
||||
parent.send_signal(list ("tag" = emitter, "command"="set","state"=on))
|
||||
return 0
|
||||
|
||||
GetText()
|
||||
return "Set emitter <a href=\"?src=\ref[src];set_subject=1\">[fmtString(emitter)]</a> to <a href=\"?src=\ref[src];set_power=1\">[on?"on":"off"]</a>."
|
||||
|
||||
Topic(href,href_list)
|
||||
if(..())
|
||||
return 1
|
||||
if(href_list["set_power"])
|
||||
on=!on
|
||||
parent.updateUsrDialog()
|
||||
return 1
|
||||
if(href_list["set_subject"])
|
||||
var/list/emitters=list()
|
||||
for(var/obj/machinery/power/emitter/E in machines)
|
||||
if(!isnull(E.id_tag) && E.frequency == parent.frequency)
|
||||
emitters|=E.id_tag
|
||||
if(emitters.len==0)
|
||||
usr << "<span class='warning'>Unable to find any emitters on this frequency.</span>"
|
||||
return
|
||||
emitter = input("Select an emitter:", "Emitter", emitter) as null|anything in emitters
|
||||
parent.updateUsrDialog()
|
||||
return 1
|
||||
@@ -0,0 +1,83 @@
|
||||
|
||||
////////////////////////////////////////////
|
||||
// Injector
|
||||
////////////////////////////////////////////
|
||||
/datum/automation/set_injector_power
|
||||
name = "Injector: Power"
|
||||
var/injector=null
|
||||
var/state=0
|
||||
|
||||
Export()
|
||||
var/list/json = ..()
|
||||
json["injector"]=injector
|
||||
json["state"]=state
|
||||
return json
|
||||
|
||||
Import(var/list/json)
|
||||
..(json)
|
||||
injector = json["injector"]
|
||||
state = text2num(json["state"])
|
||||
|
||||
process()
|
||||
if(injector)
|
||||
parent.send_signal(list ("tag" = injector, "power"=state))
|
||||
return 0
|
||||
|
||||
GetText()
|
||||
return "Set injector <a href=\"?src=\ref[src];set_injector=1\">[fmtString(injector)]</a> power to <a href=\"?src=\ref[src];toggle_state=1\">[state ? "on" : "off"]</a>."
|
||||
|
||||
Topic(href,href_list)
|
||||
if(..())
|
||||
return 1
|
||||
if(href_list["toggle_state"])
|
||||
state = !state
|
||||
parent.updateUsrDialog()
|
||||
return 1
|
||||
if(href_list["set_injector"])
|
||||
var/list/injector_names=list()
|
||||
for(var/obj/machinery/atmospherics/unary/outlet_injector/I in machines)
|
||||
if(!isnull(I.id_tag) && I.frequency == parent.frequency)
|
||||
injector_names|=I.id_tag
|
||||
injector = input("Select an injector:", "Sensor Data", injector) as null|anything in injector_names
|
||||
parent.updateUsrDialog()
|
||||
return 1
|
||||
|
||||
/datum/automation/set_injector_rate
|
||||
name = "Injector: Rate"
|
||||
var/injector=null
|
||||
var/rate=0
|
||||
|
||||
Export()
|
||||
var/list/json = ..()
|
||||
json["injector"]=injector
|
||||
json["rate"]=rate
|
||||
return json
|
||||
|
||||
Import(var/list/json)
|
||||
..(json)
|
||||
injector = json["injector"]
|
||||
rate = text2num(json["rate"])
|
||||
|
||||
process()
|
||||
if(injector)
|
||||
parent.send_signal(list ("tag" = injector, "set_volume_rate"=rate))
|
||||
return 0
|
||||
|
||||
GetText()
|
||||
return "Set injector <a href=\"?src=\ref[src];set_injector=1\">[fmtString(injector)]</a> transfer rate to <a href=\"?src=\ref[src];set_rate=1\">[rate]</a> L/s."
|
||||
|
||||
Topic(href,href_list)
|
||||
if(..())
|
||||
return 1
|
||||
if(href_list["set_rate"])
|
||||
rate = input("Set rate in L/s.", "Rate", rate) as num
|
||||
parent.updateUsrDialog()
|
||||
return 1
|
||||
if(href_list["set_injector"])
|
||||
var/list/injector_names=list()
|
||||
for(var/obj/machinery/atmospherics/unary/outlet_injector/I in machines)
|
||||
if(!isnull(I.id_tag) && I.frequency == parent.frequency)
|
||||
injector_names|=I.id_tag
|
||||
injector = input("Select an injector:", "Sensor Data", injector) as null|anything in injector_names
|
||||
parent.updateUsrDialog()
|
||||
return 1
|
||||
@@ -0,0 +1,153 @@
|
||||
/datum/automation/set_scrubber_mode
|
||||
name="Scrubber: Mode"
|
||||
|
||||
var/scrubber=null
|
||||
var/mode=1
|
||||
|
||||
Export()
|
||||
var/list/json = ..()
|
||||
json["scrubber"]=scrubber
|
||||
json["mode"]=mode
|
||||
return json
|
||||
|
||||
Import(var/list/json)
|
||||
..(json)
|
||||
scrubber = json["scrubber"]
|
||||
mode = text2num(json["mode"])
|
||||
|
||||
New(var/obj/machinery/computer/general_air_control/atmos_automation/aa)
|
||||
..(aa)
|
||||
children=list(null)
|
||||
|
||||
process()
|
||||
if(scrubber)
|
||||
parent.send_signal(list ("tag" = scrubber, "sigtype"="command", "scrubbing"=mode),filter = RADIO_FROM_AIRALARM)
|
||||
return 0
|
||||
|
||||
GetText()
|
||||
return "Set Scrubber <a href=\"?src=\ref[src];set_scrubber=1\">[fmtString(scrubber)]</a> mode to <a href=\"?src=\ref[src];set_mode=1\">[mode?"Scrubbing":"Syphoning"]</a>."
|
||||
|
||||
Topic(href,href_list)
|
||||
if(..()) return
|
||||
if(href_list["set_mode"])
|
||||
mode=!mode
|
||||
parent.updateUsrDialog()
|
||||
return 1
|
||||
if(href_list["set_scrubber"])
|
||||
var/list/injector_names=list()
|
||||
for(var/obj/machinery/atmospherics/unary/vent_scrubber/S in machines)
|
||||
if(!isnull(S.id_tag) && S.frequency == parent.frequency)
|
||||
injector_names|=S.id_tag
|
||||
scrubber = input("Select a scrubber:", "Scrubbers", scrubber) as null|anything in injector_names
|
||||
parent.updateUsrDialog()
|
||||
return 1
|
||||
|
||||
/datum/automation/set_scrubber_power
|
||||
name="Scrubber: Power"
|
||||
|
||||
var/scrubber=null
|
||||
var/state=0
|
||||
|
||||
Export()
|
||||
var/list/json = ..()
|
||||
json["scrubber"]=scrubber
|
||||
json["state"]=state
|
||||
return json
|
||||
|
||||
Import(var/list/json)
|
||||
..(json)
|
||||
scrubber = json["scrubber"]
|
||||
state = text2num(json["state"])
|
||||
|
||||
New(var/obj/machinery/computer/general_air_control/atmos_automation/aa)
|
||||
..(aa)
|
||||
|
||||
process()
|
||||
if(scrubber)
|
||||
parent.send_signal(list ("tag" = scrubber, "sigtype"="command", "power"=state),filter = RADIO_FROM_AIRALARM)
|
||||
|
||||
GetText()
|
||||
return "Set Scrubber <a href=\"?src=\ref[src];set_scrubber=1\">[fmtString(scrubber)]</a> power to <a href=\"?src=\ref[src];set_power=1\">[state ? "on" : "off"]</a>."
|
||||
|
||||
Topic(href,href_list)
|
||||
if(..()) return
|
||||
if(href_list["set_power"])
|
||||
state = !state
|
||||
parent.updateUsrDialog()
|
||||
return 1
|
||||
if(href_list["set_scrubber"])
|
||||
var/list/injector_names=list()
|
||||
for(var/obj/machinery/atmospherics/unary/vent_scrubber/S in machines)
|
||||
if(!isnull(S.id_tag) && S.frequency == parent.frequency)
|
||||
injector_names|=S.id_tag
|
||||
scrubber = input("Select a scrubber:", "Scrubbers", scrubber) as null|anything in injector_names
|
||||
parent.updateUsrDialog()
|
||||
return 1
|
||||
|
||||
var/global/list/gas_labels=list(
|
||||
"co2" = "CO<sub>2</sub>",
|
||||
"tox" = "Plasma",
|
||||
"n2o" = "N<sub>2</sub>O",
|
||||
"o2" = "O<sub>2</sub>",
|
||||
"n2" = "N<sub>2</sub>"
|
||||
)
|
||||
/datum/automation/set_scrubber_gasses
|
||||
name="Scrubber: Gasses"
|
||||
|
||||
var/scrubber=null
|
||||
var/list/gasses=list(
|
||||
"co2" = 1,
|
||||
"tox" = 0,
|
||||
"n2o" = 0,
|
||||
"o2" = 0,
|
||||
"n2" = 0
|
||||
)
|
||||
|
||||
Export()
|
||||
var/list/json = ..()
|
||||
json["scrubber"]=scrubber
|
||||
json["gasses"]=gasses
|
||||
return json
|
||||
|
||||
Import(var/list/json)
|
||||
..(json)
|
||||
scrubber = json["scrubber"]
|
||||
|
||||
var/list/newgasses=json["gasses"]
|
||||
for(var/key in newgasses)
|
||||
gasses[key]=newgasses[key]
|
||||
|
||||
|
||||
New(var/obj/machinery/computer/general_air_control/atmos_automation/aa)
|
||||
..(aa)
|
||||
|
||||
process()
|
||||
if(scrubber)
|
||||
var/list/data = list ("tag" = scrubber, "sigtype"="command")
|
||||
for(var/gas in gasses)
|
||||
data[gas+"_scrub"]=gasses[gas]
|
||||
parent.send_signal(data,filter = RADIO_FROM_AIRALARM)
|
||||
|
||||
GetText()
|
||||
var/txt = "Set Scrubber <a href=\"?src=\ref[src];set_scrubber=1\">[fmtString(scrubber)]</a> to scrub "
|
||||
for(var/gas in gasses)
|
||||
txt += " [gas_labels[gas]] (<a href=\"?src=\ref[src];tog_gas=[gas]\">[gasses[gas] ? "on" : "off"]</a>),"
|
||||
return txt
|
||||
|
||||
Topic(href,href_list)
|
||||
if(..()) return
|
||||
if(href_list["tog_gas"])
|
||||
var/gas = href_list["tog_gas"]
|
||||
if(!(gas in gasses))
|
||||
return
|
||||
gasses[gas] = !gasses[gas]
|
||||
parent.updateUsrDialog()
|
||||
return 1
|
||||
if(href_list["set_scrubber"])
|
||||
var/list/injector_names=list()
|
||||
for(var/obj/machinery/atmospherics/unary/vent_scrubber/S in machines)
|
||||
if(!isnull(S.id_tag) && S.frequency == parent.frequency)
|
||||
injector_names|=S.id_tag
|
||||
scrubber = input("Select a scrubber:", "Scrubbers", scrubber) as null|anything in injector_names
|
||||
parent.updateUsrDialog()
|
||||
return 1
|
||||
@@ -0,0 +1,56 @@
|
||||
|
||||
///////////////////////////////////////////
|
||||
// sensor data
|
||||
///////////////////////////////////////////
|
||||
|
||||
/datum/automation/get_sensor_data
|
||||
name = "Sensor: Get Data"
|
||||
var/field="temperature"
|
||||
var/sensor=null
|
||||
|
||||
returntype=AUTOM_RT_NUM
|
||||
|
||||
Export()
|
||||
var/list/json = ..()
|
||||
json["sensor"]=sensor
|
||||
json["field"]=field
|
||||
return json
|
||||
|
||||
Import(var/list/json)
|
||||
..(json)
|
||||
sensor = json["sensor"]
|
||||
field = json["field"]
|
||||
|
||||
Evaluate()
|
||||
if(sensor && field && sensor in parent.sensor_information)
|
||||
return parent.sensor_information[sensor][field]
|
||||
return 0
|
||||
|
||||
GetText()
|
||||
return "<a href=\"?src=\ref[src];set_field=1\">[fmtString(field)]</a> from sensor <a href=\"?src=\ref[src];set_sensor=1\">[fmtString(sensor)]</a>"
|
||||
|
||||
Topic(href,href_list)
|
||||
if(..())
|
||||
return 1
|
||||
if(href_list["set_field"])
|
||||
field = input("Select a sensor output:", "Sensor Data", field) as null|anything in list(
|
||||
"temperature",
|
||||
"pressure",
|
||||
"oxygen",
|
||||
"toxins",
|
||||
"nitrogen",
|
||||
"carbon_dioxide"
|
||||
)
|
||||
parent.updateUsrDialog()
|
||||
return 1
|
||||
if(href_list["set_sensor"])
|
||||
var/list/sensor_list = list()
|
||||
for(var/obj/machinery/air_sensor/G in machines)
|
||||
if(!isnull(G.id_tag) && G.frequency == parent.frequency)
|
||||
sensor_list|=G.id_tag
|
||||
for(var/obj/machinery/meter/M in machines)
|
||||
if(!isnull(M.id_tag) && M.frequency == parent.frequency)
|
||||
sensor_list|=M.id_tag
|
||||
sensor = input("Select a sensor:", "Sensor Data", field) as null|anything in sensor_list
|
||||
parent.updateUsrDialog()
|
||||
return 1
|
||||
@@ -0,0 +1,296 @@
|
||||
/datum/automation/set_vent_pump_mode
|
||||
name="Vent Pump: Mode"
|
||||
|
||||
var/vent_pump=null
|
||||
var/mode="stabilize"
|
||||
|
||||
var/list/modes = list("stabilize","purge")
|
||||
|
||||
Export()
|
||||
var/list/json = ..()
|
||||
json["vent_pump"]=vent_pump
|
||||
json["mode"]=mode
|
||||
return json
|
||||
|
||||
Import(var/list/json)
|
||||
..(json)
|
||||
vent_pump = json["vent_pump"]
|
||||
mode = json["mode"]
|
||||
|
||||
New(var/obj/machinery/computer/general_air_control/atmos_automation/aa)
|
||||
..(aa)
|
||||
children=list(null)
|
||||
|
||||
process()
|
||||
if(vent_pump)
|
||||
var/dirvalue = (mode == "stabalize" ? 1 : mode == "purge" ? 0 : 1)
|
||||
parent.send_signal(list ("tag" = vent_pump, "direction" = dirvalue),filter = RADIO_FROM_AIRALARM)
|
||||
return 0
|
||||
|
||||
GetText()
|
||||
return "Set vent pump <a href=\"?src=\ref[src];set_vent_pump=1\">[fmtString(vent_pump)]</a> mode to <a href=\"?src=\ref[src];set_mode=1\">[mode]</a>."
|
||||
|
||||
Topic(href,href_list)
|
||||
if(..())
|
||||
return 1
|
||||
if(href_list["set_mode"])
|
||||
mode = input("Select a mode to put this pump into.",mode) in modes
|
||||
parent.updateUsrDialog()
|
||||
return 1
|
||||
if(href_list["set_vent_pump"])
|
||||
var/list/injector_names=list()
|
||||
for(var/obj/machinery/atmospherics/unary/vent_pump/I in machines)
|
||||
if(!isnull(I.id_tag) && I.frequency == parent.frequency)
|
||||
injector_names|=I.id_tag
|
||||
for(var/obj/machinery/atmospherics/binary/dp_vent_pump/I in world)
|
||||
//world << "test"
|
||||
if(!isnull(I.id_tag) && I.frequency == parent.frequency)
|
||||
injector_names|=I.id_tag
|
||||
vent_pump = input("Select a vent:", "Vent Pumps", vent_pump) as null|anything in injector_names
|
||||
parent.updateUsrDialog()
|
||||
return 1
|
||||
|
||||
/datum/automation/set_vent_pump_power
|
||||
name="Vent Pump: Power"
|
||||
|
||||
var/vent_pump=null
|
||||
var/state=0
|
||||
|
||||
Export()
|
||||
var/list/json = ..()
|
||||
json["vent_pump"]=vent_pump
|
||||
json["state"]=state
|
||||
return json
|
||||
|
||||
Import(var/list/json)
|
||||
..(json)
|
||||
vent_pump = json["vent_pump"]
|
||||
state = text2num(json["state"])
|
||||
|
||||
New(var/obj/machinery/computer/general_air_control/atmos_automation/aa)
|
||||
..(aa)
|
||||
|
||||
process()
|
||||
if(vent_pump)
|
||||
parent.send_signal(list ("tag" = vent_pump, "power"=state), filter = RADIO_FROM_AIRALARM)
|
||||
|
||||
GetText()
|
||||
return "Set vent pump <a href=\"?src=\ref[src];set_vent_pump=1\">[fmtString(vent_pump)]</a> power to <a href=\"?src=\ref[src];set_power=1\">[state ? "on" : "off"]</a>."
|
||||
|
||||
Topic(href,href_list)
|
||||
if(..())
|
||||
return 1
|
||||
if(href_list["set_power"])
|
||||
state = !state
|
||||
parent.updateUsrDialog()
|
||||
return 1
|
||||
if(href_list["set_vent_pump"])
|
||||
var/list/injector_names=list()
|
||||
for(var/obj/machinery/atmospherics/unary/vent_pump/I in machines)
|
||||
if(!isnull(I.id_tag) && I.frequency == parent.frequency)
|
||||
injector_names|=I.id_tag
|
||||
for(var/obj/machinery/atmospherics/binary/dp_vent_pump/I in world)
|
||||
if(!isnull(I.id_tag) && I.frequency == parent.frequency)
|
||||
injector_names|=I.id_tag
|
||||
vent_pump = input("Select a vent:", "Vent Pumps", vent_pump) as null|anything in injector_names
|
||||
parent.updateUsrDialog()
|
||||
return 1
|
||||
|
||||
/datum/automation/set_vent_pump_pressure//controls the internal/external pressure bounds of a vent pump.
|
||||
name = "Vent pump: Pressure settings"
|
||||
|
||||
var/vent_pump = null
|
||||
var/intpressureout = 0//these 2 are for DP vents, if it's a unary vent you're sending to it will take intpressureout as var
|
||||
var/intpressurein = 0
|
||||
var/extpressure = 0
|
||||
var/mode = 0//0 for unary vents, 1 for DP vents.
|
||||
|
||||
Export()
|
||||
var/list/json = ..()
|
||||
json["vent_pump"] = vent_pump
|
||||
json["intpressureout"] = intpressureout
|
||||
json["intpressurein"] = intpressurein
|
||||
json["extpressure"] = extpressure
|
||||
json["mode"] = mode
|
||||
return json
|
||||
|
||||
Import(var/list/json)
|
||||
..(json)
|
||||
vent_pump = json["vent_pump"]
|
||||
intpressureout = text2num(json["intpressureout"])
|
||||
intpressurein = text2num(json["intpressurein"])
|
||||
extpressure = text2num(json["extpressure"])
|
||||
mode = text2num(json["mode"])
|
||||
|
||||
New(var/obj/machinery/computer/general_air_control/atmos_automation/aa)
|
||||
..(aa)
|
||||
|
||||
process()
|
||||
if(vent_pump)
|
||||
var/list/data = list( \
|
||||
"tag" = vent_pump, \
|
||||
)
|
||||
var/filter = RADIO_ATMOSIA
|
||||
if(mode)//it's a DP vent
|
||||
if(intpressurein)
|
||||
data.Add(list("set_input_pressure" = intpressurein))
|
||||
if(intpressureout)
|
||||
data.Add(list("set_output_pressure" = intpressureout))
|
||||
if(extpressure)
|
||||
data.Add(list("set_external_pressure" = extpressure))
|
||||
|
||||
else
|
||||
if(intpressureout)
|
||||
data.Add(list("set_internal_pressure" = intpressureout))
|
||||
if(extpressure)
|
||||
data.Add(list("set_external_pressure" = extpressure))
|
||||
filter = RADIO_FROM_AIRALARM
|
||||
|
||||
parent.send_signal(data, filter)
|
||||
|
||||
GetText()
|
||||
if(mode)//DP vent
|
||||
return {"Set <a href=\"?src=\ref[src];swap_modes=1\">dual-port</a> vent pump <a href=\"?src=\ref[src];set_vent_pump=1\">[fmtString(vent_pump)]</a>
|
||||
pressure bounds: internal outwards: <a href=\"?src=\ref[src];set_intpressure_out=1">[fmtString(intpressureout)]</a>
|
||||
internal inwards: <a href=\"?src=\ref[src];set_intpressure_in=1">[fmtString(intpressurein)]</a>
|
||||
external: <a href=\"?src=\ref[src];set_external=1">[fmtString(extpressure)]</a>
|
||||
"}//well that was a lot to type
|
||||
else
|
||||
return {"Set <a href=\"?src=\ref[src];swap_modes=1\">unary</a> vent pump <a href=\"?src=\ref[src];set_vent_pump=1\">[fmtString(vent_pump)]</a>
|
||||
pressure bounds: internal: <a href=\"?src=\ref[src];set_intpressure_out=1">[fmtString(intpressureout)]</a>
|
||||
external: <a href=\"?src=\ref[src];set_external=1">[fmtString(extpressure)]</a>
|
||||
"}//copy paste FTW
|
||||
|
||||
Topic(href, href_list)
|
||||
if(..())
|
||||
return 1
|
||||
|
||||
if(href_list["set_vent_pump"])
|
||||
var/list/injector_names=list()
|
||||
if(mode)//DP vent selection
|
||||
for(var/obj/machinery/atmospherics/binary/dp_vent_pump/I in world)
|
||||
if(!isnull(I.id_tag) && I.frequency == parent.frequency)
|
||||
injector_names|=I.id_tag
|
||||
else
|
||||
for(var/obj/machinery/atmospherics/unary/vent_pump/I in machines)
|
||||
if(!isnull(I.id_tag) && I.frequency == parent.frequency)
|
||||
injector_names|=I.id_tag
|
||||
vent_pump = input("Select a vent:", "Vent Pumps", vent_pump) as null|anything in injector_names
|
||||
parent.updateUsrDialog()
|
||||
return 1
|
||||
|
||||
if(href_list["set_intpressure_out"])
|
||||
var/response = input("Set new pressure, in kPa. \[0-[50*ONE_ATMOSPHERE]\]") as num
|
||||
intpressureout = text2num(response)
|
||||
intpressureout = between(0, intpressureout, 50*ONE_ATMOSPHERE)
|
||||
parent.updateUsrDialog()
|
||||
return 1
|
||||
|
||||
if(href_list["set_intpressure_in"])
|
||||
var/response = input("Set new pressure, in kPa. \[0-[50*ONE_ATMOSPHERE]\]") as num
|
||||
intpressurein = text2num(response)
|
||||
intpressurein = between(0, intpressurein, 50*ONE_ATMOSPHERE)
|
||||
parent.updateUsrDialog()
|
||||
return 1
|
||||
|
||||
if(href_list["set_external"])
|
||||
var/response = input(usr,"Set new pressure, in kPa. \[0-[50*ONE_ATMOSPHERE]\]") as num
|
||||
extpressure = text2num(response)
|
||||
extpressure = between(0, extpressure, 50*ONE_ATMOSPHERE)
|
||||
parent.updateUsrDialog()
|
||||
return 1
|
||||
|
||||
if(href_list["swap_modes"])
|
||||
mode = !mode
|
||||
vent_pump = null//if we don't clear this is could get glitchy, by which I mean not at all, whatever, stay clean
|
||||
parent.updateUsrDialog()
|
||||
return 1
|
||||
|
||||
/datum/automation/set_vent_pressure_checks
|
||||
name = "Vent pump: pressure checks"
|
||||
|
||||
var/vent_pump = null
|
||||
var/checks = 1
|
||||
var/mode = 0//1 for DP vent, 0 for unary vent
|
||||
/*
|
||||
checks bitflags
|
||||
1 = external
|
||||
2 = internal in (regular internal for unaries)
|
||||
4 = internal out (ignored by unaries)
|
||||
*/
|
||||
|
||||
|
||||
Export()
|
||||
var/list/json = ..()
|
||||
json["vent_pump"] = vent_pump
|
||||
json["checks"] = checks
|
||||
json["mode"] = mode
|
||||
return json
|
||||
|
||||
Import(var/list/json)
|
||||
..(json)
|
||||
vent_pump = json["vent_pump"]
|
||||
checks = text2num(json["checks"])
|
||||
mode = text2num(json["mode"])
|
||||
|
||||
New(var/obj/machinery/computer/general_air_control/atmos_automation/aa)
|
||||
..(aa)
|
||||
|
||||
process()
|
||||
if(vent_pump)
|
||||
parent.send_signal(list("tag" = vent_pump, "checks" = checks), filter = (mode ? RADIO_ATMOSIA : RADIO_FROM_AIRALARM))//not gonna bother with a sanity check here, there *should* not be any problems
|
||||
|
||||
GetText()
|
||||
if(mode)
|
||||
return {"Set <a href=\"?src=\ref[src];swap_modes=1\">dual-port</a> vent pump <a href=\"?src=\ref[src];set_vent_pump=1\">[fmtString(vent_pump)]</a> pressure checks to:
|
||||
external <a href=\"?src=\ref[src];togglecheck=1\">[checks&1 ? "Enabled" : "Disabled"]</a>
|
||||
internal inwards <a href=\"?src=\ref[src];togglecheck=2\">[checks&2 ? "Enabled" : "Disabled"]</a>
|
||||
internal outwards <a href=\"?src=\ref[src];togglecheck=4\">[checks&4 ? "Enabled" : "Disabled"]</a>
|
||||
"}
|
||||
else
|
||||
return {"Set <a href=\"?src=\ref[src];swap_modes=1\">unary</a> vent pump <a href=\"?src=\ref[src];set_vent_pump=1\">[fmtString(vent_pump)]</a> pressure checks to:
|
||||
external: <a href=\"?src=\ref[src];togglecheck=1\">[checks&1 ? "Enabled" : "Disabled"]</a>,
|
||||
internal: <a href=\"?src=\ref[src];togglecheck=2\">[checks&2 ? "Enabled" : "Disabled"]</a>
|
||||
"}
|
||||
|
||||
Topic(href, href_list)
|
||||
if(..())
|
||||
return 1
|
||||
|
||||
if(href_list["set_vent_pump"])
|
||||
var/list/injector_names=list()
|
||||
if(mode)//DP vent selection
|
||||
for(var/obj/machinery/atmospherics/binary/dp_vent_pump/I in world)
|
||||
if(!isnull(I.id_tag) && I.frequency == parent.frequency)
|
||||
injector_names|=I.id_tag
|
||||
else
|
||||
for(var/obj/machinery/atmospherics/unary/vent_pump/I in machines)
|
||||
if(!isnull(I.id_tag) && I.frequency == parent.frequency)
|
||||
injector_names|=I.id_tag
|
||||
vent_pump = input("Select a vent:", "Vent Pumps", vent_pump) as null|anything in injector_names
|
||||
parent.updateUsrDialog()
|
||||
return 1
|
||||
|
||||
if(href_list["swap_modes"])
|
||||
mode = !mode
|
||||
vent_pump = null//if we don't clear this is could get glitchy, by which I mean not at all, whatever, stay clean
|
||||
if(!mode && checks&4)//disable this bitflag since we're switching to unaries
|
||||
checks &= ~4
|
||||
parent.updateUsrDialog()
|
||||
return 1
|
||||
|
||||
if(href_list["togglecheck"])
|
||||
var/bitflagvalue = text2num(href_list["togglecheck"])
|
||||
if(mode)
|
||||
if(!(bitflagvalue in list(1, 2, 4)))
|
||||
return 0
|
||||
else if(!(bitflagvalue in list(1, 2)))
|
||||
return 0
|
||||
|
||||
if(checks&bitflagvalue)//the bitflag is on ATM
|
||||
checks &= ~bitflagvalue
|
||||
else//can't not be off
|
||||
checks |= bitflagvalue
|
||||
parent.updateUsrDialog()
|
||||
return 1
|
||||
|
||||
@@ -0,0 +1,457 @@
|
||||
var/global/automation_types=typesof(/datum/automation) - /datum/automation
|
||||
|
||||
#define AUTOM_RT_NULL 0
|
||||
#define AUTOM_RT_NUM 1
|
||||
#define AUTOM_RT_STRING 2
|
||||
/datum/automation
|
||||
// Name of the Automation
|
||||
var/name="Base Automation"
|
||||
|
||||
// For labelling what shit does on the AAC.
|
||||
var/label="Unnamed Script"
|
||||
var/desc ="No Description."
|
||||
|
||||
var/obj/machinery/computer/general_air_control/atmos_automation/parent
|
||||
var/list/valid_child_returntypes=list()
|
||||
var/list/datum/automation/children=list()
|
||||
|
||||
var/returntype=AUTOM_RT_NULL
|
||||
|
||||
/datum/automation/New(var/obj/machinery/computer/general_air_control/atmos_automation/aa)
|
||||
parent=aa
|
||||
|
||||
/datum/automation/proc/GetText()
|
||||
return "[type] doesn't override GetText()!"
|
||||
|
||||
/datum/automation/proc/OnReset()
|
||||
return
|
||||
|
||||
/datum/automation/proc/OnRemove()
|
||||
return
|
||||
|
||||
/datum/automation/proc/process()
|
||||
return
|
||||
|
||||
/datum/automation/proc/Evaluate()
|
||||
return 0
|
||||
|
||||
/datum/automation/proc/Export()
|
||||
var/list/R = list("type"=type)
|
||||
|
||||
if(initial(label)!=label)
|
||||
R["label"]=label
|
||||
|
||||
if(initial(desc)!=desc)
|
||||
R["desc"]=desc
|
||||
|
||||
if(children.len>0)
|
||||
var/list/C=list()
|
||||
for(var/datum/automation/A in children)
|
||||
C += list(A.Export())
|
||||
R["children"]=C
|
||||
|
||||
return R
|
||||
|
||||
/datum/automation/proc/unpackChild(var/list/cData)
|
||||
if(isnull(cData) || !("type" in cData))
|
||||
return null
|
||||
var/Atype=text2path(cData["type"])
|
||||
if(!(Atype in automation_types))
|
||||
return null
|
||||
var/datum/automation/A = new Atype(parent)
|
||||
A.Import(cData)
|
||||
return A
|
||||
|
||||
/datum/automation/proc/unpackChildren(var/list/childList)
|
||||
. = list()
|
||||
if(childList.len>0)
|
||||
for(var/list/cData in childList)
|
||||
if(isnull(cData) || !("type" in cData))
|
||||
. += null
|
||||
continue
|
||||
var/Atype=text2path(cData["type"])
|
||||
if(!(Atype in automation_types))
|
||||
continue
|
||||
var/datum/automation/A = new Atype(parent)
|
||||
A.Import(cData)
|
||||
. += A
|
||||
|
||||
/datum/automation/proc/packChildren(var/list/childList)
|
||||
. = list()
|
||||
if(childList.len>0)
|
||||
for(var/datum/automation/A in childList)
|
||||
if(isnull(A) || !istype(A))
|
||||
. += null
|
||||
continue
|
||||
. += list(A.Export())
|
||||
|
||||
/datum/automation/proc/Import(var/list/json)
|
||||
if("label" in json)
|
||||
label = json["label"]
|
||||
|
||||
if("desc" in json)
|
||||
desc = json["desc"]
|
||||
|
||||
if("children" in json)
|
||||
children = unpackChildren(json["children"])
|
||||
|
||||
/datum/automation/proc/fmtString(var/str)
|
||||
if(str==null || str == "")
|
||||
return "-----"
|
||||
return str
|
||||
|
||||
/datum/automation/Topic(href,href_list)
|
||||
if(parent.CanUseTopic(usr, href_list))//dumb hack to check sanity, empty topic shouldn't trigger a 1 on anything but sanity checks
|
||||
return 1
|
||||
|
||||
if(href_list["add"])
|
||||
var/new_child=selectValidChildFor(usr)
|
||||
if(!new_child) return 1
|
||||
children += new_child
|
||||
parent.updateUsrDialog()
|
||||
return 1
|
||||
|
||||
if(href_list["remove"])
|
||||
if(href_list["remove"]=="*")
|
||||
var/confirm=alert("Are you sure you want to remove ALL automations?","Automations","Yes","No")
|
||||
if(confirm == "No") return 0
|
||||
for(var/datum/automation/A in children)
|
||||
A.OnRemove()
|
||||
children.Remove(A)
|
||||
else
|
||||
var/datum/automation/A=locate(href_list["remove"])
|
||||
if(!A) return 1
|
||||
var/confirm=alert("Are you sure you want to remove this automation?","Automations","Yes","No")
|
||||
if(confirm == "No") return 0
|
||||
A.OnRemove()
|
||||
children.Remove(A)
|
||||
parent.updateUsrDialog()
|
||||
return 1
|
||||
|
||||
if(href_list["reset"])
|
||||
if(href_list["reset"]=="*")
|
||||
for(var/datum/automation/A in children)
|
||||
A.OnReset()
|
||||
else
|
||||
var/datum/automation/A=locate(href_list["reset"])
|
||||
if(!A) return 1
|
||||
A.OnReset()
|
||||
parent.updateUsrDialog()
|
||||
return 1
|
||||
return 0 // 1 if handled
|
||||
|
||||
/datum/automation/proc/selectValidChildFor(var/mob/user, var/list/returntypes=valid_child_returntypes)
|
||||
return parent.selectValidChildFor(src, user, returntypes)
|
||||
|
||||
///////////////////////////////////////////
|
||||
// AND
|
||||
///////////////////////////////////////////
|
||||
/datum/automation/and
|
||||
name = "AND statement"
|
||||
returntype=AUTOM_RT_NUM
|
||||
valid_child_returntypes=list(AUTOM_RT_NUM)
|
||||
|
||||
Evaluate()
|
||||
if(children.len==0) return 0
|
||||
for(var/datum/automation/stmt in children)
|
||||
if(!stmt.Evaluate())
|
||||
return 0
|
||||
return 1
|
||||
|
||||
GetText()
|
||||
var/out="AND (<a href=\"?src=\ref[src];add=1\">Add</a>)"
|
||||
if(children.len>0)
|
||||
out += "<ul>"
|
||||
for(var/datum/automation/stmt in children)
|
||||
out += {"<li>
|
||||
\[<a href="?src=\ref[src];reset=\ref[stmt]">Reset</a> |
|
||||
<a href="?src=\ref[src];remove=\ref[stmt]">×</a>\]
|
||||
[stmt.GetText()]
|
||||
</li>"}
|
||||
out += "</ul>"
|
||||
else
|
||||
out += "<blockquote><i>No statements to evaluate.</i></blockquote>"
|
||||
return out
|
||||
|
||||
///////////////////////////////////////////
|
||||
// OR
|
||||
///////////////////////////////////////////
|
||||
|
||||
/datum/automation/or
|
||||
name = "OR statement"
|
||||
returntype=AUTOM_RT_NUM
|
||||
valid_child_returntypes=list(AUTOM_RT_NUM)
|
||||
|
||||
Evaluate()
|
||||
if(children.len==0) return 0
|
||||
for(var/datum/automation/stmt in children)
|
||||
if(stmt.Evaluate())
|
||||
return 1
|
||||
return 0
|
||||
|
||||
GetText()
|
||||
var/out="OR (<a href=\"?src=\ref[src];add=1\">Add</a>)"
|
||||
if(children.len>0)
|
||||
out += "<ul>"
|
||||
for(var/datum/automation/stmt in children)
|
||||
out += {"<li>
|
||||
\[<a href="?src=\ref[src];reset=\ref[stmt]">Reset</a> |
|
||||
<a href="?src=\ref[src];remove=\ref[stmt]">×</a>\]
|
||||
[stmt.GetText()]
|
||||
</li>"}
|
||||
out += "</ul>"
|
||||
else
|
||||
out += "<blockquote><i>No statements to evaluate.</i></blockquote>"
|
||||
return out
|
||||
|
||||
///////////////////////////////////////////
|
||||
// if .. then
|
||||
///////////////////////////////////////////
|
||||
|
||||
/datum/automation/if_statement
|
||||
name = "IF statement"
|
||||
var/datum/automation/condition=null
|
||||
valid_child_returntypes=list(AUTOM_RT_NULL)
|
||||
var/list/valid_conditions=list(AUTOM_RT_NUM)
|
||||
|
||||
var/list/children_then=list()
|
||||
var/list/children_else=list()
|
||||
|
||||
Export()
|
||||
var/list/R = ..()
|
||||
|
||||
if(children_then.len>0)
|
||||
R["then"]=packChildren(children_then)
|
||||
|
||||
if(children_else.len>0)
|
||||
R["else"]=packChildren(children_else)
|
||||
|
||||
if(condition)
|
||||
R["condition"]=condition.Export()
|
||||
|
||||
return R
|
||||
|
||||
Import(var/list/json)
|
||||
..(json)
|
||||
|
||||
if("then" in json)
|
||||
children_then = unpackChildren(json["then"])
|
||||
|
||||
if("else" in json)
|
||||
children_else = unpackChildren(json["else"])
|
||||
|
||||
if("condition" in json)
|
||||
condition = unpackChild(json["condition"])
|
||||
|
||||
GetText()
|
||||
var/out="<b>IF</b> (<a href=\"?src=\ref[src];set_condition=1\">SET</a>):<blockquote>"
|
||||
if(condition)
|
||||
out += condition.GetText()
|
||||
else
|
||||
out += "<i>Not set</i>"
|
||||
out += "</blockquote>"
|
||||
out += "<b>THEN:</b> (<a href=\"?src=\ref[src];add=then\">Add</a>)"
|
||||
if(children_then.len>0)
|
||||
out += "<ul>"
|
||||
for(var/datum/automation/stmt in children_then)
|
||||
out += {"<li>
|
||||
\[<a href="?src=\ref[src];reset=\ref[stmt];context=then">Reset</a> |
|
||||
<a href="?src=\ref[src];remove=\ref[stmt];context=then">×</a>\]
|
||||
[stmt.GetText()]
|
||||
</li>"}
|
||||
out += "</ul>"
|
||||
else
|
||||
out += "<blockquote><i>(No statements to run)</i></blockquote>"
|
||||
out += "<b>ELSE:</b> (<a href=\"?src=\ref[src];add=else\">Add</a>)"
|
||||
if(children_then.len>0)
|
||||
out += "<ul>"
|
||||
for(var/datum/automation/stmt in children_else)
|
||||
out += {"<li>
|
||||
\[<a href="?src=\ref[src];reset=\ref[stmt];context=else">Reset</a> |
|
||||
<a href="?src=\ref[src];remove=\ref[stmt];context=else">×</a>\]
|
||||
[stmt.GetText()]
|
||||
</li>"}
|
||||
out += "</ul>"
|
||||
else
|
||||
out += "<blockquote><i>(No statements to run)</i></blockquote>"
|
||||
return out
|
||||
|
||||
Topic(href,href_list)
|
||||
if(href_list["add"])
|
||||
var/new_child=selectValidChildFor(usr)
|
||||
if(!new_child) return 1
|
||||
switch(href_list["add"])
|
||||
if("then")
|
||||
children_then += new_child
|
||||
if("else")
|
||||
children_else += new_child
|
||||
else
|
||||
warning("Unknown add value given to [type]/Topic():[__LINE__]: [href]")
|
||||
return 1
|
||||
parent.updateUsrDialog()
|
||||
return 1
|
||||
if(href_list["remove"])
|
||||
if(href_list["remove"]=="*")
|
||||
var/confirm=input("Are you sure you want to remove ALL automations?","Automations","No") in list("Yes","No")
|
||||
if(confirm == "No") return 0
|
||||
for(var/datum/automation/A in children_then)
|
||||
A.OnRemove()
|
||||
children_then.Remove(A)
|
||||
for(var/datum/automation/A in children_else)
|
||||
A.OnRemove()
|
||||
children_else.Remove(A)
|
||||
else
|
||||
var/datum/automation/A=locate(href_list["remove"])
|
||||
if(!A) return 1
|
||||
var/confirm=input("Are you sure you want to remove this automation?","Automations","No") in list("Yes","No")
|
||||
if(confirm == "No") return 0
|
||||
A.OnRemove()
|
||||
switch(href_list["context"])
|
||||
if("then")
|
||||
children_then.Remove(A)
|
||||
if("else")
|
||||
children_else.Remove(A)
|
||||
parent.updateUsrDialog()
|
||||
return 1
|
||||
if(href_list["reset"])
|
||||
if(href_list["reset"]=="*")
|
||||
for(var/datum/automation/A in children_then)
|
||||
A.OnReset()
|
||||
for(var/datum/automation/A in children_else)
|
||||
A.OnReset()
|
||||
else
|
||||
var/datum/automation/A=locate(href_list["reset"])
|
||||
if(!A) return 1
|
||||
A.OnReset()
|
||||
parent.updateUsrDialog()
|
||||
return 1
|
||||
if(href_list["set_condition"])
|
||||
var/new_condition = selectValidChildFor(usr,valid_conditions)
|
||||
testing("Selected condition: [new_condition]")
|
||||
if(!new_condition)
|
||||
return 1
|
||||
condition = new_condition
|
||||
parent.updateUsrDialog()
|
||||
return 1
|
||||
|
||||
process()
|
||||
if(condition)
|
||||
if(condition.Evaluate())
|
||||
for(var/datum/automation/stmt in children_then)
|
||||
stmt.process()
|
||||
else
|
||||
for(var/datum/automation/stmt in children_else)
|
||||
stmt.process()
|
||||
|
||||
///////////////////////////////////////////
|
||||
// compare
|
||||
///////////////////////////////////////////
|
||||
|
||||
/datum/automation/compare
|
||||
name = "comparison"
|
||||
var/comparator="Greater Than"
|
||||
returntype=AUTOM_RT_NUM
|
||||
valid_child_returntypes=list(AUTOM_RT_NUM)
|
||||
|
||||
New(var/obj/machinery/computer/general_air_control/atmos_automation/aa)
|
||||
..(aa)
|
||||
children=list(null,null)
|
||||
|
||||
Export()
|
||||
var/list/json = ..()
|
||||
json["cmp"]=comparator
|
||||
return json
|
||||
|
||||
Import(var/list/json)
|
||||
..(json)
|
||||
comparator = json["cmp"]
|
||||
|
||||
Evaluate()
|
||||
if(children.len<2)
|
||||
return 0
|
||||
var/datum/automation/d_left =children[1]
|
||||
var/datum/automation/d_right=children[2]
|
||||
if(!d_left || !d_right)
|
||||
return 0
|
||||
var/left=d_left.Evaluate()
|
||||
var/right=d_right.Evaluate()
|
||||
switch(comparator)
|
||||
if("Greater Than")
|
||||
return left>right
|
||||
if("Greater Than or Equal to")
|
||||
return left>=right
|
||||
if("Less Than")
|
||||
return left<right
|
||||
if("Less Than or Equal to")
|
||||
return left<=right
|
||||
if("Equal to")
|
||||
return left==right
|
||||
if("NOT Equal To")
|
||||
return left!=right
|
||||
else
|
||||
return 0
|
||||
|
||||
GetText()
|
||||
var/datum/automation/left =children[1]
|
||||
var/datum/automation/right=children[2]
|
||||
|
||||
var/out = "<a href=\"?src=\ref[src];set_field=1\">(Set Left)</a> ("
|
||||
if(left==null)
|
||||
out += "-----"
|
||||
else
|
||||
out += left.GetText()
|
||||
|
||||
out += ") is <a href=\"?src=\ref[src];set_comparator=left\">[comparator]</a>: <a href=\"?src=\ref[src];set_field=2\">(Set Right)</a> ("
|
||||
|
||||
if(right==null)
|
||||
out += "-----"
|
||||
else
|
||||
out += right.GetText()
|
||||
out +=")"
|
||||
return out
|
||||
|
||||
Topic(href,href_list)
|
||||
if(href_list["set_comparator"])
|
||||
comparator = input("Select a comparison operator:", "Compare", "Greater Than") in list("Greater Than","Greater Than or Equal to","Less Than","Less Than or Equal to","Equal to","NOT Equal To")
|
||||
parent.updateUsrDialog()
|
||||
return 1
|
||||
if(href_list["set_field"])
|
||||
var/idx = text2num(href_list["set_field"])
|
||||
var/new_child = selectValidChildFor(usr)
|
||||
if(!new_child)
|
||||
return 1
|
||||
children[idx] = new_child
|
||||
parent.updateUsrDialog()
|
||||
return 1
|
||||
|
||||
///////////////////////////////////////////
|
||||
// static value
|
||||
///////////////////////////////////////////
|
||||
|
||||
/datum/automation/static_value
|
||||
name = "Number"
|
||||
|
||||
var/value=0
|
||||
|
||||
returntype=AUTOM_RT_NUM
|
||||
|
||||
Evaluate()
|
||||
return value
|
||||
|
||||
Export()
|
||||
var/list/json = ..()
|
||||
json["value"]=value
|
||||
return json
|
||||
|
||||
Import(var/list/json)
|
||||
..(json)
|
||||
value = text2num(json["value"])
|
||||
|
||||
GetText()
|
||||
return "<a href=\"?src=\ref[src];set_value=1\">[value]</a>"
|
||||
|
||||
Topic(href,href_list)
|
||||
if(href_list["set_value"])
|
||||
value = input("Set a value:", "Static Value", value) as num
|
||||
parent.updateUsrDialog()
|
||||
return 1
|
||||
@@ -429,13 +429,14 @@ var/list/intents = list("help","disarm","grab","harm")
|
||||
src << "\blue You are now [resting ? "resting" : "getting up"]"
|
||||
|
||||
/proc/get_multitool(mob/user as mob)
|
||||
// Check distance for those that need it.
|
||||
if(!isAI(user))
|
||||
if(!in_range(user, src))
|
||||
return null
|
||||
|
||||
// Get tool
|
||||
var/obj/item/device/multitool/P = user.get_multitool()
|
||||
var/obj/item/device/multitool/P
|
||||
if(isrobot(user) || ishuman(user))
|
||||
P = user.get_active_hand()
|
||||
else if(isAI(user))
|
||||
var/mob/living/silicon/ai/AI=user
|
||||
P = AI.aiMulti
|
||||
|
||||
if(!istype(P))
|
||||
return null
|
||||
return P
|
||||
|
||||
@@ -26,7 +26,7 @@ json_reader
|
||||
src.json = json
|
||||
. = new/list()
|
||||
src.i = 1
|
||||
while(src.i <= lentext(json))
|
||||
while(src.i <= length(json))
|
||||
var/char = get_char()
|
||||
if(is_whitespace(char))
|
||||
i++
|
||||
@@ -44,7 +44,7 @@ json_reader
|
||||
|
||||
read_word()
|
||||
var/val = ""
|
||||
while(i <= lentext(json))
|
||||
while(i <= length(json))
|
||||
var/char = get_char()
|
||||
if(is_whitespace(char) || symbols.Find(char))
|
||||
i-- // let scanner handle this character
|
||||
@@ -56,7 +56,7 @@ json_reader
|
||||
var
|
||||
escape = FALSE
|
||||
val = ""
|
||||
while(++i <= lentext(json))
|
||||
while(++i <= length(json))
|
||||
var/char = get_char()
|
||||
if(escape)
|
||||
escape=FALSE // WHICH STUPID ASSHOLE FORGOT THIS - N3X
|
||||
@@ -101,6 +101,13 @@ json_reader
|
||||
return 48 <= c && c <= 57 || char == "+" || char == "-"
|
||||
|
||||
|
||||
// parser
|
||||
ReadArray(list/tokens)
|
||||
src.tokens = tokens
|
||||
i = 1
|
||||
return read_array()
|
||||
|
||||
|
||||
// parser
|
||||
ReadObject(list/tokens)
|
||||
src.tokens = tokens
|
||||
|
||||
@@ -5,8 +5,19 @@ n_Json v11.3.21
|
||||
proc
|
||||
json2list(json)
|
||||
var/static/json_reader/_jsonr = new()
|
||||
return _jsonr.ReadObject(_jsonr.ScanJson(json))
|
||||
// N3X: Array support.
|
||||
if(dd_hasprefix(json,"\["))
|
||||
return _jsonr.ReadArray(_jsonr.ScanJson(json))
|
||||
else
|
||||
return _jsonr.ReadObject(_jsonr.ScanJson(json))
|
||||
|
||||
list2json(list/L, var/cached_data = null)
|
||||
var/static/json_writer/_jsonw = new()
|
||||
return _jsonw.WriteObject(L, cached_data)
|
||||
// Detect if it's just a list of things, or an associative list
|
||||
// (Used to just assume associative, which broke things.)
|
||||
if(_jsonw.is_associative(L))
|
||||
return _jsonw.WriteObject(L, cached_data)
|
||||
else
|
||||
return _jsonw.write_array(L)
|
||||
|
||||
|
||||
|
||||
@@ -21,6 +21,17 @@
|
||||
var/state = 0
|
||||
var/locked = 0
|
||||
|
||||
var/frequency = 0
|
||||
var/id_tag = null
|
||||
var/datum/radio_frequency/radio_connection
|
||||
|
||||
//Radio remote control
|
||||
/obj/machinery/power/emitter/proc/set_frequency(new_frequency)
|
||||
radio_controller.remove_object(src, frequency)
|
||||
frequency = new_frequency
|
||||
if(frequency)
|
||||
radio_connection = radio_controller.add_object(src, frequency, RADIO_ATMOSIA)
|
||||
|
||||
|
||||
/obj/machinery/power/emitter/verb/rotate()
|
||||
set name = "Rotate"
|
||||
@@ -38,6 +49,41 @@
|
||||
if(state == 2 && anchored)
|
||||
connect_to_network()
|
||||
src.directwired = 1
|
||||
if(frequency)
|
||||
set_frequency(frequency)
|
||||
/obj/machinery/power/emitter/multitool_menu(var/mob/user,var/obj/item/device/multitool/P)
|
||||
return {"
|
||||
<ul>
|
||||
<li><b>Frequency:</b> <a href="?src=\ref[src];set_freq=-1">[format_frequency(frequency)] GHz</a> (<a href="?src=\ref[src];set_freq=[1439]">Reset</a>)</li>
|
||||
<li>[format_tag("ID Tag","id_tag","set_id")]</a></li>
|
||||
</ul>
|
||||
"}
|
||||
|
||||
/obj/machinery/power/emitter/receive_signal(datum/signal/signal)
|
||||
if(!signal.data["tag"] || (signal.data["tag"] != id_tag))
|
||||
return 0
|
||||
|
||||
var/on=0
|
||||
switch(signal.data["command"])
|
||||
if("on")
|
||||
on=1
|
||||
|
||||
if("off")
|
||||
on=0
|
||||
|
||||
if("set")
|
||||
on = signal.data["state"] > 0
|
||||
|
||||
if("toggle")
|
||||
on = !active
|
||||
|
||||
if(anchored && state == 2 && on != active)
|
||||
active=on
|
||||
var/statestr=on?"on":"off"
|
||||
// Spammy message_admins("Emitter turned [statestr] by radio signal ([signal.data["command"]] @ [frequency]) in [formatJumpTo(src)]",0,1)
|
||||
log_game("Emitter turned [statestr] by radio signal ([signal.data["command"]] @ [frequency]) in ([x],[y],[z])")
|
||||
investigate_log("turned <font color='orange'>[statestr]</font> by radio signal ([signal.data["command"]] @ [frequency])","singulo")
|
||||
update_icon()
|
||||
|
||||
/obj/machinery/power/emitter/Destroy()
|
||||
msg_admin_attack("Emitter deleted at ([x],[y],[z] - <A HREF='?_src_=holder;adminplayerobservecoodjump=1;X=[x];Y=[y];Z=[z]'>JMP</a>)",0,1)
|
||||
@@ -146,6 +192,10 @@
|
||||
|
||||
/obj/machinery/power/emitter/attackby(obj/item/W, mob/user, params)
|
||||
|
||||
|
||||
if(istype(W, /obj/item/device/multitool))
|
||||
update_multitool_menu(user)
|
||||
|
||||
if(istype(W, /obj/item/weapon/wrench))
|
||||
if(active)
|
||||
user << "Turn off the [src] first."
|
||||
|
||||
@@ -60,4 +60,3 @@ other types of metals and chemistry for reagents).
|
||||
new_reliability = Clamp(new_reliability, reliability, 100)
|
||||
reliability = new_reliability
|
||||
return
|
||||
|
||||
@@ -340,4 +340,31 @@
|
||||
build_type = IMPRINTER
|
||||
materials = list("$glass" = 1000, "sacid" = 20)
|
||||
build_path = /obj/item/weapon/circuitboard/teleporter
|
||||
category = list("Computer Boards")
|
||||
category = list("Computer Boards")
|
||||
|
||||
datum/design/GAC
|
||||
name = "Circuit Design (General Air Control)"
|
||||
desc = "Allows for the construction of circuit boards used to build a General Air Control Computer."
|
||||
id = "GAC"
|
||||
req_tech = list("programming" = 3, "magnets" = 2)
|
||||
build_type = IMPRINTER
|
||||
materials = list("$glass" = 1000, "sacid" = 20)
|
||||
build_path = "/obj/item/weapon/circtuiboard/air_management"
|
||||
|
||||
datum/design/tank_control
|
||||
name = "Circuit Design (Large Tank Control)"
|
||||
desc = "Allows for the construction of circuit boards used to build a Large Tank Control Computer."
|
||||
id = "tankcontrol"
|
||||
req_tech = list("programming" = 3, "magnets" = 2)
|
||||
build_type = IMPRINTER
|
||||
materials = list("$glass" = 1000, "sacid" = 20)
|
||||
build_path = "/obj/item/weapon/circtuiboard/general_air_control/large_tank_control"
|
||||
|
||||
datum/design/AAC
|
||||
name = "Circuit Design (Atmospheric Automations Console)"
|
||||
desc = "Allows for the construction of circuit boards used to build an Atmospheric Autmations Console."
|
||||
id = "AAC"
|
||||
req_tech = list("programming" = 4, "magnets" = 2)
|
||||
build_type = IMPRINTER
|
||||
materials = list("$glass" = 1000, "sacid" = 20)
|
||||
build_path = "/obj/item/weapon/circtuiboard/general_air_control/atmos_automation"
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 78 KiB After Width: | Height: | Size: 80 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 25 KiB After Width: | Height: | Size: 32 KiB |
Reference in New Issue
Block a user