Fix riot shield audio and popup spam (#21881)
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
using Content.Shared.Damage;
|
||||
using Content.Shared.Damage;
|
||||
using Content.Shared.Damage.Prototypes;
|
||||
using Robust.Shared.Audio;
|
||||
using Robust.Shared.Audio.Systems;
|
||||
@@ -44,6 +44,9 @@ public sealed partial class BlockingSystem
|
||||
{
|
||||
if (TryComp<BlockingComponent>(component.BlockingItem, out var blocking))
|
||||
{
|
||||
if (args.Damage.GetTotal() <= 0)
|
||||
return;
|
||||
|
||||
var blockFraction = blocking.IsBlocking ? blocking.ActiveBlockFraction : blocking.PassiveBlockFraction;
|
||||
blockFraction = Math.Clamp(blockFraction, 0, 1);
|
||||
_damageable.TryChangeDamage(component.BlockingItem, blockFraction * args.OriginalDamage);
|
||||
|
||||
@@ -19,6 +19,7 @@ using Robust.Shared.Physics.Components;
|
||||
using Robust.Shared.Physics.Systems;
|
||||
using Robust.Shared.Player;
|
||||
using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Timing;
|
||||
using Robust.Shared.Utility;
|
||||
|
||||
namespace Content.Shared.Blocking;
|
||||
@@ -36,6 +37,7 @@ public sealed partial class BlockingSystem : EntitySystem
|
||||
[Dependency] private readonly SharedPhysicsSystem _physics = default!;
|
||||
[Dependency] private readonly ExamineSystemShared _examine = default!;
|
||||
[Dependency] private readonly INetManager _net = default!;
|
||||
[Dependency] private readonly IGameTiming _gameTiming = default!;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
@@ -195,8 +197,12 @@ public sealed partial class BlockingSystem : EntitySystem
|
||||
return false;
|
||||
}
|
||||
_actionsSystem.SetToggled(component.BlockingToggleActionEntity, true);
|
||||
_popupSystem.PopupEntity(msgUser, user, user);
|
||||
_popupSystem.PopupEntity(msgOther, user, Filter.PvsExcept(user), true);
|
||||
if (_gameTiming.IsFirstTimePredicted)
|
||||
{
|
||||
_popupSystem.PopupEntity(msgOther, user, Filter.PvsExcept(user), true);
|
||||
if(_gameTiming.InPrediction)
|
||||
_popupSystem.PopupEntity(msgUser, user, user);
|
||||
}
|
||||
}
|
||||
|
||||
if (TryComp<PhysicsComponent>(user, out var physicsComponent))
|
||||
@@ -259,8 +265,12 @@ public sealed partial class BlockingSystem : EntitySystem
|
||||
_actionsSystem.SetToggled(component.BlockingToggleActionEntity, false);
|
||||
_fixtureSystem.DestroyFixture(user, BlockingComponent.BlockFixtureID, body: physicsComponent);
|
||||
_physics.SetBodyType(user, blockingUserComponent.OriginalBodyType, body: physicsComponent);
|
||||
_popupSystem.PopupEntity(msgUser, user, user);
|
||||
_popupSystem.PopupEntity(msgOther, user, Filter.PvsExcept(user), true);
|
||||
if (_gameTiming.IsFirstTimePredicted)
|
||||
{
|
||||
_popupSystem.PopupEntity(msgOther, user, Filter.PvsExcept(user), true);
|
||||
if(_gameTiming.InPrediction)
|
||||
_popupSystem.PopupEntity(msgUser, user, user);
|
||||
}
|
||||
}
|
||||
|
||||
component.IsBlocking = false;
|
||||
|
||||
Reference in New Issue
Block a user