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

@@ -27,7 +27,7 @@ namespace Content.Client.Animations
var animations = animatableClone.GetComponent<AnimationPlayerComponent>(); var animations = animatableClone.GetComponent<AnimationPlayerComponent>();
animations.AnimationCompleted += (_) => { animations.AnimationCompleted += (_) => {
animatableClone.Delete(); IoCManager.Resolve<IEntityManager>().DeleteEntity(animatableClone.Uid);
}; };
animations.Play(new Animation animations.Play(new Animation

View File

@@ -2,6 +2,7 @@
using Content.Client.Cooldown; using Content.Client.Cooldown;
using Content.Client.Items.Managers; using Content.Client.Items.Managers;
using Content.Client.Stylesheets; using Content.Client.Stylesheets;
using Robust.Client.GameObjects;
using Robust.Client.Graphics; using Robust.Client.Graphics;
using Robust.Client.UserInterface; using Robust.Client.UserInterface;
using Robust.Client.UserInterface.Controls; using Robust.Client.UserInterface.Controls;
@@ -138,7 +139,12 @@ namespace Content.Client.Items.UI
{ {
if (EntityHover) if (EntityHover)
{ {
HoverSpriteView.Sprite?.Owner.Delete(); ISpriteComponent? tempQualifier = HoverSpriteView.Sprite;
if (tempQualifier != null)
{
IoCManager.Resolve<IEntityManager>().DeleteEntity(tempQualifier.Owner.Uid);
}
HoverSpriteView.Sprite = null; HoverSpriteView.Sprite = null;
} }
} }

View File

@@ -98,7 +98,7 @@ namespace Content.Client.Lobby.UI
_preferencesManager.OnServerDataLoaded -= UpdateUI; _preferencesManager.OnServerDataLoaded -= UpdateUI;
if (!disposing) return; if (!disposing) return;
_previewDummy.Delete(); IoCManager.Resolve<IEntityManager>().DeleteEntity(_previewDummy.Uid);
_previewDummy = null!; _previewDummy = null!;
} }
@@ -160,7 +160,7 @@ namespace Content.Client.Lobby.UI
{ {
var item = entityMan.SpawnEntity(itemType, MapCoordinates.Nullspace); var item = entityMan.SpawnEntity(itemType, MapCoordinates.Nullspace);
inventory.SetSlotVisuals(slot, item); inventory.SetSlotVisuals(slot, item);
item.Delete(); IoCManager.Resolve<IEntityManager>().DeleteEntity(item.Uid);
} }
} }
} }

View File

@@ -218,7 +218,7 @@ namespace Content.Client.Preferences.UI
if (!disposing) if (!disposing)
return; return;
_previewDummy.Delete(); IoCManager.Resolve<IEntityManager>().DeleteEntity(_previewDummy.Uid);
_previewDummy = null!; _previewDummy = null!;
} }
} }

View File

@@ -482,7 +482,7 @@ namespace Content.Client.Preferences.UI
if (!disposing) if (!disposing)
return; return;
_previewDummy.Delete(); IoCManager.Resolve<IEntityManager>().DeleteEntity(_previewDummy.Uid);
_preferencesManager.OnServerDataLoaded -= LoadServerData; _preferencesManager.OnServerDataLoaded -= LoadServerData;
} }

View File

@@ -63,7 +63,11 @@ namespace Content.Client.Wall.Components
{ {
base.Shutdown(); base.Shutdown();
_overlayEntity?.Delete(); IEntity? tempQualifier = _overlayEntity;
if (tempQualifier != null)
{
IoCManager.Resolve<IEntityManager>().DeleteEntity(tempQualifier.Uid);
}
} }
internal override void CalculateNewSprite() internal override void CalculateNewSprite()

View File

@@ -2,6 +2,7 @@ using Content.Shared.Weapons.Melee;
using Robust.Client.GameObjects; using Robust.Client.GameObjects;
using Robust.Client.Graphics; using Robust.Client.Graphics;
using Robust.Shared.GameObjects; using Robust.Shared.GameObjects;
using Robust.Shared.IoC;
using Robust.Shared.Maths; using Robust.Shared.Maths;
namespace Content.Client.Weapons.Melee.Components namespace Content.Client.Weapons.Melee.Components
@@ -71,7 +72,7 @@ namespace Content.Client.Weapons.Melee.Components
if (_meleeWeaponAnimation.Length.TotalSeconds <= _timer) if (_meleeWeaponAnimation.Length.TotalSeconds <= _timer)
{ {
Owner.Delete(); IoCManager.Resolve<IEntityManager>().DeleteEntity(Owner.Uid);
} }
} }
} }

View File

@@ -38,7 +38,7 @@ namespace Content.IntegrationTests.Tests
Assert.That(inv.Equip(Slots.HEAD, item, false), Is.True); Assert.That(inv.Equip(Slots.HEAD, item, false), Is.True);
// Delete parent. // Delete parent.
container.Delete(); IoCManager.Resolve<IEntityManager>().DeleteEntity(container.Uid);
// Assert that child item was also deleted. // Assert that child item was also deleted.
Assert.That(item.Deleted, Is.True); Assert.That(item.Deleted, Is.True);

View File

@@ -4,6 +4,7 @@ using Content.Server.Doors.Components;
using Content.Shared.Doors; using Content.Shared.Doors;
using NUnit.Framework; using NUnit.Framework;
using Robust.Shared.GameObjects; using Robust.Shared.GameObjects;
using Robust.Shared.IoC;
using Robust.Shared.Map; using Robust.Shared.Map;
using Robust.Shared.Physics; using Robust.Shared.Physics;
@@ -96,7 +97,7 @@ namespace Content.IntegrationTests.Tests.Doors
{ {
Assert.DoesNotThrow(() => Assert.DoesNotThrow(() =>
{ {
airlock.Delete(); IoCManager.Resolve<IEntityManager>().DeleteEntity(airlock.Uid);
}); });
}); });

View File

@@ -49,12 +49,12 @@ namespace Content.IntegrationTests.Tests
server.Assert(() => server.Assert(() =>
{ {
visitEnt.Delete(); IoCManager.Resolve<IEntityManager>().DeleteEntity(visitEnt.Uid);
Assert.That(mind.VisitingEntity, Is.Null); Assert.That(mind.VisitingEntity, Is.Null);
// This used to throw so make sure it doesn't. // This used to throw so make sure it doesn't.
playerEnt.Delete(); IoCManager.Resolve<IEntityManager>().DeleteEntity(playerEnt.Uid);
}); });
await server.WaitIdleAsync(); await server.WaitIdleAsync();
@@ -91,7 +91,7 @@ namespace Content.IntegrationTests.Tests
server.Post(() => server.Post(() =>
{ {
playerEnt.Delete(); IoCManager.Resolve<IEntityManager>().DeleteEntity(playerEnt.Uid);
}); });
server.RunTicks(1); server.RunTicks(1);

View File

@@ -57,7 +57,7 @@ namespace Content.Server.Actions.Spells
if (!spawnedProto.TryGetComponent(out ItemComponent? itemComponent)) if (!spawnedProto.TryGetComponent(out ItemComponent? itemComponent))
{ {
Logger.Error($"Tried to use {nameof(GiveItemSpell)} but prototype has no {nameof(ItemComponent)}?"); Logger.Error($"Tried to use {nameof(GiveItemSpell)} but prototype has no {nameof(ItemComponent)}?");
spawnedProto.Delete(); IoCManager.Resolve<IEntityManager>().DeleteEntity(spawnedProto.Uid);
return; return;
} }

View File

@@ -68,7 +68,7 @@ namespace Content.Server.Administration
verb.Text = Loc.GetString("delete-verb-get-data-text"); verb.Text = Loc.GetString("delete-verb-get-data-text");
verb.Category = VerbCategory.Debug; verb.Category = VerbCategory.Debug;
verb.IconTexture = "/Textures/Interface/VerbIcons/delete_transparent.svg.192dpi.png"; verb.IconTexture = "/Textures/Interface/VerbIcons/delete_transparent.svg.192dpi.png";
verb.Act = () => args.Target.Delete(); verb.Act = () => IoCManager.Resolve<IEntityManager>().DeleteEntity(args.Target.Uid);
verb.Impact = LogImpact.Medium; verb.Impact = LogImpact.Medium;
args.Verbs.Add(verb); args.Verbs.Add(verb);
} }

View File

@@ -42,7 +42,7 @@ namespace Content.Server.Administration.Commands
var count = 0; var count = 0;
foreach (var entity in entitiesWithAllComponents) foreach (var entity in entitiesWithAllComponents)
{ {
entity.Delete(); IoCManager.Resolve<IEntityManager>().DeleteEntity(entity.Uid);
count += 1; count += 1;
} }

View File

@@ -29,7 +29,7 @@ namespace Content.Server.Administration.Commands
foreach (var entity in entities) foreach (var entity in entities)
{ {
entity.Delete(); IoCManager.Resolve<IEntityManager>().DeleteEntity(entity.Uid);
i++; i++;
} }

View File

@@ -34,7 +34,7 @@ namespace Content.Server.Administration.Commands
return; return;
} }
entity.Delete(); IoCManager.Resolve<IEntityManager>().DeleteEntity(entity.Uid);
shell.WriteLine($"Deleted entity with id {id}."); shell.WriteLine($"Deleted entity with id {id}.");
} }
} }

View File

@@ -58,7 +58,7 @@ namespace Content.Server.Chemistry.Components
{ {
if ((!IoCManager.Resolve<IEntityManager>().EntityExists(Owner.Uid) ? EntityLifeStage.Deleted : IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(Owner.Uid).EntityLifeStage) >= EntityLifeStage.Deleted) if ((!IoCManager.Resolve<IEntityManager>().EntityExists(Owner.Uid) ? EntityLifeStage.Deleted : IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(Owner.Uid).EntityLifeStage) >= EntityLifeStage.Deleted)
return; return;
Owner.Delete(); IoCManager.Resolve<IEntityManager>().DeleteEntity(Owner.Uid);
} }
} }
} }

View File

@@ -87,7 +87,7 @@ namespace Content.Server.Chemistry.Components
if (!newEffect.TryGetComponent(out SolutionAreaEffectComponent? effectComponent)) if (!newEffect.TryGetComponent(out SolutionAreaEffectComponent? effectComponent))
{ {
newEffect.Delete(); IoCManager.Resolve<IEntityManager>().DeleteEntity(newEffect.Uid);
return; return;
} }

View File

@@ -6,6 +6,7 @@ using JetBrains.Annotations;
using Robust.Server.Containers; using Robust.Server.Containers;
using Robust.Shared.Containers; using Robust.Shared.Containers;
using Robust.Shared.GameObjects; using Robust.Shared.GameObjects;
using Robust.Shared.IoC;
using Robust.Shared.Log; using Robust.Shared.Log;
using Robust.Shared.Serialization.Manager.Attributes; using Robust.Shared.Serialization.Manager.Attributes;
@@ -58,7 +59,7 @@ namespace Content.Server.Construction.Completions
foreach (var ent in computerContainer.ContainedEntities.ToArray()) foreach (var ent in computerContainer.ContainedEntities.ToArray())
{ {
computerContainer.ForceRemove(ent); computerContainer.ForceRemove(ent);
ent.Delete(); IoCManager.Resolve<IEntityManager>().DeleteEntity(ent.Uid);
} }
computerContainer.Insert(board); computerContainer.Insert(board);

View File

@@ -61,7 +61,7 @@ namespace Content.Server.Construction.Components
// get last owner coordinates and delete it // get last owner coordinates and delete it
var resultPosition = Owner.Transform.Coordinates; var resultPosition = Owner.Transform.Coordinates;
Owner.Delete(); IoCManager.Resolve<IEntityManager>().DeleteEntity(Owner.Uid);
// spawn each result after refine // spawn each result after refine
foreach (var result in _refineResult!) foreach (var result in _refineResult!)

View File

@@ -52,7 +52,7 @@ namespace Content.Server.Engineering.EntitySystems
hands.PutInHandOrDrop(item); hands.PutInHandOrDrop(item);
} }
component.Owner.Delete(); IoCManager.Resolve<IEntityManager>().DeleteEntity(component.Owner.Uid);
return; return;
} }

View File

@@ -69,7 +69,7 @@ namespace Content.Server.Engineering.EntitySystems
EntityManager.SpawnEntity(component.Prototype, args.ClickLocation.SnapToGrid(grid)); EntityManager.SpawnEntity(component.Prototype, args.ClickLocation.SnapToGrid(grid));
if (component.RemoveOnInteract && stackComp == null && !((!IoCManager.Resolve<IEntityManager>().EntityExists(component.Owner.Uid) ? EntityLifeStage.Deleted : IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(component.Owner.Uid).EntityLifeStage) >= EntityLifeStage.Deleted)) if (component.RemoveOnInteract && stackComp == null && !((!IoCManager.Resolve<IEntityManager>().EntityExists(component.Owner.Uid) ? EntityLifeStage.Deleted : IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(component.Owner.Uid).EntityLifeStage) >= EntityLifeStage.Deleted))
component.Owner.Delete(); IoCManager.Resolve<IEntityManager>().DeleteEntity(component.Owner.Uid);
} }
} }
} }

View File

@@ -123,7 +123,7 @@ namespace Content.Server.Explosion.Components
}); });
} }
Owner.Delete(); IoCManager.Resolve<IEntityManager>().DeleteEntity(Owner.Uid);
}); });
return true; return true;
} }

View File

@@ -143,7 +143,7 @@ namespace Content.Server.Fluids.Components
// is the puddle cleaned? // is the puddle cleaned?
if (puddleSolution.TotalVolume - transferAmount <= 0) if (puddleSolution.TotalVolume - transferAmount <= 0)
{ {
puddleComponent.Owner.Delete(); IoCManager.Resolve<IEntityManager>().DeleteEntity(puddleComponent.Owner.Uid);
// After cleaning the puddle, make a new puddle with solution from the mop as a "wet floor". Then evaporate it slowly. // After cleaning the puddle, make a new puddle with solution from the mop as a "wet floor". Then evaporate it slowly.
// we do this WITHOUT adding to the existing puddle. Otherwise we have might have water puddles with the vomit sprite. // we do this WITHOUT adding to the existing puddle. Otherwise we have might have water puddles with the vomit sprite.

View File

@@ -363,7 +363,7 @@ namespace Content.Server.GameTicking
{ {
// TODO: Maybe something less naive here? // TODO: Maybe something less naive here?
// FIXME: Actually, definitely. // FIXME: Actually, definitely.
entity.Delete(); IoCManager.Resolve<IEntityManager>().DeleteEntity(entity.Uid);
} }
_mapManager.Restart(); _mapManager.Restart();

View File

@@ -86,7 +86,7 @@ namespace Content.Server.GameTicking.Presets
foreach (var slot in victimSlots) foreach (var slot in victimSlots)
{ {
if (inventory.TryGetSlotItem(slot, out ItemComponent? vItem)) if (inventory.TryGetSlotItem(slot, out ItemComponent? vItem))
vItem.Owner.Delete(); IoCManager.Resolve<IEntityManager>().DeleteEntity(vItem.Owner.Uid);
} }
// Replace their items: // Replace their items:

View File

@@ -187,7 +187,7 @@ namespace Content.Server.Ghost
if (entity.TryGetComponent<MindComponent>(out var mind)) if (entity.TryGetComponent<MindComponent>(out var mind))
mind.GhostOnShutdown = false; mind.GhostOnShutdown = false;
entity.Delete(); IoCManager.Resolve<IEntityManager>().DeleteEntity(entity.Uid);
} }
private IEnumerable<string> GetLocationNames() private IEnumerable<string> GetLocationNames()

View File

@@ -58,7 +58,7 @@ namespace Content.Server.Ghost.Roles.Components
Taken = true; Taken = true;
if (_deleteOnSpawn) if (_deleteOnSpawn)
Owner.Delete(); IoCManager.Resolve<IEntityManager>().DeleteEntity(Owner.Uid);
return true; return true;
} }

View File

@@ -89,7 +89,7 @@ namespace Content.Server.Hands.Systems
|| virtualItem.BlockingEntity != args.Pulled.Owner.Uid) || virtualItem.BlockingEntity != args.Pulled.Owner.Uid)
continue; continue;
hand.HeldEntity.Delete(); IoCManager.Resolve<IEntityManager>().DeleteEntity(hand.HeldEntity.Uid);
break; break;
} }
} }

View File

@@ -69,7 +69,7 @@ namespace Content.Server.Inventory.Components
{ {
if (TryGetSlotItem(slot, out ItemComponent? item)) if (TryGetSlotItem(slot, out ItemComponent? item))
{ {
item.Owner.Delete(); IoCManager.Resolve<IEntityManager>().DeleteEntity(item.Owner.Uid);
} }
RemoveSlot(slot); RemoveSlot(slot);

View File

@@ -33,7 +33,7 @@ namespace Content.Server.Inventory
// Helper method that deletes the item and returns false. // Helper method that deletes the item and returns false.
bool DeleteItem() bool DeleteItem()
{ {
item.Delete(); IoCManager.Resolve<IEntityManager>().DeleteEntity(item.Uid);
return false; return false;
} }

View File

@@ -154,7 +154,7 @@ namespace Content.Server.Kitchen.Components
Owner.PopupMessageEveryone(Loc.GetString("comp-kitchen-spike-kill", ("user", user), ("victim", victim))); Owner.PopupMessageEveryone(Loc.GetString("comp-kitchen-spike-kill", ("user", user), ("victim", victim)));
// TODO: Need to be able to leave them on the spike to do DoT, see ss13. // TODO: Need to be able to leave them on the spike to do DoT, see ss13.
victim.Delete(); IoCManager.Resolve<IEntityManager>().DeleteEntity(victim.Uid);
SoundSystem.Play(Filter.Pvs(Owner), SpikeSound.GetSound(), Owner); SoundSystem.Play(Filter.Pvs(Owner), SpikeSound.GetSound(), Owner);
} }

View File

@@ -411,7 +411,7 @@ namespace Content.Server.Kitchen.Components
{ {
var item = _storage.ContainedEntities.ElementAt(i); var item = _storage.ContainedEntities.ElementAt(i);
_storage.Remove(item); _storage.Remove(item);
item.Delete(); IoCManager.Resolve<IEntityManager>().DeleteEntity(item.Uid);
} }
} }
@@ -459,7 +459,7 @@ namespace Content.Server.Kitchen.Components
if (IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(item.Uid).EntityPrototype.ID == recipeSolid.Key) if (IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(item.Uid).EntityPrototype.ID == recipeSolid.Key)
{ {
_storage.Remove(item); _storage.Remove(item);
item.Delete(); IoCManager.Resolve<IEntityManager>().DeleteEntity(item.Uid);
break; break;
} }
} }

View File

@@ -319,7 +319,7 @@ namespace Content.Server.Kitchen.EntitySystems
solution.ScaleSolution(juiceEvent.Scalar); solution.ScaleSolution(juiceEvent.Scalar);
_solutionsSystem.TryAddSolution(beakerEntity.Uid, component.HeldBeaker, solution); _solutionsSystem.TryAddSolution(beakerEntity.Uid, component.HeldBeaker, solution);
_solutionsSystem.RemoveAllSolution(beakerEntity.Uid, solution); _solutionsSystem.RemoveAllSolution(beakerEntity.Uid, solution);
item.Delete(); IoCManager.Resolve<IEntityManager>().DeleteEntity(item.Uid);
} }
component.Busy = false; component.Busy = false;
@@ -351,7 +351,7 @@ namespace Content.Server.Kitchen.EntitySystems
component.HeldBeaker.MaxVolume) continue; component.HeldBeaker.MaxVolume) continue;
juiceMe.JuiceSolution.ScaleSolution(juiceEvent.Scalar); juiceMe.JuiceSolution.ScaleSolution(juiceEvent.Scalar);
_solutionsSystem.TryAddSolution(beakerEntity.Uid, component.HeldBeaker, juiceMe.JuiceSolution); _solutionsSystem.TryAddSolution(beakerEntity.Uid, component.HeldBeaker, juiceMe.JuiceSolution);
item.Delete(); IoCManager.Resolve<IEntityManager>().DeleteEntity(item.Uid);
} }
bui?.SendMessage(new SharedReagentGrinderComponent.ReagentGrinderWorkCompleteMessage()); bui?.SendMessage(new SharedReagentGrinderComponent.ReagentGrinderWorkCompleteMessage());

View File

@@ -202,7 +202,7 @@ namespace Content.Server.Lathe.Components
SetAppearance(LatheVisualState.Idle); SetAppearance(LatheVisualState.Idle);
}); });
eventArgs.Using.Delete(); IoCManager.Resolve<IEntityManager>().DeleteEntity(eventArgs.Using.Uid);
return true; return true;
} }

View File

@@ -117,7 +117,7 @@ namespace Content.Server.Morgue.Components
{ {
var item = Contents.ContainedEntities[i]; var item = Contents.ContainedEntities[i];
Contents.Remove(item); Contents.Remove(item);
item.Delete(); IoCManager.Resolve<IEntityManager>().DeleteEntity(item.Uid);
} }
var ash = IoCManager.Resolve<IEntityManager>().SpawnEntity("Ash", Owner.Transform.Coordinates); var ash = IoCManager.Resolve<IEntityManager>().SpawnEntity("Ash", Owner.Transform.Coordinates);
@@ -148,7 +148,7 @@ namespace Content.Server.Morgue.Components
} }
else else
{ {
victim.Delete(); IoCManager.Resolve<IEntityManager>().DeleteEntity(victim.Uid);
} }
Cremate(); Cremate();

View File

@@ -70,7 +70,7 @@ namespace Content.Server.Nutrition.EntitySystems
if (_robustRandom.Prob(component.BreakChance)) if (_robustRandom.Prob(component.BreakChance))
{ {
SoundSystem.Play(Filter.Pvs(userUid), component.BreakSound.GetSound(), userUid, AudioParams.Default.WithVolume(-2f)); SoundSystem.Play(Filter.Pvs(userUid), component.BreakSound.GetSound(), userUid, AudioParams.Default.WithVolume(-2f));
component.Owner.Delete(); IoCManager.Resolve<IEntityManager>().DeleteEntity(component.Owner.Uid);
} }
} }
} }

View File

@@ -3,6 +3,7 @@ using Content.Server.Singularity.Components;
using Content.Shared.Singularity.Components; using Content.Shared.Singularity.Components;
using Robust.Server.GameObjects; using Robust.Server.GameObjects;
using Robust.Shared.GameObjects; using Robust.Shared.GameObjects;
using Robust.Shared.IoC;
using Robust.Shared.Log; using Robust.Shared.Log;
using Robust.Shared.Maths; using Robust.Shared.Maths;
using Robust.Shared.Physics.Collision; using Robust.Shared.Physics.Collision;
@@ -71,7 +72,7 @@ namespace Content.Server.ParticleAccelerator.Components
.LinearVelocity = angle.ToWorldVec() * 20f; .LinearVelocity = angle.ToWorldVec() * 20f;
Owner.Transform.LocalRotation = angle; Owner.Transform.LocalRotation = angle;
Timer.Spawn(3000, () => Owner.Delete()); Timer.Spawn(3000, () => IoCManager.Resolve<IEntityManager>().DeleteEntity(Owner.Uid));
} }
} }
} }

View File

@@ -81,7 +81,7 @@ namespace Content.Server.Pointing.Components
return; return;
} }
Owner.Delete(); IoCManager.Resolve<IEntityManager>().DeleteEntity(Owner.Uid);
return; return;
} }

View File

@@ -47,7 +47,7 @@ namespace Content.Server.Power.Components
if (EntitySystem.Get<ElectrocutionSystem>().TryDoElectrifiedAct(Owner.Uid, eventArgs.User.Uid)) return false; if (EntitySystem.Get<ElectrocutionSystem>().TryDoElectrifiedAct(Owner.Uid, eventArgs.User.Uid)) return false;
Owner.Delete(); IoCManager.Resolve<IEntityManager>().DeleteEntity(Owner.Uid);
var droppedEnt = IoCManager.Resolve<IEntityManager>().SpawnEntity(_cableDroppedOnCutPrototype, eventArgs.ClickLocation); var droppedEnt = IoCManager.Resolve<IEntityManager>().SpawnEntity(_cableDroppedOnCutPrototype, eventArgs.ClickLocation);
// TODO: Literally just use a prototype that has a single thing in the stack, it's not that complicated... // TODO: Literally just use a prototype that has a single thing in the stack, it's not that complicated...

View File

@@ -5,6 +5,7 @@ using Content.Shared.Examine;
using Content.Shared.PowerCell; using Content.Shared.PowerCell;
using Content.Shared.Rounding; using Content.Shared.Rounding;
using Robust.Shared.GameObjects; using Robust.Shared.GameObjects;
using Robust.Shared.IoC;
using Robust.Shared.Localization; using Robust.Shared.Localization;
using Robust.Shared.Serialization.Manager.Attributes; using Robust.Shared.Serialization.Manager.Attributes;
using Robust.Shared.Utility; using Robust.Shared.Utility;
@@ -73,7 +74,7 @@ namespace Content.Server.PowerCell.Components
CurrentCharge = 0; CurrentCharge = 0;
EntitySystem.Get<ExplosionSystem>().SpawnExplosion(OwnerUid, 0, heavy, light, light*2); EntitySystem.Get<ExplosionSystem>().SpawnExplosion(OwnerUid, 0, heavy, light, light*2);
Owner.Delete(); IoCManager.Resolve<IEntityManager>().DeleteEntity(Owner.Uid);
} }
private void UpdateVisuals() private void UpdateVisuals()

View File

@@ -98,7 +98,7 @@ namespace Content.Server.Projectiles.Components
{ {
if (!((!IoCManager.Resolve<IEntityManager>().EntityExists(Owner.Uid) ? EntityLifeStage.Deleted : IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(Owner.Uid).EntityLifeStage) >= EntityLifeStage.Deleted)) if (!((!IoCManager.Resolve<IEntityManager>().EntityExists(Owner.Uid) ? EntityLifeStage.Deleted : IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(Owner.Uid).EntityLifeStage) >= EntityLifeStage.Deleted))
{ {
Owner.Delete(); IoCManager.Resolve<IEntityManager>().DeleteEntity(Owner.Uid);
} }
}); });
} }

View File

@@ -83,7 +83,7 @@ namespace Content.Server.Projectiles
if (component.TimeLeft <= 0) if (component.TimeLeft <= 0)
{ {
component.Owner.Delete(); IoCManager.Resolve<IEntityManager>().DeleteEntity(component.Owner.Uid);
} }
} }
} }

View File

@@ -118,7 +118,11 @@ namespace Content.Server.RCD.Systems
} }
else //Delete what the user targeted else //Delete what the user targeted
{ {
args.Target?.Delete(); IEntity? tempQualifier = args.Target;
if (tempQualifier != null)
{
IoCManager.Resolve<IEntityManager>().DeleteEntity(tempQualifier.Uid);
}
} }
break; break;
//Walls are a special behaviour, and require us to build a new object with a transform rather than setting a grid tile, //Walls are a special behaviour, and require us to build a new object with a transform rather than setting a grid tile,

View File

@@ -88,7 +88,7 @@ namespace Content.Server.Rotatable
var newTransform = entity.Transform; var newTransform = entity.Transform;
newTransform.LocalRotation = oldTransform.LocalRotation; newTransform.LocalRotation = oldTransform.LocalRotation;
newTransform.Anchored = false; newTransform.Anchored = false;
component.Owner.Delete(); IoCManager.Resolve<IEntityManager>().DeleteEntity(component.Owner.Uid);
} }
} }
} }

View File

@@ -57,7 +57,7 @@ namespace Content.Server.Singularity.Components
if (!newEnt.TryGetComponent<ContainmentFieldComponent>(out var containmentFieldComponent)) 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..."); 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; continue;
} }
@@ -88,7 +88,7 @@ namespace Content.Server.Singularity.Components
_powerDecreaseCancellationTokenSource.Cancel(); _powerDecreaseCancellationTokenSource.Cancel();
foreach (var field in _fields) foreach (var field in _fields)
{ {
field.Delete(); IoCManager.Resolve<IEntityManager>().DeleteEntity(field.Uid);
} }
_fields.Clear(); _fields.Clear();

View File

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

View File

@@ -189,7 +189,7 @@ namespace Content.Server.Singularity.EntitySystems
projectile.Transform.WorldRotation = component.Owner.Transform.WorldRotation; projectile.Transform.WorldRotation = component.Owner.Transform.WorldRotation;
// TODO: Move to projectile's code. // 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, SoundSystem.Play(Filter.Pvs(component.Owner), component.FireSound.GetSound(), component.Owner,
AudioHelpers.WithVariation(EmitterComponent.Variation).WithVolume(EmitterComponent.Volume).WithMaxDistance(EmitterComponent.Distance)); AudioHelpers.WithVariation(EmitterComponent.Variation).WithVolume(EmitterComponent.Volume).WithMaxDistance(EmitterComponent.Distance));

View File

@@ -63,7 +63,7 @@ namespace Content.Server.Spawners.Components
public override void MapInit() public override void MapInit()
{ {
Spawn(); Spawn();
Owner.Delete(); IoCManager.Resolve<IEntityManager>().DeleteEntity(Owner.Uid);
} }
} }
} }

View File

@@ -55,7 +55,7 @@ namespace Content.Server.Storage.EntitySystems
if (component.Uses == 0) if (component.Uses == 0)
{ {
args.Handled = true; args.Handled = true;
owner.Delete(); IoCManager.Resolve<IEntityManager>().DeleteEntity(owner.Uid);
} }
if (entityToPlaceInHands != null if (entityToPlaceInHands != null

View File

@@ -111,7 +111,7 @@ namespace Content.Server.TraitorDeathMatch.Components
accounts.SetBalance(victimAccount, 0); accounts.SetBalance(victimAccount, 0);
accounts.AddToBalance(userAccount, transferAmount); accounts.AddToBalance(userAccount, transferAmount);
victimUplink.Owner.Delete(); IoCManager.Resolve<IEntityManager>().DeleteEntity(victimUplink.Owner.Uid);
Owner.PopupMessage(eventArgs.User, Loc.GetString("traitor-death-match-redemption-component-interact-using-success-message", ("tcAmount", transferAmount))); Owner.PopupMessage(eventArgs.User, Loc.GetString("traitor-death-match-redemption-component-interact-using-success-message", ("tcAmount", transferAmount)));
return true; return true;

View File

@@ -238,7 +238,7 @@ namespace Content.Server.Weapon.Ranged.Barrels.Components
if (ammoComponent.Caseless) if (ammoComponent.Caseless)
{ {
ammo.Delete(); IoCManager.Resolve<IEntityManager>().DeleteEntity(ammo.Uid);
} }
} }
else else

View File

@@ -187,7 +187,7 @@ namespace Content.Server.Weapon.Ranged
user.PopupMessage(Loc.GetString("server-ranged-weapon-component-try-fire-clumsy")); user.PopupMessage(Loc.GetString("server-ranged-weapon-component-try-fire-clumsy"));
Owner.Delete(); IoCManager.Resolve<IEntityManager>().DeleteEntity(Owner.Uid);
return; return;
} }

View File

@@ -293,7 +293,7 @@ namespace Content.Shared.Body.Components
return false; return false;
} }
mechanism.Owner.Delete(); IoCManager.Resolve<IEntityManager>().DeleteEntity(mechanism.Owner.Uid);
return true; return true;
} }