Adjusts how undocking signals are used

Now both server and client will to undock concurrently. It looks much
more natural.

Conflicts:
	code/game/machinery/embedded_controller/docking_program.dm
	code/game/machinery/embedded_controller/simple_docking_controller.dm
This commit is contained in:
mwerezak
2014-06-12 23:11:51 -04:00
committed by ZomgPonies
parent cd540fe56d
commit cdabebba3e
5 changed files with 39 additions and 31 deletions
@@ -30,12 +30,30 @@
MODE_NONE|anything else should never happen.
<<<<<<< HEAD
<<<<<<< HEAD
<<<<<<< HEAD
=======
>>>>>>> ed4fb8d... Shuttles now dock on arrival and departure
=======
=======
*** Docking Signals ***
Docking
Client sends request_dock
When server is ready, sends confirm_dock
Client sends confirm_dock back
Undocking
Client sends request_undock
When server is ready, sends confirm_dock
Client sends confirm_dock back
Note that in both cases each side exchanges confirm_dock before the docking operation is considered done.
>>>>>>> dc7d8fa... Adjusts how undocking signals are used
*** Override, what is it? ***
The purpose of enabling the override is to prevent the docking program from automatically doing things with the docking port when docking or undocking.
@@ -63,6 +81,7 @@
var/response_sent = 0 //so we don't spam confirmation messages
var/override_enabled = 0 //skips checks for the docking port being ready
var/received_confirm = 0 //for undocking, whether the client has recieved a confirmation from the server
/datum/computer/file/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
@@ -96,10 +115,11 @@
if ("confirm_undock")
if (control_mode == MODE_CLIENT && dock_state == STATE_UNDOCKING && receive_tag == tag_target)
send_docking_command(tag_target, "confirm_undock")
received_confirm = 1
else if (control_mode == MODE_SERVER && dock_state == STATE_UNDOCKING && receive_tag == tag_target)
if (!override_enabled)
finish_undocking()
reset() //client is done undocking!
reset() //server is done undocking!
if ("request_undock")
if (control_mode == MODE_SERVER && dock_state == STATE_DOCKED && receive_tag == tag_target)
@@ -126,16 +146,15 @@
response_sent = 0
if (STATE_UNDOCKING)
if (ready_for_undocking())
if (control_mode == MODE_CLIENT)
if (!response_sent)
send_docking_command(tag_target, "request_undock") //tell the server we want to undock now.
response_sent = 1
if (control_mode == MODE_CLIENT && received_confirm)
send_docking_command(tag_target, "confirm_undock") //tell the server we are done undocking.
if (!override_enabled)
finish_undocking()
reset() //client is done undocking!
else if (control_mode == MODE_SERVER)
send_docking_command(tag_target, "confirm_undock") //tell the client we are OK to undock.
if (!override_enabled)
finish_undocking()
reset() //server is done undocking!
if (dock_state != STATE_DOCKING && dock_state != STATE_UNDOCKING)
response_sent = 0
@@ -166,7 +185,7 @@
if (!override_enabled)
prepare_for_undocking()
//send_docking_command(tag_target, "request_undock")
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()
@@ -203,6 +222,7 @@
control_mode = MODE_NONE
tag_target = null
response_sent = 0
received_confirm = 0
/datum/computer/file/embedded_program/docking/proc/force_undock()
world << "[id_tag]: forcing undock"