Merge branch 'master' of https://github.com/Regalis11/Barotrauma.git
This commit is contained in:
@@ -305,7 +305,27 @@ namespace Barotrauma
|
||||
public abstract float? TorsoPosition { get; }
|
||||
public abstract float? TorsoAngle { get; }
|
||||
|
||||
public float ImpactTolerance => RagdollParams.ImpactTolerance;
|
||||
float? impactTolerance;
|
||||
public float ImpactTolerance
|
||||
{
|
||||
get
|
||||
{
|
||||
if (impactTolerance == null)
|
||||
{
|
||||
impactTolerance = RagdollParams.ImpactTolerance;
|
||||
if (character.Params.VariantFile != null)
|
||||
{
|
||||
float? tolerance = character.Params.VariantFile.Root.GetChildElement("ragdoll")?.GetAttributeFloat("impacttolerance", impactTolerance.Value);
|
||||
if (tolerance.HasValue)
|
||||
{
|
||||
impactTolerance = tolerance;
|
||||
}
|
||||
}
|
||||
}
|
||||
return impactTolerance.Value;
|
||||
}
|
||||
}
|
||||
|
||||
public bool Draggable => RagdollParams.Draggable;
|
||||
public bool CanEnterSubmarine => RagdollParams.CanEnterSubmarine;
|
||||
|
||||
@@ -764,8 +784,8 @@ namespace Barotrauma
|
||||
if (limbDiff.LengthSquared() < 0.0001f) { limbDiff = Rand.Vector(1.0f); }
|
||||
limbDiff = Vector2.Normalize(limbDiff);
|
||||
float mass = limbJoint.BodyA.Mass + limbJoint.BodyB.Mass;
|
||||
limbJoint.LimbA.body.ApplyLinearImpulse(limbDiff * mass, (limbJoint.LimbA.SimPosition + limbJoint.LimbB.SimPosition) / 2.0f);
|
||||
limbJoint.LimbB.body.ApplyLinearImpulse(-limbDiff * mass, (limbJoint.LimbA.SimPosition + limbJoint.LimbB.SimPosition) / 2.0f);
|
||||
limbJoint.LimbA.body.ApplyLinearImpulse(limbDiff * Math.Min(mass, limbJoint.BodyA.Mass * 500), (limbJoint.LimbA.SimPosition + limbJoint.LimbB.SimPosition) / 2.0f);
|
||||
limbJoint.LimbB.body.ApplyLinearImpulse(-limbDiff * Math.Min(mass, limbJoint.BodyB.Mass * 500), (limbJoint.LimbA.SimPosition + limbJoint.LimbB.SimPosition) / 2.0f);
|
||||
|
||||
connectedLimbs.Clear();
|
||||
checkedJoints.Clear();
|
||||
@@ -1180,13 +1200,13 @@ namespace Barotrauma
|
||||
{
|
||||
headInWater = false;
|
||||
inWater = false;
|
||||
RefreshFloorY(ignoreStairs: Stairs == null);
|
||||
if (currentHull.WaterVolume > currentHull.Volume * 0.95f)
|
||||
{
|
||||
inWater = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
RefreshFloorY(ignoreStairs: Stairs == null);
|
||||
float waterSurface = ConvertUnits.ToSimUnits(currentHull.Surface);
|
||||
if (targetMovement.Y < 0.0f)
|
||||
{
|
||||
@@ -1841,7 +1861,7 @@ namespace Barotrauma
|
||||
float sin = (float)Math.Sin(mouthLimb.Rotation);
|
||||
Vector2 bodySize = mouthLimb.body.GetSize();
|
||||
Vector2 offset = new Vector2(mouthLimb.MouthPos.X * bodySize.X / 2, mouthLimb.MouthPos.Y * bodySize.Y / 2);
|
||||
return mouthLimb.SimPosition + new Vector2(offset.X * cos - offset.Y * sin, offset.X * sin + offset.Y * cos) * mouthLimb.Scale * RagdollParams.LimbScale;
|
||||
return mouthLimb.SimPosition + new Vector2(offset.X * cos - offset.Y * sin, offset.X * sin + offset.Y * cos);
|
||||
}
|
||||
|
||||
public Vector2 GetColliderBottom()
|
||||
|
||||
Reference in New Issue
Block a user