[MIRROR] Linter diagnostics + bans non-var relative pathing

This commit is contained in:
Chompstation Bot
2021-06-22 22:17:02 +00:00
parent 968067d0e7
commit fb343cec6c
351 changed files with 20094 additions and 11284 deletions

View File

@@ -2,7 +2,7 @@
/obj/machinery/embedded_controller/radio/airlock
// Setup parameters only
radio_filter = RADIO_AIRLOCK
program = /datum/computer/file/embedded_program/airlock
program = /datum/embedded_program/airlock
var/tag_exterior_door
var/tag_interior_door
var/tag_airpump

View File

@@ -1,31 +1,31 @@
/*
* NOTE - This file defines both these datums: Yes, you read that right. Its confusing. Lets try and break it down.
* /datum/computer/file/embedded_program/docking/airlock
* /datum/embedded_program/docking/airlock
* - A docking controller for an airlock based docking port
* /datum/computer/file/embedded_program/airlock/docking
* /datum/embedded_program/airlock/docking
* - An extension to the normal airlock program allows disabling of the regular airlock functions when docking
*/
//a docking port based on an airlock
/obj/machinery/embedded_controller/radio/airlock/docking_port
name = "docking port controller"
var/datum/computer/file/embedded_program/airlock/docking/airlock_program
var/datum/computer/file/embedded_program/docking/airlock/docking_program
var/datum/embedded_program/airlock/docking/airlock_program
var/datum/embedded_program/docking/airlock/docking_program
var/display_name // For mappers to override docking_program.display_name (how would it show up on docking monitoring program)
tag_secure = 1
valid_actions = list("cycle_ext", "cycle_int", "force_ext", "force_int", "abort", "toggle_override")
/obj/machinery/embedded_controller/radio/airlock/docking_port/Initialize()
. = ..()
airlock_program = new/datum/computer/file/embedded_program/airlock/docking(src)
docking_program = new/datum/computer/file/embedded_program/docking/airlock(src, airlock_program)
airlock_program = new/datum/embedded_program/airlock/docking(src)
docking_program = new/datum/embedded_program/docking/airlock(src, airlock_program)
program = docking_program
if(display_name)
docking_program.display_name = display_name
/obj/machinery/embedded_controller/radio/airlock/docking_port/attackby(obj/item/W, mob/user)
if(istype(W,/obj/item/device/multitool)) //give them part of code, would take few tries to get full
var/datum/computer/file/embedded_program/docking/airlock/docking_program = program
var/datum/embedded_program/docking/airlock/docking_program = program
var/code = docking_program.docking_codes
if(!code)
code = "N/A"
@@ -36,8 +36,8 @@
..()
/obj/machinery/embedded_controller/radio/airlock/docking_port/tgui_data(mob/user)
var/datum/computer/file/embedded_program/docking/airlock/docking_program = program
var/datum/computer/file/embedded_program/airlock/docking/airlock_program = docking_program.airlock_program
var/datum/embedded_program/docking/airlock/docking_program = program
var/datum/embedded_program/airlock/docking/airlock_program = docking_program.airlock_program
. = list(
"chamber_pressure" = round(airlock_program.memory["chamber_sensor_pressure"]),
@@ -55,15 +55,15 @@
///////////////////////////////////////////////////////////////////////////////
//A docking controller for an airlock based docking port
//
/datum/computer/file/embedded_program/docking/airlock
var/datum/computer/file/embedded_program/airlock/docking/airlock_program
/datum/embedded_program/docking/airlock
var/datum/embedded_program/airlock/docking/airlock_program
/datum/computer/file/embedded_program/docking/airlock/New(var/obj/machinery/embedded_controller/M, var/datum/computer/file/embedded_program/airlock/docking/A)
/datum/embedded_program/docking/airlock/New(var/obj/machinery/embedded_controller/M, var/datum/embedded_program/airlock/docking/A)
..(M)
airlock_program = A
airlock_program.master_prog = src
/datum/computer/file/embedded_program/docking/airlock/receive_user_command(command)
/datum/embedded_program/docking/airlock/receive_user_command(command)
if (command == "toggle_override")
if (override_enabled)
disable_override()
@@ -74,35 +74,35 @@
. = ..(command)
. = airlock_program.receive_user_command(command) || . //pass along to subprograms; bypass shortcircuit
/datum/computer/file/embedded_program/docking/airlock/process()
/datum/embedded_program/docking/airlock/process()
airlock_program.process()
..()
/datum/computer/file/embedded_program/docking/airlock/receive_signal(datum/signal/signal, receive_method, receive_param)
/datum/embedded_program/docking/airlock/receive_signal(datum/signal/signal, receive_method, receive_param)
airlock_program.receive_signal(signal, receive_method, receive_param) //pass along to subprograms
..(signal, receive_method, receive_param)
//tell the docking port to start getting ready for docking - e.g. pressurize
/datum/computer/file/embedded_program/docking/airlock/prepare_for_docking()
/datum/embedded_program/docking/airlock/prepare_for_docking()
airlock_program.begin_dock_cycle()
//are we ready for docking?
/datum/computer/file/embedded_program/docking/airlock/ready_for_docking()
/datum/embedded_program/docking/airlock/ready_for_docking()
return airlock_program.done_cycling()
//we are docked, open the doors or whatever.
/datum/computer/file/embedded_program/docking/airlock/finish_docking()
/datum/embedded_program/docking/airlock/finish_docking()
airlock_program.enable_mech_regulation()
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()
/datum/embedded_program/docking/airlock/prepare_for_undocking()
airlock_program.stop_cycling()
airlock_program.close_doors()
airlock_program.disable_mech_regulation()
//are we ready for undocking?
/datum/computer/file/embedded_program/docking/airlock/ready_for_undocking()
/datum/embedded_program/docking/airlock/ready_for_undocking()
var/ext_closed = airlock_program.check_exterior_door_secured()
var/int_closed = airlock_program.check_interior_door_secured()
return (ext_closed || int_closed)
@@ -111,37 +111,37 @@
//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/embedded_program/airlock/docking
var/datum/embedded_program/docking/airlock/master_prog
/datum/computer/file/embedded_program/airlock/docking/Destroy()
/datum/embedded_program/airlock/docking/Destroy()
if(master_prog)
master_prog.airlock_program = null
master_prog = null
return ..()
/datum/computer/file/embedded_program/airlock/docking/receive_user_command(command)
/datum/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
return ..(command)
/datum/computer/file/embedded_program/airlock/docking/proc/open_doors()
/datum/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")
/datum/computer/file/embedded_program/airlock/docking/cycleDoors(var/target)
/datum/embedded_program/airlock/docking/cycleDoors(var/target)
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
..(target)
/*** DEBUG VERBS ***
/datum/computer/file/embedded_program/docking/proc/print_state()
/datum/embedded_program/docking/proc/print_state()
to_world("id_tag: [id_tag]")
to_world("dock_state: [dock_state]")
to_world("control_mode: [control_mode]")
to_world("tag_target: [tag_target]")
to_world("response_sent: [response_sent]")
/datum/computer/file/embedded_program/docking/post_signal(datum/signal/signal, comm_line)
/datum/embedded_program/docking/post_signal(datum/signal/signal, comm_line)
to_world("Program [id_tag] sent a message!")
print_state()
to_world("[id_tag] sent command \"[signal.data["command"]]\" to \"[signal.data["recipient"]]\"")

View File

@@ -2,7 +2,7 @@
//this is the master controller, that things will try to dock with.
/obj/machinery/embedded_controller/radio/docking_port_multi
name = "docking port controller"
program = /datum/computer/file/embedded_program/docking/multi
program = /datum/embedded_program/docking/multi
var/child_tags_txt
var/child_names_txt
var/list/child_names = list()
@@ -16,7 +16,7 @@
child_names[tags[i]] = names[i]
/obj/machinery/embedded_controller/radio/docking_port_multi/tgui_data(mob/user)
var/datum/computer/file/embedded_program/docking/multi/docking_program = program // Cast to proper type
var/datum/embedded_program/docking/multi/docking_program = program // Cast to proper type
var/list/airlocks[child_names.len]
var/i = 1
@@ -36,14 +36,14 @@
// This is the actual controller that will be commanded by the master defined above
/obj/machinery/embedded_controller/radio/airlock/docking_port_multi
name = "docking port controller"
program = /datum/computer/file/embedded_program/airlock/multi_docking
program = /datum/embedded_program/airlock/multi_docking
var/master_tag //for mapping
tag_secure = 1
valid_actions = list("cycle_ext", "cycle_int", "force_ext", "force_int", "abort", "toggle_override")
/obj/machinery/embedded_controller/radio/airlock/docking_port_multi/tgui_data(mob/user)
var/datum/computer/file/embedded_program/airlock/multi_docking/airlock_program = program // Cast to proper type
var/datum/embedded_program/airlock/multi_docking/airlock_program = program // Cast to proper type
. = list(
"chamber_pressure" = round(airlock_program.memory["chamber_sensor_pressure"]),
@@ -58,14 +58,14 @@
/*** DEBUG VERBS ***
/datum/computer/file/embedded_program/docking/multi/proc/print_state()
/datum/embedded_program/docking/multi/proc/print_state()
to_world("id_tag: [id_tag]")
to_world("dock_state: [dock_state]")
to_world("control_mode: [control_mode]")
to_world("tag_target: [tag_target]")
to_world("response_sent: [response_sent]")
/datum/computer/file/embedded_program/docking/multi/post_signal(datum/signal/signal, comm_line)
/datum/embedded_program/docking/multi/post_signal(datum/signal/signal, comm_line)
to_world("Program [id_tag] sent a message!")
print_state()
to_world("[id_tag] sent command \"[signal.data["command"]]\" to \"[signal.data["recipient"]]\"")

View File

@@ -1,5 +1,4 @@
//Handles the control of airlocks
#define STATE_IDLE 0
#define STATE_PREPARE 1
#define STATE_DEPRESSURIZE 2
@@ -12,7 +11,7 @@
#define MIN_TARGET_PRESSURE (ONE_ATMOSPHERE * 0.05) // Never try to pump to pure vacuum, its not happening.
#define SKIPCYCLE_MARGIN 1 // Skip cycling airlock (just open the doors) if pressures are within this range.
/datum/computer/file/embedded_program/airlock
/datum/embedded_program/airlock
var/tag_exterior_door
var/tag_interior_door
var/tag_airpump
@@ -29,7 +28,7 @@
var/tag_pump_out_external
var/tag_pump_out_internal
/datum/computer/file/embedded_program/airlock/New(var/obj/machinery/embedded_controller/M)
/datum/embedded_program/airlock/New(var/obj/machinery/embedded_controller/M)
..(M)
memory["chamber_sensor_pressure"] = ONE_ATMOSPHERE
@@ -62,7 +61,7 @@
signalDoor(tag_exterior_door, "update") //signals connected doors to update their status
signalDoor(tag_interior_door, "update")
/datum/computer/file/embedded_program/airlock/receive_signal(datum/signal/signal, receive_method, receive_param)
/datum/embedded_program/airlock/receive_signal(datum/signal/signal, receive_method, receive_param)
var/receive_tag = signal.data["tag"]
if(!receive_tag) return
@@ -115,7 +114,7 @@
receive_user_command("cycle_int")
/datum/computer/file/embedded_program/airlock/receive_user_command(command)
/datum/embedded_program/airlock/receive_user_command(command)
var/shutdown_pump = 0
. = TRUE
switch(command)
@@ -175,7 +174,7 @@
/datum/computer/file/embedded_program/airlock/process()
/datum/embedded_program/airlock/process()
if(!state) //Idle
if(target_state)
switch(target_state)
@@ -278,49 +277,49 @@
//these are here so that other types don't have to make so many assuptions about our implementation
/datum/computer/file/embedded_program/airlock/proc/begin_cycle_in()
/datum/embedded_program/airlock/proc/begin_cycle_in()
state = STATE_IDLE
target_state = TARGET_INOPEN
memory["purge"] = cycle_to_external_air
/datum/computer/file/embedded_program/airlock/proc/begin_dock_cycle()
/datum/embedded_program/airlock/proc/begin_dock_cycle()
state = STATE_IDLE
target_state = TARGET_INOPEN
/datum/computer/file/embedded_program/airlock/proc/begin_cycle_out()
/datum/embedded_program/airlock/proc/begin_cycle_out()
state = STATE_IDLE
target_state = TARGET_OUTOPEN
memory["purge"] = cycle_to_external_air
/datum/computer/file/embedded_program/airlock/proc/close_doors()
/datum/embedded_program/airlock/proc/close_doors()
toggleDoor(memory["interior_status"], tag_interior_door, 1, "close")
toggleDoor(memory["exterior_status"], tag_exterior_door, 1, "close")
/datum/computer/file/embedded_program/airlock/proc/stop_cycling()
/datum/embedded_program/airlock/proc/stop_cycling()
state = STATE_IDLE
target_state = TARGET_NONE
/datum/computer/file/embedded_program/airlock/proc/done_cycling()
/datum/embedded_program/airlock/proc/done_cycling()
return (state == STATE_IDLE && target_state == TARGET_NONE)
//are the doors closed and locked?
/datum/computer/file/embedded_program/airlock/proc/check_exterior_door_secured()
/datum/embedded_program/airlock/proc/check_exterior_door_secured()
return (memory["exterior_status"]["state"] == "closed" && memory["exterior_status"]["lock"] == "locked")
/datum/computer/file/embedded_program/airlock/proc/check_interior_door_secured()
/datum/embedded_program/airlock/proc/check_interior_door_secured()
return (memory["interior_status"]["state"] == "closed" && memory["interior_status"]["lock"] == "locked")
/datum/computer/file/embedded_program/airlock/proc/check_doors_secured()
/datum/embedded_program/airlock/proc/check_doors_secured()
var/ext_closed = check_exterior_door_secured()
var/int_closed = check_interior_door_secured()
return (ext_closed && int_closed)
/datum/computer/file/embedded_program/airlock/proc/signalDoor(var/tag, var/command)
/datum/embedded_program/airlock/proc/signalDoor(var/tag, var/command)
var/datum/signal/signal = new
signal.data["tag"] = tag
signal.data["command"] = command
post_signal(signal, RADIO_AIRLOCK)
/datum/computer/file/embedded_program/airlock/proc/signalPump(var/tag, var/power, var/direction, var/pressure)
/datum/embedded_program/airlock/proc/signalPump(var/tag, var/power, var/direction, var/pressure)
var/datum/signal/signal = new
signal.data = list(
"tag" = tag,
@@ -332,7 +331,7 @@
post_signal(signal)
//this is called to set the appropriate door state at the end of a cycling process, or for the exterior buttons
/datum/computer/file/embedded_program/airlock/proc/cycleDoors(var/target)
/datum/embedded_program/airlock/proc/cycleDoors(var/target)
switch(target)
if(TARGET_OUTOPEN)
toggleDoor(memory["interior_status"], tag_interior_door, memory["secure"], "close")
@@ -348,17 +347,17 @@
signalDoor(tag_exterior_door, command)
signalDoor(tag_interior_door, command)
datum/computer/file/embedded_program/airlock/proc/signal_mech_sensor(var/command, var/sensor)
/datum/embedded_program/airlock/proc/signal_mech_sensor(var/command, var/sensor)
var/datum/signal/signal = new
signal.data["tag"] = sensor
signal.data["command"] = command
post_signal(signal)
/datum/computer/file/embedded_program/airlock/proc/enable_mech_regulation()
/datum/embedded_program/airlock/proc/enable_mech_regulation()
signal_mech_sensor("enable", tag_shuttle_mech_sensor)
signal_mech_sensor("enable", tag_airlock_mech_sensor)
/datum/computer/file/embedded_program/airlock/proc/disable_mech_regulation()
/datum/embedded_program/airlock/proc/disable_mech_regulation()
signal_mech_sensor("disable", tag_shuttle_mech_sensor)
signal_mech_sensor("disable", tag_airlock_mech_sensor)
@@ -374,7 +373,7 @@ Only sends a command if it is needed, i.e. if the door is
already open, passing an open command to this proc will not
send an additional command to open the door again.
----------------------------------------------------------*/
/datum/computer/file/embedded_program/airlock/proc/toggleDoor(var/list/doorStatus, var/doorTag, var/secure, var/command)
/datum/embedded_program/airlock/proc/toggleDoor(var/list/doorStatus, var/doorTag, var/secure, var/command)
var/doorCommand = null
if(command == "toggle")
@@ -416,8 +415,10 @@ send an additional command to open the door again.
signalDoor(doorTag, doorCommand)
#undef SKIPCYCLE_MARGIN
#undef MIN_TARGET_PRESSURE
#undef STATE_IDLE
#undef STATE_PREPARE
#undef STATE_DEPRESSURIZE
#undef STATE_PRESSURIZE

View File

@@ -61,7 +61,7 @@
*/
/datum/computer/file/embedded_program/docking
/datum/embedded_program/docking
var/tag_target //the tag of the docking controller that we are trying to dock with
var/dock_state = STATE_UNDOCKED
var/control_mode = MODE_NONE
@@ -73,18 +73,18 @@
var/docking_codes //would only allow docking when receiving signal with these, if set
var/display_name //Override the name shown on docking monitoring program; defaults to area name + coordinates if unset
/datum/computer/file/embedded_program/docking/New()
/datum/embedded_program/docking/New()
..()
if(id_tag)
if(SSshuttles.docking_registry[id_tag])
crash_with("Docking controller tag [id_tag] had multiple associated programs.")
SSshuttles.docking_registry[id_tag] = src
/datum/computer/file/embedded_program/docking/Destroy()
/datum/embedded_program/docking/Destroy()
SSshuttles.docking_registry -= id_tag
return ..()
/datum/computer/file/embedded_program/docking/receive_signal(datum/signal/signal, receive_method, receive_param)
/datum/embedded_program/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
@@ -149,7 +149,7 @@
if (receive_tag == tag_target)
reset()
/datum/computer/file/embedded_program/docking/process()
/datum/embedded_program/docking/process()
switch(dock_state)
if (STATE_DOCKING) //waiting for our docking port to be ready for docking
if (ready_for_docking())
@@ -198,7 +198,7 @@
control_mode = MODE_NONE
/datum/computer/file/embedded_program/docking/proc/initiate_docking(var/target)
/datum/embedded_program/docking/proc/initiate_docking(var/target)
if (dock_state != STATE_UNDOCKED || control_mode == MODE_SERVER) //must be undocked and not serving another request to begin a new docking handshake
return
@@ -207,7 +207,7 @@
send_docking_command(tag_target, "request_dock")
/datum/computer/file/embedded_program/docking/proc/initiate_undocking()
/datum/embedded_program/docking/proc/initiate_undocking()
if (dock_state != STATE_DOCKED || control_mode != MODE_CLIENT) //must be docked and must be client to start undocking
return
@@ -220,36 +220,36 @@
send_docking_command(tag_target, "request_undock")
//tell the docking port to start getting ready for docking - e.g. pressurize
/datum/computer/file/embedded_program/docking/proc/prepare_for_docking()
/datum/embedded_program/docking/proc/prepare_for_docking()
return
//are we ready for docking?
/datum/computer/file/embedded_program/docking/proc/ready_for_docking()
/datum/embedded_program/docking/proc/ready_for_docking()
return 1
//we are docked, open the doors or whatever.
/datum/computer/file/embedded_program/docking/proc/finish_docking()
/datum/embedded_program/docking/proc/finish_docking()
return
//tell the docking port to start getting ready for undocking - e.g. close those doors.
/datum/computer/file/embedded_program/docking/proc/prepare_for_undocking()
/datum/embedded_program/docking/proc/prepare_for_undocking()
return
//we are docked, open the doors or whatever.
/datum/computer/file/embedded_program/docking/proc/finish_undocking()
/datum/embedded_program/docking/proc/finish_undocking()
return
//are we ready for undocking?
/datum/computer/file/embedded_program/docking/proc/ready_for_undocking()
/datum/embedded_program/docking/proc/ready_for_undocking()
return 1
/datum/computer/file/embedded_program/docking/proc/enable_override()
/datum/embedded_program/docking/proc/enable_override()
override_enabled = 1
/datum/computer/file/embedded_program/docking/proc/disable_override()
/datum/embedded_program/docking/proc/disable_override()
override_enabled = 0
/datum/computer/file/embedded_program/docking/proc/reset()
/datum/embedded_program/docking/proc/reset()
dock_state = STATE_UNDOCKED
broadcast_docking_status()
@@ -258,23 +258,23 @@
response_sent = 0
received_confirm = 0
/datum/computer/file/embedded_program/docking/proc/force_undock()
/datum/embedded_program/docking/proc/force_undock()
//to_world("[id_tag]: forcing undock")
if (tag_target)
send_docking_command(tag_target, "dock_error")
reset()
/datum/computer/file/embedded_program/docking/proc/docked()
/datum/embedded_program/docking/proc/docked()
return (dock_state == STATE_DOCKED)
/datum/computer/file/embedded_program/docking/proc/undocked()
/datum/embedded_program/docking/proc/undocked()
return (dock_state == STATE_UNDOCKED)
//returns 1 if we are saftely undocked (and the shuttle can leave)
/datum/computer/file/embedded_program/docking/proc/can_launch()
/datum/embedded_program/docking/proc/can_launch()
return undocked()
/datum/computer/file/embedded_program/docking/proc/send_docking_command(var/recipient, var/command)
/datum/embedded_program/docking/proc/send_docking_command(var/recipient, var/command)
var/datum/signal/signal = new
signal.data["tag"] = id_tag
signal.data["command"] = command
@@ -282,21 +282,21 @@
signal.data["code"] = docking_codes
post_signal(signal)
/datum/computer/file/embedded_program/docking/proc/broadcast_docking_status()
/datum/embedded_program/docking/proc/broadcast_docking_status()
var/datum/signal/signal = new
signal.data["tag"] = id_tag
signal.data["dock_status"] = get_docking_status()
post_signal(signal)
//this is mostly for NanoUI
/datum/computer/file/embedded_program/docking/proc/get_docking_status()
/datum/embedded_program/docking/proc/get_docking_status()
switch (dock_state)
if (STATE_UNDOCKED) return "undocked"
if (STATE_DOCKING) return "docking"
if (STATE_UNDOCKING) return "undocking"
if (STATE_DOCKED) return "docked"
/datum/computer/file/embedded_program/docking/proc/get_name()
/datum/embedded_program/docking/proc/get_name()
return display_name ? display_name : "[get_area(master)] ([master.x], [master.y])"
#undef STATE_UNDOCKED

View File

@@ -6,12 +6,12 @@
/*
the master program
*/
/datum/computer/file/embedded_program/docking/multi
/datum/embedded_program/docking/multi
var/list/children_tags
var/list/children_ready
var/list/children_override
/datum/computer/file/embedded_program/docking/multi/New(var/obj/machinery/embedded_controller/M)
/datum/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
@@ -25,11 +25,11 @@
children_ready[child_tag] = 0
children_override[child_tag] = "disabled"
/datum/computer/file/embedded_program/docking/multi/proc/clear_children_ready_status()
/datum/embedded_program/docking/multi/proc/clear_children_ready_status()
for (var/child_tag in children_tags)
children_ready[child_tag] = 0
/datum/computer/file/embedded_program/docking/multi/receive_signal(datum/signal/signal, receive_method, receive_param)
/datum/embedded_program/docking/multi/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
@@ -53,7 +53,7 @@
..(signal, receive_method, receive_param)
/datum/computer/file/embedded_program/docking/multi/prepare_for_docking()
/datum/embedded_program/docking/multi/prepare_for_docking()
//clear children ready status
clear_children_ready_status()
@@ -61,14 +61,14 @@
for (var/child_tag in children_tags)
send_docking_command(child_tag, "prepare_for_docking")
/datum/computer/file/embedded_program/docking/multi/ready_for_docking()
/datum/embedded_program/docking/multi/ready_for_docking()
//check children ready status
for (var/child_tag in children_tags)
if (!children_ready[child_tag])
return 0
return 1
/datum/computer/file/embedded_program/docking/multi/finish_docking()
/datum/embedded_program/docking/multi/finish_docking()
//tell children to finish docking
for (var/child_tag in children_tags)
send_docking_command(child_tag, "finish_docking")
@@ -76,7 +76,7 @@
//clear ready flags
clear_children_ready_status()
/datum/computer/file/embedded_program/docking/multi/prepare_for_undocking()
/datum/embedded_program/docking/multi/prepare_for_undocking()
//clear children ready status
clear_children_ready_status()
@@ -84,14 +84,14 @@
for (var/child_tag in children_tags)
send_docking_command(child_tag, "prepare_for_undocking")
/datum/computer/file/embedded_program/docking/multi/ready_for_undocking()
/datum/embedded_program/docking/multi/ready_for_undocking()
//check children ready status
for (var/child_tag in children_tags)
if (!children_ready[child_tag])
return 0
return 1
/datum/computer/file/embedded_program/docking/multi/finish_undocking()
/datum/embedded_program/docking/multi/finish_undocking()
//tell children to finish undocking
for (var/child_tag in children_tags)
send_docking_command(child_tag, "finish_undocking")
@@ -106,7 +106,7 @@
the child program
technically should be "slave" but eh... I'm too politically correct.
*/
/datum/computer/file/embedded_program/airlock/multi_docking
/datum/embedded_program/airlock/multi_docking
var/master_tag
var/master_status = "undocked"
@@ -115,14 +115,14 @@
var/docking_mode = 0 //0 = docking, 1 = undocking
var/response_sent = 0
/datum/computer/file/embedded_program/airlock/multi_docking/New(var/obj/machinery/embedded_controller/M)
/datum/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
/datum/computer/file/embedded_program/airlock/multi_docking/receive_user_command(command)
/datum/embedded_program/airlock/multi_docking/receive_user_command(command)
if (command == "toggle_override")
if (override_enabled)
override_enabled = 0
@@ -135,7 +135,7 @@
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)
/datum/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
@@ -178,7 +178,7 @@
if ("finish_undocking")
docking_enabled = 0
/datum/computer/file/embedded_program/airlock/multi_docking/process()
/datum/embedded_program/airlock/multi_docking/process()
..()
if (docking_enabled && !response_sent)
@@ -194,31 +194,31 @@
response_sent = 1
//checks if we are ready for docking
/datum/computer/file/embedded_program/airlock/multi_docking/proc/ready_for_docking()
/datum/embedded_program/airlock/multi_docking/proc/ready_for_docking()
return done_cycling()
//checks if we are ready for undocking
/datum/computer/file/embedded_program/airlock/multi_docking/proc/ready_for_undocking()
/datum/embedded_program/airlock/multi_docking/proc/ready_for_undocking()
var/ext_closed = check_exterior_door_secured()
var/int_closed = check_interior_door_secured()
return (ext_closed || int_closed)
/datum/computer/file/embedded_program/airlock/multi_docking/proc/open_doors()
/datum/embedded_program/airlock/multi_docking/proc/open_doors()
toggleDoor(memory["interior_status"], tag_interior_door, memory["secure"], "open")
toggleDoor(memory["exterior_status"], tag_exterior_door, memory["secure"], "open")
/datum/computer/file/embedded_program/airlock/multi_docking/cycleDoors(var/target)
/datum/embedded_program/airlock/multi_docking/cycleDoors(var/target)
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
..(target)
/datum/computer/file/embedded_program/airlock/multi_docking/proc/send_signal_to_master(var/command)
/datum/embedded_program/airlock/multi_docking/proc/send_signal_to_master(var/command)
var/datum/signal/signal = new
signal.data["tag"] = id_tag
signal.data["command"] = command
signal.data["recipient"] = master_tag
post_signal(signal)
/datum/computer/file/embedded_program/airlock/multi_docking/proc/broadcast_override_status()
/datum/embedded_program/airlock/multi_docking/proc/broadcast_override_status()
var/datum/signal/signal = new
signal.data["tag"] = id_tag
signal.data["override_status"] = override_enabled? "enabled" : "disabled"

View File

@@ -3,7 +3,7 @@
anchored = 1
use_power = USE_POWER_IDLE
idle_power_usage = 10
var/datum/computer/file/embedded_program/program //the currently executing program
var/datum/embedded_program/program //the currently executing program
var/list/valid_actions = list()
var/on = 1

View File

@@ -1,30 +1,30 @@
/datum/computer/file/embedded_program
/datum/embedded_program
var/name
var/list/memory = list()
var/obj/machinery/embedded_controller/master
var/id_tag
/datum/computer/file/embedded_program/New(var/obj/machinery/embedded_controller/M)
/datum/embedded_program/New(var/obj/machinery/embedded_controller/M)
master = M
if (istype(M, /obj/machinery/embedded_controller/radio))
var/obj/machinery/embedded_controller/radio/R = M
id_tag = R.id_tag
/datum/computer/file/embedded_program/Destroy()
/datum/embedded_program/Destroy()
if(master)
master.program = null
master = null
return ..()
// Return TRUE if was a command for us, otherwise return FALSE (so controllers with multiple programs can try each in turn until one accepts)
/datum/computer/file/embedded_program/proc/receive_user_command(command)
/datum/embedded_program/proc/receive_user_command(command)
return FALSE
/datum/computer/file/embedded_program/proc/receive_signal(datum/signal/signal, receive_method, receive_param)
/datum/embedded_program/proc/receive_signal(datum/signal/signal, receive_method, receive_param)
return
/datum/computer/file/embedded_program/proc/post_signal(datum/signal/signal, comm_line)
/datum/embedded_program/proc/post_signal(datum/signal/signal, comm_line)
if(master)
master.post_signal(signal, comm_line)
else

View File

@@ -1,12 +1,12 @@
//a docking port that uses a single door
/obj/machinery/embedded_controller/radio/simple_docking_controller
name = "docking hatch controller"
program = /datum/computer/file/embedded_program/docking/simple
program = /datum/embedded_program/docking/simple
var/tag_door
valid_actions = list("force_door", "toggle_override")
/obj/machinery/embedded_controller/radio/simple_docking_controller/tgui_data(mob/user)
var/datum/computer/file/embedded_program/docking/simple/docking_program = program // Cast to proper type
var/datum/embedded_program/docking/simple/docking_program = program // Cast to proper type
. = list(
"docking_status" = docking_program.get_docking_status(),
@@ -16,10 +16,10 @@
)
//A docking controller program for a simple door based docking port
/datum/computer/file/embedded_program/docking/simple
/datum/embedded_program/docking/simple
var/tag_door
/datum/computer/file/embedded_program/docking/simple/New(var/obj/machinery/embedded_controller/M)
/datum/embedded_program/docking/simple/New(var/obj/machinery/embedded_controller/M)
..(M)
memory["door_status"] = list(state = "closed", lock = "locked") //assume closed and locked in case the doors dont report in
@@ -32,7 +32,7 @@
signal_door("update") //signals connected doors to update their status
/datum/computer/file/embedded_program/docking/simple/receive_signal(datum/signal/signal, receive_method, receive_param)
/datum/embedded_program/docking/simple/receive_signal(datum/signal/signal, receive_method, receive_param)
var/receive_tag = signal.data["tag"]
if(!receive_tag) return
@@ -43,7 +43,7 @@
..(signal, receive_method, receive_param)
/datum/computer/file/embedded_program/docking/simple/receive_user_command(command)
/datum/embedded_program/docking/simple/receive_user_command(command)
. = TRUE
switch(command)
if("force_door")
@@ -60,24 +60,24 @@
else
. = FALSE
/datum/computer/file/embedded_program/docking/simple/proc/signal_door(var/command)
/datum/embedded_program/docking/simple/proc/signal_door(var/command)
var/datum/signal/signal = new
signal.data["tag"] = tag_door
signal.data["command"] = command
post_signal(signal)
///datum/computer/file/embedded_program/docking/simple/proc/signal_mech_sensor(var/command)
///datum/embedded_program/docking/simple/proc/signal_mech_sensor(var/command)
// signal_door(command)
// return
/datum/computer/file/embedded_program/docking/simple/proc/open_door()
/datum/embedded_program/docking/simple/proc/open_door()
if(memory["door_status"]["state"] == "closed")
//signal_mech_sensor("enable")
signal_door("secure_open")
else if(memory["door_status"]["lock"] == "unlocked")
signal_door("lock")
/datum/computer/file/embedded_program/docking/simple/proc/close_door()
/datum/embedded_program/docking/simple/proc/close_door()
if(memory["door_status"]["state"] == "open")
signal_door("secure_close")
//signal_mech_sensor("disable")
@@ -85,23 +85,23 @@
signal_door("lock")
//tell the docking port to start getting ready for docking - e.g. pressurize
/datum/computer/file/embedded_program/docking/simple/prepare_for_docking()
/datum/embedded_program/docking/simple/prepare_for_docking()
return //don't need to do anything
//are we ready for docking?
/datum/computer/file/embedded_program/docking/simple/ready_for_docking()
/datum/embedded_program/docking/simple/ready_for_docking()
return 1 //don't need to do anything
//we are docked, open the doors or whatever.
/datum/computer/file/embedded_program/docking/simple/finish_docking()
/datum/embedded_program/docking/simple/finish_docking()
open_door()
//tell the docking port to start getting ready for undocking - e.g. close those doors.
/datum/computer/file/embedded_program/docking/simple/prepare_for_undocking()
/datum/embedded_program/docking/simple/prepare_for_undocking()
close_door()
//are we ready for undocking?
/datum/computer/file/embedded_program/docking/simple/ready_for_undocking()
/datum/embedded_program/docking/simple/ready_for_undocking()
return (memory["door_status"]["state"] == "closed" && memory["door_status"]["lock"] == "locked")
/*** DEBUG VERBS ***