Click attack arcs no longer follow the player. Fixes #2079.

This commit is contained in:
Víctor Aguilera Puerto
2020-10-12 13:17:38 +02:00
parent 77fa796a3b
commit b38b152534
5 changed files with 10 additions and 7 deletions

View File

@@ -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)

View File

@@ -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)