From 4e20fe871fd20156438f42b4f4b663c67ea6c718 Mon Sep 17 00:00:00 2001 From: Joonas Rikkonen Date: Thu, 25 Apr 2019 17:43:13 +0300 Subject: [PATCH] (7f12d8742) More reliable firesource syncing: instead of just creating a network event when a firesource is created/removed and trusting that the fire behaves deterministically enough to stay in sync between the client and server, create events at 0.5 s intervals when there's fire in a hull. Closes #721 --- .../Source/Characters/Animation/Ragdoll.cs | 6 ------ Barotrauma/BarotraumaServer/Source/Map/Hull.cs | 3 ++- Barotrauma/BarotraumaShared/Source/Map/Hull.cs | 10 ---------- 3 files changed, 2 insertions(+), 17 deletions(-) diff --git a/Barotrauma/BarotraumaClient/Source/Characters/Animation/Ragdoll.cs b/Barotrauma/BarotraumaClient/Source/Characters/Animation/Ragdoll.cs index cb38edd0c..09a4fc0cb 100644 --- a/Barotrauma/BarotraumaClient/Source/Characters/Animation/Ragdoll.cs +++ b/Barotrauma/BarotraumaClient/Source/Characters/Animation/Ragdoll.cs @@ -257,12 +257,6 @@ namespace Barotrauma } } - } - if (Character.Controlled == character) - { - GameMain.GameScreen.Cam.Shake = Math.Min(Math.Max(strongestImpact, GameMain.GameScreen.Cam.Shake), 3.0f); - } - } if (character.MemLocalState.Count > 120) character.MemLocalState.RemoveRange(0, character.MemLocalState.Count - 120); character.MemState.Clear(); diff --git a/Barotrauma/BarotraumaServer/Source/Map/Hull.cs b/Barotrauma/BarotraumaServer/Source/Map/Hull.cs index 3b10a7a24..3fc9ec6d3 100644 --- a/Barotrauma/BarotraumaServer/Source/Map/Hull.cs +++ b/Barotrauma/BarotraumaServer/Source/Map/Hull.cs @@ -33,7 +33,8 @@ namespace Barotrauma //update client hulls if the amount of water has changed by >10% //or if oxygen percentage has changed by 5% if (Math.Abs(lastSentVolume - waterVolume) > Volume * 0.1f || - Math.Abs(lastSentOxygen - OxygenPercentage) > 5f) + Math.Abs(lastSentOxygen - OxygenPercentage) > 5f || + FireSources.Count > 0) { sendUpdateTimer -= deltaTime; if (sendUpdateTimer < 0.0f) diff --git a/Barotrauma/BarotraumaShared/Source/Map/Hull.cs b/Barotrauma/BarotraumaShared/Source/Map/Hull.cs index 4c3b594d6..23fc81dce 100644 --- a/Barotrauma/BarotraumaShared/Source/Map/Hull.cs +++ b/Barotrauma/BarotraumaShared/Source/Map/Hull.cs @@ -417,11 +417,6 @@ namespace Barotrauma public void AddFireSource(FireSource fireSource) { FireSources.Add(fireSource); - - if (GameMain.NetworkMember != null && GameMain.NetworkMember.IsServer && !IdFreed) - { - GameMain.NetworkMember.CreateEntityEvent(this); - } } public override void Update(float deltaTime, Camera cam) @@ -589,11 +584,6 @@ namespace Barotrauma public void RemoveFire(FireSource fire) { FireSources.Remove(fire); - - if (GameMain.NetworkMember != null && GameMain.NetworkMember.IsServer && !Removed && !IdFreed) - { - GameMain.NetworkMember.CreateEntityEvent(this); - } } public IEnumerable GetConnectedHulls(int? searchDepth)