Change wide swing sprites to be that of the weapon used (#21050)
Co-authored-by: notquitehadouken <1isthisameme>
This commit is contained in:
@@ -11,6 +11,11 @@ public sealed class MeleeLungeEvent : EntityEventArgs
|
||||
{
|
||||
public NetEntity Entity;
|
||||
|
||||
/// <summary>
|
||||
/// The weapon used.
|
||||
/// </summary>
|
||||
public NetEntity Weapon;
|
||||
|
||||
/// <summary>
|
||||
/// Width of the attack angle.
|
||||
/// </summary>
|
||||
@@ -26,9 +31,10 @@ public sealed class MeleeLungeEvent : EntityEventArgs
|
||||
/// </summary>
|
||||
public string? Animation;
|
||||
|
||||
public MeleeLungeEvent(NetEntity entity, Angle angle, Vector2 localPos, string? animation)
|
||||
public MeleeLungeEvent(NetEntity entity, NetEntity weapon, Angle angle, Vector2 localPos, string? animation)
|
||||
{
|
||||
Entity = entity;
|
||||
Weapon = weapon;
|
||||
Angle = angle;
|
||||
LocalPos = localPos;
|
||||
Animation = animation;
|
||||
|
||||
@@ -96,6 +96,17 @@ public sealed partial class MeleeWeaponComponent : Component
|
||||
[ViewVariables(VVAccess.ReadWrite), DataField, AutoNetworkedField]
|
||||
public EntProtoId WideAnimation = "WeaponArcSlash";
|
||||
|
||||
/// <summary>
|
||||
/// Rotation of the animation.
|
||||
/// 0 degrees means the top faces the attacker.
|
||||
/// </summary>
|
||||
[ViewVariables(VVAccess.ReadWrite), DataField]
|
||||
public Angle WideAnimationRotation = Angle.Zero;
|
||||
|
||||
[ViewVariables(VVAccess.ReadWrite), DataField]
|
||||
public bool SwingLeft;
|
||||
|
||||
|
||||
// Sounds
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -423,7 +423,7 @@ public abstract class SharedMeleeWeaponSystem : EntitySystem
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
DoLungeAnimation(user, weapon.Angle, GetCoordinates(attack.Coordinates).ToMap(EntityManager, TransformSystem), weapon.Range, animation);
|
||||
DoLungeAnimation(user, weaponUid, weapon.Angle, GetCoordinates(attack.Coordinates).ToMap(EntityManager, TransformSystem), weapon.Range, animation);
|
||||
}
|
||||
|
||||
var attackEv = new MeleeAttackEvent(weaponUid);
|
||||
@@ -823,7 +823,7 @@ public abstract class SharedMeleeWeaponSystem : EntitySystem
|
||||
return true;
|
||||
}
|
||||
|
||||
private void DoLungeAnimation(EntityUid user, Angle angle, MapCoordinates coordinates, float length, string? animation)
|
||||
private void DoLungeAnimation(EntityUid user, EntityUid weapon, Angle angle, MapCoordinates coordinates, float length, string? animation)
|
||||
{
|
||||
// TODO: Assert that offset eyes are still okay.
|
||||
if (!TryComp<TransformComponent>(user, out var userXform))
|
||||
@@ -844,8 +844,8 @@ public abstract class SharedMeleeWeaponSystem : EntitySystem
|
||||
if (localPos.Length() > visualLength)
|
||||
localPos = localPos.Normalized() * visualLength;
|
||||
|
||||
DoLunge(user, angle, localPos, animation);
|
||||
DoLunge(user, weapon, angle, localPos, animation);
|
||||
}
|
||||
|
||||
public abstract void DoLunge(EntityUid user, Angle angle, Vector2 localPos, string? animation, bool predicted = true);
|
||||
public abstract void DoLunge(EntityUid user, EntityUid weapon, Angle angle, Vector2 localPos, string? animation, bool predicted = true);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user