Files
tbd-station-14/Content.Shared/Damage/Systems/StaminaSystem.Resistance.cs
BramvanZijp cf14cb3eb5 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>
2025-04-14 17:27:26 +02:00

39 lines
1.3 KiB
C#

using Content.Shared.Armor;
using Content.Shared.Damage.Components;
using Content.Shared.Damage.Events;
using Content.Shared.Inventory;
namespace Content.Shared.Damage.Systems;
public sealed partial class StaminaSystem
{
private void InitializeResistance()
{
SubscribeLocalEvent<StaminaResistanceComponent, BeforeStaminaDamageEvent>(OnGetResistance);
SubscribeLocalEvent<StaminaResistanceComponent, InventoryRelayedEvent<BeforeStaminaDamageEvent>>(RelayedResistance);
SubscribeLocalEvent<StaminaResistanceComponent, ArmorExamineEvent>(OnArmorExamine);
}
private void OnGetResistance(Entity<StaminaResistanceComponent> ent, ref BeforeStaminaDamageEvent args)
{
args.Value *= ent.Comp.DamageCoefficient;
}
private void RelayedResistance(Entity<StaminaResistanceComponent> ent, ref InventoryRelayedEvent<BeforeStaminaDamageEvent> args)
{
if (ent.Comp.Worn)
OnGetResistance(ent, ref args.Args);
}
private void OnArmorExamine(Entity<StaminaResistanceComponent> ent, ref ArmorExamineEvent args)
{
var value = MathF.Round((1f - ent.Comp.DamageCoefficient) * 100, 1);
if (value == 0)
return;
args.Msg.PushNewline();
args.Msg.AddMarkupOrThrow(Loc.GetString(ent.Comp.Examine, ("value", value)));
}
}