Tiny shove fix. (#25353)

* Remove second shove check.

* Change when popups and sounds are created.
Reduces phantom shoves that feel bad.

* why didn't i think of this i saw it earlier...

* Replaced Is fields with prefix

* remove some dependencies to fix tests???
This commit is contained in:
Callmore
2024-02-21 04:01:45 +00:00
committed by GitHub
parent 811858a155
commit 5a2c744998
4 changed files with 55 additions and 32 deletions

View File

@@ -28,12 +28,10 @@ public sealed partial class StaminaSystem : EntitySystem
{
[Dependency] private readonly IGameTiming _timing = default!;
[Dependency] private readonly INetManager _net = default!;
[Dependency] private readonly IRobustRandom _random = default!;
[Dependency] private readonly ISharedAdminLogManager _adminLogger = default!;
[Dependency] private readonly AlertsSystem _alerts = default!;
[Dependency] private readonly MetaDataSystem _metadata = default!;
[Dependency] private readonly SharedColorFlashEffectSystem _color = default!;
[Dependency] private readonly SharedPopupSystem _popup = default!;
[Dependency] private readonly SharedStunSystem _stunSystem = default!;
[Dependency] private readonly SharedAudioSystem _audio = default!;
@@ -122,7 +120,7 @@ public sealed partial class StaminaSystem : EntitySystem
private void OnDisarmed(EntityUid uid, StaminaComponent component, DisarmedEvent args)
{
if (args.Handled || !_random.Prob(args.PushProbability))
if (args.Handled)
return;
if (component.Critical)
@@ -131,17 +129,8 @@ public sealed partial class StaminaSystem : EntitySystem
var damage = args.PushProbability * component.CritThreshold;
TakeStaminaDamage(uid, damage, component, source: args.Source);
// We need a better method of getting if the entity is going to resist stam damage, both this and the lines in the foreach at the end of OnHit() are awful
if (!component.Critical)
return;
var targetEnt = Identity.Entity(args.Target, EntityManager);
var sourceEnt = Identity.Entity(args.Source, EntityManager);
_popup.PopupEntity(Loc.GetString("stunned-component-disarm-success-others", ("source", sourceEnt), ("target", targetEnt)), targetEnt, Filter.PvsExcept(args.Source), true, PopupType.LargeCaution);
_popup.PopupCursor(Loc.GetString("stunned-component-disarm-success", ("target", targetEnt)), args.Source, PopupType.Large);
_adminLogger.Add(LogType.DisarmedKnockdown, LogImpact.Medium, $"{ToPrettyString(args.Source):user} knocked down {ToPrettyString(args.Target):target}");
args.PopupPrefix = "disarm-action-shove-";
args.IsStunned = component.Critical;
args.Handled = true;
}