From f278ff212c5e6a13e7436114c46e7a8ef68cce23 Mon Sep 17 00:00:00 2001 From: Joonas Rikkonen Date: Mon, 8 Apr 2019 13:35:02 +0300 Subject: [PATCH] (370a5daac) Merge branch 'dev' of https://github.com/Regalis11/Barotrauma-development into dev --- .../Source/Characters/CharacterNetworking.cs | 4 +++- Barotrauma/BarotraumaServer/Source/Physics/PhysicsBody.cs | 8 +++++--- .../BarotraumaShared/Data/ContentPackages/Vanilla 0.9.xml | 1 + Barotrauma/BarotraumaShared/SharedContent.projitems | 3 +++ 4 files changed, 12 insertions(+), 4 deletions(-) diff --git a/Barotrauma/BarotraumaServer/Source/Characters/CharacterNetworking.cs b/Barotrauma/BarotraumaServer/Source/Characters/CharacterNetworking.cs index 5252292e5..3b8d62294 100644 --- a/Barotrauma/BarotraumaServer/Source/Characters/CharacterNetworking.cs +++ b/Barotrauma/BarotraumaServer/Source/Characters/CharacterNetworking.cs @@ -383,7 +383,9 @@ namespace Barotrauma tempBuffer.Write(SimPosition.X); tempBuffer.Write(SimPosition.Y); float MaxVel = NetConfig.MaxPhysicsBodyVelocity; - AnimController.Collider.LinearVelocity = NetConfig.Quantize(AnimController.Collider.LinearVelocity, -MaxVel, MaxVel, 12); + AnimController.Collider.LinearVelocity = new Vector2( + MathHelper.Clamp(AnimController.Collider.LinearVelocity.X, -MaxVel, MaxVel), + MathHelper.Clamp(AnimController.Collider.LinearVelocity.Y, -MaxVel, MaxVel)); tempBuffer.WriteRangedSingle(AnimController.Collider.LinearVelocity.X, -MaxVel, MaxVel, 12); tempBuffer.WriteRangedSingle(AnimController.Collider.LinearVelocity.Y, -MaxVel, MaxVel, 12); diff --git a/Barotrauma/BarotraumaServer/Source/Physics/PhysicsBody.cs b/Barotrauma/BarotraumaServer/Source/Physics/PhysicsBody.cs index 10580b11e..aceb6ad85 100644 --- a/Barotrauma/BarotraumaServer/Source/Physics/PhysicsBody.cs +++ b/Barotrauma/BarotraumaServer/Source/Physics/PhysicsBody.cs @@ -33,13 +33,15 @@ namespace Barotrauma if (FarseerBody.Awake) { body.Enabled = true; - body.LinearVelocity = NetConfig.Quantize(body.LinearVelocity, -MaxVel, MaxVel, 12); + body.LinearVelocity = new Vector2( + MathHelper.Clamp(body.LinearVelocity.X, -MaxVel, MaxVel), + MathHelper.Clamp(body.LinearVelocity.Y, -MaxVel, MaxVel)); msg.WriteRangedSingle(body.LinearVelocity.X, -MaxVel, MaxVel, 12); msg.WriteRangedSingle(body.LinearVelocity.Y, -MaxVel, MaxVel, 12); if (!FarseerBody.FixedRotation) { - body.AngularVelocity = NetConfig.Quantize(body.AngularVelocity, -MaxAngularVel, MaxAngularVel, 8); - msg.WriteRangedSingle(MathHelper.Clamp(body.AngularVelocity, -MaxAngularVel, MaxAngularVel), -MaxAngularVel, MaxAngularVel, 8); + body.AngularVelocity = MathHelper.Clamp(body.AngularVelocity, -MaxAngularVel, MaxAngularVel); + msg.WriteRangedSingle(body.AngularVelocity, -MaxAngularVel, MaxAngularVel, 8); } } diff --git a/Barotrauma/BarotraumaShared/Data/ContentPackages/Vanilla 0.9.xml b/Barotrauma/BarotraumaShared/Data/ContentPackages/Vanilla 0.9.xml index 7a10d5467..41f00b5a3 100644 --- a/Barotrauma/BarotraumaShared/Data/ContentPackages/Vanilla 0.9.xml +++ b/Barotrauma/BarotraumaShared/Data/ContentPackages/Vanilla 0.9.xml @@ -70,6 +70,7 @@ + diff --git a/Barotrauma/BarotraumaShared/SharedContent.projitems b/Barotrauma/BarotraumaShared/SharedContent.projitems index 0cedc6162..7fae3d1c5 100644 --- a/Barotrauma/BarotraumaShared/SharedContent.projitems +++ b/Barotrauma/BarotraumaShared/SharedContent.projitems @@ -1964,6 +1964,9 @@ PreserveNewest + + PreserveNewest +