Merge branch 'master' of https://github.com/Regalis11/Barotrauma into develop

This commit is contained in:
Evil Factory
2025-09-17 08:30:35 -03:00
121 changed files with 2582 additions and 635 deletions
@@ -1,5 +1,6 @@
using Barotrauma.Networking;
using Microsoft.Xna.Framework;
using System;
using System.Linq;
namespace Barotrauma.Items.Components
@@ -197,7 +198,16 @@ namespace Barotrauma.Items.Components
item.Drop(CurrentThrower, createNetworkEvent: GameMain.NetworkMember == null || GameMain.NetworkMember.IsServer);
item.WaterDragCoefficient = WaterDragCoefficient;
item.body.ApplyLinearImpulse(throwVector * ThrowForce * item.body.Mass * 3.0f, maxVelocity: NetConfig.MaxPhysicsBodyVelocity);
float throwForce = ThrowForce;
//Reduce force when aiming down
float downwardsDotProduct = Vector2.Dot(-Vector2.UnitY, throwVector); //1 when pointing directly down, 0 when sideways, -1 when up
if (downwardsDotProduct > 0)
{
throwForce *= (1.0f - downwardsDotProduct * 0.7f);
}
item.body.ApplyLinearImpulse(throwVector * throwForce * item.body.Mass * 3.0f, maxVelocity: NetConfig.MaxPhysicsBodyVelocity);
//disable platform collisions until the item comes back to rest again
item.body.CollidesWith = Physics.CollisionWall | Physics.CollisionLevel;