diff --git a/Content.Client/GameObjects/Components/Weapons/Melee/MeleeWeaponArcAnimationComponent.cs b/Content.Client/GameObjects/Components/Weapons/Melee/MeleeWeaponArcAnimationComponent.cs index f2e2964c2b..ff166c8800 100644 --- a/Content.Client/GameObjects/Components/Weapons/Melee/MeleeWeaponArcAnimationComponent.cs +++ b/Content.Client/GameObjects/Components/Weapons/Melee/MeleeWeaponArcAnimationComponent.cs @@ -2,6 +2,7 @@ using Content.Shared.GameObjects.Components.Weapons.Melee; using Robust.Client.GameObjects; using Robust.Client.Graphics; using Robust.Shared.GameObjects; +using Robust.Shared.Interfaces.GameObjects; using Robust.Shared.Maths; namespace Content.Client.GameObjects.Components.Weapons.Melee @@ -24,11 +25,12 @@ namespace Content.Client.GameObjects.Components.Weapons.Melee _sprite = Owner.GetComponent(); } - public void SetData(MeleeWeaponAnimationPrototype prototype, Angle baseAngle) + public void SetData(MeleeWeaponAnimationPrototype prototype, Angle baseAngle, IEntity attacker) { _meleeWeaponAnimation = prototype; _sprite.AddLayer(new RSI.StateId(prototype.State)); _baseAngle = baseAngle; + Owner.Transform.AttachParent(attacker); } internal void Update(float frameTime) @@ -48,11 +50,12 @@ namespace Content.Client.GameObjects.Components.Weapons.Melee { case WeaponArcType.Slash: var angle = Angle.FromDegrees(_meleeWeaponAnimation.Width)/2; - Owner.Transform.LocalRotation = + Owner.Transform.WorldRotation = _baseAngle + Angle.Lerp(-angle, angle, (float) (_timer / _meleeWeaponAnimation.Length.TotalSeconds)); break; case WeaponArcType.Poke: + Owner.Transform.WorldRotation = _baseAngle; _sprite.Offset += (_meleeWeaponAnimation.Speed * frameTime, 0); break; } diff --git a/Content.Client/GameObjects/EntitySystems/MeleeWeaponSystem.cs b/Content.Client/GameObjects/EntitySystems/MeleeWeaponSystem.cs index 9691ecafb3..17dcde3023 100644 --- a/Content.Client/GameObjects/EntitySystems/MeleeWeaponSystem.cs +++ b/Content.Client/GameObjects/EntitySystems/MeleeWeaponSystem.cs @@ -54,7 +54,7 @@ namespace Content.Client.GameObjects.EntitySystems entity.Transform.LocalRotation = msg.Angle; var weaponArcAnimation = entity.GetComponent(); - weaponArcAnimation.SetData(weaponArc, msg.Angle); + weaponArcAnimation.SetData(weaponArc, msg.Angle, attacker); foreach (var uid in msg.Hits)