Click attack arcs no longer follow the player. Fixes #2079.
This commit is contained in:
@@ -25,12 +25,13 @@ namespace Content.Client.GameObjects.Components.Weapons.Melee
|
||||
_sprite = Owner.GetComponent<SpriteComponent>();
|
||||
}
|
||||
|
||||
public void SetData(MeleeWeaponAnimationPrototype prototype, Angle baseAngle, IEntity attacker)
|
||||
public void SetData(MeleeWeaponAnimationPrototype prototype, Angle baseAngle, IEntity attacker, bool followAttacker = true)
|
||||
{
|
||||
_meleeWeaponAnimation = prototype;
|
||||
_sprite.AddLayer(new RSI.StateId(prototype.State));
|
||||
_baseAngle = baseAngle;
|
||||
Owner.Transform.AttachParent(attacker);
|
||||
if(followAttacker)
|
||||
Owner.Transform.AttachParent(attacker);
|
||||
}
|
||||
|
||||
internal void Update(float frameTime)
|
||||
|
||||
@@ -56,7 +56,7 @@ namespace Content.Client.GameObjects.EntitySystems
|
||||
entity.Transform.LocalRotation = msg.Angle;
|
||||
|
||||
var weaponArcAnimation = entity.GetComponent<MeleeWeaponArcAnimationComponent>();
|
||||
weaponArcAnimation.SetData(weaponArc, msg.Angle, attacker);
|
||||
weaponArcAnimation.SetData(weaponArc, msg.Angle, attacker, msg.ArcFollowAttacker);
|
||||
|
||||
// Due to ISpriteComponent limitations, weapons that don't use an RSI won't have this effect.
|
||||
if (EntityManager.TryGetEntity(msg.Source, out var source) && msg.TextureEffect && source.TryGetComponent(out ISpriteComponent sourceSprite)
|
||||
|
||||
@@ -173,7 +173,7 @@ namespace Content.Server.GameObjects.Components.Weapon.Melee
|
||||
if (ClickArc != null)
|
||||
{
|
||||
var sys = EntitySystem.Get<MeleeWeaponSystem>();
|
||||
sys.SendAnimation(ClickArc, angle, eventArgs.User, Owner, targets, ClickAttackEffect);
|
||||
sys.SendAnimation(ClickArc, angle, eventArgs.User, Owner, targets, ClickAttackEffect, false);
|
||||
}
|
||||
|
||||
_lastAttackTime = curTime;
|
||||
|
||||
@@ -9,10 +9,10 @@ namespace Content.Server.GameObjects.EntitySystems
|
||||
{
|
||||
public sealed class MeleeWeaponSystem : EntitySystem
|
||||
{
|
||||
public void SendAnimation(string arc, Angle angle, IEntity attacker, IEntity source, IEnumerable<IEntity> hits, bool textureEffect = false)
|
||||
public void SendAnimation(string arc, Angle angle, IEntity attacker, IEntity source, IEnumerable<IEntity> hits, bool textureEffect = false, bool arcFollowAttacker = true)
|
||||
{
|
||||
RaiseNetworkEvent(new MeleeWeaponSystemMessages.PlayMeleeWeaponAnimationMessage(arc, angle, attacker.Uid, source.Uid,
|
||||
hits.Select(e => e.Uid).ToList(), textureEffect));
|
||||
hits.Select(e => e.Uid).ToList(), textureEffect, arcFollowAttacker));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ namespace Content.Shared.GameObjects.EntitySystemMessages
|
||||
[Serializable, NetSerializable]
|
||||
public sealed class PlayMeleeWeaponAnimationMessage : EntitySystemMessage
|
||||
{
|
||||
public PlayMeleeWeaponAnimationMessage(string arcPrototype, Angle angle, EntityUid attacker, EntityUid source, List<EntityUid> hits, bool textureEffect = false)
|
||||
public PlayMeleeWeaponAnimationMessage(string arcPrototype, Angle angle, EntityUid attacker, EntityUid source, List<EntityUid> hits, bool textureEffect = false, bool arcFollowAttacker = true)
|
||||
{
|
||||
ArcPrototype = arcPrototype;
|
||||
Angle = angle;
|
||||
@@ -19,6 +19,7 @@ namespace Content.Shared.GameObjects.EntitySystemMessages
|
||||
Source = source;
|
||||
Hits = hits;
|
||||
TextureEffect = textureEffect;
|
||||
ArcFollowAttacker = arcFollowAttacker;
|
||||
}
|
||||
|
||||
public string ArcPrototype { get; }
|
||||
@@ -27,6 +28,7 @@ namespace Content.Shared.GameObjects.EntitySystemMessages
|
||||
public EntityUid Source { get; }
|
||||
public List<EntityUid> Hits { get; }
|
||||
public bool TextureEffect { get; }
|
||||
public bool ArcFollowAttacker { get; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user