The long overdue downfall of stun meta - Stamina resists on Nukie & ERT Suits. (#35580)

* Add stamina damage resistance

* Probably starting a civil war within the community.

* Tweak some values, my chart was outdated.

* Tone down the values

* Allow a way to bypass the resistances, which forks downstream can use.

* Apply suggestions from code review

Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com>

* Comment out the changes to non-deathsquad suits.

* minor text fix e

* review

---------

Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com>
Co-authored-by: SlamBamActionman <slambamactionman@gmail.com>
Co-authored-by: Milon <milonpl.git@proton.me>
This commit is contained in:
BramvanZijp
2025-04-14 17:27:26 +02:00
committed by GitHub
parent 8700d10f98
commit cf14cb3eb5
9 changed files with 112 additions and 7 deletions

View File

@@ -50,6 +50,7 @@ public sealed partial class StaminaSystem : EntitySystem
base.Initialize();
InitializeModifier();
InitializeResistance();
SubscribeLocalEvent<StaminaComponent, ComponentStartup>(OnStartup);
SubscribeLocalEvent<StaminaComponent, ComponentShutdown>(OnShutdown);
@@ -240,7 +241,7 @@ public sealed partial class StaminaSystem : EntitySystem
}
public void TakeStaminaDamage(EntityUid uid, float value, StaminaComponent? component = null,
EntityUid? source = null, EntityUid? with = null, bool visual = true, SoundSpecifier? sound = null)
EntityUid? source = null, EntityUid? with = null, bool visual = true, SoundSpecifier? sound = null, bool ignoreResist = false)
{
if (!Resolve(uid, ref component, false))
return;
@@ -250,6 +251,12 @@ public sealed partial class StaminaSystem : EntitySystem
if (ev.Cancelled)
return;
// Allow stamina resistance to be applied.
if (!ignoreResist)
{
value = ev.Value;
}
value = UniversalStaminaDamageModifier * value;
// Have we already reached the point of max stamina damage?
@@ -399,9 +406,3 @@ public sealed partial class StaminaSystem : EntitySystem
_adminLogger.Add(LogType.Stamina, LogImpact.Low, $"{ToPrettyString(uid):user} recovered from stamina crit");
}
}
/// <summary>
/// Raised before stamina damage is dealt to allow other systems to cancel it.
/// </summary>
[ByRefEvent]
public record struct BeforeStaminaDamageEvent(float Value, bool Cancelled = false);