]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
ninja stun change (#20503)
authordeltanedas <39013340+deltanedas@users.noreply.github.com>
Mon, 6 Nov 2023 04:08:33 +0000 (04:08 +0000)
committerGitHub <noreply@github.com>
Mon, 6 Nov 2023 04:08:33 +0000 (21:08 -0700)
* tagless fields

* add damage and paralyze instead of electrocuting

* add disable bool to RevealNinja

* raise MeleeAttackEvent on the user after swinging

* uncloak ninja after attacking

* revert RevealNinja bool

* revert meleeattack event

* revert uncloak

* validate shock prototype

* damagespecifier no validation

* ;

* :trollface:

---------

Co-authored-by: deltanedas <@deltanedas:kde.org>
Content.Server/Ninja/Systems/StunProviderSystem.cs
Content.Shared/Ninja/Components/StunProviderComponent.cs
Resources/Prototypes/Entities/Clothing/Hands/gloves.yml

index 70182e0e36f24f9c41ae6446fa0a6329f33173b5..097058f4d35c8f74d23875fb908677bc8eeccb6b 100644 (file)
@@ -1,12 +1,15 @@
 using Content.Server.Ninja.Events;
 using Content.Server.Power.EntitySystems;
-using Content.Shared.Electrocution;
+using Content.Shared.Damage;
+using Content.Shared.Damage.Prototypes;
 using Content.Shared.Interaction;
 using Content.Shared.Ninja.Components;
 using Content.Shared.Ninja.Systems;
 using Content.Shared.Popups;
+using Content.Shared.Stunnable;
 using Content.Shared.Whitelist;
 using Robust.Shared.Audio;
+using Robust.Shared.Prototypes;
 using Robust.Shared.Timing;
 
 namespace Content.Server.Ninja.Systems;
@@ -17,11 +20,13 @@ namespace Content.Server.Ninja.Systems;
 public sealed class StunProviderSystem : SharedStunProviderSystem
 {
     [Dependency] private readonly BatterySystem _battery = default!;
+    [Dependency] private readonly DamageableSystem _damageable = default!;
     [Dependency] private readonly IGameTiming _timing = default!;
+    [Dependency] private readonly IPrototypeManager _proto = default!;
     [Dependency] private readonly SharedAudioSystem _audio = default!;
-    [Dependency] private readonly SharedElectrocutionSystem _electrocution = default!;
     [Dependency] private readonly SharedNinjaGlovesSystem _gloves = default!;
     [Dependency] private readonly SharedPopupSystem _popup = default!;
+    [Dependency] private readonly SharedStunSystem _stun = default!;
 
     public override void Initialize()
     {
@@ -55,8 +60,9 @@ public sealed class StunProviderSystem : SharedStunProviderSystem
 
         _audio.PlayPvs(comp.Sound, target);
 
-        // not holding hands with target so insuls don't matter
-        _electrocution.TryDoElectrocution(target, uid, comp.StunDamage, comp.StunTime, false, ignoreInsulation: true);
+        _damageable.TryChangeDamage(target, comp.StunDamage, false, true, null, origin: uid);
+        _stun.TryParalyze(target, comp.StunTime, refresh: false);
+
         // short cooldown to prevent instant stunlocking
         comp.NextStun = _timing.CurTime + comp.Cooldown;
 
index e8eb25a1b68e27b88c6eadb0ee74498d5c75b2f5..37a27074a49f1929a2a66a1da71662574aeefe20 100644 (file)
@@ -1,3 +1,4 @@
+using Content.Shared.Damage;
 using Content.Shared.Ninja.Systems;
 using Content.Shared.Whitelist;
 using Robust.Shared.Audio;
@@ -17,49 +18,55 @@ public sealed partial class StunProviderComponent : Component
     /// The powercell entity to take power from.
     /// Determines whether stunning is possible.
     /// </summary>
-    [DataField("batteryUid"), ViewVariables(VVAccess.ReadWrite), AutoNetworkedField]
+    [DataField, ViewVariables(VVAccess.ReadWrite), AutoNetworkedField]
     public EntityUid? BatteryUid;
 
     /// <summary>
     /// Sound played when stunning someone.
     /// </summary>
-    [DataField("sound"), ViewVariables(VVAccess.ReadWrite)]
+    [DataField, ViewVariables(VVAccess.ReadWrite)]
     public SoundSpecifier Sound = new SoundCollectionSpecifier("sparks");
 
     /// <summary>
     /// Joules required in the battery to stun someone. Defaults to 10 uses on a small battery.
     /// </summary>
-    [DataField("stunCharge"), ViewVariables(VVAccess.ReadWrite)]
-    public float StunCharge = 36.0f;
+    [DataField, ViewVariables(VVAccess.ReadWrite)]
+    public float StunCharge = 36f;
 
     /// <summary>
-    /// Shock damage dealt when stunning someone
+    /// Damage dealt when stunning someone
     /// </summary>
-    [DataField("stunDamage"), ViewVariables(VVAccess.ReadWrite)]
-    public int StunDamage = 5;
+    [DataField, ViewVariables(VVAccess.ReadWrite)]
+    public DamageSpecifier StunDamage = new()
+    {
+        DamageDict = new()
+        {
+            { "Shock", 5 }
+        }
+    };
 
     /// <summary>
     /// Time that someone is stunned for, stacks if done multiple times.
     /// </summary>
-    [DataField("stunTime"), ViewVariables(VVAccess.ReadWrite)]
+    [DataField, ViewVariables(VVAccess.ReadWrite)]
     public TimeSpan StunTime = TimeSpan.FromSeconds(5);
 
     /// <summary>
     /// How long stunning is disabled after stunning something.
     /// </summary>
-    [DataField("cooldown"), ViewVariables(VVAccess.ReadWrite)]
+    [DataField, ViewVariables(VVAccess.ReadWrite)]
     public TimeSpan Cooldown = TimeSpan.FromSeconds(2);
 
     /// <summary>
     /// Locale string to popup when there is no power
     /// </summary>
-    [DataField("noPowerPopup", required: true), ViewVariables(VVAccess.ReadWrite)]
+    [DataField(required: true), ViewVariables(VVAccess.ReadWrite)]
     public string NoPowerPopup = string.Empty;
 
     /// <summary>
     /// Whitelist for what counts as a mob.
     /// </summary>
-    [DataField("whitelist")]
+    [DataField]
     public EntityWhitelist Whitelist = new()
     {
         Components = new[] {"Stamina"}
@@ -69,6 +76,6 @@ public sealed partial class StunProviderComponent : Component
     /// When someone can next be stunned.
     /// Essentially a UseDelay unique to this component.
     /// </summary>
-    [DataField("nextStun", customTypeSerializer: typeof(TimeOffsetSerializer)), ViewVariables(VVAccess.ReadWrite)]
+    [DataField(customTypeSerializer: typeof(TimeOffsetSerializer)), ViewVariables(VVAccess.ReadWrite)]
     public TimeSpan NextStun = TimeSpan.Zero;
 }
index ddecf376e778f2ce0f7c3f2e1313aa8874ca83ac..8fcc62dcb03a034e6d1bf39de8198116216adc21 100644 (file)
     stripTimeReduction: 1
     stealthy: true
   - type: NinjaGloves
-  # not actually electrified, just used to make stun ability work
-  - type: Electrified
 
 - type: entity
   parent: ClothingHandsGlovesColorBlack