-using Content.Shared.Damage;
+using Content.Shared.Damage;
using Content.Shared.Damage.Prototypes;
using Robust.Shared.Audio;
using Robust.Shared.Audio.Systems;
{
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);
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;
[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()
{
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))
_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;