From 0e15d55b24b44d40875dfbfb7873ded91b295325 Mon Sep 17 00:00:00 2001 From: mwerezak Date: Sat, 5 Jul 2014 14:34:21 -0400 Subject: [PATCH 1/3] Fixes #5459 --- .../machinery/embedded_controller/docking_program.dm | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/code/game/machinery/embedded_controller/docking_program.dm b/code/game/machinery/embedded_controller/docking_program.dm index f6f1eaf7c7..59a74cc037 100644 --- a/code/game/machinery/embedded_controller/docking_program.dm +++ b/code/game/machinery/embedded_controller/docking_program.dm @@ -6,7 +6,9 @@ #define MODE_NONE 0 #define MODE_SERVER 1 -#define MODE_CLIENT 2 //The one who initiated the docking, and who can initiate the undocking. The server cannot initiate undocking. (Think server == station, client == shuttle) +#define MODE_CLIENT 2 //The one who initiated the docking, and who can initiate the undocking. The server cannot initiate undocking, and is the one responsible for deciding to accept a docking request and signals when docking and undocking is complete. (Think server == station, client == shuttle) + +#define MESSAGE_RESEND_TIME 5 //how long (in seconds) do we wait before resending a message /* *** STATE TABLE *** @@ -64,6 +66,7 @@ var/dock_state = STATE_UNDOCKED var/control_mode = MODE_NONE var/response_sent = 0 //so we don't spam confirmation messages + var/resend_counter = 0 //for periodically resending confirmation messages in case they are missed 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 @@ -158,10 +161,12 @@ finish_undocking() reset() //server is done undocking! - + if (response_sent || resend_counter > 0) + resend_counter++ - if (dock_state != STATE_DOCKING && dock_state != STATE_UNDOCKING) + if (resend_counter >= MESSAGE_RESEND_TIME || (dock_state != STATE_DOCKING && dock_state != STATE_UNDOCKING)) response_sent = 0 + resend_counter = 0 //handle invalid states if (control_mode == MODE_NONE && dock_state != STATE_UNDOCKED) From cd6594f22304dd59405ab0ec7e6542f20d668439 Mon Sep 17 00:00:00 2001 From: mwerezak Date: Sat, 5 Jul 2014 14:35:40 -0400 Subject: [PATCH 2/3] Fixes shuttle being late AFTER it arrives --- code/modules/shuttles/shuttle_supply.dm | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/code/modules/shuttles/shuttle_supply.dm b/code/modules/shuttles/shuttle_supply.dm index 41d0a82224..7b60f7b50b 100644 --- a/code/modules/shuttles/shuttle_supply.dm +++ b/code/modules/shuttles/shuttle_supply.dm @@ -46,13 +46,13 @@ while (world.time <= arrive_time) sleep(5) - if (destination != away_area) - move(away_area, destination) - //late if (prob(late_chance)) sleep(rand(0,max_late_time)) + if (destination != away_area) + move(away_area, destination) + moving_status = SHUTTLE_IDLE if (!at_station()) //at centcom From 6d0a3b864db31f8ce9c7935d04cf6eec7c62bfed Mon Sep 17 00:00:00 2001 From: mwerezak Date: Sat, 5 Jul 2014 14:49:30 -0400 Subject: [PATCH 3/3] Shuttle now can only be late when arriving --- code/modules/shuttles/shuttle_supply.dm | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/code/modules/shuttles/shuttle_supply.dm b/code/modules/shuttles/shuttle_supply.dm index 7b60f7b50b..a33f067c8e 100644 --- a/code/modules/shuttles/shuttle_supply.dm +++ b/code/modules/shuttles/shuttle_supply.dm @@ -46,11 +46,11 @@ while (world.time <= arrive_time) sleep(5) - //late - if (prob(late_chance)) - sleep(rand(0,max_late_time)) - if (destination != away_area) + //late + if (prob(late_chance)) + sleep(rand(0,max_late_time)) + move(away_area, destination) moving_status = SHUTTLE_IDLE