(7d0cf0d4f) Clamp forces in a bunch of more places where forces are applied to bodies

This commit is contained in:
Joonas Rikkonen
2019-04-03 16:21:38 +03:00
parent 0844f1eae4
commit 8de2eccff2
7 changed files with 26 additions and 20 deletions
@@ -1,5 +1,6 @@
using System.Xml.Linq;
using Microsoft.Xna.Framework;
using Barotrauma.Networking;
#if CLIENT
using Microsoft.Xna.Framework.Graphics;
using Barotrauma.Particles;
@@ -83,15 +84,20 @@ namespace Barotrauma.Items.Components
foreach (Limb limb in character.AnimController.Limbs)
{
if (limb.WearingItems.Find(w => w.WearableComponent.Item == this.item)==null) continue;
limb.body.ApplyForce(propulsion);
if (limb.WearingItems.Find(w => w.WearableComponent.Item == this.item) == null) continue;
limb.body.ApplyForce(propulsion, maxVelocity: NetConfig.MaxPhysicsBodyVelocity);
}
character.AnimController.Collider.ApplyForce(propulsion);
character.AnimController.Collider.ApplyForce(propulsion, maxVelocity: NetConfig.MaxPhysicsBodyVelocity);
if (character.SelectedItems[0] == item) character.AnimController.GetLimb(LimbType.RightHand).body.ApplyForce(propulsion);
if (character.SelectedItems[1] == item) character.AnimController.GetLimb(LimbType.LeftHand).body.ApplyForce(propulsion);
if (character.SelectedItems[0] == item)
{
character.AnimController.GetLimb(LimbType.RightHand)?.body.ApplyForce(propulsion, maxVelocity: NetConfig.MaxPhysicsBodyVelocity);
}
if (character.SelectedItems[1] == item)
{
character.AnimController.GetLimb(LimbType.LeftHand)?.body.ApplyForce(propulsion, maxVelocity: NetConfig.MaxPhysicsBodyVelocity);
}
#if CLIENT
if (!string.IsNullOrWhiteSpace(particles))