From 06b4a48b8f190af82cf9986d80dfda6192143233 Mon Sep 17 00:00:00 2001 From: Spatison <137375981+Spatison@users.noreply.github.com> Date: Sun, 21 Jul 2024 20:55:01 +0300 Subject: [PATCH] StunLock (#474) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * StunLock * DisarmMalus * Баланс --- Content.Shared/Damage/Systems/StaminaSystem.cs | 11 +++++++++-- Content.Shared/Stunnable/SharedStunSystem.cs | 3 +++ .../StaminaProtection/StaminaProtectionSystem.cs | 2 +- Content.Shared/_White/StunLock/StunLockComponent.cs | 7 +++++++ .../Prototypes/Entities/Objects/Shields/shields.yml | 1 + .../Weapons/Guns/Ammunition/Projectiles/magnum.yml | 2 +- .../Weapons/Guns/Ammunition/Projectiles/shotgun.yml | 2 +- .../Objects/Weapons/Guns/Projectiles/projectiles.yml | 3 ++- .../Prototypes/Entities/Objects/Weapons/security.yml | 1 + 9 files changed, 26 insertions(+), 6 deletions(-) create mode 100644 Content.Shared/_White/StunLock/StunLockComponent.cs diff --git a/Content.Shared/Damage/Systems/StaminaSystem.cs b/Content.Shared/Damage/Systems/StaminaSystem.cs index e722b79904..883046b38a 100644 --- a/Content.Shared/Damage/Systems/StaminaSystem.cs +++ b/Content.Shared/Damage/Systems/StaminaSystem.cs @@ -1,5 +1,6 @@ using System.Linq; using Content.Shared._White.StaminaProtection; +using Content.Shared._White.StunLock; using Content.Shared.Administration.Logs; using Content.Shared.Alert; using Content.Shared.CombatMode; @@ -15,6 +16,7 @@ using Content.Shared.Rounding; using Content.Shared.Stunnable; using Content.Shared.Throwing; using Content.Shared.Weapons.Melee.Events; +using Content.Shared.StatusEffect; using JetBrains.Annotations; using Robust.Shared.Audio; using Robust.Shared.Audio.Systems; @@ -35,6 +37,7 @@ public sealed partial class StaminaSystem : EntitySystem [Dependency] private readonly SharedColorFlashEffectSystem _color = default!; [Dependency] private readonly SharedStunSystem _stunSystem = default!; [Dependency] private readonly SharedAudioSystem _audio = default!; + [Dependency] private readonly StatusEffectsSystem _statusEffectsSystem = default!; // WD EDIT /// /// How much of a buffer is there between the stun duration and when stuns can be re-applied. @@ -209,7 +212,7 @@ public sealed partial class StaminaSystem : EntitySystem damage = modifyEv.Damage; } - TakeStaminaDamage(target, damage, source: uid, sound: component.Sound); + TakeStaminaDamage(target, damage, with: uid, sound: component.Sound); // WD EDIT END } @@ -256,7 +259,11 @@ public sealed partial class StaminaSystem : EntitySystem // Have we already reached the point of max stamina damage? if (component.Critical) + { + if (TryComp(with, out _)) // WD EDIT + _stunSystem.TryParalyze(uid, component.StunTime, true); return; + } var oldDamage = component.StaminaDamage; component.StaminaDamage = MathF.Max(0f, component.StaminaDamage + value); @@ -349,7 +356,7 @@ public sealed partial class StaminaSystem : EntitySystem continue; // We were in crit so come out of it and continue. - if (comp.Critical) + if (!_statusEffectsSystem.HasStatusEffect(uid, "Stun") && comp.Critical) // WD EIT { ExitStamCrit(uid, comp); continue; diff --git a/Content.Shared/Stunnable/SharedStunSystem.cs b/Content.Shared/Stunnable/SharedStunSystem.cs index 2931117036..1a226ef28f 100644 --- a/Content.Shared/Stunnable/SharedStunSystem.cs +++ b/Content.Shared/Stunnable/SharedStunSystem.cs @@ -202,6 +202,9 @@ public abstract class SharedStunSystem : EntitySystem if (!Resolve(uid, ref status, false)) return false; + if (_statusEffect.HasStatusEffect(uid, "Stun")) + time = TimeSpan.FromSeconds(6); + return TryKnockdown(uid, time, refresh, status) && TryStun(uid, time, refresh, status); } diff --git a/Content.Shared/_White/StaminaProtection/StaminaProtectionSystem.cs b/Content.Shared/_White/StaminaProtection/StaminaProtectionSystem.cs index 934ebce818..8dda4616d4 100644 --- a/Content.Shared/_White/StaminaProtection/StaminaProtectionSystem.cs +++ b/Content.Shared/_White/StaminaProtection/StaminaProtectionSystem.cs @@ -20,7 +20,7 @@ public sealed class StaminaProtectionSystem : EntitySystem args.Args.Damage = MathF.Max(0f, args.Args.Damage - flat); if (modifiers.Coefficients.TryGetValue("Blunt", out var coefficient)) - args.Args.Damage *= coefficient; + args.Args.Damage *= coefficient / 1.5f; } } diff --git a/Content.Shared/_White/StunLock/StunLockComponent.cs b/Content.Shared/_White/StunLock/StunLockComponent.cs new file mode 100644 index 0000000000..7589080a3d --- /dev/null +++ b/Content.Shared/_White/StunLock/StunLockComponent.cs @@ -0,0 +1,7 @@ +namespace Content.Shared._White.StunLock; + +[RegisterComponent] +public sealed partial class StunLockComponent : Component +{ + +} diff --git a/Resources/Prototypes/Entities/Objects/Shields/shields.yml b/Resources/Prototypes/Entities/Objects/Shields/shields.yml index a35693617b..ed85e4500e 100644 --- a/Resources/Prototypes/Entities/Objects/Shields/shields.yml +++ b/Resources/Prototypes/Entities/Objects/Shields/shields.yml @@ -59,6 +59,7 @@ max: 2 - type: StaticPrice price: 50 + - type: DisarmMalus #Security Shields diff --git a/Resources/Prototypes/Entities/Objects/Weapons/Guns/Ammunition/Projectiles/magnum.yml b/Resources/Prototypes/Entities/Objects/Weapons/Guns/Ammunition/Projectiles/magnum.yml index 7457891c6c..364ba18c42 100644 --- a/Resources/Prototypes/Entities/Objects/Weapons/Guns/Ammunition/Projectiles/magnum.yml +++ b/Resources/Prototypes/Entities/Objects/Weapons/Guns/Ammunition/Projectiles/magnum.yml @@ -32,7 +32,7 @@ Blunt: 3 - type: StaminaDamageOnCollide ignoreResistances: false - damage: 35 # 3 hits to stun cuz revolver + damage: 45 # 3 hits to stun cuz revolver - type: entity id: BulletMagnumIncendiary diff --git a/Resources/Prototypes/Entities/Objects/Weapons/Guns/Ammunition/Projectiles/shotgun.yml b/Resources/Prototypes/Entities/Objects/Weapons/Guns/Ammunition/Projectiles/shotgun.yml index 8f07ec2a4a..f7b30f214d 100644 --- a/Resources/Prototypes/Entities/Objects/Weapons/Guns/Ammunition/Projectiles/shotgun.yml +++ b/Resources/Prototypes/Entities/Objects/Weapons/Guns/Ammunition/Projectiles/shotgun.yml @@ -27,7 +27,7 @@ Blunt: 10 - type: StaminaDamageOnCollide ignoreResistances: false - damage: 60 + damage: 80 - type: entity id: PelletShotgun diff --git a/Resources/Prototypes/Entities/Objects/Weapons/Guns/Projectiles/projectiles.yml b/Resources/Prototypes/Entities/Objects/Weapons/Guns/Projectiles/projectiles.yml index 78cc46c3f1..9100b5bf2e 100644 --- a/Resources/Prototypes/Entities/Objects/Weapons/Guns/Projectiles/projectiles.yml +++ b/Resources/Prototypes/Entities/Objects/Weapons/Guns/Projectiles/projectiles.yml @@ -122,7 +122,7 @@ path: /Audio/Weapons/Guns/Hits/snap.ogg - type: StaminaDamageOnCollide ignoreResistances: false - damage: 22 # 5 hits to stun sounds reasonable + damage: 33 # Wd EDIT - type: entity id: BaseBulletIncendiary @@ -756,6 +756,7 @@ - state: grenade - type: FlashOnTrigger range: 7 + forceStun: true # WD EDIT - type: SpawnOnTrigger proto: GrenadeFlashEffect - type: ActiveTimerTrigger diff --git a/Resources/Prototypes/Entities/Objects/Weapons/security.yml b/Resources/Prototypes/Entities/Objects/Weapons/security.yml index 21097aac66..5dcf2c872e 100644 --- a/Resources/Prototypes/Entities/Objects/Weapons/security.yml +++ b/Resources/Prototypes/Entities/Objects/Weapons/security.yml @@ -87,6 +87,7 @@ - type: GuideHelp guides: - Security + - type: StunLock # Wd EDIT - type: entity name: truncheon