]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Autoattacking weapons (#23765)
authorNemanja <98561806+EmoGarbage404@users.noreply.github.com>
Tue, 9 Jan 2024 07:25:07 +0000 (02:25 -0500)
committerGitHub <noreply@github.com>
Tue, 9 Jan 2024 07:25:07 +0000 (00:25 -0700)
auto attacks

Content.Client/Weapons/Melee/MeleeWeaponSystem.cs
Content.Shared/Weapons/Melee/MeleeWeaponComponent.cs
Resources/Prototypes/Entities/Clothing/Hands/gloves.yml
Resources/Prototypes/Entities/Objects/Weapons/Melee/chainsaw.yml
Resources/Prototypes/Entities/Objects/Weapons/Melee/pickaxe.yml

index 2d2883d8b7698ad0acf3d01f166001c0df28f03b..2676a7ea6a921a9b6b83154a6ba6596bd9c1d3b8 100644 (file)
@@ -69,7 +69,7 @@ public sealed partial class MeleeWeaponSystem : SharedMeleeWeaponSystem
         var useDown = _inputSystem.CmdStates.GetState(EngineKeyFunctions.Use);
         var altDown = _inputSystem.CmdStates.GetState(EngineKeyFunctions.UseSecondary);
 
-        if (useDown != BoundKeyState.Down && altDown != BoundKeyState.Down)
+        if (weapon.AutoAttack || useDown != BoundKeyState.Down && altDown != BoundKeyState.Down)
         {
             if (weapon.Attacking)
             {
index d76d7340ff12ea4d531bff82af8fbb738c833b02..cec7402faca4002c9324223fcf06a0dfd6a231b6 100644 (file)
@@ -60,6 +60,12 @@ public sealed partial class MeleeWeaponComponent : Component
     [ViewVariables(VVAccess.ReadWrite), AutoNetworkedField]
     public bool Attacking = false;
 
+    /// <summary>
+    /// If true, attacks will be repeated automatically without requiring the mouse button to be lifted.
+    /// </summary>
+    [DataField, ViewVariables(VVAccess.ReadWrite), AutoNetworkedField]
+    public bool AutoAttack;
+
     /// <summary>
     /// Base damage for this weapon. Can be modified via heavy damage or other means.
     /// </summary>
index 3780be491b73b2f045e3bedf03c9bc2dbbb25d7f..270ecf94dd61de7c278e8320fa006fa996404265 100644 (file)
   - type: Clothing
     sprite: Clothing/Hands/Gloves/northstar.rsi
   - type: MeleeWeapon
+    autoAttack: true
     attackRate: 4
     damage:
       types:
index dcead72ce64466bb63041e2d199b6cc8586d9792..bfdd94add6c05832b2ae67e6c19fd3add40340ce 100644 (file)
     sprite: Objects/Weapons/Melee/chainsaw.rsi
     state: icon
   - type: MeleeWeapon
+    autoAttack: true
+    angle: 0
     wideAnimationRotation: -135
+    attackRate: 4
     damage:
       types:
-        Slash: 5
-        Blunt: 5
-        Structural: 10
+        Slash: 2
+        Blunt: 2
+        Structural: 4
     soundHit:
       path: /Audio/Weapons/chainsaw.ogg
       params:
@@ -27,8 +30,8 @@
   - type: IncreaseDamageOnWield
     damage:
       types:
-        Slash: 10
-        Structural: 10
+        Slash: 4
+        Structural: 4
   - type: Item
     size: Normal
     sprite: Objects/Weapons/Melee/chainsaw.rsi
index b252d286d10d1f1947cfbc8a8494517b37104426..21c1cedd01f824e2bff76b5fcbdb193249852ac5 100644 (file)
@@ -49,6 +49,8 @@
     sprite: Objects/Tools/handdrill.rsi
     state: handdrill
   - type: MeleeWeapon
+    autoAttack: true
+    angle: 0
     wideAnimationRotation: -90
     soundHit:
       path: "/Audio/Items/drill_hit.ogg"