]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Add stamina and mob damage playtest modifiers (#35599)
authorSlamBamActionman <83650252+SlamBamActionman@users.noreply.github.com>
Thu, 20 Mar 2025 23:01:35 +0000 (00:01 +0100)
committerGitHub <noreply@github.com>
Thu, 20 Mar 2025 23:01:35 +0000 (00:01 +0100)
* Add stamina and mob damage playtest modifiers

* Fix typo

* Add FTL

* Review fixes

* Update Content.Shared/Mobs/Systems/MobStateSystem.Subscribers.cs

---------

Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com>
Content.Shared/CCVar/CCVars.Playtest.cs
Content.Shared/Damage/Systems/DamageableSystem.cs
Content.Shared/Damage/Systems/StaminaSystem.cs
Content.Shared/Mobs/Systems/MobStateSystem.Subscribers.cs
Content.Shared/Mobs/Systems/MobStateSystem.cs
Resources/Locale/en-US/cvar/cvar-help.ftl

index 5b5bea7d9472173367a032816ab5921f918da503..ea403ca75e91494e44202b2ef69eaaafaa02e0c9 100644 (file)
@@ -77,4 +77,18 @@ public sealed partial class CCVars
         public static readonly CVarDef<float> PlaytestExplosionDamageModifier =
             CVarDef.Create("playtest.explosion_damage_modifier", 1f, CVar.SERVER | CVar.REPLICATED);
 
+        /// <summary>
+        ///     Scales the damage dealt to mobs in the game (i.e. entities with MobStateComponent).
+        /// </summary>
+        [CVarControl(AdminFlags.VarEdit)]
+        public static readonly CVarDef<float> PlaytestMobDamageModifier =
+            CVarDef.Create("playtest.mob_damage_modifier", 1f, CVar.SERVER | CVar.REPLICATED);
+
+        /// <summary>
+        ///     Scales the stamina damage dealt the game.
+        /// </summary>
+        [CVarControl(AdminFlags.VarEdit)]
+        public static readonly CVarDef<float> PlaytestStaminaDamageModifier =
+            CVarDef.Create("playtest.stamina_damage_modifier", 1f, CVar.SERVER | CVar.REPLICATED);
+
 }
index d5938db9af3e73c669275c09581188563025e13f..8557e5623fdc35a5b4f568f41b90caa90883a222 100644 (file)
@@ -40,6 +40,7 @@ namespace Content.Shared.Damage
         public float UniversalExplosionDamageModifier { get; private set; } = 1f;
         public float UniversalThrownDamageModifier { get; private set; } = 1f;
         public float UniversalTopicalsHealModifier { get; private set; } = 1f;
+        public float UniversalMobDamageModifier { get; private set; } = 1f;
 
         public override void Initialize()
         {
@@ -82,6 +83,7 @@ namespace Content.Shared.Damage
             Subs.CVar(_config, CCVars.PlaytestExplosionDamageModifier, value => UniversalExplosionDamageModifier = value, true);
             Subs.CVar(_config, CCVars.PlaytestThrownDamageModifier, value => UniversalThrownDamageModifier = value, true);
             Subs.CVar(_config, CCVars.PlaytestTopicalsHealModifier, value => UniversalTopicalsHealModifier = value, true);
+            Subs.CVar(_config, CCVars.PlaytestMobDamageModifier, value => UniversalMobDamageModifier = value, true);
         }
 
         /// <summary>
index a5c8a4b38de7f511f86e973498546a8294f164c7..d897a363d4db659aa09085dbcf7aced3e4784e6b 100644 (file)
@@ -1,6 +1,7 @@
 using System.Linq;
 using Content.Shared.Administration.Logs;
 using Content.Shared.Alert;
+using Content.Shared.CCVar;
 using Content.Shared.CombatMode;
 using Content.Shared.Damage.Components;
 using Content.Shared.Damage.Events;
@@ -17,6 +18,7 @@ using Content.Shared.Weapons.Melee.Events;
 using JetBrains.Annotations;
 using Robust.Shared.Audio;
 using Robust.Shared.Audio.Systems;
+using Robust.Shared.Configuration;
 using Robust.Shared.Network;
 using Robust.Shared.Player;
 using Robust.Shared.Random;
@@ -34,12 +36,15 @@ 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 IConfigurationManager _config = default!;
 
     /// <summary>
     /// How much of a buffer is there between the stun duration and when stuns can be re-applied.
     /// </summary>
     private static readonly TimeSpan StamCritBufferTime = TimeSpan.FromSeconds(3f);
 
+    public float UniversalStaminaDamageModifier { get; private set; } = 1f;
+
     public override void Initialize()
     {
         base.Initialize();
@@ -58,6 +63,8 @@ public sealed partial class StaminaSystem : EntitySystem
         SubscribeLocalEvent<StaminaDamageOnCollideComponent, ThrowDoHitEvent>(OnThrowHit);
 
         SubscribeLocalEvent<StaminaDamageOnHitComponent, MeleeHitEvent>(OnMeleeHit);
+
+        Subs.CVar(_config, CCVars.PlaytestStaminaDamageModifier, value => UniversalStaminaDamageModifier = value, true);
     }
 
     private void OnStamHandleState(EntityUid uid, StaminaComponent component, ref AfterAutoHandleStateEvent args)
@@ -243,6 +250,8 @@ public sealed partial class StaminaSystem : EntitySystem
         if (ev.Cancelled)
             return;
 
+        value = UniversalStaminaDamageModifier * value;
+
         // Have we already reached the point of max stamina damage?
         if (component.Critical)
             return;
index f99bd43febccbeedd7c18a272725e48d9add8538..7b5ee52b272db34cf0a5483f8aa31e398f0cac7b 100644 (file)
@@ -1,6 +1,7 @@
 using Content.Shared.Bed.Sleep;
 using Content.Shared.Buckle.Components;
 using Content.Shared.CombatMode.Pacification;
+using Content.Shared.Damage;
 using Content.Shared.Damage.ForceSay;
 using Content.Shared.Emoting;
 using Content.Shared.Hands;
@@ -44,6 +45,7 @@ public partial class MobStateSystem
         SubscribeLocalEvent<MobStateComponent, TryingToSleepEvent>(OnSleepAttempt);
         SubscribeLocalEvent<MobStateComponent, CombatModeShouldHandInteractEvent>(OnCombatModeShouldHandInteract);
         SubscribeLocalEvent<MobStateComponent, AttemptPacifiedAttackEvent>(OnAttemptPacifiedAttack);
+        SubscribeLocalEvent<MobStateComponent, DamageModifyEvent>(OnDamageModify);
 
         SubscribeLocalEvent<MobStateComponent, UnbuckleAttemptEvent>(OnUnbuckleAttempt);
     }
@@ -186,5 +188,10 @@ public partial class MobStateSystem
         args.Cancelled = true;
     }
 
+    private void OnDamageModify(Entity<MobStateComponent> ent, ref DamageModifyEvent args)
+    {
+        args.Damage *= _damageable.UniversalMobDamageModifier;
+    }
+
     #endregion
 }
index d3e55f0d698299900ac56c92ac52c12392fc96ba..d3cfda32bb519e065c43db73acf6a46088517db7 100644 (file)
@@ -1,5 +1,6 @@
 using Content.Shared.ActionBlocker;
 using Content.Shared.Administration.Logs;
+using Content.Shared.Damage;
 using Content.Shared.Mobs.Components;
 using Content.Shared.Standing;
 using Robust.Shared.Physics.Systems;
@@ -16,6 +17,7 @@ public partial class MobStateSystem : EntitySystem
     [Dependency] private readonly ISharedAdminLogManager _adminLogger = default!;
     [Dependency] private readonly ILogManager _logManager = default!;
     [Dependency] private readonly IGameTiming _timing = default!;
+    [Dependency] private readonly DamageableSystem _damageable = default!;
     private ISawmill _sawmill = default!;
 
     private EntityQuery<MobStateComponent> _mobStateQuery;
index 55b0cb6188c68e918d00189ebf03e456f593d365..03f5ab71076bbc44762ab979645744e3facc44e6 100644 (file)
@@ -27,3 +27,7 @@ changecvar-simple-playtest_reagent_heal_modifier = Multiplier affecting reagent
 changecvar-full-playtest_reagent_heal_modifier = Multiplier affecting all healing done by reagents.
 changecvar-simple-playtest_explosion_damage_modifier = Multiplier affecting explosion damage.
 changecvar-full-playtest_explosion_damage_modifier = Multiplier affecting all damage dealt by explosives.
+changecvar-simple-playtest_stamina_damage_modifier = Multiplier affecting stamina damage.
+changecvar-full-playtest_stamina_damage_modifier = Multiplier affecting all stamina damage dealt.
+changecvar-simple-playtest_mob_damage_modifier = Multiplier affecting all damage dealt to mobs.
+changecvar-full-playtest_mob_damage_modifier = Multiplier affecting all damage dealt to entities with MobStateComponent.