Inline Deleted

This commit is contained in:
Vera Aguilera Puerto
2021-12-03 11:30:03 +01:00
parent 149707a566
commit b2035543e2
60 changed files with 94 additions and 79 deletions

View File

@@ -39,7 +39,7 @@ namespace Content.Server.Projectiles
var coordinates = args.OtherFixture.Body.Owner.Transform.Coordinates;
var playerFilter = Filter.Pvs(coordinates);
if (!otherEntity.Deleted && component.SoundHitSpecies != null &&
if (!((!IoCManager.Resolve<IEntityManager>().EntityExists(otherEntity.Uid) ? EntityLifeStage.Deleted : IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(otherEntity.Uid).EntityLifeStage) >= EntityLifeStage.Deleted) && component.SoundHitSpecies != null &&
otherEntity.HasComponent<SharedBodyComponent>())
{
SoundSystem.Play(playerFilter, component.SoundHitSpecies.GetSound(), coordinates);
@@ -52,7 +52,7 @@ namespace Content.Server.Projectiles
SoundSystem.Play(playerFilter, soundHit, coordinates);
}
if (!otherEntity.Deleted)
if (!((!IoCManager.Resolve<IEntityManager>().EntityExists(otherEntity.Uid) ? EntityLifeStage.Deleted : IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(otherEntity.Uid).EntityLifeStage) >= EntityLifeStage.Deleted))
{
var dmg = _damageableSystem.TryChangeDamage(otherEntity.Uid, component.Damage);
component.DamagedEntity = true;
@@ -63,7 +63,7 @@ namespace Content.Server.Projectiles
}
// Damaging it can delete it
if (!otherEntity.Deleted && otherEntity.TryGetComponent(out CameraRecoilComponent? recoilComponent))
if (!((!IoCManager.Resolve<IEntityManager>().EntityExists(otherEntity.Uid) ? EntityLifeStage.Deleted : IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(otherEntity.Uid).EntityLifeStage) >= EntityLifeStage.Deleted) && otherEntity.TryGetComponent(out CameraRecoilComponent? recoilComponent))
{
var direction = args.OurFixture.Body.LinearVelocity.Normalized;
recoilComponent.Kick(direction);