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).

This commit is contained in:
Joonas Rikkonen
2018-08-23 14:57:13 +03:00
parent 6cb2a7260c
commit afc2e63b55

View File

@@ -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