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

@@ -0,0 +1,38 @@
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)));
}
}