From da88f8f8e05a1bc59759a842514c9ea5dcb4bc06 Mon Sep 17 00:00:00 2001 From: Spatison <137375981+Spatison@users.noreply.github.com> Date: Thu, 31 Oct 2024 11:51:10 +0300 Subject: [PATCH 01/11] add: knockdown --- .../Weapons/Melee/MeleeWeaponSystem.cs | 2 +- .../Speech/EntitySystems/StutteringSystem.cs | 2 +- .../Knockdown/BaseKnockdownOnComponent.cs | 16 ++++ .../_White/Knockdown/KnockComponent.cs | 11 +++ .../Knockdown/KnockdownOnCollideComponent.cs | 4 + .../Knockdown/KnockdownOnHitComponent.cs | 4 + .../_White/Knockdown/KnockdownSystem.cs | 77 ++++++++++++++++++ Content.Shared/Alert/AlertType.cs | 1 + Content.Shared/Stunnable/SharedStunSystem.cs | 2 +- .../Weapons/Melee/MeleeWeaponComponent.cs | 3 + .../Knockdown/KnockdownOnCollideSystem.cs | 33 -------- .../LayDownOnCollideComponent.cs} | 4 +- .../LayDown/LayDownOnCollideSystem.cs | 33 ++++++++ Resources/Prototypes/Alerts/alerts.yml | 24 ++++-- .../Weapons/Guns/Projectiles/projectiles.yml | 4 +- .../Objects/Weapons/Melee/stunprod.yml | 14 ++-- .../Entities/Objects/Weapons/security.yml | 11 ++- .../Weapons/Guns/Projectiles/bolts..yml | 2 +- Resources/Prototypes/status_effects.yml | 2 +- .../Alerts/knockdown.rsi/knockdown.png | Bin 0 -> 409 bytes .../Interface/Alerts/knockdown.rsi/meta.json | 14 ++++ 21 files changed, 198 insertions(+), 65 deletions(-) create mode 100644 Content.Server/_White/Knockdown/BaseKnockdownOnComponent.cs create mode 100644 Content.Server/_White/Knockdown/KnockComponent.cs create mode 100644 Content.Server/_White/Knockdown/KnockdownOnCollideComponent.cs create mode 100644 Content.Server/_White/Knockdown/KnockdownOnHitComponent.cs create mode 100644 Content.Server/_White/Knockdown/KnockdownSystem.cs delete mode 100644 Content.Shared/_White/Collision/Knockdown/KnockdownOnCollideSystem.cs rename Content.Shared/_White/Collision/{Knockdown/KnockdownOnCollideComponent.cs => LayDown/LayDownOnCollideComponent.cs} (54%) create mode 100644 Content.Shared/_White/Collision/LayDown/LayDownOnCollideSystem.cs create mode 100644 Resources/Textures/_White/Interface/Alerts/knockdown.rsi/knockdown.png create mode 100644 Resources/Textures/_White/Interface/Alerts/knockdown.rsi/meta.json diff --git a/Content.Client/Weapons/Melee/MeleeWeaponSystem.cs b/Content.Client/Weapons/Melee/MeleeWeaponSystem.cs index 8521e4c93c..9e1620bd17 100644 --- a/Content.Client/Weapons/Melee/MeleeWeaponSystem.cs +++ b/Content.Client/Weapons/Melee/MeleeWeaponSystem.cs @@ -116,7 +116,7 @@ public override void Update(float frameTime) // Unarmed will try to disarm // Melee weapons will wideswing // Ranged weapons will do a light attack. - if (altDown == BoundKeyState.Down) + if (altDown == BoundKeyState.Down && weapon.CanHeavyAttack) // WD EDIT { // Get the target that was clicked on EntityUid? target = null; diff --git a/Content.Server/Speech/EntitySystems/StutteringSystem.cs b/Content.Server/Speech/EntitySystems/StutteringSystem.cs index d6e3c0b749..71090511d5 100644 --- a/Content.Server/Speech/EntitySystems/StutteringSystem.cs +++ b/Content.Server/Speech/EntitySystems/StutteringSystem.cs @@ -13,7 +13,7 @@ public sealed class StutteringSystem : SharedStutteringSystem [Dependency] private readonly IRobustRandom _random = default!; // Regex of characters to stutter. - private static readonly Regex Stutter = new(@"[b-df-hj-np-tv-wxyz]", + private static readonly Regex Stutter = new(@"[b-df-hj-np-tv-wxyz-б-вд-к-лмн-прст]", // WD EDIT RegexOptions.Compiled | RegexOptions.IgnoreCase); public override void Initialize() diff --git a/Content.Server/_White/Knockdown/BaseKnockdownOnComponent.cs b/Content.Server/_White/Knockdown/BaseKnockdownOnComponent.cs new file mode 100644 index 0000000000..4e33afb122 --- /dev/null +++ b/Content.Server/_White/Knockdown/BaseKnockdownOnComponent.cs @@ -0,0 +1,16 @@ +namespace Content.Server._White.Knockdown; + +public abstract partial class BaseKnockdownOnComponent : Component +{ + [DataField] + public TimeSpan Delay = TimeSpan.FromSeconds(2); + + [DataField] + public TimeSpan KnockdownTime = TimeSpan.FromSeconds(5); + + [DataField] + public TimeSpan JitterTime = TimeSpan.FromSeconds(15); + + [DataField] + public TimeSpan StutterTime = TimeSpan.FromSeconds(15); +} diff --git a/Content.Server/_White/Knockdown/KnockComponent.cs b/Content.Server/_White/Knockdown/KnockComponent.cs new file mode 100644 index 0000000000..389b2747fd --- /dev/null +++ b/Content.Server/_White/Knockdown/KnockComponent.cs @@ -0,0 +1,11 @@ +namespace Content.Server._White.Knockdown; + +[RegisterComponent] +public sealed partial class KnockComponent : Component +{ + [DataField] + public TimeSpan Delay = TimeSpan.FromSeconds(2); + + [DataField] + public TimeSpan KnockdownTime = TimeSpan.FromSeconds(5); +} diff --git a/Content.Server/_White/Knockdown/KnockdownOnCollideComponent.cs b/Content.Server/_White/Knockdown/KnockdownOnCollideComponent.cs new file mode 100644 index 0000000000..65f2f7a3a9 --- /dev/null +++ b/Content.Server/_White/Knockdown/KnockdownOnCollideComponent.cs @@ -0,0 +1,4 @@ +namespace Content.Server._White.Knockdown; + +[RegisterComponent] +public sealed partial class KnockdownOnCollideComponent : BaseKnockdownOnComponent; diff --git a/Content.Server/_White/Knockdown/KnockdownOnHitComponent.cs b/Content.Server/_White/Knockdown/KnockdownOnHitComponent.cs new file mode 100644 index 0000000000..11bdb75e28 --- /dev/null +++ b/Content.Server/_White/Knockdown/KnockdownOnHitComponent.cs @@ -0,0 +1,4 @@ +namespace Content.Server._White.Knockdown; + +[RegisterComponent] +public sealed partial class KnockdownOnHitComponent : BaseKnockdownOnComponent; diff --git a/Content.Server/_White/Knockdown/KnockdownSystem.cs b/Content.Server/_White/Knockdown/KnockdownSystem.cs new file mode 100644 index 0000000000..2d55d77b18 --- /dev/null +++ b/Content.Server/_White/Knockdown/KnockdownSystem.cs @@ -0,0 +1,77 @@ +using Content.Server.Jittering; +using Content.Server.Speech.EntitySystems; +using Content.Server.Stunnable; +using Content.Shared.Damage.Events; +using Content.Shared.Projectiles; +using Content.Shared.StatusEffect; +using Content.Shared.Throwing; +using Robust.Shared.Timing; + +namespace Content.Server._White.Knockdown; + +public sealed class KnockdownSystem : EntitySystem +{ + [Dependency] private readonly StunSystem _sharedStun = default!; + [Dependency] private readonly JitteringSystem _jitter = default!; + [Dependency] private readonly StutteringSystem _stutter = default!; + [Dependency] private readonly IGameTiming _timing = default!; + + public override void Initialize() + { + SubscribeLocalEvent(OnMeleeHit); + SubscribeLocalEvent(OnProjectileHit); + SubscribeLocalEvent(OnThrowDoHit); + } + + private void OnMeleeHit(EntityUid uid, KnockdownOnHitComponent component, TakeStaminaDamageEvent args) + { + Knockdown(args.Target, component); + } + + private void OnProjectileHit(EntityUid uid, KnockdownOnCollideComponent component, ProjectileHitEvent args) + { + Knockdown(args.Target, component); + } + + private void OnThrowDoHit(EntityUid uid, KnockdownOnCollideComponent component, ThrowDoHitEvent args) + { + Knockdown(args.Target, component); + } + + private void Knockdown(EntityUid target, BaseKnockdownOnComponent component) + { + if (!TryComp(target, out var statusEffects)) + return; + + if (component.JitterTime > TimeSpan.Zero) + _jitter.DoJitter(target, component.JitterTime, true, status: statusEffects); + + if (component.StutterTime > TimeSpan.Zero) + _stutter.DoStutter(target, component.StutterTime, true, statusEffects); + + if (component.Delay == TimeSpan.Zero) + { + _sharedStun.TryKnockdown(target, component.KnockdownTime, true, statusEffects); + return; + } + + var knockdown = EnsureComp(target); + knockdown.Delay = _timing.CurTime + component.Delay; + knockdown.KnockdownTime = component.KnockdownTime; + } + + public override void Update(float frameTime) + { + base.Update(frameTime); + + var query = EntityQueryEnumerator(); + while (query.MoveNext(out var uid, out var delayedKnockdown)) + { + if (delayedKnockdown.Delay > _timing.CurTime) + continue; + + _sharedStun.TryKnockdown(uid, delayedKnockdown.KnockdownTime, true); + RemCompDeferred(uid); + } + } +} diff --git a/Content.Shared/Alert/AlertType.cs b/Content.Shared/Alert/AlertType.cs index baa6a806ff..0003e36c5b 100644 --- a/Content.Shared/Alert/AlertType.cs +++ b/Content.Shared/Alert/AlertType.cs @@ -17,6 +17,7 @@ public enum AlertType : byte Hot, Weightless, Stun, + KnockedDown, // WD EDIT Handcuffed, Ensnared, Buckled, diff --git a/Content.Shared/Stunnable/SharedStunSystem.cs b/Content.Shared/Stunnable/SharedStunSystem.cs index 52225843f2..f59ad58d7b 100644 --- a/Content.Shared/Stunnable/SharedStunSystem.cs +++ b/Content.Shared/Stunnable/SharedStunSystem.cs @@ -110,7 +110,7 @@ private void UpdateCanMove(EntityUid uid, StunnedComponent component, EntityEven private void OnKnockInit(EntityUid uid, KnockedDownComponent component, ComponentInit args) { RaiseNetworkEvent(new CheckAutoGetUpEvent(GetNetEntity(uid))); - _layingDown.TryLieDown(uid, null, null, DropHeldItemsBehavior.DropIfStanding); + _layingDown.TryLieDown(uid, null, null, DropHeldItemsBehavior.AlwaysDrop); // WD EDIT } private void OnKnockShutdown(EntityUid uid, KnockedDownComponent component, ComponentShutdown args) diff --git a/Content.Shared/Weapons/Melee/MeleeWeaponComponent.cs b/Content.Shared/Weapons/Melee/MeleeWeaponComponent.cs index 7fedf32213..bfac056a44 100644 --- a/Content.Shared/Weapons/Melee/MeleeWeaponComponent.cs +++ b/Content.Shared/Weapons/Melee/MeleeWeaponComponent.cs @@ -121,6 +121,9 @@ public sealed partial class MeleeWeaponComponent : Component // WD EDIT START [ViewVariables(VVAccess.ReadWrite), DataField, AutoNetworkedField] public EntProtoId DisarmAnimation = "WeaponArcDisarm"; + + [DataField, AutoNetworkedField] + public bool CanHeavyAttack = true; // WD EDIT END /// diff --git a/Content.Shared/_White/Collision/Knockdown/KnockdownOnCollideSystem.cs b/Content.Shared/_White/Collision/Knockdown/KnockdownOnCollideSystem.cs deleted file mode 100644 index dcc6b38377..0000000000 --- a/Content.Shared/_White/Collision/Knockdown/KnockdownOnCollideSystem.cs +++ /dev/null @@ -1,33 +0,0 @@ -using Content.Shared.Projectiles; -using Content.Shared.Standing; -using Content.Shared.Throwing; - -namespace Content.Shared._White.Collision.Knockdown; - -public sealed class KnockdownOnCollideSystem : EntitySystem -{ - [Dependency] private readonly SharedLayingDownSystem _layingDown = default!; - - public override void Initialize() - { - base.Initialize(); - - SubscribeLocalEvent(OnProjectileHit); - SubscribeLocalEvent(OnEntityHit); - } - - private void OnEntityHit(Entity ent, ref ThrowDoHitEvent args) - { - ApplyEffects(args.Target, ent.Comp); - } - - private void OnProjectileHit(Entity ent, ref ProjectileHitEvent args) - { - ApplyEffects(args.Target, ent.Comp); - } - - private void ApplyEffects(EntityUid target, KnockdownOnCollideComponent component) - { - _layingDown.TryLieDown(target, null, null, component.Behavior); - } -} diff --git a/Content.Shared/_White/Collision/Knockdown/KnockdownOnCollideComponent.cs b/Content.Shared/_White/Collision/LayDown/LayDownOnCollideComponent.cs similarity index 54% rename from Content.Shared/_White/Collision/Knockdown/KnockdownOnCollideComponent.cs rename to Content.Shared/_White/Collision/LayDown/LayDownOnCollideComponent.cs index 078f01b952..215def75b4 100644 --- a/Content.Shared/_White/Collision/Knockdown/KnockdownOnCollideComponent.cs +++ b/Content.Shared/_White/Collision/LayDown/LayDownOnCollideComponent.cs @@ -1,9 +1,9 @@ using Content.Shared.Standing; -namespace Content.Shared._White.Collision.Knockdown; +namespace Content.Shared._White.Collision.LayDown; [RegisterComponent] -public sealed partial class KnockdownOnCollideComponent : Component +public sealed partial class LayDownOnCollideComponent : Component { [DataField] public DropHeldItemsBehavior Behavior = DropHeldItemsBehavior.NoDrop; diff --git a/Content.Shared/_White/Collision/LayDown/LayDownOnCollideSystem.cs b/Content.Shared/_White/Collision/LayDown/LayDownOnCollideSystem.cs new file mode 100644 index 0000000000..1a10c67a8d --- /dev/null +++ b/Content.Shared/_White/Collision/LayDown/LayDownOnCollideSystem.cs @@ -0,0 +1,33 @@ +using Content.Shared.Projectiles; +using Content.Shared.Standing; +using Content.Shared.Throwing; + +namespace Content.Shared._White.Collision.LayDown; + +public sealed class LayDownOnCollideSystem : EntitySystem +{ + [Dependency] private readonly SharedLayingDownSystem _layingDown = default!; + + public override void Initialize() + { + base.Initialize(); + + SubscribeLocalEvent(OnProjectileHit); + SubscribeLocalEvent(OnEntityHit); + } + + private void OnEntityHit(Entity ent, ref ThrowDoHitEvent args) + { + ApplyEffects(args.Target, ent.Comp); + } + + private void OnProjectileHit(Entity ent, ref ProjectileHitEvent args) + { + ApplyEffects(args.Target, ent.Comp); + } + + private void ApplyEffects(EntityUid target, LayDownOnCollideComponent component) + { + _layingDown.TryLieDown(target, null, null, component.Behavior); + } +} diff --git a/Resources/Prototypes/Alerts/alerts.yml b/Resources/Prototypes/Alerts/alerts.yml index 6a05683ac1..932eac27f7 100644 --- a/Resources/Prototypes/Alerts/alerts.yml +++ b/Resources/Prototypes/Alerts/alerts.yml @@ -17,6 +17,7 @@ - category: Piloting - alertType: Corporeal - alertType: Stun + - alertType: KnockedDown # WD EDIT - category: Breathing # Vox gang not calling this oxygen - category: Pressure - alertType: Bleed @@ -452,13 +453,6 @@ minSeverity: 0 maxSeverity: 1 -# WD EDIT -- type: alert - id: RecentlyBlocked - icons: [ /Textures/Objects/Weapons/Melee/shields.rsi/buckler-icon.png ] - name: alerts-blocked-name - description: alerts-blocked-desc - - type: alert id: Debug1 icons: @@ -625,3 +619,19 @@ state: deflecting0 name: alerts-deflecting-name description: alerts-deflecting-desc + +# WD EDIT START +- type: alert + id: KnockedDown + icons: + - sprite: /Textures/_White/Interface/Alerts/knockdown.rsi + state: knockdown + name: alerts-knockdown-name + description: alerts-knockdown-desc + +- type: alert + id: RecentlyBlocked + icons: [ /Textures/Objects/Weapons/Melee/shields.rsi/buckler-icon.png ] + name: alerts-blocked-name + description: alerts-blocked-desc +# WD EDIT END diff --git a/Resources/Prototypes/Entities/Objects/Weapons/Guns/Projectiles/projectiles.yml b/Resources/Prototypes/Entities/Objects/Weapons/Guns/Projectiles/projectiles.yml index 55e09014ec..0267a075bc 100644 --- a/Resources/Prototypes/Entities/Objects/Weapons/Guns/Projectiles/projectiles.yml +++ b/Resources/Prototypes/Entities/Objects/Weapons/Guns/Projectiles/projectiles.yml @@ -211,9 +211,7 @@ soundHit: path: "/Audio/Weapons/Guns/Hits/taser_hit.ogg" forceSound: true - - type: StunOnCollide - stunAmount: 5 - knockdownAmount: 5 + - type: KnockdownOnCollide # WD EDIT - type: entity name : disabler bolt diff --git a/Resources/Prototypes/Entities/Objects/Weapons/Melee/stunprod.yml b/Resources/Prototypes/Entities/Objects/Weapons/Melee/stunprod.yml index 772379cc42..3b034b4fbd 100644 --- a/Resources/Prototypes/Entities/Objects/Weapons/Melee/stunprod.yml +++ b/Resources/Prototypes/Entities/Objects/Weapons/Melee/stunprod.yml @@ -25,21 +25,15 @@ - type: Stunbaton energyPerUse: 120 - type: MeleeWeapon - wideAnimationRotation: -135 - attackRate: 0.8 + attackRate: 0.4 # WD EDIT range: 1.4 damage: types: Blunt: 7.5 bluntStaminaDamageFactor: 2.0 - heavyRateModifier: 0.8 - heavyDamageBaseModifier: 1.2 - heavyStaminaCost: 5 - maxTargets: 3 - angle: 60 - animation: WeaponArcThrust + canHeavyAttack: false # WD EDIT - type: StaminaDamageOnHit - damage: 22 + damage: 35 # WD EDIT sound: /Audio/Weapons/egloves.ogg - type: StaminaDamageOnCollide damage: 22 @@ -65,6 +59,8 @@ - type: ContainerContainer containers: cell_slot: !type:ContainerSlot {} + - type: KnockdownOnHit # WD EDIT + knockdownTime: 3 - type: entity name: stun prod diff --git a/Resources/Prototypes/Entities/Objects/Weapons/security.yml b/Resources/Prototypes/Entities/Objects/Weapons/security.yml index e93c74db46..697647a7c6 100644 --- a/Resources/Prototypes/Entities/Objects/Weapons/security.yml +++ b/Resources/Prototypes/Entities/Objects/Weapons/security.yml @@ -10,7 +10,7 @@ - state: stunbaton_off map: [ "enum.ToggleVisuals.Layer" ] - type: Stunbaton - energyPerUse: 50 + energyPerUse: 100 # WD EDIT - type: ItemToggle predictable: false soundActivate: @@ -30,17 +30,15 @@ types: Blunt: 0 - type: MeleeWeapon - wideAnimationRotation: -135 damage: types: Blunt: 7 bluntStaminaDamageFactor: 2.0 - heavyRateModifier: 0.75 - maxTargets: 3 + canHeavyAttack: false # WD EDIT + attackRate: 0.4 # WD EDIT angle: 60 - animation: WeaponArcSlash - type: StaminaDamageOnHit - damage: 35 + damage: 55 # WD EDIT sound: /Audio/Weapons/egloves.ogg - type: StaminaDamageOnCollide damage: 35 @@ -87,6 +85,7 @@ - type: GuideHelp guides: - Security + - type: KnockdownOnHit # WD EDIT - type: entity name: truncheon diff --git a/Resources/Prototypes/_White/Entities/Objects/Weapons/Guns/Projectiles/bolts..yml b/Resources/Prototypes/_White/Entities/Objects/Weapons/Guns/Projectiles/bolts..yml index 4bf6ad8722..c67dce87be 100644 --- a/Resources/Prototypes/_White/Entities/Objects/Weapons/Guns/Projectiles/bolts..yml +++ b/Resources/Prototypes/_White/Entities/Objects/Weapons/Guns/Projectiles/bolts..yml @@ -26,6 +26,6 @@ hard: false mask: - Opaque - - type: KnockdownOnCollide + - type: LayDownOnCollide behavior: AlwaysDrop - type: BlurOnCollide \ No newline at end of file diff --git a/Resources/Prototypes/status_effects.yml b/Resources/Prototypes/status_effects.yml index 0c29d79d5c..1e454d25ef 100644 --- a/Resources/Prototypes/status_effects.yml +++ b/Resources/Prototypes/status_effects.yml @@ -7,7 +7,7 @@ - type: statusEffect id: KnockedDown - alert: Stun + alert: KnockedDown # WD EDIT - type: statusEffect id: SlowedDown diff --git a/Resources/Textures/_White/Interface/Alerts/knockdown.rsi/knockdown.png b/Resources/Textures/_White/Interface/Alerts/knockdown.rsi/knockdown.png new file mode 100644 index 0000000000000000000000000000000000000000..dcefa1f58d0c3c55f2353a29b9fbee445f033158 GIT binary patch literal 409 zcmV;K0cQS*P)Px$Q%OWYR9J=Wls|96Fc8IGB+7zHK^1cc6c2oaP8}-|qJBmORCRRSy%U+(P*j|D z=$cdz!UW58vK8kaVQL5eqzo6o+`agG1}qkf#q!5Emx$MkIaR&y_6J7HJim3`l28h6 z6j8~f;Bcd)0s9>Y)5OP;MBx%n-LLFl}-vy z@#a&n9k*HI69fSjTYc8RB`C9Xu`&$+ovPi)_gBUHB-ZUIu2+4VZ__DDb!&=k)&`j8 zJL;tWd~9%aJH&{MaoQb>12tk}?2{NbfHsjgsI+xcAO)wqf!Z;2r!%Zxp3(31j8Rm7 zkw#(V4zw9Rm8Vf#IwTFO7jp`Nfa)$Pi^XEG{A+#zx=U<@Kv|9v00000NkvXXu0mjf D&+@D4 literal 0 HcmV?d00001 diff --git a/Resources/Textures/_White/Interface/Alerts/knockdown.rsi/meta.json b/Resources/Textures/_White/Interface/Alerts/knockdown.rsi/meta.json new file mode 100644 index 0000000000..ccfa26f5c9 --- /dev/null +++ b/Resources/Textures/_White/Interface/Alerts/knockdown.rsi/meta.json @@ -0,0 +1,14 @@ +{ + "version": 1, + "license": "CC-BY-SA-4.0", + "copyright": "Made by WWDP Team", + "size": { + "x": 32, + "y": 32 + }, + "states": [ + { + "name": "knockdown" + } + ] +} \ No newline at end of file From e774c3438c7455488a4f9846c74e6a49c88f0105 Mon Sep 17 00:00:00 2001 From: Spatison <137375981+Spatison@users.noreply.github.com> Date: Fri, 1 Nov 2024 01:45:41 +0300 Subject: [PATCH 02/11] tweak --- .../Explosion/EntitySystems/TriggerSystem.cs | 2 +- Content.Server/Flash/FlashSystem.cs | 42 +++++++++++++-- .../Flash/FlashSoundSuppressionComponent.cs | 8 +++ .../Flash/FlashSoundSuppressionSystem.cs | 19 +++++++ .../Components/FlashOnTriggerComponent.cs | 6 +++ Content.Shared/Flash/SharedFlashSystem.cs | 15 ++++++ .../Inventory/InventorySystem.Relay.cs | 2 + .../Systems/ClothingGrantingSystem.cs | 8 +-- .../Entities/Clothing/Ears/headsets_alt.yml | 1 + .../Clothing/Head/hardsuit-helmets.yml | 51 +++++++++++++++++++ .../Weapons/Guns/Projectiles/projectiles.yml | 2 + .../Objects/Weapons/Throwable/grenades.yml | 2 + 12 files changed, 150 insertions(+), 8 deletions(-) create mode 100644 Content.Server/_White/Flash/FlashSoundSuppressionComponent.cs create mode 100644 Content.Server/_White/Flash/FlashSoundSuppressionSystem.cs diff --git a/Content.Server/Explosion/EntitySystems/TriggerSystem.cs b/Content.Server/Explosion/EntitySystems/TriggerSystem.cs index 8e0a75ea24..098d5a3603 100644 --- a/Content.Server/Explosion/EntitySystems/TriggerSystem.cs +++ b/Content.Server/Explosion/EntitySystems/TriggerSystem.cs @@ -154,7 +154,7 @@ private void HandleExplodeTrigger(EntityUid uid, ExplodeOnTriggerComponent compo private void HandleFlashTrigger(EntityUid uid, FlashOnTriggerComponent component, TriggerEvent args) { // TODO Make flash durations sane ffs. - _flashSystem.FlashArea(uid, args.User, component.Range, component.Duration * 1000f, probability: component.Probability); + _flashSystem.FlashArea(uid, args.User, component.Range, component.Duration * 1000f, probability: component.Probability, stunTime: component.StunTime, knockdownTime: component.KnockdownTime); // WD EDIT args.Handled = true; } diff --git a/Content.Server/Flash/FlashSystem.cs b/Content.Server/Flash/FlashSystem.cs index bc91a307b0..eaa96c08ae 100644 --- a/Content.Server/Flash/FlashSystem.cs +++ b/Content.Server/Flash/FlashSystem.cs @@ -1,4 +1,5 @@ using System.Linq; +using Content.Server._White.Flash; using Content.Server.Flash.Components; using Content.Shared.Flash.Components; using Content.Server.Light.EntitySystems; @@ -167,7 +168,39 @@ public void Flash(EntityUid target, } } - public void FlashArea(Entity source, EntityUid? user, float range, float duration, float slowTo = 0.8f, bool displayPopup = false, float probability = 1f, SoundSpecifier? sound = null) + // WD EDIT START + private void FlashStun(EntityUid target, float stunDuration, float knockdownDuration, float distance, float range) + { + if (stunDuration <= 0 || knockdownDuration <= 0) + return; + + if (TryComp(target, out var suppression)) + range = MathF.Min(range, suppression.MaxRange); + + var ev = new FlashbangedEvent(range); + RaiseLocalEvent(target, ev); + + range = MathF.Min(range, ev.MaxRange); + if (range <= 0f) + return; + + if (distance < 0f) + distance = 0f; + + if (distance > range) + return; + + var knockdownTime = float.Lerp(knockdownDuration, 0f, distance / range); + if (knockdownTime > 0f) + _stun.TryKnockdown(target, TimeSpan.FromSeconds(knockdownTime), true); + + var stunTime = float.Lerp(stunDuration, 0f, distance / range); + if (stunTime > 0f) + _stun.TryStun(target, TimeSpan.FromSeconds(stunTime), true); + } + // WD EDIT END + + public void FlashArea(Entity source, EntityUid? user, float range, float duration, float slowTo = 0.8f, bool displayPopup = false, float probability = 1f, SoundSpecifier? sound = null, float stunTime = 0f, float knockdownTime = 0f) // WD EDIT { var transform = Transform(source); var mapPosition = _transform.GetMapCoordinates(transform); @@ -187,6 +220,11 @@ public void FlashArea(Entity source, EntityUid? user, float ran // They shouldn't have flash removed in between right? Flash(entity, user, source, duration, slowTo, displayPopup, flashableQuery.GetComponent(entity)); + + // WD EDIT START + var distance = (mapPosition.Position - _transform.GetMapCoordinates(entity).Position).Length(); + FlashStun(entity, stunTime, knockdownTime, distance, range); + // WD EDIT END } _audio.PlayPvs(sound, source, AudioParams.Default.WithVolume(1f).WithMaxDistance(3f)); @@ -251,6 +289,4 @@ public AfterFlashedEvent(EntityUid target, EntityUid? user, EntityUid? used) Used = used; } } - - } diff --git a/Content.Server/_White/Flash/FlashSoundSuppressionComponent.cs b/Content.Server/_White/Flash/FlashSoundSuppressionComponent.cs new file mode 100644 index 0000000000..4c57f939c5 --- /dev/null +++ b/Content.Server/_White/Flash/FlashSoundSuppressionComponent.cs @@ -0,0 +1,8 @@ +namespace Content.Server._White.Flash; + +[RegisterComponent] +public sealed partial class FlashSoundSuppressionComponent : Component +{ + [DataField] + public float MaxRange = 2f; +} diff --git a/Content.Server/_White/Flash/FlashSoundSuppressionSystem.cs b/Content.Server/_White/Flash/FlashSoundSuppressionSystem.cs new file mode 100644 index 0000000000..747a3080ad --- /dev/null +++ b/Content.Server/_White/Flash/FlashSoundSuppressionSystem.cs @@ -0,0 +1,19 @@ +using Content.Shared.Flash; +using Content.Shared.Inventory; + +namespace Content.Server._White.Flash; + +public sealed class FlashSoundSuppressionSystem : EntitySystem +{ + public override void Initialize() + { + base.Initialize(); + + SubscribeLocalEvent>(OnFlashbanged); + } + + private void OnFlashbanged(Entity ent, ref InventoryRelayedEvent args) + { + args.Args.MaxRange = MathF.Min(args.Args.MaxRange, ent.Comp.MaxRange); + } +} diff --git a/Content.Shared/Flash/Components/FlashOnTriggerComponent.cs b/Content.Shared/Flash/Components/FlashOnTriggerComponent.cs index 7658ca0ae5..5b8d7885cc 100644 --- a/Content.Shared/Flash/Components/FlashOnTriggerComponent.cs +++ b/Content.Shared/Flash/Components/FlashOnTriggerComponent.cs @@ -10,4 +10,10 @@ public sealed partial class FlashOnTriggerComponent : Component [DataField] public float Range = 1.0f; [DataField] public float Duration = 8.0f; [DataField] public float Probability = 1.0f; + + [DataField] + public float StunTime; + + [DataField] + public float KnockdownTime; } diff --git a/Content.Shared/Flash/SharedFlashSystem.cs b/Content.Shared/Flash/SharedFlashSystem.cs index 2646ae5e69..6e0a6abf6c 100644 --- a/Content.Shared/Flash/SharedFlashSystem.cs +++ b/Content.Shared/Flash/SharedFlashSystem.cs @@ -1,3 +1,4 @@ +using Content.Shared.Inventory; using Robust.Shared.GameStates; namespace Content.Shared.Flash @@ -16,4 +17,18 @@ private static void OnFlashableGetState(EntityUid uid, FlashableComponent compon args.State = new FlashableComponentState(component.Duration, component.LastFlash, component.EyeDamageChance, component.EyeDamage, component.DurationMultiplier); } } + + // WD EDIT START + public sealed class FlashbangedEvent : EntityEventArgs, IInventoryRelayEvent + { + public float MaxRange; + + public SlotFlags TargetSlots => SlotFlags.EARS | SlotFlags.HEAD; + + public FlashbangedEvent(float maxRange) + { + MaxRange = maxRange; + } + } + // WD EDIT END } diff --git a/Content.Shared/Inventory/InventorySystem.Relay.cs b/Content.Shared/Inventory/InventorySystem.Relay.cs index b9d6a51f88..f81ab968bf 100644 --- a/Content.Shared/Inventory/InventorySystem.Relay.cs +++ b/Content.Shared/Inventory/InventorySystem.Relay.cs @@ -4,6 +4,7 @@ using Content.Shared.Electrocution; using Content.Shared.Explosion; using Content.Shared.Eye.Blinding.Systems; +using Content.Shared.Flash; using Content.Shared.IdentityManagement.Components; using Content.Shared.Inventory.Events; using Content.Shared.Movement.Systems; @@ -29,6 +30,7 @@ public void InitializeRelay() SubscribeLocalEvent(RelayInventoryEvent); SubscribeLocalEvent(RelayInventoryEvent); SubscribeLocalEvent(RelayInventoryEvent); + SubscribeLocalEvent(RelayInventoryEvent); // WD EDIT // by-ref events SubscribeLocalEvent(RefRelayInventoryEvent); diff --git a/Content.Shared/SimpleStation14/Clothing/Systems/ClothingGrantingSystem.cs b/Content.Shared/SimpleStation14/Clothing/Systems/ClothingGrantingSystem.cs index 5fbc83a4b0..c5fa8ea4eb 100644 --- a/Content.Shared/SimpleStation14/Clothing/Systems/ClothingGrantingSystem.cs +++ b/Content.Shared/SimpleStation14/Clothing/Systems/ClothingGrantingSystem.cs @@ -28,9 +28,9 @@ private void OnCompEquip(EntityUid uid, ClothingGrantComponentComponent componen if (!clothing.Slots.HasFlag(args.SlotFlags)) return; - if (component.Components.Count > 1) + if (component.Components.Count > 8) // WD EDIT { - Logger.Error("Although a component registry supports multiple components, we cannot bookkeep more than 1 component for ClothingGrantComponent at this time."); + Logger.Error("Although a component registry supports multiple components, we cannot bookkeep more than 8 component for ClothingGrantComponent at this time."); // WD EDIT return; } @@ -46,9 +46,9 @@ private void OnCompEquip(EntityUid uid, ClothingGrantComponentComponent componen var temp = (object) newComp; _serializationManager.CopyTo(data.Component, ref temp); EntityManager.AddComponent(args.Equipee, (Component)temp!); - - component.IsActive = true; } + + component.IsActive = true; // WD EDIT } private void OnCompUnequip(EntityUid uid, ClothingGrantComponentComponent component, GotUnequippedEvent args) diff --git a/Resources/Prototypes/Entities/Clothing/Ears/headsets_alt.yml b/Resources/Prototypes/Entities/Clothing/Ears/headsets_alt.yml index 5dfa1df150..9cfb20ffc0 100644 --- a/Resources/Prototypes/Entities/Clothing/Ears/headsets_alt.yml +++ b/Resources/Prototypes/Entities/Clothing/Ears/headsets_alt.yml @@ -9,6 +9,7 @@ state: icon_alt - type: Clothing equippedPrefix: alt + - type: FlashSoundSuppression # WD EDIT - type: entity parent: ClothingHeadsetAlt diff --git a/Resources/Prototypes/Entities/Clothing/Head/hardsuit-helmets.yml b/Resources/Prototypes/Entities/Clothing/Head/hardsuit-helmets.yml index 78a895b64e..1603c4f1ba 100644 --- a/Resources/Prototypes/Entities/Clothing/Head/hardsuit-helmets.yml +++ b/Resources/Prototypes/Entities/Clothing/Head/hardsuit-helmets.yml @@ -199,6 +199,9 @@ Slash: 0.9 Piercing: 0.9 Heat: 0.9 + - type: FlashImmunity # WD EDIT + - type: FlashSoundSuppression # WD EDIT + #Brigmedic Hardsuit - type: entity @@ -226,6 +229,8 @@ - type: PressureProtection highPressureMultiplier: 0.6 lowPressureMultiplier: 1000 + - type: FlashImmunity # WD EDIT + - type: FlashSoundSuppression # WD EDIT #Warden's Hardsuit - type: entity @@ -251,6 +256,8 @@ Slash: 0.9 Piercing: 0.9 Heat: 0.9 + - type: FlashImmunity # WD EDIT + - type: FlashSoundSuppression # WD EDIT #Captain's Hardsuit - type: entity @@ -269,6 +276,8 @@ lowPressureMultiplier: 1000 - type: PointLight color: "#9CF4FF" + - type: FlashImmunity # WD EDIT + - type: FlashSoundSuppression # WD EDIT #Chief Engineer's Hardsuit - type: entity @@ -348,6 +357,8 @@ Slash: 0.9 Piercing: 0.9 Heat: 0.9 + - type: FlashImmunity # WD EDIT + - type: FlashSoundSuppression # WD EDIT #Luxury Mining Hardsuit - type: entity @@ -393,6 +404,9 @@ Slash: 0.9 Piercing: 0.9 Heat: 0.9 + - type: EyeProtection # WD EDIT + - type: FlashImmunity # WD EDIT + - type: FlashSoundSuppression # WD EDIT #Blood-red Medic Hardsuit - type: entity @@ -418,6 +432,9 @@ Slash: 0.9 Piercing: 0.9 Heat: 0.9 + - type: EyeProtection # WD EDIT + - type: FlashImmunity # WD EDIT + - type: FlashSoundSuppression # WD EDIT #Syndicate Elite Hardsuit - type: entity @@ -447,6 +464,9 @@ Slash: 0.9 Piercing: 0.9 Heat: 0.9 + - type: EyeProtection # WD EDIT + - type: FlashImmunity # WD EDIT + - type: FlashSoundSuppression # WD EDIT #Syndicate Commander Hardsuit - type: entity @@ -472,6 +492,9 @@ Slash: 0.9 Piercing: 0.9 Heat: 0.9 + - type: EyeProtection # WD EDIT + - type: FlashImmunity # WD EDIT + - type: FlashSoundSuppression # WD EDIT #Cybersun Juggernaut Hardsuit - type: entity @@ -495,6 +518,9 @@ Slash: 0.9 Piercing: 0.9 Heat: 0.9 + - type: EyeProtection # WD EDIT + - type: FlashImmunity # WD EDIT + - type: FlashSoundSuppression # WD EDIT #Wizard Hardsuit - type: entity @@ -593,6 +619,9 @@ Slash: 0.9 Piercing: 0.9 Heat: 0.9 + - type: EyeProtection # WD EDIT + - type: FlashImmunity # WD EDIT + - type: FlashSoundSuppression # WD EDIT #ERT Chaplain Hardsuit - type: entity @@ -608,6 +637,9 @@ sprite: Clothing/Head/Hardsuits/ERThelmets/ertchaplain.rsi - type: PointLight color: "#ffffff" + - type: EyeProtection # WD EDIT + - type: FlashImmunity # WD EDIT + - type: FlashSoundSuppression # WD EDIT #ERT Engineer Hardsuit - type: entity @@ -630,6 +662,9 @@ Slash: 0.9 Piercing: 0.9 Heat: 0.9 + - type: EyeProtection # WD EDIT + - type: FlashImmunity # WD EDIT + - type: FlashSoundSuppression # WD EDIT #ERT Medical Hardsuit - type: entity @@ -645,6 +680,9 @@ sprite: Clothing/Head/Hardsuits/ERThelmets/ertmedical.rsi - type: PointLight color: "#adffec" + - type: EyeProtection # WD EDIT + - type: FlashImmunity # WD EDIT + - type: FlashSoundSuppression # WD EDIT #ERT Security Hardsuit - type: entity @@ -667,6 +705,9 @@ Slash: 0.9 Piercing: 0.9 Heat: 0.9 + - type: EyeProtection # WD EDIT + - type: FlashImmunity # WD EDIT + - type: FlashSoundSuppression # WD EDIT #ERT Janitor Hardsuit - type: entity @@ -682,6 +723,9 @@ sprite: Clothing/Head/Hardsuits/ERThelmets/ertjanitor.rsi - type: PointLight color: "#cbadff" + - type: EyeProtection # WD EDIT + - type: FlashImmunity # WD EDIT + - type: FlashSoundSuppression # WD EDIT #CBURN Hardsuit - type: entity @@ -721,6 +765,9 @@ Slash: 0.9 Piercing: 0.9 Heat: 0.9 + - type: EyeProtection # WD EDIT + - type: FlashImmunity # WD EDIT + - type: FlashSoundSuppression # WD EDIT #Deathsquad Hardsuit - type: entity @@ -751,6 +798,10 @@ component: - type: ThermalVision - type: NightVision + - type: EyeProtection + - type: FlashImmunity + - type: FlashSoundSuppression + maxRange: 0 # WD EDIT END #MISC. HARDSUITS diff --git a/Resources/Prototypes/Entities/Objects/Weapons/Guns/Projectiles/projectiles.yml b/Resources/Prototypes/Entities/Objects/Weapons/Guns/Projectiles/projectiles.yml index 0267a075bc..8b29c472a8 100644 --- a/Resources/Prototypes/Entities/Objects/Weapons/Guns/Projectiles/projectiles.yml +++ b/Resources/Prototypes/Entities/Objects/Weapons/Guns/Projectiles/projectiles.yml @@ -743,6 +743,8 @@ - state: grenade - type: FlashOnTrigger range: 7 + stunTime: 2 # WD EDIT + knockdownTime: 10 # WD EDIT - type: SpawnOnTrigger proto: GrenadeFlashEffect - type: ActiveTimerTrigger diff --git a/Resources/Prototypes/Entities/Objects/Weapons/Throwable/grenades.yml b/Resources/Prototypes/Entities/Objects/Weapons/Throwable/grenades.yml index acbaac2922..336a9f9d43 100644 --- a/Resources/Prototypes/Entities/Objects/Weapons/Throwable/grenades.yml +++ b/Resources/Prototypes/Entities/Objects/Weapons/Throwable/grenades.yml @@ -67,6 +67,8 @@ sprite: Objects/Weapons/Grenades/flashbang.rsi - type: FlashOnTrigger range: 7 + stunTime: 2 # WD EDIT + knockdownTime: 10 # WD EDIT - type: SoundOnTrigger sound: path: "/Audio/Effects/flash_bang.ogg" From 94e1345b03fe163c433d083f99fce6f5d007944b Mon Sep 17 00:00:00 2001 From: Spatison <137375981+Spatison@users.noreply.github.com> Date: Fri, 1 Nov 2024 02:52:19 +0300 Subject: [PATCH 03/11] tweak --- .../Locale/en-US/_white/alerts/alerts.ftl | 5 +- .../Locale/ru-RU/_white/alerts/alerts.ftl | 5 +- Resources/Locale/ru-RU/_white/white-shit.ftl | 30 ---------- .../VendingMachines/Inventories/sec.yml | 1 + .../Objects/Weapons/Throwable/bola.yml | 32 +---------- .../Objects/Weapons/Throwable/bola.yml | 53 ++++++++++++++++++ .../Weapons/Throwable/energybola.rsi/icon.png | Bin 0 -> 629 bytes .../Throwable/energybola.rsi/meta.json | 20 +++++++ 8 files changed, 85 insertions(+), 61 deletions(-) delete mode 100644 Resources/Locale/ru-RU/_white/white-shit.ftl create mode 100644 Resources/Prototypes/_White/Entities/Objects/Weapons/Throwable/bola.yml create mode 100644 Resources/Textures/_White/Objects/Weapons/Throwable/energybola.rsi/icon.png create mode 100644 Resources/Textures/_White/Objects/Weapons/Throwable/energybola.rsi/meta.json diff --git a/Resources/Locale/en-US/_white/alerts/alerts.ftl b/Resources/Locale/en-US/_white/alerts/alerts.ftl index d64317cb0a..9a438b3219 100644 --- a/Resources/Locale/en-US/_white/alerts/alerts.ftl +++ b/Resources/Locale/en-US/_white/alerts/alerts.ftl @@ -1,2 +1,5 @@ alerts-blocked-name = Recently blocked -alerts-blocked-desc = I can't block for a while! \ No newline at end of file +alerts-blocked-desc = I can't block for a while! + +alerts-knockdown-name = [color=yellow]Knocked down[/color] +alerts-knockdown-desc = You're [color=yellow]knocked down[/color]! Something is impairing your ability to getting up. diff --git a/Resources/Locale/ru-RU/_white/alerts/alerts.ftl b/Resources/Locale/ru-RU/_white/alerts/alerts.ftl index b622781c1d..0972bd4efa 100644 --- a/Resources/Locale/ru-RU/_white/alerts/alerts.ftl +++ b/Resources/Locale/ru-RU/_white/alerts/alerts.ftl @@ -1,2 +1,5 @@ alerts-blocked-name = Атака заблокирована -alerts-blocked-desc = Невозможно блокировать некоторое время. \ No newline at end of file +alerts-blocked-desc = Невозможно блокировать некоторое время. + +alerts-knockdown-name = [color=yellow]Cбиты с ног[/color] +alerts-knockdown-desc = Вы [color=yellow]cбиты с ног[/color]! Что-то мешает вам встать. diff --git a/Resources/Locale/ru-RU/_white/white-shit.ftl b/Resources/Locale/ru-RU/_white/white-shit.ftl deleted file mode 100644 index c3787be86d..0000000000 --- a/Resources/Locale/ru-RU/_white/white-shit.ftl +++ /dev/null @@ -1,30 +0,0 @@ -# Cult - -ent-CultBola = магическая { ent-Bola } - .desc = { ent-Bola.desc } - .suffix = культ - -# Energy bola - -ent-EnergyBola = энергобола - .desc = Соверешенное слияние технологии и справедливости для отлова преступников. - -ent-DrinkShakerEphedrineInfinite = { ent-DrinkShaker } - .desc = { ent-DrinkShaker.desc } - .suffix = Эфедрин, Бесконечный - -action-name-insert-self = Залезть внутрь. -action-name-insert-other = Засунуть внутрь. -action-start-insert-self = Вы начинаете залазить в {$storage}. -action-start-insert-other = {$user} начинает засовывать вас в {$storage}. -carry-start = { $carrier } пытается взять вас на руки! - -alerts-knockdown-name = Лежу -alerts-knockdown-desc = Не могу встать. - -melee-block-event-blocked = заблокировал! -alerts-blocked-name = Атака заблокирована -alerts-blocked-desc = Невозможно блокировать некоторое время. -melee-block-component-delay = Может блокировать атаку ближнего боя каждые {$delay} секунд. - -context-menu-cant-interact = Невозможно взаимодействовать этим через контекстное меню! diff --git a/Resources/Prototypes/Catalog/VendingMachines/Inventories/sec.yml b/Resources/Prototypes/Catalog/VendingMachines/Inventories/sec.yml index 723f944222..7193605192 100644 --- a/Resources/Prototypes/Catalog/VendingMachines/Inventories/sec.yml +++ b/Resources/Prototypes/Catalog/VendingMachines/Inventories/sec.yml @@ -7,6 +7,7 @@ TearGasGrenade: 4 ClusterBangFull: 2 GrenadeStinger: 4 + EnergyBola: 5 # WD EDIT Flash: 5 Tourniquet: 5 FlashlightSeclite: 5 diff --git a/Resources/Prototypes/Entities/Objects/Weapons/Throwable/bola.yml b/Resources/Prototypes/Entities/Objects/Weapons/Throwable/bola.yml index ca3edf68c0..840f278ca5 100644 --- a/Resources/Prototypes/Entities/Objects/Weapons/Throwable/bola.yml +++ b/Resources/Prototypes/Entities/Objects/Weapons/Throwable/bola.yml @@ -1,8 +1,7 @@ - type: entity - name: bola parent: BaseItem - id: Bola - description: Linked together with some spare cuffs and metal. + id: BaseBola # WD EDIT + abstract: true # WD EDIT components: - type: Item size: Normal @@ -13,32 +12,6 @@ sound: /Audio/Weapons/bolathrow.ogg - type: EmitSoundOnLand sound: /Audio/Effects/snap.ogg - - type: Construction - graph: Bola - node: bola - - type: Damageable - damageContainer: Inorganic - - type: Destructible - thresholds: - - trigger: - !type:DamageTrigger - damage: 75 - behaviors: - - !type:DoActsBehavior - acts: [ "Destruction" ] - - trigger: - !type:DamageTrigger - damage: 15 - behaviors: - - !type:PlaySoundBehavior - sound: - collection: MetalBreak - - !type:DoActsBehavior - acts: [ "Destruction" ] - - type: DamageOnLand - damage: - types: - Blunt: 5 - type: Ensnaring freeTime: 2.0 breakoutTime: 3.5 #all bola should generally be fast to remove @@ -47,4 +20,5 @@ staminaDamage: 55 # Sudden weight increase sapping stamina canThrowTrigger: true canMoveBreakout: true + - type: LayDownOnCollide # WD EDIT diff --git a/Resources/Prototypes/_White/Entities/Objects/Weapons/Throwable/bola.yml b/Resources/Prototypes/_White/Entities/Objects/Weapons/Throwable/bola.yml new file mode 100644 index 0000000000..6b21c8ad45 --- /dev/null +++ b/Resources/Prototypes/_White/Entities/Objects/Weapons/Throwable/bola.yml @@ -0,0 +1,53 @@ +- type: entity + parent: BaseBola + id: Bola + name: bola + description: Linked together with some spare cuffs and metal. + components: + - type: Construction + graph: Bola + node: bola + - type: Damageable + damageContainer: Inorganic + - type: Destructible + thresholds: + - trigger: + !type:DamageTrigger + damage: 75 + behaviors: + - !type:DoActsBehavior + acts: [ "Destruction" ] + - trigger: + !type:DamageTrigger + damage: 15 + behaviors: + - !type:PlaySoundBehavior + sound: + collection: MetalBreak + - !type:DoActsBehavior + acts: [ "Destruction" ] + - type: DamageOnLand + damage: + types: + Blunt: 5 + +- type: entity + parent: BaseBola + id: EnergyBola + name: energy bola + description: A perfect fusion of technology and justice to catch criminals. + components: + - type: Item + size: Small + - type: Sprite + sprite: _White/Objects/Weapons/Throwable/energybola.rsi + - type: EmitSoundOnLand + sound: + collection: sparks + - type: KnockdownOnCollide + knockdownTime: 2 + jitterTime: 7 + stutterTime: 7 + - type: Tag + tags: + - SecBeltEquip diff --git a/Resources/Textures/_White/Objects/Weapons/Throwable/energybola.rsi/icon.png b/Resources/Textures/_White/Objects/Weapons/Throwable/energybola.rsi/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..500b7034bb5c690362cad7834497ecb24ed1ddf6 GIT binary patch literal 629 zcmV-*0*d{KP)RCt{2m@!KOK@f#Uu}YUhtOZS(N`HY!8vO-=je>|MqQ65C z#lj*Wf*`iq1kuLwtOP-nTpCk|2-=7Q;k-GRxLI$ryEl6Y%039WyG`=Goqaj>W(fK$ z5Ac5gmbSMdIzHIg9Ox+knm;zej&oB8XBD{G+y60KU5QK~*Z>R1M-e=~Wd1%2ATgIj zS;&0}(#&m)Spc&6*T^trl{EmGKLj`J^U~x5aAXBQ=GQyB?J}1XOW_Qed#!}H?*nITvz8yrGy=hLY0YnJ#TpY()b916yg0vqJ*It(sHh{{U)*i3va>526Bb0bI z)aAqpfE+TYU3QG?a>4>Iy%}+COxg-?L&gR`aYDuda1k;VfCwR;gF_iDK_2@6D}X%Z z0X%^35BUCo?+^I?fbS3djs5`biu=+Zz+G`620%3{Q@!mE;LOP!cf^T=2b0|U1N0m~ z+j86)7p2eS-yev}jzaTp{Q+H0tN}y_EPD~u{Q*u+*!=-rPS^k{b6R_ooUj43{Q*Tz zoB+rnQ}zcGIbi{q-i&hX4{$@q2H=K_1>hoNEC3NAYslCD1OYjz@6U$co_{sLxP=}m P00000NkvXXu0mjfE!z%Y literal 0 HcmV?d00001 diff --git a/Resources/Textures/_White/Objects/Weapons/Throwable/energybola.rsi/meta.json b/Resources/Textures/_White/Objects/Weapons/Throwable/energybola.rsi/meta.json new file mode 100644 index 0000000000..48e6f05450 --- /dev/null +++ b/Resources/Textures/_White/Objects/Weapons/Throwable/energybola.rsi/meta.json @@ -0,0 +1,20 @@ +{ + "version": 1, + "license": "CC-BY-SA-3.0", + "copyright": "Taken from https://github.com/ParadiseSS13/Paradise", + "size": { + "x": 32, + "y": 32 + }, + "states": [ + { + "name": "icon", + "delays": [ + [ + 0.1, + 0.1 + ] + ] + } + ] +} From 6224e4c92a900b3703783004611aa248d0a679ca Mon Sep 17 00:00:00 2001 From: Spatison <137375981+Spatison@users.noreply.github.com> Date: Fri, 1 Nov 2024 02:58:24 +0300 Subject: [PATCH 04/11] WD EDIT --- Content.Shared/Flash/Components/FlashOnTriggerComponent.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Content.Shared/Flash/Components/FlashOnTriggerComponent.cs b/Content.Shared/Flash/Components/FlashOnTriggerComponent.cs index 5b8d7885cc..2c830cdda1 100644 --- a/Content.Shared/Flash/Components/FlashOnTriggerComponent.cs +++ b/Content.Shared/Flash/Components/FlashOnTriggerComponent.cs @@ -11,9 +11,11 @@ public sealed partial class FlashOnTriggerComponent : Component [DataField] public float Duration = 8.0f; [DataField] public float Probability = 1.0f; + // WD EDIT START [DataField] public float StunTime; [DataField] public float KnockdownTime; + // WD EDIT END } From 2cb63b20d43c5b332a8ae0d2884c0413a835137b Mon Sep 17 00:00:00 2001 From: Spatison <137375981+Spatison@users.noreply.github.com> Date: Fri, 1 Nov 2024 03:08:37 +0300 Subject: [PATCH 05/11] ru loc --- .../objects/weapons/throwable/bola.ftl | 53 ++++++++++++++++++ .../Objects/Weapons/Throwable/bola.yml | 55 +------------------ 2 files changed, 55 insertions(+), 53 deletions(-) create mode 100644 Resources/Locale/ru-RU/_white/prototypes/entities/objects/weapons/throwable/bola.ftl diff --git a/Resources/Locale/ru-RU/_white/prototypes/entities/objects/weapons/throwable/bola.ftl b/Resources/Locale/ru-RU/_white/prototypes/entities/objects/weapons/throwable/bola.ftl new file mode 100644 index 0000000000..6b21c8ad45 --- /dev/null +++ b/Resources/Locale/ru-RU/_white/prototypes/entities/objects/weapons/throwable/bola.ftl @@ -0,0 +1,53 @@ +- type: entity + parent: BaseBola + id: Bola + name: bola + description: Linked together with some spare cuffs and metal. + components: + - type: Construction + graph: Bola + node: bola + - type: Damageable + damageContainer: Inorganic + - type: Destructible + thresholds: + - trigger: + !type:DamageTrigger + damage: 75 + behaviors: + - !type:DoActsBehavior + acts: [ "Destruction" ] + - trigger: + !type:DamageTrigger + damage: 15 + behaviors: + - !type:PlaySoundBehavior + sound: + collection: MetalBreak + - !type:DoActsBehavior + acts: [ "Destruction" ] + - type: DamageOnLand + damage: + types: + Blunt: 5 + +- type: entity + parent: BaseBola + id: EnergyBola + name: energy bola + description: A perfect fusion of technology and justice to catch criminals. + components: + - type: Item + size: Small + - type: Sprite + sprite: _White/Objects/Weapons/Throwable/energybola.rsi + - type: EmitSoundOnLand + sound: + collection: sparks + - type: KnockdownOnCollide + knockdownTime: 2 + jitterTime: 7 + stutterTime: 7 + - type: Tag + tags: + - SecBeltEquip diff --git a/Resources/Prototypes/_White/Entities/Objects/Weapons/Throwable/bola.yml b/Resources/Prototypes/_White/Entities/Objects/Weapons/Throwable/bola.yml index 6b21c8ad45..f235561911 100644 --- a/Resources/Prototypes/_White/Entities/Objects/Weapons/Throwable/bola.yml +++ b/Resources/Prototypes/_White/Entities/Objects/Weapons/Throwable/bola.yml @@ -1,53 +1,2 @@ -- type: entity - parent: BaseBola - id: Bola - name: bola - description: Linked together with some spare cuffs and metal. - components: - - type: Construction - graph: Bola - node: bola - - type: Damageable - damageContainer: Inorganic - - type: Destructible - thresholds: - - trigger: - !type:DamageTrigger - damage: 75 - behaviors: - - !type:DoActsBehavior - acts: [ "Destruction" ] - - trigger: - !type:DamageTrigger - damage: 15 - behaviors: - - !type:PlaySoundBehavior - sound: - collection: MetalBreak - - !type:DoActsBehavior - acts: [ "Destruction" ] - - type: DamageOnLand - damage: - types: - Blunt: 5 - -- type: entity - parent: BaseBola - id: EnergyBola - name: energy bola - description: A perfect fusion of technology and justice to catch criminals. - components: - - type: Item - size: Small - - type: Sprite - sprite: _White/Objects/Weapons/Throwable/energybola.rsi - - type: EmitSoundOnLand - sound: - collection: sparks - - type: KnockdownOnCollide - knockdownTime: 2 - jitterTime: 7 - stutterTime: 7 - - type: Tag - tags: - - SecBeltEquip +ent-EnergyBola = энергобола + .desc = Совершенное слияние технологии и справедливости для отлова преступников. From 3b3d6da74ab9f8e018f7859f319b2460ecad59e6 Mon Sep 17 00:00:00 2001 From: Spatison <137375981+Spatison@users.noreply.github.com> Date: Fri, 1 Nov 2024 03:12:25 +0300 Subject: [PATCH 06/11] fix --- .../objects/weapons/throwable/bola.ftl | 55 +------------------ .../Objects/Weapons/Throwable/bola.yml | 55 ++++++++++++++++++- 2 files changed, 55 insertions(+), 55 deletions(-) diff --git a/Resources/Locale/ru-RU/_white/prototypes/entities/objects/weapons/throwable/bola.ftl b/Resources/Locale/ru-RU/_white/prototypes/entities/objects/weapons/throwable/bola.ftl index 6b21c8ad45..f235561911 100644 --- a/Resources/Locale/ru-RU/_white/prototypes/entities/objects/weapons/throwable/bola.ftl +++ b/Resources/Locale/ru-RU/_white/prototypes/entities/objects/weapons/throwable/bola.ftl @@ -1,53 +1,2 @@ -- type: entity - parent: BaseBola - id: Bola - name: bola - description: Linked together with some spare cuffs and metal. - components: - - type: Construction - graph: Bola - node: bola - - type: Damageable - damageContainer: Inorganic - - type: Destructible - thresholds: - - trigger: - !type:DamageTrigger - damage: 75 - behaviors: - - !type:DoActsBehavior - acts: [ "Destruction" ] - - trigger: - !type:DamageTrigger - damage: 15 - behaviors: - - !type:PlaySoundBehavior - sound: - collection: MetalBreak - - !type:DoActsBehavior - acts: [ "Destruction" ] - - type: DamageOnLand - damage: - types: - Blunt: 5 - -- type: entity - parent: BaseBola - id: EnergyBola - name: energy bola - description: A perfect fusion of technology and justice to catch criminals. - components: - - type: Item - size: Small - - type: Sprite - sprite: _White/Objects/Weapons/Throwable/energybola.rsi - - type: EmitSoundOnLand - sound: - collection: sparks - - type: KnockdownOnCollide - knockdownTime: 2 - jitterTime: 7 - stutterTime: 7 - - type: Tag - tags: - - SecBeltEquip +ent-EnergyBola = энергобола + .desc = Совершенное слияние технологии и справедливости для отлова преступников. diff --git a/Resources/Prototypes/_White/Entities/Objects/Weapons/Throwable/bola.yml b/Resources/Prototypes/_White/Entities/Objects/Weapons/Throwable/bola.yml index f235561911..6b21c8ad45 100644 --- a/Resources/Prototypes/_White/Entities/Objects/Weapons/Throwable/bola.yml +++ b/Resources/Prototypes/_White/Entities/Objects/Weapons/Throwable/bola.yml @@ -1,2 +1,53 @@ -ent-EnergyBola = энергобола - .desc = Совершенное слияние технологии и справедливости для отлова преступников. +- type: entity + parent: BaseBola + id: Bola + name: bola + description: Linked together with some spare cuffs and metal. + components: + - type: Construction + graph: Bola + node: bola + - type: Damageable + damageContainer: Inorganic + - type: Destructible + thresholds: + - trigger: + !type:DamageTrigger + damage: 75 + behaviors: + - !type:DoActsBehavior + acts: [ "Destruction" ] + - trigger: + !type:DamageTrigger + damage: 15 + behaviors: + - !type:PlaySoundBehavior + sound: + collection: MetalBreak + - !type:DoActsBehavior + acts: [ "Destruction" ] + - type: DamageOnLand + damage: + types: + Blunt: 5 + +- type: entity + parent: BaseBola + id: EnergyBola + name: energy bola + description: A perfect fusion of technology and justice to catch criminals. + components: + - type: Item + size: Small + - type: Sprite + sprite: _White/Objects/Weapons/Throwable/energybola.rsi + - type: EmitSoundOnLand + sound: + collection: sparks + - type: KnockdownOnCollide + knockdownTime: 2 + jitterTime: 7 + stutterTime: 7 + - type: Tag + tags: + - SecBeltEquip From c5c4f0f1fa1f3659cd26135e37ab2183897f680d Mon Sep 17 00:00:00 2001 From: Spatison <137375981+Spatison@users.noreply.github.com> Date: Fri, 1 Nov 2024 13:30:02 +0300 Subject: [PATCH 07/11] Ai rewiew --- Content.Server/Flash/FlashSystem.cs | 2 +- .../_White/Collision/LayDown/LayDownOnCollideSystem.cs | 3 +++ Resources/Locale/en-US/_white/alerts/alerts.ftl | 2 +- Resources/Locale/ru-RU/_white/alerts/alerts.ftl | 4 ++-- Resources/Prototypes/Alerts/alerts.yml | 4 +++- 5 files changed, 10 insertions(+), 5 deletions(-) diff --git a/Content.Server/Flash/FlashSystem.cs b/Content.Server/Flash/FlashSystem.cs index eaa96c08ae..7eb14e2fcb 100644 --- a/Content.Server/Flash/FlashSystem.cs +++ b/Content.Server/Flash/FlashSystem.cs @@ -171,7 +171,7 @@ public void Flash(EntityUid target, // WD EDIT START private void FlashStun(EntityUid target, float stunDuration, float knockdownDuration, float distance, float range) { - if (stunDuration <= 0 || knockdownDuration <= 0) + if (stunDuration <= 0 && knockdownDuration <= 0) return; if (TryComp(target, out var suppression)) diff --git a/Content.Shared/_White/Collision/LayDown/LayDownOnCollideSystem.cs b/Content.Shared/_White/Collision/LayDown/LayDownOnCollideSystem.cs index 1a10c67a8d..53678ac922 100644 --- a/Content.Shared/_White/Collision/LayDown/LayDownOnCollideSystem.cs +++ b/Content.Shared/_White/Collision/LayDown/LayDownOnCollideSystem.cs @@ -28,6 +28,9 @@ private void OnProjectileHit(Entity ent, ref Projecti private void ApplyEffects(EntityUid target, LayDownOnCollideComponent component) { + if (!Exists(target)) + return; + _layingDown.TryLieDown(target, null, null, component.Behavior); } } diff --git a/Resources/Locale/en-US/_white/alerts/alerts.ftl b/Resources/Locale/en-US/_white/alerts/alerts.ftl index 9a438b3219..ffb066dae0 100644 --- a/Resources/Locale/en-US/_white/alerts/alerts.ftl +++ b/Resources/Locale/en-US/_white/alerts/alerts.ftl @@ -2,4 +2,4 @@ alerts-blocked-name = Recently blocked alerts-blocked-desc = I can't block for a while! alerts-knockdown-name = [color=yellow]Knocked down[/color] -alerts-knockdown-desc = You're [color=yellow]knocked down[/color]! Something is impairing your ability to getting up. +alerts-knockdown-desc = You're [color=yellow]knocked down[/color]! Something is impairing your ability to get up. diff --git a/Resources/Locale/ru-RU/_white/alerts/alerts.ftl b/Resources/Locale/ru-RU/_white/alerts/alerts.ftl index 0972bd4efa..82184c0a0d 100644 --- a/Resources/Locale/ru-RU/_white/alerts/alerts.ftl +++ b/Resources/Locale/ru-RU/_white/alerts/alerts.ftl @@ -1,5 +1,5 @@ alerts-blocked-name = Атака заблокирована alerts-blocked-desc = Невозможно блокировать некоторое время. -alerts-knockdown-name = [color=yellow]Cбиты с ног[/color] -alerts-knockdown-desc = Вы [color=yellow]cбиты с ног[/color]! Что-то мешает вам встать. +alerts-knockdown-name = [color=yellow]Сбиты с ног[/color] +alerts-knockdown-desc = Вы [color=yellow]сбиты с ног[/color]! Что-то мешает вам встать. diff --git a/Resources/Prototypes/Alerts/alerts.yml b/Resources/Prototypes/Alerts/alerts.yml index 932eac27f7..de55649842 100644 --- a/Resources/Prototypes/Alerts/alerts.yml +++ b/Resources/Prototypes/Alerts/alerts.yml @@ -631,7 +631,9 @@ - type: alert id: RecentlyBlocked - icons: [ /Textures/Objects/Weapons/Melee/shields.rsi/buckler-icon.png ] + icons: + - sprite: /Textures/Objects/Weapons/Melee/shields.rsi + state: buckler-icon name: alerts-blocked-name description: alerts-blocked-desc # WD EDIT END From 7700c1ae1af81539d7f7cafc5ac8b7abfad3ada0 Mon Sep 17 00:00:00 2001 From: Spatison <137375981+Spatison@users.noreply.github.com> Date: Tue, 26 Nov 2024 17:41:11 +0300 Subject: [PATCH 08/11] tweak --- Content.Shared/Stunnable/KnockedDownComponent.cs | 2 +- RobustToolbox | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Content.Shared/Stunnable/KnockedDownComponent.cs b/Content.Shared/Stunnable/KnockedDownComponent.cs index 865c69bf6e..0a6c634890 100644 --- a/Content.Shared/Stunnable/KnockedDownComponent.cs +++ b/Content.Shared/Stunnable/KnockedDownComponent.cs @@ -14,7 +14,7 @@ public sealed partial class KnockedDownComponent : Component public SoundSpecifier StunAttemptSound = new SoundPathSpecifier("/Audio/Effects/thudswoosh.ogg"); [DataField] - public DropHeldItemsBehavior DropHeldItemsBehavior = DropHeldItemsBehavior.DropIfStanding; + public DropHeldItemsBehavior DropHeldItemsBehavior = DropHeldItemsBehavior.AlwaysDrop; [ViewVariables, AutoNetworkedField] public float HelpTimer = 0f; diff --git a/RobustToolbox b/RobustToolbox index 32bca7cfd4..ec794ce4e4 160000 --- a/RobustToolbox +++ b/RobustToolbox @@ -1 +1 @@ -Subproject commit 32bca7cfd417edcad9a60c2b1703eba8675f56af +Subproject commit ec794ce4e4693069d3b3ebf7a88ead5ff2f860e0 From eac4930f004b50a1a44ccd91cb30952db0dc6709 Mon Sep 17 00:00:00 2001 From: Spatison <137375981+Spatison@users.noreply.github.com> Date: Tue, 26 Nov 2024 20:23:41 +0300 Subject: [PATCH 09/11] Revert "tweak" This reverts commit 7700c1ae1af81539d7f7cafc5ac8b7abfad3ada0. --- Content.Shared/Stunnable/KnockedDownComponent.cs | 2 +- RobustToolbox | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Content.Shared/Stunnable/KnockedDownComponent.cs b/Content.Shared/Stunnable/KnockedDownComponent.cs index 0a6c634890..865c69bf6e 100644 --- a/Content.Shared/Stunnable/KnockedDownComponent.cs +++ b/Content.Shared/Stunnable/KnockedDownComponent.cs @@ -14,7 +14,7 @@ public sealed partial class KnockedDownComponent : Component public SoundSpecifier StunAttemptSound = new SoundPathSpecifier("/Audio/Effects/thudswoosh.ogg"); [DataField] - public DropHeldItemsBehavior DropHeldItemsBehavior = DropHeldItemsBehavior.AlwaysDrop; + public DropHeldItemsBehavior DropHeldItemsBehavior = DropHeldItemsBehavior.DropIfStanding; [ViewVariables, AutoNetworkedField] public float HelpTimer = 0f; diff --git a/RobustToolbox b/RobustToolbox index ec794ce4e4..32bca7cfd4 160000 --- a/RobustToolbox +++ b/RobustToolbox @@ -1 +1 @@ -Subproject commit ec794ce4e4693069d3b3ebf7a88ead5ff2f860e0 +Subproject commit 32bca7cfd417edcad9a60c2b1703eba8675f56af From d435c27d303615fc850efc46ffb60506f30bc4e5 Mon Sep 17 00:00:00 2001 From: Spatison <137375981+Spatison@users.noreply.github.com> Date: Tue, 26 Nov 2024 20:24:34 +0300 Subject: [PATCH 10/11] fix --- Content.Shared/Stunnable/KnockedDownComponent.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Content.Shared/Stunnable/KnockedDownComponent.cs b/Content.Shared/Stunnable/KnockedDownComponent.cs index 865c69bf6e..0a6c634890 100644 --- a/Content.Shared/Stunnable/KnockedDownComponent.cs +++ b/Content.Shared/Stunnable/KnockedDownComponent.cs @@ -14,7 +14,7 @@ public sealed partial class KnockedDownComponent : Component public SoundSpecifier StunAttemptSound = new SoundPathSpecifier("/Audio/Effects/thudswoosh.ogg"); [DataField] - public DropHeldItemsBehavior DropHeldItemsBehavior = DropHeldItemsBehavior.DropIfStanding; + public DropHeldItemsBehavior DropHeldItemsBehavior = DropHeldItemsBehavior.AlwaysDrop; [ViewVariables, AutoNetworkedField] public float HelpTimer = 0f; From 6a359d0d2dc4057635ae627cdb4543b9c5c995cc Mon Sep 17 00:00:00 2001 From: Spatison <137375981+Spatison@users.noreply.github.com> Date: Fri, 29 Nov 2024 07:57:20 +0300 Subject: [PATCH 11/11] rewiew --- .../Stunnable/Systems/StunbatonSystem.cs | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/Content.Server/Stunnable/Systems/StunbatonSystem.cs b/Content.Server/Stunnable/Systems/StunbatonSystem.cs index fc97c86ad2..2b10aa3cc1 100644 --- a/Content.Server/Stunnable/Systems/StunbatonSystem.cs +++ b/Content.Server/Stunnable/Systems/StunbatonSystem.cs @@ -40,10 +40,7 @@ public override void Initialize() private void OnStaminaHitAttempt(Entity entity, ref StaminaDamageOnHitAttemptEvent args) { // WD EDIT START - if (!_itemToggle.IsActivated(entity.Owner) - || !_battery.TryGetBatteryComponent(entity, out var battery, out var batteryUid) - || battery.CurrentCharge < entity.Comp.EnergyPerUse - || !_battery.TryUseCharge(batteryUid.Value, entity.Comp.EnergyPerUse / 2, battery)) + if (!_itemToggle.IsActivated(entity.Owner) || TryUseCharge(entity)) args.Cancelled = true; // WD EDIT END } @@ -51,10 +48,7 @@ private void OnStaminaHitAttempt(Entity entity, ref StaminaD // WD EDIT START private void OnKnockdownHitAttempt(Entity entity, ref KnockdownOnHitAttemptEvent args) { - if (!_itemToggle.IsActivated(entity.Owner) - || !_battery.TryGetBatteryComponent(entity, out var battery, out var batteryUid) - || battery.CurrentCharge < entity.Comp.EnergyPerUse - || !_battery.TryUseCharge(batteryUid.Value, entity.Comp.EnergyPerUse / 2, battery)) + if (!_itemToggle.IsActivated(entity.Owner) || TryUseCharge(entity)) args.Cancelled = true; } // WD EDIT END @@ -141,6 +135,13 @@ private void CheckCharge(Entity entity) || battery.CurrentCharge < entity.Comp.EnergyPerUse) _itemToggle.TryDeactivate(entity.Owner, predicted: false); } + + private bool TryUseCharge(Entity entity) + { + return _battery.TryGetBatteryComponent(entity, out var battery, out var batteryUid) + && battery.CurrentCharge >= entity.Comp.EnergyPerUse + && _battery.TryUseCharge(batteryUid.Value, entity.Comp.EnergyPerUse / 2, battery); + } // WD EDIT END } }