A sensor which registers mechs and trains attempting to pass by and, if necessary, blocks their movement.

If enabled, detects mechs/trains and blocks their movement if they are coming from any of the directions set by dir. Can currently only be enabled/disabled by radio command and airlocks are updated to utilize this.

The current setup allows mechs to move through airlocks during normal cycles, which for example lets Odysseus out to save lives.
Once a shuttle docks however, the sensors are enabled to prevent boarding.

If blocked, players receive a simple message stating that their command has been overridden.
This commit is contained in:
PsiOmega
2014-07-26 20:07:18 +02:00
parent f0a8671c00
commit 0036bea6b6
5 changed files with 143 additions and 40 deletions

View File

@@ -7,6 +7,7 @@
var/tag_chamber_sensor
var/tag_exterior_sensor
var/tag_interior_sensor
var/tag_mech_sensor
var/tag_secure = 0
/obj/machinery/embedded_controller/radio/airlock/initialize()
@@ -43,10 +44,10 @@
/obj/machinery/embedded_controller/radio/airlock/advanced_airlock_controller/Topic(href, href_list)
if(..())
return
usr.set_machine(src)
src.add_fingerprint(usr)
var/clean = 0
switch(href_list["command"]) //anti-HTML-hacking checks
if("cycle_ext")
@@ -99,10 +100,10 @@
/obj/machinery/embedded_controller/radio/airlock/airlock_controller/Topic(href, href_list)
if(..())
return
usr.set_machine(src)
src.add_fingerprint(usr)
var/clean = 0
switch(href_list["command"]) //anti-HTML-hacking checks
if("cycle_ext")
@@ -163,10 +164,10 @@
/obj/machinery/embedded_controller/radio/airlock/access_controller/Topic(href, href_list)
if(..())
return
usr.set_machine(src)
src.add_fingerprint(usr)
var/clean = 0
switch(href_list["command"]) //anti-HTML-hacking checks
if("cycle_ext_door")

View File

@@ -35,10 +35,10 @@
/obj/machinery/embedded_controller/radio/airlock/docking_port/Topic(href, href_list)
if(..())
return
usr.set_machine(src)
src.add_fingerprint(usr)
var/clean = 0
switch(href_list["command"]) //anti-HTML-hacking checks
if("cycle_ext")
@@ -77,7 +77,7 @@
else
enable_override()
return
..(command)
airlock_program.receive_user_command(command) //pass along to subprograms
@@ -99,12 +99,14 @@
//we are docked, open the doors or whatever.
/datum/computer/file/embedded_program/docking/airlock/finish_docking()
airlock_program.enable_mech_regulators()
airlock_program.open_doors()
//tell the docking port to start getting ready for undocking - e.g. close those doors.
/datum/computer/file/embedded_program/docking/airlock/prepare_for_undocking()
airlock_program.stop_cycling()
airlock_program.close_doors()
airlock_program.disable_mech_regulators()
//are we ready for undocking?
/datum/computer/file/embedded_program/docking/airlock/ready_for_undocking()
@@ -115,13 +117,18 @@
//An airlock controller to be used by the airlock-based docking port controller.
//Same as a regular airlock controller but allows disabling of the regular airlock functions when docking
/datum/computer/file/embedded_program/airlock/docking
var/datum/computer/file/embedded_program/docking/airlock/master_prog
/datum/computer/file/embedded_program/airlock/docking/receive_user_command(command)
if (master_prog.undocked() || master_prog.override_enabled) //only allow the port to be used as an airlock if nothing is docked here or the override is enabled
..(command)
/datum/computer/file/embedded_program/airlock/docking/proc/enable_mech_regulators()
enable_mech_regulation()
/datum/computer/file/embedded_program/airlock/docking/proc/disable_mech_regulators()
disable_mech_regulation()
/datum/computer/file/embedded_program/airlock/docking/proc/open_doors()
toggleDoor(memory["interior_status"], tag_interior_door, memory["secure"], "open")
toggleDoor(memory["exterior_status"], tag_exterior_door, memory["secure"], "open")

View File

@@ -16,13 +16,14 @@
var/tag_chamber_sensor
var/tag_exterior_sensor
var/tag_interior_sensor
var/tag_mech_sensor
var/state = STATE_WAIT
var/target_state = TARGET_NONE
/datum/computer/file/embedded_program/airlock/New(var/obj/machinery/embedded_controller/M)
..(M)
memory["chamber_sensor_pressure"] = ONE_ATMOSPHERE
memory["external_sensor_pressure"] = 0 //assume vacuum for simple airlock controller
memory["internal_sensor_pressure"] = ONE_ATMOSPHERE
@@ -32,7 +33,7 @@
memory["target_pressure"] = ONE_ATMOSPHERE
memory["purge"] = 0
memory["secure"] = 0
if (istype(M, /obj/machinery/embedded_controller/radio/airlock)) //if our controller is an airlock controller than we can auto-init our tags
var/obj/machinery/embedded_controller/radio/airlock/controller = M
tag_exterior_door = controller.tag_exterior_door? controller.tag_exterior_door : "[id_tag]_outer"
@@ -41,8 +42,9 @@
tag_chamber_sensor = controller.tag_chamber_sensor? controller.tag_chamber_sensor : "[id_tag]_sensor"
tag_exterior_sensor = controller.tag_exterior_sensor
tag_interior_sensor = controller.tag_interior_sensor
tag_mech_sensor = controller.tag_mech_sensor? controller.tag_mech_sensor : "[id_tag]_mech"
memory["secure"] = controller.tag_secure
spawn(10)
signalDoor(tag_exterior_door, "update") //signals connected doors to update their status
signalDoor(tag_interior_door, "update")
@@ -187,11 +189,11 @@
//make sure to return to a sane idle state
if(memory["pump_status"] != "off") //send a signal to stop pumping
signalPump(tag_airpump, 0)
//the airlock will not allow itself to continue to cycle when any of the doors are forced open.
if (state && !check_doors_secured())
stop_cycling()
switch(state)
if(STATE_PRESSURIZE)
if(memory["chamber_sensor_pressure"] >= memory["target_pressure"] * 0.95)
@@ -293,6 +295,11 @@
signalDoor(tag_exterior_door, command)
signalDoor(tag_interior_door, command)
/datum/computer/file/embedded_program/airlock/proc/enable_mech_regulation()
signalDoor(tag_mech_sensor, "enable")
/datum/computer/file/embedded_program/airlock/proc/disable_mech_regulation()
signalDoor(tag_mech_sensor, "disable")
/*----------------------------------------------------------
toggleDoor()

View File

@@ -13,12 +13,12 @@
/datum/computer/file/embedded_program/docking/multi/New(var/obj/machinery/embedded_controller/M)
..(M)
if (istype(M,/obj/machinery/embedded_controller/radio/docking_port_multi)) //if our parent controller is the right type, then we can auto-init stuff at construction
var/obj/machinery/embedded_controller/radio/docking_port_multi/controller = M
//parse child_tags_txt and create child tags
children_tags = text2list(controller.child_tags_txt, ";")
children_ready = list()
children_override = list()
for (var/child_tag in children_tags)
@@ -33,13 +33,13 @@
var/receive_tag = signal.data["tag"] //for docking signals, this is the sender id
var/command = signal.data["command"]
var/recipient = signal.data["recipient"] //the intended recipient of the docking signal
if (receive_tag in children_tags)
//track children status
if (signal.data["override_status"])
children_override[receive_tag] = signal.data["override_status"]
if (recipient == id_tag)
switch (command)
if ("ready_for_docking")
@@ -50,13 +50,13 @@
children_override[receive_tag] = 1
if ("status_override_disabled")
children_override[receive_tag] = 0
..(signal, receive_method, receive_param)
/datum/computer/file/embedded_program/docking/multi/prepare_for_docking()
//clear children ready status
clear_children_ready_status()
//tell children to prepare for docking
for (var/child_tag in children_tags)
send_docking_command(child_tag, "prepare_for_docking")
@@ -72,14 +72,14 @@
//tell children to finish docking
for (var/child_tag in children_tags)
send_docking_command(child_tag, "finish_docking")
//clear ready flags
clear_children_ready_status()
/datum/computer/file/embedded_program/docking/multi/prepare_for_undocking()
//clear children ready status
clear_children_ready_status()
//tell children to prepare for undocking
for (var/child_tag in children_tags)
send_docking_command(child_tag, "prepare_for_undocking")
@@ -95,7 +95,7 @@
//tell children to finish undocking
for (var/child_tag in children_tags)
send_docking_command(child_tag, "finish_undocking")
//clear ready flags
clear_children_ready_status()
@@ -108,7 +108,7 @@
*/
/datum/computer/file/embedded_program/airlock/multi_docking
var/master_tag
var/master_status = "undocked"
var/override_enabled = 0
var/docking_enabled = 0
@@ -117,7 +117,7 @@
/datum/computer/file/embedded_program/airlock/multi_docking/New(var/obj/machinery/embedded_controller/M)
..(M)
if (istype(M, /obj/machinery/embedded_controller/radio/airlock/docking_port_multi)) //if our parent controller is the right type, then we can auto-init stuff at construction
var/obj/machinery/embedded_controller/radio/airlock/docking_port_multi/controller = M
src.master_tag = controller.master_tag
@@ -131,56 +131,58 @@
override_enabled = 1
broadcast_override_status()
return
if (!docking_enabled|| override_enabled) //only allow the port to be used as an airlock if nothing is docked here or the override is enabled
..(command)
/datum/computer/file/embedded_program/airlock/multi_docking/receive_signal(datum/signal/signal, receive_method, receive_param)
..()
var/receive_tag = signal.data["tag"] //for docking signals, this is the sender id
var/command = signal.data["command"]
var/recipient = signal.data["recipient"] //the intended recipient of the docking signal
if (receive_tag != master_tag)
return //only respond to master
//track master's status
if (signal.data["dock_status"])
master_status = signal.data["dock_status"]
if (recipient != id_tag)
return //this signal is not for us
switch (command)
if ("prepare_for_docking")
docking_enabled = 1
docking_mode = 0
response_sent = 0
if (!override_enabled)
begin_cycle_in()
if ("prepare_for_undocking")
docking_mode = 1
response_sent = 0
if (!override_enabled)
stop_cycling()
close_doors()
disable_mech_regulation()
if ("finish_docking")
if (!override_enabled)
enable_mech_regulation()
open_doors()
if ("finish_undocking")
docking_enabled = 0
/datum/computer/file/embedded_program/airlock/multi_docking/process()
..()
if (docking_enabled && !response_sent)
switch (docking_mode)
if (0) //docking
if (ready_for_docking())