(8f9250974) Fix spritesheet orientation offestting the joint widgets in the wrong direction, which made it a bit difficult to use.
This commit is contained in:
@@ -369,7 +369,16 @@ namespace Barotrauma
|
||||
|
||||
float movementAngle = MathUtils.VectorToAngle(movement) - MathHelper.PiOver2;
|
||||
|
||||
float mainLimbAngle = (MainLimb.type == LimbType.Torso ? TorsoAngle.Value : HeadAngle.Value) * Dir;
|
||||
float mainLimbAngle = 0;
|
||||
if (MainLimb.type == LimbType.Torso && TorsoAngle.HasValue)
|
||||
{
|
||||
mainLimbAngle = TorsoAngle.Value;
|
||||
}
|
||||
else if (MainLimb.type == LimbType.Head && HeadAngle.HasValue)
|
||||
{
|
||||
mainLimbAngle = HeadAngle.Value;
|
||||
}
|
||||
mainLimbAngle *= Dir;
|
||||
while (MainLimb.Rotation - (movementAngle + mainLimbAngle) > MathHelper.Pi)
|
||||
{
|
||||
movementAngle += MathHelper.TwoPi;
|
||||
@@ -408,7 +417,7 @@ namespace Barotrauma
|
||||
}
|
||||
}
|
||||
}
|
||||
while (MainLimb.Rotation - (movementAngle + mainLimbAngle) < -MathHelper.Pi)
|
||||
else
|
||||
{
|
||||
movementAngle = Dir > 0 ? -MathHelper.PiOver2 : MathHelper.PiOver2;
|
||||
if (MainLimb.type == LimbType.Head && HeadAngle.HasValue)
|
||||
@@ -683,12 +692,6 @@ namespace Barotrauma
|
||||
|
||||
limb.body.ApplyForce(diff * (float)(Math.Sin(WalkPos) * Math.Sqrt(limb.Mass)) * 30.0f * animStrength);
|
||||
}
|
||||
while (referenceLimb.Rotation - angle < -MathHelper.TwoPi)
|
||||
{
|
||||
angle -= MathHelper.TwoPi;
|
||||
}
|
||||
|
||||
limb?.body.SmoothRotate(angle, torque, wrapAngle: false);
|
||||
}
|
||||
|
||||
private void SmoothRotateWithoutWrapping(Limb limb, float angle, Limb referenceLimb, float torque)
|
||||
|
||||
+1
-1
@@ -99,7 +99,7 @@ namespace Barotrauma
|
||||
public static string GetDefaultFolder(string speciesName) => $"Content/Characters/{speciesName.CapitaliseFirstInvariant()}/Animations/";
|
||||
public static string GetDefaultFile(string speciesName, AnimationType animType) => $"{GetFolder(speciesName)}{GetDefaultFileName(speciesName, animType)}.xml";
|
||||
|
||||
protected static string GetFolder(string speciesName)
|
||||
public static string GetFolder(string speciesName)
|
||||
{
|
||||
var folder = XMLExtensions.TryLoadXml(Character.GetConfigFile(speciesName))?.Root?.Element("animations")?.GetAttributeString("folder", string.Empty);
|
||||
if (string.IsNullOrEmpty(folder) || folder.ToLowerInvariant() == "default")
|
||||
|
||||
+1
-1
@@ -79,7 +79,7 @@ namespace Barotrauma
|
||||
new XAttribute("sourcerect", $"0, 0, 1, 1")))
|
||||
};
|
||||
|
||||
protected static string GetFolder(string speciesName)
|
||||
public static string GetFolder(string speciesName)
|
||||
{
|
||||
var folder = XMLExtensions.TryLoadXml(Character.GetConfigFile(speciesName))?.Root?.Element("ragdolls")?.GetAttributeString("folder", string.Empty);
|
||||
if (string.IsNullOrEmpty(folder) || folder.ToLowerInvariant() == "default")
|
||||
|
||||
@@ -1035,78 +1035,6 @@ namespace Barotrauma
|
||||
|
||||
CheckValidity();
|
||||
|
||||
CheckValidity();
|
||||
|
||||
CheckValidity();
|
||||
|
||||
CheckValidity();
|
||||
|
||||
CheckValidity();
|
||||
|
||||
CheckValidity();
|
||||
|
||||
CheckValidity();
|
||||
|
||||
CheckValidity();
|
||||
|
||||
CheckValidity();
|
||||
|
||||
CheckValidity();
|
||||
|
||||
CheckValidity();
|
||||
|
||||
CheckValidity();
|
||||
|
||||
CheckValidity();
|
||||
|
||||
CheckValidity();
|
||||
|
||||
CheckValidity();
|
||||
|
||||
CheckValidity();
|
||||
|
||||
CheckValidity();
|
||||
|
||||
CheckValidity();
|
||||
|
||||
CheckValidity();
|
||||
|
||||
CheckValidity();
|
||||
|
||||
CheckValidity();
|
||||
|
||||
CheckValidity();
|
||||
|
||||
CheckValidity();
|
||||
|
||||
CheckValidity();
|
||||
|
||||
CheckValidity();
|
||||
|
||||
CheckValidity();
|
||||
|
||||
CheckValidity();
|
||||
|
||||
CheckValidity();
|
||||
|
||||
CheckValidity();
|
||||
|
||||
CheckValidity();
|
||||
|
||||
CheckValidity();
|
||||
|
||||
CheckValidity();
|
||||
|
||||
CheckValidity();
|
||||
|
||||
CheckValidity();
|
||||
|
||||
CheckValidity();
|
||||
|
||||
CheckValidity();
|
||||
|
||||
CheckValidity();
|
||||
|
||||
UpdateNetPlayerPosition(deltaTime);
|
||||
CheckDistFromCollider();
|
||||
UpdateCollisionCategories();
|
||||
@@ -1367,17 +1295,42 @@ namespace Barotrauma
|
||||
UpdateProjSpecific(deltaTime);
|
||||
}
|
||||
|
||||
private void CheckValidity()
|
||||
public bool Invalid { get; private set; }
|
||||
private int validityResets;
|
||||
private bool CheckValidity()
|
||||
{
|
||||
CheckValidity(Collider);
|
||||
bool isColliderValid = CheckValidity(Collider);
|
||||
bool limbsValid = true;
|
||||
foreach (Limb limb in limbs)
|
||||
{
|
||||
if (limb.body == null || !limb.body.Enabled) { continue; }
|
||||
CheckValidity(limb.body);
|
||||
if (!CheckValidity(limb.body))
|
||||
{
|
||||
limbsValid = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
bool isValid = isColliderValid && limbsValid;
|
||||
if (!isValid)
|
||||
{
|
||||
validityResets++;
|
||||
if (validityResets > 1)
|
||||
{
|
||||
Invalid = true;
|
||||
DebugConsole.ThrowError("Invalid ragdoll physics. Ragdoll freezed to prevent crashes.");
|
||||
Collider.SetTransform(Vector2.Zero, 0.0f);
|
||||
foreach (Limb limb in Limbs)
|
||||
{
|
||||
limb.body.SetTransform(Collider.SimPosition, 0.0f);
|
||||
limb.body.ResetDynamics();
|
||||
}
|
||||
Frozen = true;
|
||||
}
|
||||
}
|
||||
return isValid;
|
||||
}
|
||||
|
||||
private void CheckValidity(PhysicsBody body)
|
||||
private bool CheckValidity(PhysicsBody body)
|
||||
{
|
||||
string errorMsg = null;
|
||||
string bodyName = body.UserData is Limb ? "Limb" : "Collider";
|
||||
@@ -1429,9 +1382,9 @@ namespace Barotrauma
|
||||
limb.body.ResetDynamics();
|
||||
}
|
||||
SetInitialLimbPositions();
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
UpdateProjSpecific(deltaTime);
|
||||
return true;
|
||||
}
|
||||
|
||||
partial void UpdateProjSpecific(float deltaTime);
|
||||
|
||||
Reference in New Issue
Block a user