diff --git a/Content.Client/Weapons/Melee/Components/WeaponArcVisualsComponent.cs b/Content.Client/Weapons/Melee/Components/WeaponArcVisualsComponent.cs index eb8672965b..b6d2ba1109 100644 --- a/Content.Client/Weapons/Melee/Components/WeaponArcVisualsComponent.cs +++ b/Content.Client/Weapons/Melee/Components/WeaponArcVisualsComponent.cs @@ -19,5 +19,6 @@ public enum WeaponArcAnimation : byte Thrust, Slash, //CrystallPunk Melee upgrade - CPSlashLight + CPSlash, + CPThrust } diff --git a/Content.Client/Weapons/Melee/MeleeWeaponSystem.Effects.cs b/Content.Client/Weapons/Melee/MeleeWeaponSystem.Effects.cs index 7e9c5e94c3..4fb9f56cb1 100644 --- a/Content.Client/Weapons/Melee/MeleeWeaponSystem.Effects.cs +++ b/Content.Client/Weapons/Melee/MeleeWeaponSystem.Effects.cs @@ -14,8 +14,6 @@ public sealed partial class MeleeWeaponSystem private const string SlashAnimationKey = "melee-slash"; private const string ThrustAnimationKey = "melee-thrust"; - private const string CPSlashLightAnimationKey = "cp-melee-slash-light"; //CrystallPunk Melee upgrade - /// /// Does all of the melee effects for a player that are predicted, i.e. character lunge and weapon animation. /// @@ -45,7 +43,6 @@ public sealed partial class MeleeWeaponSystem } var length = 1f; //CrystallPunk Melee upgrade - var scale = 1f; //CrystallPunk Melee upgrade var offset = -1f; //CrystallPunk Melee upgrade var spriteRotation = Angle.Zero; @@ -62,12 +59,10 @@ public sealed partial class MeleeWeaponSystem angle *= -1; length = meleeWeaponComponent.CPAnimationLength; //CrystallPunk Melee upgrade - scale = meleeWeaponComponent.CPAnimationScale; //CrystallPunk Melee upgrade offset = meleeWeaponComponent.CPAnimationOffset; //CrystallPunk Melee upgrade } sprite.NoRotation = true; sprite.Rotation = localPos.ToWorldAngle(); - sprite.Scale = new Vector2(scale); //CrystallPunk Melee upgrade var distance = Math.Clamp(localPos.Length() / 2f, 0.2f, 1f); var xform = _xformQuery.GetComponent(animationUid); @@ -96,12 +91,17 @@ public sealed partial class MeleeWeaponSystem _animation.Play(animationUid, GetFadeAnimation(sprite, 0f, 0.15f), FadeAnimationKey); break; //CrystallPunk MeleeUpgrade - case WeaponArcAnimation.CPSlashLight: - _animation.Play(animationUid, CPGetSlashLightAnimation(sprite, angle, spriteRotation, length, offset), CPSlashLightAnimationKey); + case WeaponArcAnimation.CPSlash: + _animation.Play(animationUid, CPGetSlashAnimation(sprite, angle, spriteRotation, length, offset), SlashAnimationKey); TransformSystem.SetParent(animationUid, xform, user, userXform); if (arcComponent.Fadeout) _animation.Play(animationUid, GetFadeAnimation(sprite, length * 0.5f, length + 0.15f), FadeAnimationKey); - + break; + case WeaponArcAnimation.CPThrust: + _animation.Play(animationUid, CPGetThrustAnimation(sprite, -offset, spriteRotation, length), ThrustAnimationKey); + TransformSystem.SetParent(animationUid, xform, user, userXform); + if (arcComponent.Fadeout) + _animation.Play(animationUid, GetFadeAnimation(sprite, 0f, 0.15f), FadeAnimationKey); break; //CrystallPunk MeleeUpgrade end } @@ -219,8 +219,8 @@ public sealed partial class MeleeWeaponSystem KeyFrames = { new AnimationTrackProperty.KeyFrame(Vector2.Zero, 0f), //CrystallPunk MeleeUpgrade - new AnimationTrackProperty.KeyFrame(direction.Normalized() * 0.15f, length/2), //CrystallPunk MeleeUpgrade - new AnimationTrackProperty.KeyFrame(Vector2.Zero, length) + new AnimationTrackProperty.KeyFrame(direction.Normalized() * 0.15f, length*0.4f), //CrystallPunk MeleeUpgrade + new AnimationTrackProperty.KeyFrame(Vector2.Zero, length*0.8f) //CrystallPunk MeleeUpgrade } } } @@ -228,7 +228,7 @@ public sealed partial class MeleeWeaponSystem } //CrystallPunk MeleeUpgrade start - private Animation CPGetSlashLightAnimation(SpriteComponent sprite, Angle arc, Angle spriteRotation, float length, float offset = -1f) + private Animation CPGetSlashAnimation(SpriteComponent sprite, Angle arc, Angle spriteRotation, float length, float offset = -1f) { var startRotation = sprite.Rotation + (arc * 0.5f); var endRotation = sprite.Rotation - (arc * 0.5f); @@ -270,6 +270,34 @@ public sealed partial class MeleeWeaponSystem } }; } + + private Animation CPGetThrustAnimation(SpriteComponent sprite, float distance, Angle spriteRotation, float length) + { + var startOffset = sprite.Rotation.RotateVec(new Vector2(0f, -distance / 5f)); + var endOffset = sprite.Rotation.RotateVec(new Vector2(0f, -distance)); + + sprite.Rotation += spriteRotation; + + return new Animation() + { + Length = TimeSpan.FromSeconds(length), + AnimationTracks = + { + new AnimationTrackComponentProperty() + { + ComponentType = typeof(SpriteComponent), + Property = nameof(SpriteComponent.Offset), + KeyFrames = + { + new AnimationTrackProperty.KeyFrame(Vector2.Lerp(startOffset, endOffset, 0f), length * 0f), + new AnimationTrackProperty.KeyFrame(Vector2.Lerp(startOffset, endOffset, 1f), length * 0.5f), + new AnimationTrackProperty.KeyFrame(Vector2.Lerp(startOffset, endOffset, 0.9f), length * 0.8f), + } + }, + } + }; + } + //CrystallPunk MeleeUpgrade end } diff --git a/Content.Shared/Weapons/Melee/MeleeWeaponComponent.cs b/Content.Shared/Weapons/Melee/MeleeWeaponComponent.cs index 29b25e73e3..618d77f133 100644 --- a/Content.Shared/Weapons/Melee/MeleeWeaponComponent.cs +++ b/Content.Shared/Weapons/Melee/MeleeWeaponComponent.cs @@ -125,12 +125,6 @@ public sealed partial class MeleeWeaponComponent : Component [DataField] public float CPAnimationLength = 0.5f; - /// - /// CrystallPunk Melee upgrade. Scale arc (for small knife ex.) - /// - [DataField] - public float CPAnimationScale = 1f; - /// /// CrystallPunk Melee upgrade. how far away from the player the animation should be played. /// diff --git a/Resources/Prototypes/_CP14/Entities/Effects/weapon_arc.yml b/Resources/Prototypes/_CP14/Entities/Effects/weapon_arc.yml index d9103eaf62..f7d9b747d5 100644 --- a/Resources/Prototypes/_CP14/Entities/Effects/weapon_arc.yml +++ b/Resources/Prototypes/_CP14/Entities/Effects/weapon_arc.yml @@ -1,7 +1,15 @@ - type: entity - id: CPWeaponArcSlashLight + id: CPWeaponArcSlash parent: WeaponArcStatic noSpawn: true components: - type: WeaponArcVisuals - animation: CPSlashLight \ No newline at end of file + animation: CPSlash + +- type: entity + id: CPWeaponArcThrust + parent: WeaponArcStatic + noSpawn: true + components: + - type: WeaponArcVisuals + animation: CPThrust \ No newline at end of file diff --git a/Resources/Prototypes/_CP14/Entities/Objects/Weapons/Melee/dagger.yml b/Resources/Prototypes/_CP14/Entities/Objects/Weapons/Melee/dagger.yml index 9df1e833b6..45aee09e2b 100644 --- a/Resources/Prototypes/_CP14/Entities/Objects/Weapons/Melee/dagger.yml +++ b/Resources/Prototypes/_CP14/Entities/Objects/Weapons/Melee/dagger.yml @@ -19,7 +19,7 @@ - type: MeleeWeapon attackRate: 1.8 wideAnimationRotation: 225 - wideAnimation: CPWeaponArcSlashLight + wideAnimation: CPWeaponArcSlash damage: types: Slash: 5 diff --git a/Resources/Prototypes/_CP14/Entities/Objects/Weapons/Melee/handheldAxe.yml b/Resources/Prototypes/_CP14/Entities/Objects/Weapons/Melee/handheldAxe.yml index b335b9bd00..dcffad050f 100644 --- a/Resources/Prototypes/_CP14/Entities/Objects/Weapons/Melee/handheldAxe.yml +++ b/Resources/Prototypes/_CP14/Entities/Objects/Weapons/Melee/handheldAxe.yml @@ -19,7 +19,7 @@ attackRate: 1.4 range: 1.2 wideAnimationRotation: 225 - wideAnimation: CPWeaponArcSlashLight + wideAnimation: CPWeaponArcSlash damage: types: Slash: 10 diff --git a/Resources/Prototypes/_CP14/Entities/Objects/Weapons/Melee/lightHammer.yml b/Resources/Prototypes/_CP14/Entities/Objects/Weapons/Melee/lightHammer.yml index d946996092..8f1b83b7c4 100644 --- a/Resources/Prototypes/_CP14/Entities/Objects/Weapons/Melee/lightHammer.yml +++ b/Resources/Prototypes/_CP14/Entities/Objects/Weapons/Melee/lightHammer.yml @@ -18,7 +18,7 @@ - type: MeleeWeapon attackRate: 1.5 wideAnimationRotation: 225 - wideAnimation: CPWeaponArcSlashLight + wideAnimation: CPWeaponArcSlash cPAnimationLength: 0.18 damage: types: diff --git a/Resources/Prototypes/_CP14/Entities/Objects/Weapons/Melee/mace.yml b/Resources/Prototypes/_CP14/Entities/Objects/Weapons/Melee/mace.yml new file mode 100644 index 0000000000..388dd88f1d --- /dev/null +++ b/Resources/Prototypes/_CP14/Entities/Objects/Weapons/Melee/mace.yml @@ -0,0 +1,25 @@ +- type: entity + id: CPBaseMace + parent: + - BaseItem + name: булава + description: Тяжелый кусок металла на длинной палке. Что может быть проще? + components: + - type: Item + size: Large + - type: Sprite + sprite: _CP14/Objects/Weapons/Melee/Mace/mace.rsi + layers: + - state: icon + - type: Sharp + - type: MeleeWeapon + attackRate: 0.7 + wideAnimationRotation: 205 + wideAnimation: CPWeaponArcSlash + damage: + types: + Blunt: 25 + Piercing: 5 + soundHit: + collection: MetalThud + cPAnimationLength: 0.25 \ No newline at end of file diff --git a/Resources/Prototypes/_CP14/Entities/Objects/Weapons/Melee/sickle.yml b/Resources/Prototypes/_CP14/Entities/Objects/Weapons/Melee/sickle.yml index c7a3ded97a..6a1ac9f498 100644 --- a/Resources/Prototypes/_CP14/Entities/Objects/Weapons/Melee/sickle.yml +++ b/Resources/Prototypes/_CP14/Entities/Objects/Weapons/Melee/sickle.yml @@ -17,7 +17,7 @@ - type: MeleeWeapon attackRate: 1.5 wideAnimationRotation: 225 - wideAnimation: CPWeaponArcSlashLight + wideAnimation: CPWeaponArcSlash cPAnimationLength: 0.18 damage: types: diff --git a/Resources/Prototypes/_CP14/Entities/Objects/Weapons/Melee/spear.yml b/Resources/Prototypes/_CP14/Entities/Objects/Weapons/Melee/spear.yml new file mode 100644 index 0000000000..aef1dca906 --- /dev/null +++ b/Resources/Prototypes/_CP14/Entities/Objects/Weapons/Melee/spear.yml @@ -0,0 +1,41 @@ +- type: entity + id: CPBaseThrowableSpear + parent: + - BaseItem + - CPBaseWeaponChemical + - CPBaseWeaponThrowable + name: метательное копье + description: Оружие, исправно выполняющее свой долг еще со времен эпохи драконов. + components: + - type: Item + storedRotation: 0 + size: Large + - type: Sprite + sprite: _CP14/Objects/Weapons/Melee/ThrowableSpear/throwableSpear.rsi + layers: + - state: icon + - type: Sharp + - type: MeleeWeapon + attackRate: 1 + wideAnimationRotation: -115 + wideAnimation: CPWeaponArcThrust + damage: + types: + Piercing: 24 + soundHit: + collection: MetalThud + cPAnimationLength: 0.25 + cPAnimationOffset: -1.3 + - type: EmbeddableProjectile + offset: 0.15,0.15 + removalTime: 1.5 + - type: ThrowingAngle + angle: 245 + - type: DamageOtherOnHit + damage: + types: + Piercing: 20 + - type: DamageOnLand + damage: + types: + Piercing: 20 \ No newline at end of file diff --git a/Resources/Prototypes/_CP14/Entities/Objects/Weapons/Melee/twoHandedSword.yml b/Resources/Prototypes/_CP14/Entities/Objects/Weapons/Melee/twoHandedSword.yml index 82c27e6dab..1c29a5c725 100644 --- a/Resources/Prototypes/_CP14/Entities/Objects/Weapons/Melee/twoHandedSword.yml +++ b/Resources/Prototypes/_CP14/Entities/Objects/Weapons/Melee/twoHandedSword.yml @@ -21,7 +21,7 @@ - type: MeleeWeapon attackRate: 0.5 wideAnimationRotation: 205 - wideAnimation: CPWeaponArcSlashLight + wideAnimation: CPWeaponArcSlash damage: types: Slash: 5 diff --git a/Resources/Textures/_CP14/Objects/Weapons/Melee/Mace/mace.rsi/icon.png b/Resources/Textures/_CP14/Objects/Weapons/Melee/Mace/mace.rsi/icon.png new file mode 100644 index 0000000000..f7a98c91f5 Binary files /dev/null and b/Resources/Textures/_CP14/Objects/Weapons/Melee/Mace/mace.rsi/icon.png differ diff --git a/Resources/Textures/_CP14/Objects/Weapons/Melee/Mace/mace.rsi/inhand-left.png b/Resources/Textures/_CP14/Objects/Weapons/Melee/Mace/mace.rsi/inhand-left.png new file mode 100644 index 0000000000..c0fec43c7d Binary files /dev/null and b/Resources/Textures/_CP14/Objects/Weapons/Melee/Mace/mace.rsi/inhand-left.png differ diff --git a/Resources/Textures/_CP14/Objects/Weapons/Melee/Mace/mace.rsi/inhand-right.png b/Resources/Textures/_CP14/Objects/Weapons/Melee/Mace/mace.rsi/inhand-right.png new file mode 100644 index 0000000000..1d9e84ea7d Binary files /dev/null and b/Resources/Textures/_CP14/Objects/Weapons/Melee/Mace/mace.rsi/inhand-right.png differ diff --git a/Resources/Textures/_CP14/Objects/Weapons/Melee/Mace/mace.rsi/meta.json b/Resources/Textures/_CP14/Objects/Weapons/Melee/Mace/mace.rsi/meta.json new file mode 100644 index 0000000000..c3fe6dd6e0 --- /dev/null +++ b/Resources/Textures/_CP14/Objects/Weapons/Melee/Mace/mace.rsi/meta.json @@ -0,0 +1,22 @@ +{ + "version": 1, + "license": "CC-BY-NC-SA-3.0", + "copyright": "Created by link (Discord) for CrystallPunk", + "size": { + "x": 32, + "y": 32 + }, + "states": [ + { + "name": "icon" + }, + { + "name": "inhand-left", + "directions": 4 + }, + { + "name": "inhand-right", + "directions": 4 + } + ] +} diff --git a/Resources/Textures/_CP14/Objects/Weapons/Melee/HandheldSpear/handheldSpear.rsi/icon.png b/Resources/Textures/_CP14/Objects/Weapons/Melee/ThrowableSpear/throwableSpear.rsi/icon.png similarity index 100% rename from Resources/Textures/_CP14/Objects/Weapons/Melee/HandheldSpear/handheldSpear.rsi/icon.png rename to Resources/Textures/_CP14/Objects/Weapons/Melee/ThrowableSpear/throwableSpear.rsi/icon.png diff --git a/Resources/Textures/_CP14/Objects/Weapons/Melee/HandheldSpear/handheldSpear.rsi/inhand-left.png b/Resources/Textures/_CP14/Objects/Weapons/Melee/ThrowableSpear/throwableSpear.rsi/inhand-left.png similarity index 100% rename from Resources/Textures/_CP14/Objects/Weapons/Melee/HandheldSpear/handheldSpear.rsi/inhand-left.png rename to Resources/Textures/_CP14/Objects/Weapons/Melee/ThrowableSpear/throwableSpear.rsi/inhand-left.png diff --git a/Resources/Textures/_CP14/Objects/Weapons/Melee/HandheldSpear/handheldSpear.rsi/inhand-right.png b/Resources/Textures/_CP14/Objects/Weapons/Melee/ThrowableSpear/throwableSpear.rsi/inhand-right.png similarity index 100% rename from Resources/Textures/_CP14/Objects/Weapons/Melee/HandheldSpear/handheldSpear.rsi/inhand-right.png rename to Resources/Textures/_CP14/Objects/Weapons/Melee/ThrowableSpear/throwableSpear.rsi/inhand-right.png diff --git a/Resources/Textures/_CP14/Objects/Weapons/Melee/HandheldSpear/handheldSpear.rsi/meta.json b/Resources/Textures/_CP14/Objects/Weapons/Melee/ThrowableSpear/throwableSpear.rsi/meta.json similarity index 100% rename from Resources/Textures/_CP14/Objects/Weapons/Melee/HandheldSpear/handheldSpear.rsi/meta.json rename to Resources/Textures/_CP14/Objects/Weapons/Melee/ThrowableSpear/throwableSpear.rsi/meta.json