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