Skip to content

Commit

Permalink
prevent stamina damage still going through after pacification cancel
Browse files Browse the repository at this point in the history
  • Loading branch information
angelofallars committed Jan 5, 2025
1 parent 8ce4dd9 commit 8b6f064
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions Content.Server/Damage/Systems/DamageOtherOnHitSystem.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Content.Shared.Camera;
using Content.Shared.CombatMode.Pacification;
using Content.Shared.Damage;
using Content.Shared.Damage.Components;
using Content.Shared.Damage.Events;
Expand Down Expand Up @@ -30,13 +31,13 @@ public override void Initialize()
{
base.Initialize();

SubscribeLocalEvent<StaminaComponent, BeforeThrowEvent>(OnBeforeThrow);
SubscribeLocalEvent<StaminaComponent, BeforeThrowEvent>(OnBeforeThrow, after: [typeof(PacificationSystem)]);
SubscribeLocalEvent<DamageOtherOnHitComponent, DamageExamineEvent>(OnDamageExamine);
}

private void OnBeforeThrow(EntityUid uid, StaminaComponent component, ref BeforeThrowEvent args)
{
if (!TryComp<DamageOtherOnHitComponent>(args.ItemUid, out var damage))
if (args.Cancelled || !TryComp<DamageOtherOnHitComponent>(args.ItemUid, out var damage))
return;

if (component.CritThreshold - component.StaminaDamage <= damage.StaminaCost)
Expand Down

0 comments on commit 8b6f064

Please sign in to comment.