Merge pull request #13662 from AffectedArc07/byebye

Removes some old and broken features
This commit is contained in:
Fox McCloud
2020-06-22 19:14:56 -04:00
committed by GitHub
30 changed files with 5 additions and 3474 deletions
-454
View File
@@ -1,454 +0,0 @@
/obj/machinery/computer/general_air_control/atmos_automation
icon = 'icons/obj/computer.dmi'
icon_screen = "area_atmos"
icon_keyboard = "atmos_key"
circuit = /obj/item/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()
/obj/machinery/computer/general_air_control/atmos_automation/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
/obj/machinery/computer/general_air_control/atmos_automation/process()
if(on)
for(var/datum/automation/A in automations)
A.process()
/obj/machinery/computer/general_air_control/atmos_automation/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"
/obj/machinery/computer/general_air_control/atmos_automation/proc/request_device_refresh(device)
send_signal(list("tag"=device, "status"))
/obj/machinery/computer/general_air_control/atmos_automation/proc/send_signal(list/data, 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)
/obj/machinery/computer/general_air_control/atmos_automation/proc/selectValidChildFor(datum/automation/parent, mob/user, list/valid_returntypes)
var/list/choices=list()
for(var/childtype in GLOB.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]
/obj/machinery/computer/general_air_control/atmos_automation/return_text()
var/out=..()
if(on)
out += "<a href=\"?src=[UID()];on=1\" style=\"font-size:large;font-weight:bold;color:red;\">RUNNING</a>"
else
out += "<a href=\"?src=[UID()];on=1\" style=\"font-size:large;font-weight:bold;color:green;\">STOPPED</a>"
out += {"
<h2>Automations</h2>
<p>\[
<a href="?src=[UID()];add=1">
Add
</a>
|
<a href="?src=[UID()];reset=*">
Reset All
</a>
|
<a href="?src=[UID()];remove=*">
Clear
</a>
\]</p>
<p>\[
<a href="?src=[UID()];dump=1">
Export
</a>
|
<a href="?src=[UID()];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=[UID()];label=\ref[A]">[A.label]</a>
(<a href="?src=[UID()];reset=\ref[A]">Reset</a> |
<a href="?src=[UID()];remove=\ref[A]">&times;</a>)
</legend>
[A.GetText()]
</fieldset>
"}
return out
/obj/machinery/computer/general_air_control/atmos_automation/Topic(href,href_list)
if(..())
return 1
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
/obj/machinery/computer/general_air_control/atmos_automation/proc/MakeCompare(datum/automation/a, datum/automation/b, comparetype)
var/datum/automation/compare/compare=new(src)
compare.comparator = comparetype
compare.children[1] = a
compare.children[2] = b
return compare
/obj/machinery/computer/general_air_control/atmos_automation/proc/MakeNumber(value)
var/datum/automation/static_value/val = new(src)
val.value=value
return val
/obj/machinery/computer/general_air_control/atmos_automation/proc/MakeGetSensorData(sns_tag,field)
var/datum/automation/get_sensor_data/sensor=new(src)
sensor.sensor=sns_tag
sensor.field=field
return sensor
/obj/machinery/computer/general_air_control/atmos_automation/proc/DumpCode()
var/list/json[0]
for(var/datum/automation/A in automations)
json += list(A.Export())
return json_encode(json)
/obj/machinery/computer/general_air_control/atmos_automation/proc/ReadCode(jsonStr)
automations.Cut()
var/list/json = json_decode(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 GLOB.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=AIRLOCK_FREQ
var/temperature=1000
/obj/machinery/computer/general_air_control/atmos_automation/burnchamber/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=ATMOS_DISTRO_FREQ
var/temperature=1000
/obj/machinery/computer/general_air_control/atmos_automation/air_mixing/New()
..()
buildO2()
buildN2()
buildOutletVent()
/obj/machinery/computer/general_air_control/atmos_automation/air_mixing/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
/obj/machinery/computer/general_air_control/atmos_automation/air_mixing/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
/obj/machinery/computer/general_air_control/atmos_automation/air_mixing/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
@@ -1,44 +0,0 @@
/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=[UID()];set_subject=1\">[fmtString(valve)]</a> to <a href=\"?src=[UID()];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/binary/valve/digital/V in SSair.atmos_machinery)
if(!isnull(V.id_tag) && V.frequency == parent.frequency)
valves|=V.id_tag
if(valves.len==0)
to_chat(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
@@ -1,42 +0,0 @@
/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, "hiddenprints" = parent.fingerprintshidden))
return 0
GetText()
return "Set emitter <a href=\"?src=[UID()];set_subject=1\">[fmtString(emitter)]</a> to <a href=\"?src=[UID()];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 GLOB.machines)
if(!isnull(E.id_tag) && E.frequency == parent.frequency)
emitters|=E.id_tag
if(emitters.len==0)
to_chat(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
@@ -1,83 +0,0 @@
////////////////////////////////////////////
// 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=[UID()];set_injector=1\">[fmtString(injector)]</a> power to <a href=\"?src=[UID()];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 GLOB.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=[UID()];set_injector=1\">[fmtString(injector)]</a> transfer rate to <a href=\"?src=[UID()];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 GLOB.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
@@ -1,153 +0,0 @@
/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=[UID()];set_scrubber=1\">[fmtString(scrubber)]</a> mode to <a href=\"?src=[UID()];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 GLOB.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=[UID()];set_scrubber=1\">[fmtString(scrubber)]</a> power to <a href=\"?src=[UID()];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 GLOB.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
GLOBAL_LIST_INIT(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=[UID()];set_scrubber=1\">[fmtString(scrubber)]</a> to scrub "
for(var/gas in gasses)
txt += " [GLOB.gas_labels[gas]] (<a href=\"?src=[UID()];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 GLOB.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
@@ -1,56 +0,0 @@
///////////////////////////////////////////
// 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=[UID()];set_field=1\">[fmtString(field)]</a> from sensor <a href=\"?src=[UID()];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 GLOB.machines)
if(!isnull(G.id_tag) && G.frequency == parent.frequency)
sensor_list|=G.id_tag
for(var/obj/machinery/meter/M in GLOB.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
@@ -1,314 +0,0 @@
/datum/automation/set_vent_pump_mode
name="Vent Pump: Mode"
var/vent_pump = null
var/mode = "stabilize"
var/vent_type = 0//0 for unary vents, 1 for DP vents
var/list/modes = list("stabilize","purge")
Export()
var/list/json = ..()
json["vent_pump"] = vent_pump
json["mode"] = mode
json["vent_type"] = vent_type
return json
Import(var/list/json)
..(json)
vent_pump = json["vent_pump"]
mode = json["mode"]
vent_type = text2num(json["vent_type"])
process()
if(vent_pump)
var/dirvalue = (mode == "stabilize" ? 1 : mode == "purge" ? 0 : 1)
parent.send_signal(list("tag" = vent_pump, "direction" = dirvalue), filter = (vent_type ? RADIO_ATMOSIA : RADIO_FROM_AIRALARM))
return 0
GetText()
return "Set <a href=\"?src=[UID()];toggle_type=1\">[vent_type ? "Dual-Port" : "Unary"]</a> vent pump <a href=\"?src=[UID()];set_vent_pump=1\">[fmtString(vent_pump)]</a> mode to <a href=\"?src=[UID()];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()
if(!vent_type)
for(var/obj/machinery/atmospherics/unary/vent_pump/I in SSair.atmos_machinery)
if(!isnull(I.id_tag) && I.frequency == parent.frequency)
injector_names |= I.id_tag
else
for(var/obj/machinery/atmospherics/binary/dp_vent_pump/I in SSair.atmos_machinery)
// to_chat(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
if(href_list["toggle_type"])
vent_type = !vent_type
parent.updateUsrDialog()
return 1
/datum/automation/set_vent_pump_power
name="Vent Pump: Power"
var/vent_pump = null
var/state = 0
var/mode = 0//0 for unary vents, 1 for DP vents.
Export()
var/list/json = ..()
json["vent_pump"] = vent_pump
json["state"] = state
json["mode"] = mode
return json
Import(var/list/json)
..(json)
vent_pump = json["vent_pump"]
state = text2num(json["state"])
mode = text2num(json["mode"])
process()
if(vent_pump)
parent.send_signal(list ("tag" = vent_pump, "power" = state), filter = (mode ? RADIO_ATMOSIA : RADIO_FROM_AIRALARM))
GetText()
return "Set <a href=\"?src=[UID()];toggle_mode=1\">[mode ? "Dual-Port" : "Unary"]</a> vent pump <a href=\"?src=[UID()];set_vent_pump=1\">[fmtString(vent_pump)]</a> power to <a href=\"?src=[UID()];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()
if(!mode)
for(var/obj/machinery/atmospherics/unary/vent_pump/I in SSair.atmos_machinery)
if(!isnull(I.id_tag) && I.frequency == parent.frequency)
injector_names|=I.id_tag
else
for(var/obj/machinery/atmospherics/binary/dp_vent_pump/I in SSair.atmos_machinery)
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["toggle_mode"])
mode = !mode
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=[UID()];swap_modes=1\">dual-port</a> vent pump <a href=\"?src=[UID()];set_vent_pump=1\">[fmtString(vent_pump)]</a>
pressure bounds: internal outwards: <a href=\"?src=[UID()];set_intpressure_out=1">[fmtString(intpressureout)]</a>
internal inwards: <a href=\"?src=[UID()];set_intpressure_in=1">[fmtString(intpressurein)]</a>
external: <a href=\"?src=[UID()];set_external=1">[fmtString(extpressure)]</a>
"}//well that was a lot to type
else
return {"Set <a href=\"?src=[UID()];swap_modes=1\">unary</a> vent pump <a href=\"?src=[UID()];set_vent_pump=1\">[fmtString(vent_pump)]</a>
pressure bounds: internal: <a href=\"?src=[UID()];set_intpressure_out=1">[fmtString(intpressureout)]</a>
external: <a href=\"?src=[UID()];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 SSair.atmos_machinery)
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 SSair.atmos_machinery)
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=[UID()];swap_modes=1\">dual-port</a> vent pump <a href=\"?src=[UID()];set_vent_pump=1\">[fmtString(vent_pump)]</a> pressure checks to:
external <a href=\"?src=[UID()];togglecheck=1\">[checks&1 ? "Enabled" : "Disabled"]</a>
internal inwards <a href=\"?src=[UID()];togglecheck=2\">[checks&2 ? "Enabled" : "Disabled"]</a>
internal outwards <a href=\"?src=[UID()];togglecheck=4\">[checks&4 ? "Enabled" : "Disabled"]</a>
"}
else
return {"Set <a href=\"?src=[UID()];swap_modes=1\">unary</a> vent pump <a href=\"?src=[UID()];set_vent_pump=1\">[fmtString(vent_pump)]</a> pressure checks to:
external: <a href=\"?src=[UID()];togglecheck=1\">[checks&1 ? "Enabled" : "Disabled"]</a>,
internal: <a href=\"?src=[UID()];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 SSair.atmos_machinery)
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 SSair.atmos_machinery)
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
-457
View File
@@ -1,457 +0,0 @@
GLOBAL_LIST_INIT(automation_types, subtypesof(/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/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 GLOB.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 GLOB.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.Topic("src=[parent.UID()]", list("src" = parent)))//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=[UID()];add=1\">Add</a>)"
if(children.len>0)
out += "<ul>"
for(var/datum/automation/stmt in children)
out += {"<li>
\[<a href="?src=[UID()];reset=\ref[stmt]">Reset</a> |
<a href="?src=[UID()];remove=\ref[stmt]">&times;</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=[UID()];add=1\">Add</a>)"
if(children.len>0)
out += "<ul>"
for(var/datum/automation/stmt in children)
out += {"<li>
\[<a href="?src=[UID()];reset=\ref[stmt]">Reset</a> |
<a href="?src=[UID()];remove=\ref[stmt]">&times;</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=[UID()];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=[UID()];add=then\">Add</a>)"
if(children_then.len>0)
out += "<ul>"
for(var/datum/automation/stmt in children_then)
out += {"<li>
\[<a href="?src=[UID()];reset=\ref[stmt];context=then">Reset</a> |
<a href="?src=[UID()];remove=\ref[stmt];context=then">&times;</a>\]
[stmt.GetText()]
</li>"}
out += "</ul>"
else
out += "<blockquote><i>(No statements to run)</i></blockquote>"
out += "<b>ELSE:</b> (<a href=\"?src=[UID()];add=else\">Add</a>)"
if(children_then.len>0)
out += "<ul>"
for(var/datum/automation/stmt in children_else)
out += {"<li>
\[<a href="?src=[UID()];reset=\ref[stmt];context=else">Reset</a> |
<a href="?src=[UID()];remove=\ref[stmt];context=else">&times;</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=[UID()];set_field=1\">(Set Left)</a> ("
if(left==null)
out += "-----"
else
out += left.GetText()
out += ") is <a href=\"?src=[UID()];set_comparator=left\">[comparator]</a>: <a href=\"?src=[UID()];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=[UID()];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
-143
View File
@@ -1,143 +0,0 @@
//////////////////////////////////
// Converter Gate //
//////////////////////////////////
/*
This gate is special enough to warrant its own file, as it overrides a lot of the logic_gate procs as well as adds a new one.
- CONVERT Gates convert signaler and logic signals, to allow logic gates to actually be used in tandem with assemblies and station equipment like doors.
- While technically a mono-input device, the input and output are actually completely different types of signals, and thus incompatible without this gate.
- A signaler must be attached manually before the gate is fully functional, and will retain any frequency and code settings it had when attached.
- You can adjust these settings through a link in the multitool menu, but the receiving mode is automatically controlled by the converter.
- While attached, the ability to manually send the signal on the signaler through its menu is also disabled, to avoid messing up the logic system.
*/
//CONVERT Gate
/obj/machinery/logic_gate/convert
name = "CONVERT Gate"
desc = "Converts signals between radio and logic types, allowing for signaller input/output from logic systems."
icon_state = "logic_convert"
mono_input = 1
var/logic_output = 0 //When set to 1, the logic signal is the output. When set to 0, the logic signal is the input.
var/obj/item/assembly/signaler/attached_signaler = null
/obj/machinery/logic_gate/convert/handle_logic()
output_state = input1_state
return
/obj/machinery/logic_gate/convert/attackby(obj/item/O, mob/user, params)
if(tamperproof) //Extra precaution to avoid people attaching/removing signalers from tamperproofed converters
return
if(istype(O, /obj/item/assembly/signaler))
var/obj/item/assembly/signaler/S = O
if(S.secured)
to_chat(user, "<span class='warning'>The [S] is already secured.</span>")
return
if(attached_signaler)
to_chat(user, "<span class='warning'>There is already a device attached, remove it first.</span>")
return
user.unEquip(S)
S.forceMove(src)
S.holder = src
S.toggle_secure()
if(logic_output) //Make sure we are set to receive if the converter is set to output logic, and send if the converter is set to accept logic input
S.receiving = 1
else
S.receiving = 0
attached_signaler = S
to_chat(user, "<span class='notice'>You attach \the [S] to the I/O connection port and secure it.</span>")
return
if(attached_signaler && istype(O, /obj/item/screwdriver)) //Makes sure we remove the attached signaler before we can open up and deconstruct the machine
var/obj/item/assembly/signaler/S = attached_signaler
attached_signaler = null
S.forceMove(get_turf(src))
S.holder = null
S.toggle_secure()
to_chat(user, "<span class='notice'>You unsecure and detach \the [S] from the I/O connection port.</span>")
return
return ..()
/obj/machinery/logic_gate/convert/multitool_menu(var/mob/user, var/obj/item/multitool/P)
var/logic_state_string
var/menu_contents = {"
<dl>
"}
if(logic_output)
switch(output_state)
if(LOGIC_OFF)
logic_state_string = "OFF"
if(LOGIC_ON)
logic_state_string = "ON"
if(LOGIC_FLICKER)
logic_state_string = "FLICKER"
else
logic_state_string = "ERROR: UNKNOWN STATE"
menu_contents += {"
<dt><b>Output:</b> [format_tag("ID Tag","output_id_tag")]</dt>
<dd>Output State: [logic_state_string]</dd>
"}
else
switch(input1_state)
if(LOGIC_OFF)
logic_state_string = "OFF"
if(LOGIC_ON)
logic_state_string = "ON"
if(LOGIC_FLICKER)
logic_state_string = "FLICKER"
else
logic_state_string = "ERROR: UNKNOWN STATE"
menu_contents += {"
<dt><b>Input:</b> [format_tag("ID Tag","input1_id_tag")]</dt>
<dd>Input State: [logic_state_string]</dd>
"}
menu_contents += {"
<dt><b>Logic Signal Designation:</b> <a href='?src=[UID()];toggle_logic=1'>[logic_output ? "Output" : "Input"]</a></dt>
"}
if(attached_signaler)
menu_contents += "<dt><a href='?src=[UID()];adjust_signaler=1'>Adjust Signaler Settings</a></dt>"
else
menu_contents += "<dt><b>NO SIGNALER ATTACHED!</b></dt>"
menu_contents += {"
</dl>
"}
return menu_contents
/obj/machinery/logic_gate/convert/multitool_topic(var/mob/user,var/list/href_list,var/obj/O)
..()
if("toggle_logic" in href_list)
logic_output = !logic_output
if(attached_signaler) //If we have a signaler attached, make sure we update it to send/receive when we change the logic signal desgination
if(logic_output)
attached_signaler.receiving = 1
else
attached_signaler.receiving = 0
if(("adjust_signaler" in href_list) && attached_signaler) //Make sure that we have a signaler attached to handle this one, otherwise ignore this command
attached_signaler.interact(user, 1)
update_multitool_menu(user)
/obj/machinery/logic_gate/convert/receive_signal(datum/signal/signal, receive_method, receive_param)
if(logic_output)
if(attached_signaler)
attached_signaler.receive_signal(signal)
return
else
..()
/obj/machinery/logic_gate/convert/handle_output()
if(logic_output)
..()
else
if(attached_signaler && (output_state == LOGIC_ON || output_state == LOGIC_FLICKER))
attached_signaler.signal()
return
/obj/machinery/logic_gate/convert/proc/process_activation(var/obj/item/D)
if(!logic_output) //Don't bother if our input is a logic signal
return
if(D == attached_signaler) //Ignore if we somehow got called by a device that isn't what we have attached
input1_state = LOGIC_FLICKER
spawn(LOGIC_FLICKER_TIME)
if(input1_state == LOGIC_FLICKER)
input1_state = LOGIC_OFF
return
-100
View File
@@ -1,100 +0,0 @@
//////////////////////////////////
// Dual-Input Gates //
//////////////////////////////////
// OR Gate
/obj/machinery/logic_gate/or
name = "OR Gate"
desc = "Outputs ON when at least one input is ON."
icon_state = "logic_or"
/obj/machinery/logic_gate/or/handle_logic()
if(input1_state == LOGIC_ON || input1_state == LOGIC_FLICKER || input2_state == LOGIC_ON || input2_state == LOGIC_FLICKER)
if(input1_state == LOGIC_ON || input2_state == LOGIC_ON) //continuous signal takes priority in determining what to output
output_state = LOGIC_ON
else
output_state = LOGIC_FLICKER
else //Both inputs were off, so input is off
output_state = LOGIC_OFF
return
// AND Gate
/obj/machinery/logic_gate/and
name = "AND Gate"
desc = "Outputs ON only when both inputs are ON."
icon_state = "logic_and"
/obj/machinery/logic_gate/and/handle_logic()
if((input1_state == LOGIC_ON || input1_state == LOGIC_FLICKER) && (input2_state == LOGIC_ON || input2_state == LOGIC_FLICKER))
if(input1_state == LOGIC_ON && input2_state == LOGIC_ON) //only output a continuous signal when both inputs are continuous signals
output_state = LOGIC_ON
else
output_state = LOGIC_FLICKER
else //At least one input was off, so output is off
output_state = LOGIC_OFF
return
// NAND Gate
/obj/machinery/logic_gate/nand
name = "NAND Gate"
desc = "Outputs OFF only when both inputs are ON."
output_state = LOGIC_ON
icon_state = "logic_nand"
/obj/machinery/logic_gate/nand/handle_logic()
if((input1_state == LOGIC_ON || input1_state == LOGIC_FLICKER) && (input2_state == LOGIC_ON || input2_state == LOGIC_FLICKER))
output_state = LOGIC_OFF //Both inputs are ON/FLICKER, so output is off
else
output_state = LOGIC_ON //This can only output continuous signals
return
// NOR Gate
/obj/machinery/logic_gate/nor
name = "NOR Gate"
desc = "Outputs OFF when at least one input is ON."
icon_state = "logic_nor"
output_state = LOGIC_ON
/obj/machinery/logic_gate/nor/handle_logic()
if(input1_state == LOGIC_OFF && input2_state == LOGIC_OFF) //Both inputs are OFF, so output is ON
output_state = LOGIC_ON //This can only output continuous signals
else
output_state = LOGIC_OFF
return
// XOR Gate
/obj/machinery/logic_gate/xor
name = "XOR Gate"
desc = "Outputs ON when only one input is ON."
icon_state = "logic_xor"
/obj/machinery/logic_gate/xor/handle_logic()
if((input1_state == LOGIC_ON || input1_state == LOGIC_FLICKER) && (input2_state == LOGIC_OFF)) //Only input1 is ON/FLICKER, so output matches input1
output_state = input1_state
else if((input2_state == LOGIC_ON || input2_state == LOGIC_FLICKER) && (input1_state == LOGIC_OFF)) //Only input2 is ON/FLICKER, so output matches input2
output_state = input2_state
else //Both inputs are ON or OFF, so output is OFF
output_state = LOGIC_OFF
return
// XNOR Gate
/obj/machinery/logic_gate/xnor
name = "XNOR Gate"
desc = "Outputs ON when both inputs are ON or OFF."
icon_state = "logic_xnor"
output_state = LOGIC_ON
/obj/machinery/logic_gate/xnor/handle_logic()
if((input1_state == LOGIC_ON || input1_state == LOGIC_FLICKER) && (input2_state == LOGIC_ON || input2_state == LOGIC_FLICKER)) //Both inputs are ON/FLICKER
if(input1_state == LOGIC_ON && input2_state == LOGIC_ON) //Only continuous signal when both inputs are ON
output_state = LOGIC_ON
else //If at least one input is FLICKER, output FLICKER
output_state = LOGIC_FLICKER
else if(input1_state == LOGIC_OFF && input2_state == LOGIC_OFF) //Both inputs are OFF
output_state = LOGIC_ON //Always continuous in this case
else //Only one input is ON/FLICKER
output_state = LOGIC_OFF
return
-284
View File
@@ -1,284 +0,0 @@
/obj/machinery/logic_gate
name = "Logic Base"
desc = "This does nothing except connect to things. Highly illogical, report to a coder at once if you see this in-game."
icon = 'icons/obj/computer3.dmi'
icon_state = "serverframe"
density = 1
anchored = 1
settagwhitelist = list("input1_id_tag", "input2_id_tag", "output_id_tag")
var/tamperproof = 0 //if set, will make the machine unable to be destroyed, adjusted, etc. via in-game interaction (USE ONLY FOR MAPPING STUFF)
var/mono_input = 0 //if set, will ignore input2
var/datum/radio_frequency/radio_connection
var/frequency = 0
/*
Some notes on Input/Output:
- Multiple things can be linked to the same input or output tag, just like how wires can connect multiple sources and receivers.
- For inputs, only the last signal received BEFORE a process() call will be used in the logic handling.
- Input states are updated immediately whenever an input signal is received, so it is possible to update multiple times within a single process cycle.
- This means if you have multiple connected inputs, but the last signal received before the process() call is OFF, it won't matter if the others are both ON.
- For this reason, please set up your logic properly. You can theoretically chain these infinitely, so there's no need to link multiple things to a single input.
- For outputs, the signal will attempt to be sent out every process() call, to ensure newly connected things are updated within one process cycle
- Connecting an output to multiple inputs should not cause issues, as long as you don't have multiple connections to a given input (see previous notes on inputs).
- The output state is determined immediately preceeding the signal broadcast, using the input states at the time of the process() call, not when a signal is received.
- Because of how the process cycle works, it is possible that it may take multiple cycles for a signal to fully propogate through a logic chain.
- This is because machines attempt to process in the order they were added to the scheduler.
- Building the logic gates at the end of the chain first may cause delays in signal propogation.
If you take all this into consideration when linking and using logic machinery, you should have no unexpected issues with input/output. Your design flaws are on you though.
*/
var/input1_id_tag = null
var/input1_state = LOGIC_OFF
var/input2_id_tag = null
var/input2_state = LOGIC_OFF
var/output_id_tag = null
var/output_state = LOGIC_OFF
/obj/machinery/logic_gate/New()
if(tamperproof) //doing this during New so we don't have to worry about forgetting to set these vars during editting / defining
resistance_flags |= ACID_PROOF
..()
if(SSradio)
set_frequency(frequency)
component_parts = list()
var/obj/item/circuitboard/logic_gate/LG = new(null)
LG.set_type(type)
component_parts += LG
component_parts += new /obj/item/stack/cable_coil(null, 1)
/obj/machinery/logic_gate/Initialize()
..()
set_frequency(frequency)
/obj/machinery/logic_gate/proc/set_frequency(new_frequency)
SSradio.remove_object(src, frequency)
frequency = new_frequency
radio_connection = SSradio.add_object(src, frequency, RADIO_LOGIC)
return
/obj/machinery/logic_gate/Destroy()
if(SSradio)
SSradio.remove_object(src, frequency)
radio_connection = null
return ..()
/obj/machinery/logic_gate/process()
handle_logic()
handle_output() //All output will send for at least one cycle, and will attempt to send every cycle. Hopefully this won't be too taxing.
return
/obj/machinery/logic_gate/proc/handle_logic()
return
/obj/machinery/logic_gate/proc/handle_output()
if(!radio_connection) //can't output without this
return
if(output_id_tag == null) //Don't output to an undefined id_tag
return
var/datum/signal/signal = new
signal.transmission_method = 1 //radio signal
signal.source = src
signal.data = list(
"tag" = output_id_tag,
"sigtype" = "logic",
"state" = output_state,
)
radio_connection.post_signal(src, signal, filter = RADIO_LOGIC)
/obj/machinery/logic_gate/receive_signal(datum/signal/signal, receive_method, receive_param)
if(!signal.data["tag"] || ((signal.data["tag"] != input1_id_tag) && (signal.data["tag"] != input2_id_tag)) || (signal.data["sigtype"] != "logic"))
//If the signal lacks tag data, the signal's tag data doesn't match either input id tag, or is not a "logic" signal, ignore it since it's not for us
return
if(signal.data["tag"] == input1_id_tag) //If the signal is for input1
if(signal.data["state"] == input1_state) //If we already match, ignore the new signal since nothing changes
return
if(signal.data["state"] == LOGIC_OFF) //Shut it down and keep it off
input1_state = LOGIC_OFF
return
if(signal.data["state"] == LOGIC_ON) //Turn it on and keep it on
input1_state = LOGIC_ON
return
if(signal.data["state"] == LOGIC_FLICKER) //Turn it on then turn it off
if(input1_state == LOGIC_ON) //An existing continuous ON state overrides new flicker signals
return
input1_state = LOGIC_FLICKER
spawn(LOGIC_FLICKER_TIME)
if(input1_state == LOGIC_FLICKER) //Make sure we didn't get a new continuous signal set while we waited (those take priority)
input1_state = LOGIC_OFF
return
//Now, you may be wondering why I included those returns.
//The answer is "If you link both inputs to the same source, you're an idiot and deserve to have it break", so yeah. Deal with it.
if(mono_input)
//We only care about input1, so if we didn't receive a signal for that, we're done.
return
if(signal.data["tag"] == input2_id_tag) //If the signal is for input2 (reaching this point assumes mono_input is not set)
if(signal.data["state"] == input2_state) //If we already match, ignore the new signal since nothing changes
return
if(signal.data["state"] == LOGIC_OFF) //Shut it down and keep it off
input2_state = LOGIC_OFF
return
if(signal.data["state"] == LOGIC_ON) //Turn it on and keep it on
input2_state = LOGIC_ON
return
if(signal.data["state"] == LOGIC_FLICKER) //Turn it on then turn it off
if(input2_state == LOGIC_ON) //An existing continuous ON state overrides new flicker signals
return
input2_state = LOGIC_FLICKER
spawn(LOGIC_FLICKER_TIME)
if(input2_state == LOGIC_FLICKER) //Make sure we didn't get a new continuous signal set while we waited (those take priority)
input2_state = LOGIC_OFF
return
/obj/machinery/logic_gate/multitool_menu(var/mob/user, var/obj/item/multitool/P)
var/input1_state_string
var/input2_state_string
var/output_state_string
switch(input1_state)
if(LOGIC_OFF)
input1_state_string = "OFF"
if(LOGIC_ON)
input1_state_string = "ON"
if(LOGIC_FLICKER)
input1_state_string = "FLICKER"
else
input1_state_string = "ERROR: UNKNOWN STATE"
switch(input2_state)
if(LOGIC_OFF)
input2_state_string = "OFF"
if(LOGIC_ON)
input2_state_string = "ON"
if(LOGIC_FLICKER)
input2_state_string = "FLICKER"
else
input2_state_string = "ERROR: UNKNOWN STATE"
switch(output_state)
if(LOGIC_OFF)
output_state_string = "OFF"
if(LOGIC_ON)
output_state_string = "ON"
if(LOGIC_FLICKER)
output_state_string = "FLICKER"
else
output_state_string = "ERROR: UNKNOWN STATE"
var/menu_contents = {"
<dl>
<dt><b>Input:</b> [format_tag("ID Tag","input1_id_tag")]</dt>
<dd>Input State: [input1_state_string]</dd>
"}
if(!mono_input)
menu_contents = {"
<dt><b>Input 1:</b> [format_tag("ID Tag","input1_id_tag")]</dt>
<dd>Input 1 State: [input1_state_string]</dd>
<dt><b>Input 2:</b> [format_tag("ID Tag","input2_id_tag")]</dt>
<dd>Input 2 State: [input2_state_string]</dd>
"}
menu_contents += {"
<dt><b>Output:</b> [format_tag("ID Tag","output_id_tag")]</dt>
<dd>Output State: [output_state_string]</dd>
</dl>
"}
return menu_contents
/obj/machinery/logic_gate/convert/multitool_topic(var/mob/user,var/list/href_list,var/obj/O)
..()
update_multitool_menu(user)
/obj/machinery/logic_gate/attackby(obj/item/O, mob/user, params)
if(tamperproof)
to_chat(user, "<span class='warning'>The [src] appears to be tamperproofed! You can't interact with it!</span>")
return 0
if(istype(O, /obj/item/multitool))
update_multitool_menu(user)
return 1
if(istype(O, /obj/item/screwdriver))
panel_open = !panel_open
to_chat(user, "<span class='notice'>You [panel_open ? "open" : "close"] the access panel.</span>")
return 1
if(panel_open && istype(O, /obj/item/crowbar))
default_deconstruction_crowbar(user, O)
return 1
return ..()
//////////////////////////////////////
// Attack procs //
//////////////////////////////////////
/obj/machinery/logic_gate/attack_ai(mob/user)
if(tamperproof)
to_chat(user, "<span class='warning'>The [src] appears to be tamperproofed! You can't interface with it!</span>")
return 0
add_hiddenprint(user)
return ui_interact(user)
/obj/machinery/logic_gate/attack_ghost(mob/user)
if(tamperproof)
to_chat(user, "<span class='warning'>The [src] appears to be tamperproofed! You can't haunt it!</span>")
return 0
return ui_interact(user)
/obj/machinery/logic_gate/attack_hand(mob/user)
if(tamperproof)
to_chat(user, "<span class='warning'>The [src] appears to be tamperproofed! You can't interact with it!</span>")
return 0
. = ..()
if(.)
return 0
return interact(user)
/obj/machinery/logic_gate/attack_alien(mob/user) //No xeno logic, that's too silly.
to_chat(user, "<span class='warning'>The [src] appears to be too complex! You can't comprehend it and back off in fear!</span>")
return 0
/obj/machinery/logic_gate/attack_animal(mob/user) //No animal logic either.
to_chat(user, "<span class='warning'>The [src] appears to be beyond your comprehension! You can't fathom it!</span>")
return 0
/obj/machinery/logic_gate/attack_slime(mob/user) //No slime logic. Seriously.
to_chat(user, "<span class='warning'>The [src] appears to be beyond your gelatinous understanding! You ignore it!</span>")
return 0
/obj/machinery/logic_gate/emp_act(severity)
if(tamperproof)
return 0
..()
/obj/machinery/logic_gate/ex_act(severity)
if(tamperproof)
return 0
..()
/obj/machinery/logic_gate/blob_act(obj/structure/blob/B)
if(!tamperproof)
return ..()
/obj/machinery/logic_gate/singularity_act()
if(tamperproof)
//This is some top-level tamperproofing right here, that's for sure. It can even defy a singularity!
return 0
..()
/obj/machinery/logic_gate/bullet_act()
if(tamperproof)
return 0
..()
/obj/machinery/logic_gate/tesla_act(var/power)
if(tamperproof)
tesla_zap(src, 3, power) //If we're tamperproof, we'll just bounce the full shock of the tesla zap we got hit by, so it continues on normally without diminishing
return 0
..()
-62
View File
@@ -1,62 +0,0 @@
//////////////////////////////////
// Mono-Input Gates //
//////////////////////////////////
//NOT Gate
/obj/machinery/logic_gate/not
name = "NOT Gate"
desc = "Accepts one input and outputs the reverse state."
icon_state = "logic_not"
mono_input = 1 //NOT Gates are the simplest logic gate because they only utilize one input.
output_state = LOGIC_ON //Starts with an active output, since the input will be OFF at start
/*
A quick note regarding NOT Gates:
- Connecting multiple things to the input of a NOT Gate can cause weird behaviour due to updating both when it receives a signal and when it calls process().
- This means it will attempt to output once for every logic machine connected to its input's own process() call.
- It will then attempt to output an additional time based on the current state when it comes to its own process() call.
- For this reason, it is HIGHLY RECOMMENDED that you only connect a single signal source to the input of a NOT Gate to avoid signal spasms.
- Connecting multiple things to the output of a NOT Gate should not cause this unusual behavior.
*/
/obj/machinery/logic_gate/not/handle_logic() //Our output will always be a continuous signal, even with a FLICKER, it just will update the output when the FLICKER ends
if(input1_state == LOGIC_ON) //Output is OFF while input is ON
output_state = LOGIC_OFF
else if(input1_state == LOGIC_FLICKER) //Output is OFF while input is FLICKER, then output returns to ON when input returns to OFF
output_state = LOGIC_OFF
spawn(LOGIC_FLICKER_TIME + 1) //Call handle_logic again after this delay (the input should update from the spawn(LOGIC_FLICKER_TIME) in receive_signal() by then)
handle_logic()
else //Output is ON while input is OFF
output_state = LOGIC_ON
handle_output()
return
//STATUS Gate
/obj/machinery/logic_gate/status
name = "Status Gate"
desc = "Accepts one input and outputs the same state, showing a colored light based on current state."
icon_state = "logic_status"
mono_input = 1 //STATUS Gate doesn't actually perform logic operations, but instead acts as a testing conduit.
/*
STATUS Gates are largely a diagnostics tool, but I'm sure someone will still make a logic gate rave with them anyways.
- There is no need to actually connect an output for these to work, they just need an input to sample from.
- STATUS Gates attempt to update their lights whenever they receive a signal.
*/
/obj/machinery/logic_gate/status/receive_signal(datum/signal/signal, receive_method, receive_params)
..()
handle_logic() //STATUS Gate calls handle_logic() when it receives a signal to update its light and output_state
/obj/machinery/logic_gate/status/handle_logic()
output_state = input1_state //Output is equal to input, since it is simply a connection with an attached light
if(output_state == LOGIC_OFF) //Red light when OFF
set_light(2,2,"#ff0000")
return
if(output_state == LOGIC_ON) //Green light when ON
set_light(2,2,"#009933")
return
if(output_state == LOGIC_FLICKER) //Orange light when FLICKER, then update after LOGIC_FLICKER_TIME + 1 to reflect the changed state
set_light(2,2,"#ff9900")
spawn(LOGIC_FLICKER_TIME + 1)
handle_logic()
return
-2
View File
@@ -50,8 +50,6 @@
if(!pda.notifying_programs.len)
pda.overlays -= image('icons/obj/pda.dmi', "pda-r")
/datum/data/pda/proc/
// An app has a button on the home screen and its own UI
/datum/data/pda/app
name = "App"
-50
View File
@@ -21,11 +21,8 @@
var/state = 0
var/locked = 0
var/frequency = 0
var/id_tag = null
var/projectile_type = /obj/item/projectile/beam/emitter
var/projectile_sound = 'sound/weapons/emitter.ogg'
var/datum/radio_frequency/radio_connection
var/datum/effect_system/spark_spread/sparks
/obj/machinery/power/emitter/Initialize(mapload)
@@ -40,8 +37,6 @@
sparks = new
sparks.attach(src)
sparks.set_up(5, 1, src)
if(frequency)
set_frequency(frequency)
/obj/machinery/power/emitter/RefreshParts()
var/max_firedelay = 120
@@ -59,14 +54,6 @@
power_usage -= 50 * M.rating
active_power_usage = power_usage
//Radio remote control
/obj/machinery/power/emitter/proc/set_frequency(new_frequency)
SSradio.remove_object(src, frequency)
frequency = new_frequency
if(frequency)
radio_connection = SSradio.add_object(src, frequency, RADIO_ATMOSIA)
/obj/machinery/power/emitter/verb/rotate()
set name = "Rotate"
set category = "Object"
@@ -86,44 +73,7 @@
return
rotate()
/obj/machinery/power/emitter/multitool_menu(var/mob/user,var/obj/item/multitool/P)
return {"
<ul>
<li><b>Frequency:</b> <a href="?src=[UID()];set_freq=-1">[format_frequency(frequency)] GHz</a> (<a href="?src=[UID()];set_freq=[ENGINE_FREQ]">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]) AAC prints: [jointext(signal.data["hiddenprints"], "")]")
investigate_log("turned <font color='orange'>[statestr]</font> by radio signal ([signal.data["command"]] @ [frequency]) AAC prints: [jointext(signal.data["hiddenprints"], "")]","singulo")
update_icon()
/obj/machinery/power/emitter/Destroy()
if(SSradio)
SSradio.remove_object(src, frequency)
radio_connection = null
msg_admin_attack("Emitter deleted at ([x],[y],[z] - [ADMIN_JMP(src)])", ATKLOG_FEW)
log_game("Emitter deleted at ([x],[y],[z])")
investigate_log("<font color='red'>deleted</font> at ([x],[y],[z])","singulo")
@@ -880,14 +880,6 @@
build_path = /obj/item/assembly/mousetrap
category = list("initial", "Miscellaneous")
/datum/design/logic_board
name = "Logic Circuit"
id = "logic_board"
build_type = AUTOLATHE
materials = list(MAT_METAL = 50, MAT_GLASS = 50)
build_path = /obj/item/circuitboard/logic_gate
category = list("initial", "Electronics")
/datum/design/vendor
name = "Machine Board (Vendor)"
desc = "The circuit board for a Vendor."
@@ -332,16 +332,6 @@
build_path = /obj/item/circuitboard/large_tank_control
category = list("Computer Boards")
/datum/design/AAC
name = "Console Board (Atmospheric Automations Console)"
desc = "Allows for the construction of circuit boards used to build an Atmospheric Automations Console."
id = "AAC"
req_tech = list("programming" = 4, "magnets" = 2)
build_type = IMPRINTER
materials = list(MAT_GLASS = 1000)
build_path = /obj/item/circuitboard/atmos_automation
category = list("Computer Boards")
/datum/design/xenobiocamera
name = "Console Board (Xenobiology Console)"
desc = "Allows for the construction of circuit boards used to build xenobiology camera computers."
-251
View File
@@ -1,251 +0,0 @@
/obj/tram/tram_controller
name = ""
desc = "tram controller"
anchored = 1
var/list/tram_floors = list()
var/list/tram_walls = list()
var/list/controllers = list()
var/list/tram = list()
var/list/collide_list = list()
var/list/stored_anchor = list()
var/last_played_rail
var/automode = 0
var/fast_mode = 0
var/activated = 0
var/looptick = 0
var/delay_timer = null
var/list/blacklist = list(/obj/tram/rail)
var/list/ancwhitelist = list(/obj/tram, /obj/vehicle, /obj/structure/chair, /obj/structure/grille, /obj/structure/window)
/obj/tram/tram_controller/New()
spawn(1)
init_floors() //Search and link floors
init_walls() //Search and link walls
spawn(1)
init_tram() //Combine walls and floors and anything inside the tram
init_controllers() //Find control pads
gen_collision() //Generate collision system
/obj/tram/tram_controller/Destroy()
for(var/obj/tram/floor/F in tram_floors)
remove_floor(F)
for(var/obj/tram/wall/TW in tram_walls)
remove_wall(TW)
for(var/obj/tram/controlpad/CP in controllers)
remove_controller(CP)
killLoop()
return ..()
/obj/tram/tram_controller/emp_act(severity)
if(automode) automode = 0
..()
/obj/tram/tram_controller/proc/startLoop()
if(activated) return
activated = 1
spawn(0)
while(activated)
process()
looptick++
sleep(1)
/obj/tram/tram_controller/proc/killLoop()
activated = 0
looptick = 0
/obj/tram/tram_controller/process()
update_tram() //Update combine to account for new mobs and/or objects
if(automode)
tram_rail_follow()
if(fast_mode)
tram_rail_follow()
/obj/tram/tram_controller/proc/update_tram()
tram.Cut()
init_tram()
/obj/tram/tram_controller/proc/tram_rail_follow()
var/stored_rail = null
if(delay_timer >= world.time) return
for(var/obj/tram/rail/RT in get_turf(src))
if(RT.stop_duration && !delay_timer)
delay_timer = world.time + RT.stop_duration
return
if(RT.godir)
handle_move(RT.godir)
last_played_rail = RT
return
stored_rail = RT
for(var/cdir in GLOB.cardinal)
for(var/obj/tram/rail/R in get_step(src,cdir))
if(!istype(R)) continue
if(R != last_played_rail)
handle_move(get_dir(src,R))
last_played_rail = stored_rail
return
//INITIALIZATION PROCS
/obj/tram/tram_controller/proc/init_floors()
var/turf/T = get_turf(src)
if(!T) return
var/obj/tram/floor/TTF = locate(/obj/tram/floor) in T
if(istype(TTF)) add_floor(TTF) //Find and link floor on controller turf
for(var/cdir in GLOB.cardinal)
var/turf/T2 = get_step(T,cdir)
var/obj/tram/floor/TF = locate(/obj/tram/floor) in T2
if(istype(TF))
if(TF in tram_floors) continue
add_floor(TF) //Find and link all cardinally surrounding floors
spawn(1)
TF.spread_floors() //Do the same thing over again from the floor itself
/obj/tram/tram_controller/proc/init_walls()
var/turf/T = get_turf(src)
if(!T) return
if(!tram_floors.len) return
var/obj/tram/floor/TTW = locate(/obj/tram/wall) in T //Find and link wall on controller turf
if(istype(TTW)) add_wall(TTW)
for(var/obj/tram/floor/TF in tram_floors)
for(var/cdir in GLOB.cardinal)
var/obj/tram/wall/TW = locate(/obj/tram/wall) in get_step(TF,cdir)
if(istype(TW))
if(TW in tram_walls) continue
add_wall(TW) //Find and link all cardinally surrounding walls
spawn(1)
TW.spread_walls() //Do the same thing over again from the wall itself
/obj/tram/tram_controller/proc/init_tram()
tram = tram_floors + tram_walls //Tram is everything that makes up the tram
for(var/obj/tram/OT in tram)
var/turf/T = get_turf(OT)
for(var/atom/movable/AM in T) //Including anything inside of it
if(AM in tram) continue
if(!check_validity(AM)) continue
tram += AM
if(!(src in tram))
tram += src
/obj/tram/tram_controller/proc/check_validity(var/atom/movable/AM)
if(!AM)
return FALSE
if(!AM.simulated)
return FALSE
if(is_type_in_list(AM, blacklist))
return FALSE
if(AM.anchored)
if(is_type_in_list(AM, ancwhitelist))
return TRUE
return FALSE
return TRUE
/obj/tram/tram_controller/proc/init_controllers()
for(var/obj/tram/controlpad/CCP in tram)
add_controller(CCP) //Control pad not necessary until now, easiest to search through tram
//SYNC PROCS
//These procs are used for un/linking floors, walls, and control pads to the central tram controller
/obj/tram/tram_controller/proc/add_floor(var/obj/tram/floor/TF)
if(!istype(TF)) return
if(TF in tram_floors) return
tram_floors += TF
TF.controller = src
/obj/tram/tram_controller/proc/remove_floor(var/obj/tram/floor/TF)
if(!istype(TF)) return
if(TF in tram_floors)
tram_floors -= TF
TF.controller = null
/obj/tram/tram_controller/proc/add_wall(var/obj/tram/wall/TW)
if(!istype(TW)) return
if(TW in tram_walls) return
tram_walls += TW
TW.controller = src
/obj/tram/tram_controller/proc/remove_wall(var/obj/tram/wall/TW)
if(!istype(TW)) return
if(TW in tram_walls)
tram_walls -= TW
TW.controller = null
/obj/tram/tram_controller/proc/add_controller(var/obj/tram/controlpad/CCT)
if(!istype(CCT)) return
if(CCT in controllers) return
controllers += CCT
CCT.tram_linked = src
/obj/tram/tram_controller/proc/remove_controller(var/obj/tram/controlpad/CCT)
if(!istype(CCT)) return
if(CCT in controllers)
controllers -= CCT
CCT.tram_linked = null
//COLLISION & MOVEMENT
//Collision detection system to prevent going through walls
//Tram does not use built-in byond Move(), it uses it's own logic and then forceMove()s itself.
/obj/tram/tram_controller/proc/gen_collision()
collide_list.Cut()
var/list/collisions = list()
for(var/obj/tram/wall/W in tram_walls)
for(var/cdir in GLOB.cardinal)
var/turf/T = get_step(W, cdir)
if(istype(T))
if(T.density)
collisions += cdir
if(!T.density)
for(var/atom/movable/A in T)
if(A.density)
if(tram.Find(A)) continue
collisions += cdir
for(var/obj/tram/floor/F in tram_floors)
for(var/cdir in GLOB.cardinal)
var/turf/T = get_step(F, cdir)
if(istype(T))
if(T.density)
collisions += cdir
if(!T.density)
for(var/atom/movable/A in T)
if(A.density)
if(tram.Find(A)) continue
collisions += cdir
collide_list = collisions
/obj/tram/tram_controller/proc/handle_move(var/dir)
delay_timer = null //reset delay
gen_collision() //Look for collisions
if(dir in collide_list) //Prevent moving if there are collisions in that direction
return 0
for(var/atom/movable/A in tram)
var/turf/T = get_step(A,dir)
A.forceMove(T) //Move everything inside the tram and the tram itself manually
if(A.light_range)
A.set_light()
gen_collision() //Generate collision again
return 1
/obj/tram/attack_animal(var/mob/living/simple_animal/M as mob)
if(M.melee_damage_upper == 0) return
if(prob(M.melee_damage_upper))
qdel(src)
src.visible_message("<span class='danger'>[M] has [M.attacktext] [src]!</span>")
M.create_attack_log("<font color='red'>attacked [src.name]</font>")
add_attack_logs(M, src, "attacked")
/obj/tram/bullet_act(var/obj/item/projectile/proj)
if(prob(proj.damage))
qdel(src)
..()
-33
View File
@@ -1,33 +0,0 @@
/obj/tram/controlpad
name = "tram controller interface"
desc = "Controls a tram."
icon = 'icons/obj/airlock_machines.dmi'
icon_state = "airlock_control_standby"
anchored = 1
var/obj/tram/tram_controller/tram_linked
/obj/tram/controlpad/attack_hand(var/mob/user)
usr.set_machine(src)
if(!tram_linked) return
var/dat = "Tram Controller"
dat += "<br>Tram engine: <a href=?src=[UID()];engine_toggle=1>[tram_linked.automode ? "<font color='green'>On</font>" : "<font color='red'>Off</font>"]</a>"
dat += "<br><A href='?src=[UID()];close=1'>Close console</A>"
user << browse(dat, "window=trampad")
onclose(user,"trampad")
/obj/tram/controlpad/Topic(href, href_list)
if(..())
usr << browse(null, "window=publiclibrary")
onclose(usr, "publiclibrary")
return
if(href_list["engine_toggle"])
tram_linked.automode = !tram_linked.automode
if(tram_linked.automode) tram_linked.startLoop()
else tram_linked.killLoop()
else if(href_list["close"])
usr.unset_machine()
usr << browse(null, "window=trampad")
src.add_fingerprint(usr)
src.updateUsrDialog()
-20
View File
@@ -1,20 +0,0 @@
/obj/tram/floor
name = "tram platform"
desc = "A holding space for a tram system."
icon = 'icons/turf/floors.dmi'
icon_state = "floor"
var/obj/tram/tram_controller/controller
anchored = 1
layer = TURF_LAYER + 0.2
/obj/tram/floor/proc/spread_floors()
var/turf/T = get_turf(src)
if(!T) return
if(!controller) return
for(var/cdir in GLOB.cardinal)
var/turf/T2 = get_step(T,cdir)
var/obj/tram/floor/TF = locate(/obj/tram/floor) in T2
if(istype(TF))
if(TF in controller.tram_floors) continue
controller.add_floor(TF)
TF.spread_floors()
-8
View File
@@ -1,8 +0,0 @@
/obj/tram/rail
name = "tram rail"
desc = "A guiding rail for trams"
icon = 'icons/obj/tram/tram_rail.dmi'
icon_state = "rail"
var/godir = null
var/stop_duration = null
layer = TURF_LAYER + 0.1
-21
View File
@@ -1,21 +0,0 @@
/obj/tram/wall
name = "reinforced tram wall"
desc = "A huge chunk of reinforced metal used to shield a tram system."
icon = 'icons/turf/walls.dmi'
icon_state = "r_wall"
var/obj/tram/tram_controller/controller
anchored = 1
density = 1
opacity = 1
/obj/tram/wall/proc/spread_walls()
var/turf/T = get_turf(src)
if(!T) return
if(!controller) return
for(var/cdir in GLOB.cardinal)
var/turf/T2 = get_step(T,cdir)
var/obj/tram/wall/TW = locate(/obj/tram/wall) in T2
if(istype(TW))
if(TW in controller.tram_walls) continue
controller.add_wall(TW)
TW.spread_walls()