Faction Test 100.13.0.0

This commit is contained in:
Markus Isberg
2023-01-11 15:36:23 +02:00
parent 1650735468
commit caa5a2f762
145 changed files with 2100 additions and 1111 deletions
@@ -24,7 +24,7 @@ namespace Barotrauma
public bool IsAiming => wasAiming;
public bool IsAimingMelee => wasAimingMelee;
protected bool Aiming => aiming || aimingMelee || LockFlippingUntil > Timing.TotalTime && character.IsKeyDown(InputType.Aim);
protected bool Aiming => aiming || aimingMelee || FlipLockTime > Timing.TotalTime && character.IsKeyDown(InputType.Aim);
public float ArmLength => upperArmLength + forearmLength;
@@ -278,7 +278,11 @@ namespace Barotrauma
// We need some margin, because if a hatch has closed, it's possible that the height from floor is slightly negative.
public bool IsAboveFloor => GetHeightFromFloor() > -0.1f;
public float LockFlippingUntil;
public float FlipLockTime { get; private set; }
public void LockFlipping(float time = 0.2f)
{
FlipLockTime = (float)Timing.TotalTime + time;
}
public void UpdateUseItem(bool allowMovement, Vector2 handWorldPos)
{
@@ -1023,7 +1023,7 @@ namespace Barotrauma
foreach (Limb l in Limbs)
{
if (l.IsSevered) { continue; }
if (!l.DoesFlip) { continue; }
if (!l.DoesFlip) { continue; }
if (RagdollParams.IsSpritesheetOrientationHorizontal)
{
//horizontally aligned limbs need to be flipped 180 degrees
@@ -1043,7 +1043,7 @@ namespace Barotrauma
if (l.IsSevered) { continue; }
float rotation = l.body.Rotation;
if (l.DoesFlip)
if (l.DoesMirror)
{
if (RagdollParams.IsSpritesheetOrientationHorizontal)
{
@@ -431,7 +431,7 @@ namespace Barotrauma
}
}
if (Timing.TotalTime > LockFlippingUntil && TargetDir != dir && !IsStuck)
if (Timing.TotalTime > FlipLockTime && TargetDir != dir && !IsStuck)
{
Flip();
}
@@ -1723,7 +1723,7 @@ namespace Barotrauma
{
if (target.AnimController.Dir > 0 == WorldPosition.X > target.WorldPosition.X)
{
target.AnimController.LockFlippingUntil = (float)Timing.TotalTime + 0.5f;
target.AnimController.LockFlipping(0.5f);
}
else
{
@@ -1822,16 +1822,22 @@ namespace Barotrauma
public override void Flip()
{
if (Character == null || Character.Removed)
{
LogAccessedRemovedCharacterError();
return;
}
base.Flip();
WalkPos = -WalkPos;
Limb torso = GetLimb(LimbType.Torso);
Vector2 difference;
if (torso == null) { return; }
Matrix torsoTransform = Matrix.CreateRotationZ(torso.Rotation);
Vector2 difference;
foreach (Item heldItem in character.HeldItems)
{
if (heldItem?.body != null && !heldItem.Removed && heldItem.GetComponent<Holdable>() != null)
@@ -57,17 +57,7 @@ namespace Barotrauma
{
if (limbs == null)
{
if (!accessRemovedCharacterErrorShown)
{
string errorMsg = "Attempted to access a potentially removed ragdoll. Character: " + character.Name + ", id: " + character.ID + ", removed: " + character.Removed + ", ragdoll removed: " + !list.Contains(this);
errorMsg += '\n' + Environment.StackTrace.CleanupStackTrace();
DebugConsole.ThrowError(errorMsg);
GameAnalyticsManager.AddErrorEventOnce(
"Ragdoll.Limbs:AccessRemoved",
GameAnalyticsManager.ErrorSeverity.Error,
"Attempted to access a potentially removed ragdoll. Character: " + character.SpeciesName + ", id: " + character.ID + ", removed: " + character.Removed + ", ragdoll removed: " + !list.Contains(this) + "\n" + Environment.StackTrace.CleanupStackTrace());
accessRemovedCharacterErrorShown = true;
}
LogAccessedRemovedCharacterError();
return Array.Empty<Limb>();
}
return limbs;
@@ -158,6 +148,20 @@ namespace Barotrauma
}
}
public bool TryGetCollider(int index, out PhysicsBody collider)
{
collider = null;
try
{
collider = this.collider?[index];
return true;
}
catch
{
return false;
}
}
public int ColliderIndex
{
get
@@ -881,7 +885,7 @@ namespace Barotrauma
foreach (Limb limb in Limbs)
{
if (limb == null || limb.IsSevered || !limb.DoesFlip) { continue; }
if (limb == null || limb.IsSevered || !limb.DoesMirror) { continue; }
limb.Dir = Dir;
limb.MouthPos = new Vector2(-limb.MouthPos.X, limb.MouthPos.Y);
limb.MirrorPullJoint();
@@ -1436,6 +1440,21 @@ namespace Barotrauma
return true;
}
protected void LogAccessedRemovedCharacterError()
{
if (!accessRemovedCharacterErrorShown)
{
string errorMsg = "Attempted to access a potentially removed ragdoll. Character: " + character.Name + ", id: " + character.ID + ", removed: " + character.Removed + ", ragdoll removed: " + !list.Contains(this);
errorMsg += '\n' + Environment.StackTrace.CleanupStackTrace();
DebugConsole.ThrowError(errorMsg);
GameAnalyticsManager.AddErrorEventOnce(
"Ragdoll:AccessRemoved",
GameAnalyticsManager.ErrorSeverity.Error,
"Attempted to access a potentially removed ragdoll. Character: " + character.SpeciesName + ", id: " + character.ID + ", removed: " + character.Removed + ", ragdoll removed: " + !list.Contains(this) + "\n" + Environment.StackTrace.CleanupStackTrace());
accessRemovedCharacterErrorShown = true;
}
}
partial void UpdateProjSpecific(float deltaTime, Camera cam);
partial void Splash(Limb limb, Hull limbHull);