From bfe043c1547d2df779b471e97b8af1f8c93bae12 Mon Sep 17 00:00:00 2001 From: Regalis Date: Wed, 5 Apr 2017 23:51:45 +0300 Subject: [PATCH] Fixed door sounds playing twice client-side (first when the client activates the door and again when the correct state is received from the server) --- Subsurface/Source/Items/Components/Door.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Subsurface/Source/Items/Components/Door.cs b/Subsurface/Source/Items/Components/Door.cs index 10dcb6646..b92e51597 100644 --- a/Subsurface/Source/Items/Components/Door.cs +++ b/Subsurface/Source/Items/Components/Door.cs @@ -503,7 +503,6 @@ namespace Barotrauma.Items.Components if (isStuck || isOpen == open) return; - PlaySound(ActionType.OnUse, item.WorldPosition); if (GameMain.Client != null && !isNetworkMessage) { @@ -512,11 +511,15 @@ namespace Barotrauma.Items.Components //the prediction will be reset after 1 second, setting the door to a state //sent by the server, or reverting it back to its old state if no msg from server was received + PlaySound(ActionType.OnUse, item.WorldPosition); + predictedState = open; resetPredictionTimer = 1.0f; } else { + if (!isNetworkMessage) PlaySound(ActionType.OnUse, item.WorldPosition); + isOpen = open; }