From afc2e63b550e474c0e267b88a0110ab1b9f86022 Mon Sep 17 00:00:00 2001 From: Joonas Rikkonen Date: Thu, 23 Aug 2018 14:57:13 +0300 Subject: [PATCH] Client-side door state prediction fix: the clients wouldn't set the door to the correct state if the predicted state was the same as the door's previous known correct state, even if the latest state sent by the server was different (= a convoluted way of saying that door syncing works correctly now with complex door setups like the ones in SS Odyssey, see #579). --- Barotrauma/BarotraumaShared/Source/Items/Components/Door.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Barotrauma/BarotraumaShared/Source/Items/Components/Door.cs b/Barotrauma/BarotraumaShared/Source/Items/Components/Door.cs index 9a97d444a..80b768ae9 100644 --- a/Barotrauma/BarotraumaShared/Source/Items/Components/Door.cs +++ b/Barotrauma/BarotraumaShared/Source/Items/Components/Door.cs @@ -471,8 +471,10 @@ namespace Barotrauma.Items.Components public void SetState(bool open, bool isNetworkMessage, bool sendNetworkMessage = false) { - if (isStuck || (predictedState == null && isOpen == open) || (predictedState != null && isOpen == predictedState.Value)) return; - + if (isStuck || + (predictedState == null && isOpen == open) || + (predictedState != null && isOpen == predictedState.Value && isOpen == open)) return; + if (GameMain.Client != null && !isNetworkMessage) { //clients can "predict" that the door opens/closes when a signal is received