Fix predicted entity deletion for damage markers (#17015)
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
using Content.Shared.Damage;
|
||||
using Content.Shared.Projectiles;
|
||||
using Content.Shared.Weapons.Melee.Events;
|
||||
using Robust.Shared.Network;
|
||||
using Robust.Shared.Physics.Events;
|
||||
using Robust.Shared.Timing;
|
||||
|
||||
@@ -9,6 +10,7 @@ namespace Content.Shared.Weapons.Marker;
|
||||
public abstract class SharedDamageMarkerSystem : EntitySystem
|
||||
{
|
||||
[Dependency] private readonly IGameTiming _timing = default!;
|
||||
[Dependency] private readonly INetManager _netManager = default!;
|
||||
[Dependency] private readonly SharedAudioSystem _audio = default!;
|
||||
|
||||
public override void Initialize()
|
||||
@@ -69,13 +71,16 @@ public abstract class SharedDamageMarkerSystem : EntitySystem
|
||||
component.Amount--;
|
||||
Dirty(marker);
|
||||
|
||||
if (component.Amount <= 0)
|
||||
if (_netManager.IsServer)
|
||||
{
|
||||
QueueDel(uid);
|
||||
}
|
||||
else
|
||||
{
|
||||
Dirty(component);
|
||||
if (component.Amount <= 0)
|
||||
{
|
||||
QueueDel(uid);
|
||||
}
|
||||
else
|
||||
{
|
||||
Dirty(component);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user