Inline Delete

This commit is contained in:
Vera Aguilera Puerto
2021-12-03 11:43:03 +01:00
parent f10ed6c0c3
commit e3227546b3
53 changed files with 80 additions and 60 deletions

View File

@@ -57,7 +57,7 @@ namespace Content.Server.Singularity.Components
if (!newEnt.TryGetComponent<ContainmentFieldComponent>(out var containmentFieldComponent))
{
Logger.Error("While creating Fields in ContainmentFieldConnection, a ContainmentField without a ContainmentFieldComponent was created. Deleting newly spawned ContainmentField...");
newEnt.Delete();
IoCManager.Resolve<IEntityManager>().DeleteEntity(newEnt.Uid);
continue;
}
@@ -88,7 +88,7 @@ namespace Content.Server.Singularity.Components
_powerDecreaseCancellationTokenSource.Cancel();
foreach (var field in _fields)
{
field.Delete();
IoCManager.Resolve<IEntityManager>().DeleteEntity(field.Uid);
}
_fields.Clear();

View File

@@ -4,6 +4,7 @@ using Content.Shared.Sound;
using Robust.Shared.Audio;
using Robust.Shared.Containers;
using Robust.Shared.GameObjects;
using Robust.Shared.IoC;
using Robust.Shared.Physics.Collision;
using Robust.Shared.Physics.Dynamics;
using Robust.Shared.Player;
@@ -31,7 +32,7 @@ namespace Content.Server.Singularity.Components
_energy = value;
if (_energy <= 0)
{
Owner.Delete();
IoCManager.Resolve<IEntityManager>().DeleteEntity(Owner.Uid);
return;
}

View File

@@ -189,7 +189,7 @@ namespace Content.Server.Singularity.EntitySystems
projectile.Transform.WorldRotation = component.Owner.Transform.WorldRotation;
// TODO: Move to projectile's code.
Timer.Spawn(3000, () => projectile.Delete());
Timer.Spawn(3000, () => IoCManager.Resolve<IEntityManager>().DeleteEntity(projectile.Uid));
SoundSystem.Play(Filter.Pvs(component.Owner), component.FireSound.GetSound(), component.Owner,
AudioHelpers.WithVariation(EmitterComponent.Variation).WithVolume(EmitterComponent.Volume).WithMaxDistance(EmitterComponent.Distance));