mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-11 10:43:20 +00:00
Adjusts how undocking signals are used
Now both server and client will to undock concurrently. It looks much more natural.
This commit is contained in:
@@ -127,7 +127,7 @@
|
||||
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 ***/
|
||||
/*** DEBUG VERBS ***
|
||||
|
||||
/datum/computer/file/embedded_program/docking/proc/print_state()
|
||||
world << "id_tag: [id_tag]"
|
||||
@@ -167,4 +167,4 @@
|
||||
set src in view(1)
|
||||
src.program:initiate_undocking()
|
||||
|
||||
/**/
|
||||
*/
|
||||
@@ -24,6 +24,20 @@
|
||||
MODE_NONE|STATE_UNDOCKED idle - not docked.
|
||||
MODE_NONE|anything else should never happen.
|
||||
|
||||
*** 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.
|
||||
|
||||
*** 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.
|
||||
@@ -45,6 +59,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
|
||||
@@ -78,10 +93,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)
|
||||
@@ -108,16 +124,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
|
||||
@@ -148,7 +163,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()
|
||||
@@ -185,6 +200,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"
|
||||
|
||||
@@ -127,7 +127,7 @@
|
||||
/datum/computer/file/embedded_program/docking/simple/ready_for_undocking()
|
||||
return (memory["door_status"]["state"] == "closed" && memory["door_status"]["lock"] == "locked")
|
||||
|
||||
/*** DEBUG VERBS ***/
|
||||
/*** DEBUG VERBS ***
|
||||
|
||||
/obj/machinery/embedded_controller/radio/simple_docking_controller/verb/view_state()
|
||||
set category = "Debug"
|
||||
@@ -154,4 +154,4 @@
|
||||
set src in view(1)
|
||||
src.program:initiate_undocking()
|
||||
|
||||
/**/
|
||||
*/
|
||||
@@ -95,7 +95,7 @@
|
||||
|
||||
process_state = WAIT_ARRIVE
|
||||
|
||||
/datum/shuttle/ferry/proc/cancel_launch()
|
||||
/datum/shuttle/ferry/proc/cancel_launch(var/obj/machinery/computer/shuttle_control/user)
|
||||
if (!can_cancel()) return
|
||||
|
||||
moving_status = SHUTTLE_IDLE
|
||||
@@ -119,9 +119,9 @@
|
||||
return 1
|
||||
|
||||
/datum/shuttle/ferry/proc/can_force()
|
||||
if (moving_status != SHUTTLE_IDLE && process_state == WAIT_LAUNCH)
|
||||
return 0
|
||||
return 1
|
||||
if (moving_status == SHUTTLE_IDLE && process_state == WAIT_LAUNCH)
|
||||
return 1
|
||||
return 0
|
||||
|
||||
/datum/shuttle/ferry/proc/can_cancel()
|
||||
if (moving_status == SHUTTLE_WARMUP || process_state == WAIT_LAUNCH)
|
||||
|
||||
@@ -29,19 +29,6 @@
|
||||
Docking Status:
|
||||
</div>
|
||||
<div class="itemContent">
|
||||
<!--
|
||||
{{if docking_status == "docked"}}
|
||||
<span class="good">DOCKED</span>
|
||||
{{else docking_status == "docking"}}
|
||||
<span class="average">DOCKING</span>
|
||||
{{else docking_status == "undocking"}}
|
||||
<span class="average">UNDOCKING</span>
|
||||
{{else docking_status == "undocked"}}
|
||||
<span class="idle">UNDOCKED</span>
|
||||
{{else}}
|
||||
<span class="bad">ERROR</span>
|
||||
{{/if}}
|
||||
-->
|
||||
{{if docking_status == "docked"}}
|
||||
<span class="good">DOCKED</span>
|
||||
{{else docking_status == "docking"}}
|
||||
@@ -73,6 +60,7 @@
|
||||
<div class="itemContent" style="padding-top: 2px; width: 100%">
|
||||
{{:~link('Launch Shuttle', 'arrowthickstop-1-e', {'move' : '1'}, can_launch? null : 'disabled' , null)}}
|
||||
{{:~link('Cancel Launch', 'cancel', {'cancel' : '1'}, can_cancel? null : 'disabled' , null)}}
|
||||
{{:~link('Force Launch', 'alert', {'force' : '1'}, can_force? null : 'disabled' , can_force? 'redBackground' : null)}}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
Reference in New Issue
Block a user