Fix melee animation exception (#12806)
This commit is contained in:
@@ -125,22 +125,20 @@ public sealed partial class MeleeWeaponSystem
|
|||||||
_animation.Stop(user, MeleeLungeKey);
|
_animation.Stop(user, MeleeLungeKey);
|
||||||
_animation.Play(user, lunge, MeleeLungeKey);
|
_animation.Play(user, lunge, MeleeLungeKey);
|
||||||
|
|
||||||
// Clientside entity to spawn
|
if (localPos == Vector2.Zero || animation == null)
|
||||||
if (animation != null)
|
|
||||||
{
|
|
||||||
if (!TryComp<TransformComponent>(user, out var userXform))
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var coords = userXform.Coordinates;
|
if (!TryComp<TransformComponent>(user, out var userXform) || userXform.MapID == MapId.Nullspace)
|
||||||
var animationUid = Spawn(animation, coords);
|
return;
|
||||||
|
|
||||||
|
var animationUid = Spawn(animation, userXform.Coordinates);
|
||||||
|
|
||||||
|
if (!TryComp<SpriteComponent>(animationUid, out var sprite)
|
||||||
|
|| !TryComp<WeaponArcVisualsComponent>(animationUid, out var arcComponent))
|
||||||
|
return;
|
||||||
|
|
||||||
if (localPos != Vector2.Zero && TryComp<SpriteComponent>(animationUid, out var sprite))
|
|
||||||
{
|
|
||||||
if (TryComp<WeaponArcVisualsComponent>(animationUid, out var arcComponent))
|
|
||||||
{
|
|
||||||
sprite.NoRotation = true;
|
sprite.NoRotation = true;
|
||||||
sprite.Rotation = localPos.ToWorldAngle();
|
sprite.Rotation = localPos.ToWorldAngle();
|
||||||
|
|
||||||
var distance = Math.Clamp(localPos.Length / 2f, 0.2f, 1f);
|
var distance = Math.Clamp(localPos.Length / 2f, 0.2f, 1f);
|
||||||
|
|
||||||
switch (arcComponent.Animation)
|
switch (arcComponent.Animation)
|
||||||
@@ -165,9 +163,6 @@ public sealed partial class MeleeWeaponSystem
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private Animation GetSlashAnimation(SpriteComponent sprite, Angle arc)
|
private Animation GetSlashAnimation(SpriteComponent sprite, Angle arc)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user