diff --git a/Content.Shared/CCVar/CCVars.Playtest.cs b/Content.Shared/CCVar/CCVars.Playtest.cs index 5b5bea7d94..ea403ca75e 100644 --- a/Content.Shared/CCVar/CCVars.Playtest.cs +++ b/Content.Shared/CCVar/CCVars.Playtest.cs @@ -77,4 +77,18 @@ public sealed partial class CCVars public static readonly CVarDef PlaytestExplosionDamageModifier = CVarDef.Create("playtest.explosion_damage_modifier", 1f, CVar.SERVER | CVar.REPLICATED); + /// + /// Scales the damage dealt to mobs in the game (i.e. entities with MobStateComponent). + /// + [CVarControl(AdminFlags.VarEdit)] + public static readonly CVarDef PlaytestMobDamageModifier = + CVarDef.Create("playtest.mob_damage_modifier", 1f, CVar.SERVER | CVar.REPLICATED); + + /// + /// Scales the stamina damage dealt the game. + /// + [CVarControl(AdminFlags.VarEdit)] + public static readonly CVarDef PlaytestStaminaDamageModifier = + CVarDef.Create("playtest.stamina_damage_modifier", 1f, CVar.SERVER | CVar.REPLICATED); + } diff --git a/Content.Shared/Damage/Systems/DamageableSystem.cs b/Content.Shared/Damage/Systems/DamageableSystem.cs index d5938db9af..8557e5623f 100644 --- a/Content.Shared/Damage/Systems/DamageableSystem.cs +++ b/Content.Shared/Damage/Systems/DamageableSystem.cs @@ -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); } /// diff --git a/Content.Shared/Damage/Systems/StaminaSystem.cs b/Content.Shared/Damage/Systems/StaminaSystem.cs index a5c8a4b38d..d897a363d4 100644 --- a/Content.Shared/Damage/Systems/StaminaSystem.cs +++ b/Content.Shared/Damage/Systems/StaminaSystem.cs @@ -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!; /// /// How much of a buffer is there between the stun duration and when stuns can be re-applied. /// 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(OnThrowHit); SubscribeLocalEvent(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; diff --git a/Content.Shared/Mobs/Systems/MobStateSystem.Subscribers.cs b/Content.Shared/Mobs/Systems/MobStateSystem.Subscribers.cs index f99bd43feb..7b5ee52b27 100644 --- a/Content.Shared/Mobs/Systems/MobStateSystem.Subscribers.cs +++ b/Content.Shared/Mobs/Systems/MobStateSystem.Subscribers.cs @@ -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(OnSleepAttempt); SubscribeLocalEvent(OnCombatModeShouldHandInteract); SubscribeLocalEvent(OnAttemptPacifiedAttack); + SubscribeLocalEvent(OnDamageModify); SubscribeLocalEvent(OnUnbuckleAttempt); } @@ -186,5 +188,10 @@ public partial class MobStateSystem args.Cancelled = true; } + private void OnDamageModify(Entity ent, ref DamageModifyEvent args) + { + args.Damage *= _damageable.UniversalMobDamageModifier; + } + #endregion } diff --git a/Content.Shared/Mobs/Systems/MobStateSystem.cs b/Content.Shared/Mobs/Systems/MobStateSystem.cs index d3e55f0d69..d3cfda32bb 100644 --- a/Content.Shared/Mobs/Systems/MobStateSystem.cs +++ b/Content.Shared/Mobs/Systems/MobStateSystem.cs @@ -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 _mobStateQuery; diff --git a/Resources/Locale/en-US/cvar/cvar-help.ftl b/Resources/Locale/en-US/cvar/cvar-help.ftl index 55b0cb6188..03f5ab7107 100644 --- a/Resources/Locale/en-US/cvar/cvar-help.ftl +++ b/Resources/Locale/en-US/cvar/cvar-help.ftl @@ -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.