- The server doesn't disable client-controlled AI characters that are far from all other players.

- Clients aren't allowed to flip swimming FishAnimControllers unless the server says so (occasionally caused creatures to flip around constantly because the clients ignore the 1-second "flipping cooldown").
- Moved Character.ReadStatus to the client project.
This commit is contained in:
Joonas Rikkonen
2017-09-21 17:44:52 +03:00
parent f291a22976
commit dd86b5745a
4 changed files with 101 additions and 103 deletions
@@ -120,12 +120,10 @@ namespace Barotrauma
UpdateWalkAnim(deltaTime);
}
if (mirror || !inWater)
if (!character.IsRemotePlayer)
{
if (!character.IsRemotePlayer)
if (mirror || !inWater)
{
//targetDir = (movement.X > 0.0f) ? Direction.Right : Direction.Left;
if (targetMovement.X > 0.1f && targetMovement.X > Math.Abs(targetMovement.Y) * 0.5f)
{
TargetDir = Direction.Right;
@@ -135,40 +133,39 @@ namespace Barotrauma
TargetDir = Direction.Left;
}
}
}
else
{
Limb head = GetLimb(LimbType.Head);
if (head == null) head = GetLimb(LimbType.Torso);
float rotation = MathUtils.WrapAngleTwoPi(head.Rotation);
rotation = MathHelper.ToDegrees(rotation);
if (rotation < 0.0f) rotation += 360;
if (rotation > 20 && rotation < 160)
else
{
TargetDir = Direction.Left;
}
else if (rotation > 200 && rotation < 340)
{
TargetDir = Direction.Right;
Limb head = GetLimb(LimbType.Head);
if (head == null) head = GetLimb(LimbType.Torso);
float rotation = MathUtils.WrapAngleTwoPi(head.Rotation);
rotation = MathHelper.ToDegrees(rotation);
if (rotation < 0.0f) rotation += 360;
if (rotation > 20 && rotation < 160)
{
TargetDir = Direction.Left;
}
else if (rotation > 200 && rotation < 340)
{
TargetDir = Direction.Right;
}
}
}
if (!flip) return;
flipTimer += deltaTime;
if (TargetDir != Direction.None && TargetDir != dir)
{
if (flipTimer>1.0f || character.IsRemotePlayer)
{
if (flipTimer > 1.0f || character.IsRemotePlayer)
{
Flip();
if (mirror || !inWater) Mirror();
flipTimer = 0.0f;
}
}
}
}