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)

This commit is contained in:
Regalis
2017-04-05 23:51:45 +03:00
parent b1ef7ffd05
commit bfe043c154
+4 -1
View File
@@ -503,7 +503,6 @@ namespace Barotrauma.Items.Components
if (isStuck || isOpen == open) return; if (isStuck || isOpen == open) return;
PlaySound(ActionType.OnUse, item.WorldPosition);
if (GameMain.Client != null && !isNetworkMessage) 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 //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 //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; predictedState = open;
resetPredictionTimer = 1.0f; resetPredictionTimer = 1.0f;
} }
else else
{ {
if (!isNetworkMessage) PlaySound(ActionType.OnUse, item.WorldPosition);
isOpen = open; isOpen = open;
} }