Server sends position updates for items when their sleep state changes, removed some redundancies from item update methods
This commit is contained in:
@@ -779,8 +779,6 @@ namespace Barotrauma
|
|||||||
|
|
||||||
isHighlighted = false;
|
isHighlighted = false;
|
||||||
|
|
||||||
isHighlighted = false;
|
|
||||||
|
|
||||||
if (body == null || !body.Enabled) return;
|
if (body == null || !body.Enabled) return;
|
||||||
|
|
||||||
System.Diagnostics.Debug.Assert(body.FarseerBody.FixtureList != null);
|
System.Diagnostics.Debug.Assert(body.FarseerBody.FixtureList != null);
|
||||||
@@ -812,14 +810,12 @@ namespace Barotrauma
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
UpdateNetPosition(deltaTime);
|
UpdateNetPosition();
|
||||||
|
|
||||||
if (!inWater || Container != null) return;
|
if (!inWater || ParentInventory != null) return;
|
||||||
|
|
||||||
ApplyWaterForces();
|
ApplyWaterForces();
|
||||||
|
CurrentHull?.ApplyFlowForces(deltaTime, this);
|
||||||
if(CurrentHull != null) CurrentHull.ApplyFlowForces(deltaTime, this);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -827,8 +823,6 @@ namespace Barotrauma
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
private void ApplyWaterForces()
|
private void ApplyWaterForces()
|
||||||
{
|
{
|
||||||
if (!InWater || Container != null || body == null || !body.Enabled) return;
|
|
||||||
|
|
||||||
float forceFactor = 1.0f;
|
float forceFactor = 1.0f;
|
||||||
if (CurrentHull != null)
|
if (CurrentHull != null)
|
||||||
{
|
{
|
||||||
@@ -2060,15 +2054,11 @@ namespace Barotrauma
|
|||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void UpdateNetPosition(float deltaTime)
|
private void UpdateNetPosition()
|
||||||
{
|
{
|
||||||
if (GameMain.Server == null) return;
|
if (GameMain.Server == null || parentInventory != null) return;
|
||||||
if (body == null || !body.Enabled || parentInventory != null) return;
|
|
||||||
|
|
||||||
float minDistance = !body.FarseerBody.Awake && prevBodyAwake ?
|
if (prevBodyAwake != body.FarseerBody.Awake || Vector2.Distance(lastSentPos, SimPosition) > NetConfig.ItemPosUpdateDistance)
|
||||||
0.1f : NetConfig.ItemPosUpdateDistance;
|
|
||||||
|
|
||||||
if (Vector2.Distance(lastSentPos, SimPosition) > minDistance)
|
|
||||||
{
|
{
|
||||||
needsPositionUpdate = true;
|
needsPositionUpdate = true;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user