Content ecs containers (#22484)

This commit is contained in:
TemporalOroboros
2023-12-27 21:30:03 -08:00
committed by GitHub
parent 1d06539432
commit 7a77d6d5dd
72 changed files with 172 additions and 160 deletions

View File

@@ -33,7 +33,7 @@ public sealed partial class GunSystem
var existing = component.Entities[^1];
component.Entities.RemoveAt(component.Entities.Count - 1);
component.Container.Remove(existing);
Containers.Remove(existing, component.Container);
EnsureShootable(existing);
}
else if (component.UnspawnedCount > 0)

View File

@@ -373,7 +373,7 @@ namespace Content.IntegrationTests.Tests.Interaction.Click
await server.WaitAssertion(() =>
{
#pragma warning disable NUnit2045 // Interdependent assertions.
Assert.That(container.Insert(user));
Assert.That(conSystem.Insert(user, container));
Assert.That(sEntities.GetComponent<TransformComponent>(user).ParentUid, Is.EqualTo(containerEntity));
#pragma warning restore NUnit2045

View File

@@ -177,7 +177,7 @@ public sealed class AmeControllerSystem : EntitySystem
if (!Exists(jar))
return;
controller.JarSlot.Remove(jar!.Value);
_containerSystem.Remove(jar!.Value, controller.JarSlot);
UpdateUi(uid, controller);
if (Exists(user))
_handsSystem.PickupOrDrop(user, jar!.Value);
@@ -303,7 +303,7 @@ public sealed class AmeControllerSystem : EntitySystem
return;
}
comp.JarSlot.Insert(args.Used);
_containerSystem.Insert(args.Used, comp.JarSlot);
_popupSystem.PopupEntity(Loc.GetString("ame-controller-component-interact-using-success"), uid, args.User, PopupType.Medium);
UpdateUi(uid, comp);

View File

@@ -285,7 +285,7 @@ public sealed class AntagSelectionSystem : GameRuleSystem<GameRuleComponent>
{
if (_containerSystem.CanInsert(itemToSpawn, pocket1Slot))
{
pocket1Slot.Insert(itemToSpawn);
_containerSystem.Insert(itemToSpawn, pocket1Slot);
}
}
else if (_inventory.TryGetSlotContainer(antag, "pocket2", out var pocket2Slot, out _))
@@ -294,7 +294,7 @@ public sealed class AntagSelectionSystem : GameRuleSystem<GameRuleComponent>
{
if (_containerSystem.CanInsert(itemToSpawn, pocket2Slot))
{
pocket2Slot.Insert(itemToSpawn);
_containerSystem.Insert(itemToSpawn, pocket2Slot);
}
}
}

View File

@@ -199,7 +199,7 @@ public sealed class CartridgeLoaderSystem : SharedCartridgeLoaderSystem
return false;
var installedProgram = Spawn(prototype, new EntityCoordinates(loaderUid, 0, 0));
container.Insert(installedProgram);
_containerSystem.Insert(installedProgram, container);
UpdateCartridgeInstallationStatus(installedProgram, deinstallable ? InstallationStatus.Installed : InstallationStatus.Readonly);

View File

@@ -255,7 +255,7 @@ namespace Content.Server.Cloning
var cloneMindReturn = EntityManager.AddComponent<BeingClonedComponent>(mob);
cloneMindReturn.Mind = mind;
cloneMindReturn.Parent = uid;
clonePod.BodyContainer.Insert(mob);
_containerSystem.Insert(mob, clonePod.BodyContainer);
ClonesWaitingForMind.Add(mind, mob);
UpdateStatus(uid, CloningPodStatus.NoMind, clonePod);
_euiManager.OpenEui(new AcceptCloningEui(mindEnt, mind, this), client);
@@ -326,7 +326,7 @@ namespace Content.Server.Cloning
return;
EntityManager.RemoveComponent<BeingClonedComponent>(entity);
clonePod.BodyContainer.Remove(entity);
_containerSystem.Remove(entity, clonePod.BodyContainer);
clonePod.CloningProgress = 0f;
clonePod.UsedBiomass = 0;
UpdateStatus(uid, CloningPodStatus.Idle, clonePod);

View File

@@ -54,7 +54,7 @@ public sealed partial class BuildMech : IGraphAction
return;
}
container.Remove(cell);
containerSystem.Remove(cell, container);
var transform = entityManager.GetComponent<TransformComponent>(uid);
var mech = entityManager.SpawnEntity(MechPrototype, transform.Coordinates);
@@ -62,7 +62,7 @@ public sealed partial class BuildMech : IGraphAction
if (entityManager.TryGetComponent<MechComponent>(mech, out var mechComp) && mechComp.BatterySlot.ContainedEntity == null)
{
mechSys.InsertBattery(mech, cell, mechComp, batteryComponent);
mechComp.BatterySlot.Insert(cell);
containerSystem.Insert(cell, mechComp.BatterySlot);
}
var entChangeEv = new ConstructionChangeEntityEvent(mech, uid);

View File

@@ -21,7 +21,7 @@ namespace Content.Server.Construction.Completions
foreach (var contained in container.ContainedEntities.ToArray())
{
if(container.Remove(contained))
if(containerSys.Remove(contained, container))
entityManager.QueueDeleteEntity(contained);
}
}

View File

@@ -26,8 +26,8 @@ namespace Content.Server.Construction.Completions
foreach (var contained in from.ContainedEntities.ToArray())
{
if (from.Remove(contained))
to.Insert(contained);
if (containerSystem.Remove(contained, from))
containerSystem.Insert(contained, to);
}
}
}

View File

@@ -24,7 +24,7 @@ namespace Content.Server.Construction.Completions
var coordinates = entityManager.GetComponent<TransformComponent>(uid).Coordinates;
for (var i = 0; i < Amount; i++)
{
container.Insert(entityManager.SpawnEntity(Prototype, coordinates));
containerSystem.Insert(entityManager.SpawnEntity(Prototype, coordinates), container);
}
}
}

View File

@@ -61,7 +61,7 @@ public sealed partial class ConstructionSystem
var board = EntityManager.SpawnEntity(component.BoardPrototype, Transform(ent).Coordinates);
if (!container.Insert(board))
if (!_container.Insert(board, container))
Log.Warning($"Couldn't insert board {board} to computer {ent}!");
}
}

View File

@@ -388,8 +388,8 @@ namespace Content.Server.Construction
for (var i = ourContainer.ContainedEntities.Count - 1; i >= 0; i--)
{
var entity = ourContainer.ContainedEntities[i];
ourContainer.ForceRemove(entity);
otherContainer.Insert(entity);
_container.Remove(entity, ourContainer, reparent: false, force: true);
_container.Insert(entity, otherContainer);
}
}
}

View File

@@ -133,14 +133,14 @@ namespace Content.Server.Construction
{
foreach (var entity in container.ContainedEntities.ToArray())
{
container.Remove(entity);
_container.Remove(entity, container);
}
foreach (var cont in containers.Values)
{
foreach (var entity in cont.ContainedEntities.ToArray())
{
cont.Remove(entity);
_container.Remove(entity, cont);
}
}
@@ -150,10 +150,10 @@ namespace Content.Server.Construction
void ShutdownContainers()
{
container.Shutdown();
_container.ShutdownContainer(container);
foreach (var c in containers.Values.ToArray())
{
c.Shutdown();
_container.ShutdownContainer(c);
}
}
@@ -188,10 +188,10 @@ namespace Content.Server.Construction
if (string.IsNullOrEmpty(materialStep.Store))
{
if (!container.Insert(splitStack.Value))
if (!_container.Insert(splitStack.Value, container))
continue;
}
else if (!GetContainer(materialStep.Store).Insert(splitStack.Value))
else if (!_container.Insert(splitStack.Value, GetContainer(materialStep.Store)))
continue;
handled = true;
@@ -217,10 +217,10 @@ namespace Content.Server.Construction
if (string.IsNullOrEmpty(arbitraryStep.Store))
{
if (!container.Insert(entity))
if (!_container.Insert(entity, container))
continue;
}
else if (!GetContainer(arbitraryStep.Store).Insert(entity))
else if (!_container.Insert(entity, GetContainer(arbitraryStep.Store)))
continue;
handled = true;
@@ -284,8 +284,8 @@ namespace Content.Server.Construction
foreach (var entity in cont.ContainedEntities.ToArray())
{
cont.ForceRemove(entity);
newCont.Insert(entity);
_container.Remove(entity, cont, reparent: false, force: true);
_container.Insert(entity, newCont);
}
}

View File

@@ -329,7 +329,7 @@ namespace Content.Server.Construction
construction.Containers.Add(store);
// The container doesn't necessarily need to exist, so we ensure it.
_container.EnsureContainer<Container>(uid, store).Insert(insert);
_container.Insert(insert, _container.EnsureContainer<Container>(uid, store));
}
else
{

View File

@@ -125,7 +125,7 @@ public sealed partial class ConstructionSystem
var board = EntityManager.SpawnEntity(component.BoardPrototype, Transform(uid).Coordinates);
if (!component.BoardContainer.Insert(board))
if (!_container.Insert(board, component.BoardContainer))
{
throw new Exception($"Couldn't insert board with prototype {component.BoardPrototype} to machine with prototype {MetaData(uid).EntityPrototype?.ID ?? "N/A"}!");
}
@@ -143,7 +143,7 @@ public sealed partial class ConstructionSystem
{
var p = EntityManager.SpawnEntity(partProto.StockPartPrototype, xform.Coordinates);
if (!partContainer.Insert(p))
if (!_container.Insert(p, partContainer))
throw new Exception($"Couldn't insert machine part of type {part} to machine with prototype {partProto.StockPartPrototype ?? "N/A"}!");
}
}
@@ -152,7 +152,7 @@ public sealed partial class ConstructionSystem
{
var stack = _stackSystem.Spawn(amount, stackType, Transform(uid).Coordinates);
if (!partContainer.Insert(stack))
if (!_container.Insert(stack, partContainer))
throw new Exception($"Couldn't insert machine material of type {stackType} to machine with prototype {MetaData(uid).EntityPrototype?.ID ?? "N/A"}");
}
@@ -162,7 +162,7 @@ public sealed partial class ConstructionSystem
{
var c = EntityManager.SpawnEntity(info.DefaultPrototype, Transform(uid).Coordinates);
if(!partContainer.Insert(c))
if(!_container.Insert(c, partContainer))
throw new Exception($"Couldn't insert machine component part with default prototype '{compName}' to machine with prototype {MetaData(uid).EntityPrototype?.ID ?? "N/A"}");
}
}
@@ -173,7 +173,7 @@ public sealed partial class ConstructionSystem
{
var c = EntityManager.SpawnEntity(info.DefaultPrototype, Transform(uid).Coordinates);
if(!partContainer.Insert(c))
if(!_container.Insert(c, partContainer))
throw new Exception($"Couldn't insert machine component part with default prototype '{tagName}' to machine with prototype {MetaData(uid).EntityPrototype?.ID ?? "N/A"}");
}
}

View File

@@ -100,7 +100,7 @@ public sealed class MachineFrameSystem : EntitySystem
return;
args.Handled = true;
if (!component.PartContainer.Insert(args.Used))
if (!_container.Insert(args.Used, component.PartContainer))
return;
}
@@ -132,7 +132,7 @@ public sealed class MachineFrameSystem : EntitySystem
return;
args.Handled = true;
if (!component.PartContainer.Insert(args.Used))
if (!_container.Insert(args.Used, component.PartContainer))
return;
}
@@ -156,7 +156,7 @@ public sealed class MachineFrameSystem : EntitySystem
if (!_container.TryRemoveFromContainer(used))
return false;
if (!component.BoardContainer.Insert(used))
if (!_container.Insert(used, component.BoardContainer))
return true;
ResetProgressAndRequirements(component, machineBoard);
@@ -181,7 +181,7 @@ public sealed class MachineFrameSystem : EntitySystem
if (!_container.TryRemoveFromContainer(used))
return false;
if (!component.PartContainer.Insert(used))
if (!_container.Insert(used, component.PartContainer))
return true;
component.Progress[machinePart.PartType]++;
@@ -212,7 +212,7 @@ public sealed class MachineFrameSystem : EntitySystem
if (!_container.TryRemoveFromContainer(used))
return false;
if (!component.PartContainer.Insert(used))
if (!_container.Insert(used, component.PartContainer))
return true;
component.MaterialProgress[type] += count;
@@ -224,7 +224,7 @@ public sealed class MachineFrameSystem : EntitySystem
if (splitStack == null)
return false;
if (!component.PartContainer.Insert(splitStack.Value))
if (!_container.Insert(splitStack.Value, component.PartContainer))
return true;
component.MaterialProgress[type] += needed;

View File

@@ -91,7 +91,7 @@ public sealed class PartExchangerSystem : EntitySystem
}
foreach (var part in updatedParts)
{
machine.PartContainer.Insert(part.part, EntityManager);
_container.Insert(part.part, machine.PartContainer);
machineParts.Remove(part);
}
@@ -140,7 +140,7 @@ public sealed class PartExchangerSystem : EntitySystem
if (!machine.Requirements.ContainsKey(part.PartType))
continue;
machine.PartContainer.Insert(partEnt, EntityManager);
_container.Insert(partEnt, machine.PartContainer);
machine.Progress[part.PartType]++;
machineParts.Remove(pair);
}

View File

@@ -26,8 +26,8 @@ namespace Content.Server.Containers
{
foreach (var slot in component.Slots.Values)
{
if (slot.EjectOnDeconstruct && slot.Item != null)
slot.ContainerSlot?.Remove(slot.Item.Value);
if (slot.EjectOnDeconstruct && slot.Item != null && slot.ContainerSlot != null)
_container.Remove(slot.Item.Value, slot.ContainerSlot);
}
}

View File

@@ -31,7 +31,7 @@ public sealed class DevourSystem : SharedDevourSystem
if (component.ShouldStoreDevoured && args.Args.Target is not null)
{
component.Stomach.Insert(args.Args.Target.Value);
ContainerSystem.Insert(args.Args.Target.Value, component.Stomach);
}
_bloodstreamSystem.TryAddToChemicals(uid, ichorInjection);
}

View File

@@ -63,7 +63,7 @@ namespace Content.Server.Disposal.Unit.EntitySystems
if (!CanInsert(uid, toInsert, holder))
return false;
if (!holder.Container.Insert(toInsert, EntityManager))
if (!_containerSystem.Insert(toInsert, holder.Container))
return false;
if (_physicsQuery.TryGetComponent(toInsert, out var physBody))
@@ -127,14 +127,14 @@ namespace Content.Server.Disposal.Unit.EntitySystems
RemComp<BeingDisposedComponent>(entity);
var meta = _metaQuery.GetComponent(entity);
holder.Container.Remove(entity, EntityManager, meta: meta, reparent: false, force: true);
_containerSystem.Remove((entity, null, meta), holder.Container, reparent: false, force: true);
var xform = _xformQuery.GetComponent(entity);
if (xform.ParentUid != uid)
continue;
if (duc != null)
duc.Container.Insert(entity, EntityManager, xform, meta: meta);
_containerSystem.Insert((entity, xform, meta), duc.Container);
else
{
_xformSystem.AttachToGridOrMap(entity, xform);
@@ -185,7 +185,7 @@ namespace Content.Server.Disposal.Unit.EntitySystems
}
// Insert into next tube
if (!to.Contents.Insert(holderUid))
if (!_containerSystem.Insert(holderUid, to.Contents))
{
ExitDisposals(holderUid, holder, holderTransform);
return false;
@@ -267,7 +267,7 @@ namespace Content.Server.Disposal.Unit.EntitySystems
// Past this point, we are performing inter-tube transfer!
// Remove current tube content
_disposalTubeQuery.GetComponent(currentTube).Contents.Remove(uid, reparent: false, force: true);
_containerSystem.Remove(uid, _disposalTubeQuery.GetComponent(currentTube).Contents, reparent: false, force: true);
// Find next tube
var nextTube = _disposalTubeSystem.NextTubeFor(currentTube, holder.CurrentDirection);

View File

@@ -208,7 +208,7 @@ public sealed class DisposalUnitSystem : SharedDisposalUnitSystem
if (!ResolveDisposals(uid, ref disposal))
return;
if (!disposal.Container.Insert(toInsert))
if (!_containerSystem.Insert(toInsert, disposal.Container))
return;
_adminLogger.Add(LogType.Action, LogImpact.Medium, $"{ToPrettyString(user):player} inserted {ToPrettyString(toInsert)} into {ToPrettyString(uid)}");
@@ -681,7 +681,7 @@ public sealed class DisposalUnitSystem : SharedDisposalUnitSystem
public void Remove(EntityUid uid, SharedDisposalUnitComponent component, EntityUid toRemove)
{
component.Container.Remove(toRemove);
_containerSystem.Remove(toRemove, component.Container);
if (component.Container.ContainedEntities.Count == 0)
{
@@ -800,7 +800,7 @@ public sealed class DisposalUnitSystem : SharedDisposalUnitSystem
{
_audioSystem.PlayPvs(component.InsertSound, uid);
if (!component.Container.Insert(inserted))
if (!_containerSystem.Insert(inserted, component.Container))
return;
if (user != inserted && user != null)

View File

@@ -91,7 +91,7 @@ public sealed partial class EnsnareableSystem
}
component.Ensnared = target;
ensnareable.Container.Insert(ensnare);
_container.Insert(ensnare, ensnareable.Container);
ensnareable.IsEnsnared = true;
Dirty(ensnareable);
@@ -147,7 +147,7 @@ public sealed partial class EnsnareableSystem
var target = component.Ensnared.Value;
ensnareable.Container.Remove(ensnare, force: true);
_container.Remove(ensnare, ensnareable.Container, force: true);
ensnareable.IsEnsnared = ensnareable.Container.ContainedEntities.Count > 0;
Dirty(ensnareable);
component.Ensnared = null;

View File

@@ -38,7 +38,7 @@ public sealed partial class EnsnareableSystem : SharedEnsnareableSystem
if (args.Handled || !TryComp<EnsnaringComponent>(args.Args.Used, out var ensnaring))
return;
if (args.Cancelled || !component.Container.Remove(args.Args.Used.Value))
if (args.Cancelled || !_container.Remove(args.Args.Used.Value, component.Container))
{
_popup.PopupEntity(Loc.GetString("ensnare-component-try-free-fail", ("ensnare", args.Args.Used)), uid, uid, PopupType.MediumCaution);
return;

View File

@@ -158,7 +158,7 @@ public sealed class ClusterGrenadeSystem : EntitySystem
grenade = component.GrenadesContainer.ContainedEntities[0];
// This shouldn't happen but you never know.
if (!component.GrenadesContainer.Remove(grenade))
if (!_containerSystem.Remove(grenade, component.GrenadesContainer))
return false;
return true;

View File

@@ -67,7 +67,7 @@ namespace Content.Server.Guardian
if (!TryComp(host, out GuardianHostComponent? hostComponent))
return;
hostComponent.GuardianContainer.Remove(uid);
_container.Remove(uid, hostComponent.GuardianContainer);
hostComponent.HostedGuardian = null;
Dirty(host.Value, hostComponent);
QueueDel(hostComponent.ActionEntity);
@@ -213,7 +213,7 @@ namespace Content.Server.Guardian
// Use map position so it's not inadvertantly parented to the host + if it's in a container it spawns outside I guess.
var guardian = Spawn(component.GuardianProto, hostXform.MapPosition);
host.GuardianContainer.Insert(guardian);
_container.Insert(guardian, host.GuardianContainer);
host.HostedGuardian = guardian;
if (TryComp<GuardianComponent>(guardian, out var guardianComp))
@@ -337,7 +337,7 @@ namespace Content.Server.Guardian
}
DebugTools.Assert(hostComponent.GuardianContainer.Contains(guardian));
hostComponent.GuardianContainer.Remove(guardian);
_container.Remove(guardian, hostComponent.GuardianContainer);
DebugTools.Assert(!hostComponent.GuardianContainer.Contains(guardian));
guardianComponent.GuardianLoose = true;
@@ -351,7 +351,7 @@ namespace Content.Server.Guardian
return;
}
hostComponent.GuardianContainer.Insert(guardian);
_container.Insert(guardian, hostComponent.GuardianContainer);
DebugTools.Assert(hostComponent.GuardianContainer.Contains(guardian));
_popupSystem.PopupEntity(Loc.GetString("guardian-entity-recall"), host);
guardianComponent.GuardianLoose = false;

View File

@@ -9,6 +9,7 @@ using Content.Shared.IdentityManagement;
using Content.Shared.IdentityManagement.Components;
using Content.Shared.Inventory;
using Content.Shared.Inventory.Events;
using Robust.Shared.Containers;
using Robust.Shared.Enums;
using Robust.Shared.GameObjects.Components.Localization;
@@ -22,6 +23,7 @@ public class IdentitySystem : SharedIdentitySystem
[Dependency] private readonly IdCardSystem _idCard = default!;
[Dependency] private readonly IAdminLogManager _adminLog = default!;
[Dependency] private readonly MetaDataSystem _metaData = default!;
[Dependency] private readonly SharedContainerSystem _container = default!;
[Dependency] private readonly HumanoidAppearanceSystem _humanoid = default!;
private HashSet<EntityUid> _queuedIdentityUpdates = new();
@@ -59,7 +61,7 @@ public class IdentitySystem : SharedIdentitySystem
var ident = Spawn(null, Transform(uid).Coordinates);
QueueIdentityUpdate(uid);
component.IdentityEntitySlot.Insert(ident);
_container.Insert(ident, component.IdentityEntitySlot);
}
/// <summary>

View File

@@ -173,7 +173,7 @@ namespace Content.Server.Kitchen.EntitySystems
if (metaData.EntityPrototype.ID == recipeSolid.Key)
{
component.Storage.Remove(item);
_sharedContainer.Remove(item, component.Storage);
EntityManager.DeleteEntity(item);
break;
}
@@ -208,7 +208,7 @@ namespace Content.Server.Kitchen.EntitySystems
foreach (var part in headSlots)
{
component.Storage.Insert(part.Id);
_container.Insert(part.Id, component.Storage);
headCount++;
}
}
@@ -371,7 +371,7 @@ namespace Content.Server.Kitchen.EntitySystems
if (_tag.HasTag(item, "MicrowaveSelfUnsafe") || _tag.HasTag(item, "Plastic"))
{
var junk = Spawn(component.BadRecipeEntityId, Transform(uid).Coordinates);
component.Storage.Insert(junk);
_container.Insert(junk, component.Storage);
QueueDel(item);
}
@@ -504,7 +504,7 @@ namespace Content.Server.Kitchen.EntitySystems
if (!HasContents(component) || HasComp<ActiveMicrowaveComponent>(uid))
return;
component.Storage.Remove(EntityManager.GetEntity(args.EntityID));
_sharedContainer.Remove(EntityManager.GetEntity(args.EntityID), component.Storage);
UpdateUserInterfaceState(uid, component);
}

View File

@@ -159,7 +159,7 @@ namespace Content.Server.Kitchen.EntitySystems
if (inputContainer.ContainedEntities.Count >= reagentGrinder.StorageMaxEntities)
return;
if (!inputContainer.Insert(heldEnt, EntityManager))
if (!_containerSystem.Insert(heldEnt, inputContainer))
return;
args.Handled = true;
@@ -230,7 +230,7 @@ namespace Content.Server.Kitchen.EntitySystems
ClickSound(uid, reagentGrinder);
foreach (var entity in inputContainer.ContainedEntities.ToList())
{
inputContainer.Remove(entity);
_containerSystem.Remove(entity, inputContainer);
_randomHelper.RandomOffset(entity, 0.4f);
}
UpdateUiState(uid);
@@ -244,7 +244,7 @@ namespace Content.Server.Kitchen.EntitySystems
var inputContainer = _containerSystem.EnsureContainer<Container>(uid, SharedReagentGrinder.InputContainerId);
var ent = GetEntity(message.EntityId);
if (inputContainer.Remove(ent))
if (_containerSystem.Remove(ent, inputContainer))
{
_randomHelper.RandomOffset(ent, 0.4f);
ClickSound(uid, reagentGrinder);

View File

@@ -137,7 +137,7 @@ public sealed class LightReplacerSystem : EntitySystem
if (bulb.Valid) // FirstOrDefault can return default/invalid uid.
{
// try to remove it
var hasRemoved = replacer.InsertedBulbs.Remove(bulb);
var hasRemoved = _container.Remove(bulb, replacer.InsertedBulbs);
if (!hasRemoved)
return false;
}
@@ -187,7 +187,7 @@ public sealed class LightReplacerSystem : EntitySystem
}
// try insert light and show message
var hasInsert = replacer.InsertedBulbs.Insert(bulbUid);
var hasInsert = _container.Insert(bulbUid, replacer.InsertedBulbs);
if (hasInsert && showTooltip && userUid != null)
{
var msg = Loc.GetString("comp-light-replacer-insert-light",

View File

@@ -87,7 +87,7 @@ namespace Content.Server.Light.EntitySystems
if (light.HasLampOnSpawn != null)
{
var entity = EntityManager.SpawnEntity(light.HasLampOnSpawn, EntityManager.GetComponent<TransformComponent>(uid).Coordinates);
light.LightBulbContainer.Insert(entity);
_containerSystem.Insert(entity, light.LightBulbContainer);
}
// need this to update visualizers
UpdateLight(uid, light);
@@ -182,7 +182,7 @@ namespace Content.Server.Light.EntitySystems
return false;
// try to insert bulb in container
if (!light.LightBulbContainer.Insert(bulbUid))
if (!_containerSystem.Insert(bulbUid, light.LightBulbContainer))
return false;
UpdateLight(uid, light);
@@ -203,7 +203,7 @@ namespace Content.Server.Light.EntitySystems
return null;
// try to remove bulb from container
if (!light.LightBulbContainer.Remove(bulb))
if (!_containerSystem.Remove(bulb, light.LightBulbContainer))
return null;
// try to place bulb in hands

View File

@@ -141,7 +141,7 @@ public sealed class MaterialReclaimerSystem : SharedMaterialReclaimerSystem
if (active.ReclaimingContainer.ContainedEntities.FirstOrNull() is not { } item)
return false;
active.ReclaimingContainer.Remove(item);
Container.Remove(item, active.ReclaimingContainer);
Dirty(component);
// scales the output if the process was interrupted.

View File

@@ -78,7 +78,7 @@ public sealed class MechGrabberSystem : EntitySystem
if (!Resolve(uid, ref component))
return;
component.ItemContainer.Remove(toRemove);
_container.Remove(toRemove, component.ItemContainer);
var mechxform = Transform(mech);
var xform = Transform(toRemove);
_transform.AttachToGridOrMap(toRemove, xform);
@@ -175,7 +175,7 @@ public sealed class MechGrabberSystem : EntitySystem
if (!_mech.TryChangeEnergy(equipmentComponent.EquipmentOwner.Value, component.GrabEnergyDelta))
return;
component.ItemContainer.Insert(args.Args.Target.Value);
_container.Insert(args.Args.Target.Value, component.ItemContainer);
_mech.UpdateUserInterface(equipmentComponent.EquipmentOwner.Value);
args.Handled = true;

View File

@@ -47,7 +47,7 @@ public sealed class MechAssemblySystem : EntitySystem
if (!val && tagComp.Tags.Contains(tag))
{
component.RequiredParts[tag] = true;
component.PartsContainer.Insert(args.Used);
_container.Insert(args.Used, component.PartsContainer);
break;
}
}

View File

@@ -358,7 +358,7 @@ public sealed partial class MechSystem : SharedMechSystem
if (!Resolve(toInsert, ref battery, false))
return;
component.BatterySlot.Insert(toInsert);
_container.Insert(toInsert, component.BatterySlot);
component.Energy = battery.CurrentCharge;
component.MaxEnergy = battery.MaxCharge;

View File

@@ -233,7 +233,7 @@ namespace Content.Server.Medical
if (!HasComp<BodyComponent>(to_insert))
return;
scannerComponent.BodyContainer.Insert(to_insert);
_containerSystem.Insert(to_insert, scannerComponent.BodyContainer);
UpdateAppearance(uid, scannerComponent);
}
@@ -245,7 +245,7 @@ namespace Content.Server.Medical
if (scannerComponent.BodyContainer.ContainedEntity is not { Valid: true } contained)
return;
scannerComponent.BodyContainer.Remove(contained);
_containerSystem.Remove(contained, scannerComponent.BodyContainer);
_climbSystem.ForciblySetClimbing(contained, uid);
UpdateAppearance(uid, scannerComponent);
}

View File

@@ -16,6 +16,7 @@ using Content.Shared.Verbs;
using Robust.Server.GameObjects;
using Robust.Shared.Audio;
using Robust.Shared.Audio.Systems;
using Robust.Shared.Containers;
using Robust.Shared.Player;
namespace Content.Server.Morgue;
@@ -29,6 +30,7 @@ public sealed class CrematoriumSystem : EntitySystem
[Dependency] private readonly SharedPopupSystem _popup = default!;
[Dependency] private readonly StandingStateSystem _standing = default!;
[Dependency] private readonly SharedMindSystem _minds = default!;
[Dependency] private readonly SharedContainerSystem _containers = default!;
public override void Initialize()
{
@@ -126,11 +128,11 @@ public sealed class CrematoriumSystem : EntitySystem
for (var i = storage.Contents.ContainedEntities.Count - 1; i >= 0; i--)
{
var item = storage.Contents.ContainedEntities[i];
storage.Contents.Remove(item);
_containers.Remove(item, storage.Contents);
EntityManager.DeleteEntity(item);
}
var ash = Spawn("Ash", Transform(uid).Coordinates);
storage.Contents.Insert(ash);
_containers.Insert(ash, storage.Contents);
}
_entityStorage.OpenStorage(uid, storage);

View File

@@ -181,7 +181,7 @@ namespace Content.Server.Polymorph.Systems
childXform.LocalRotation = targetTransformComp.LocalRotation;
if (_container.TryGetContainingContainer(uid, out var cont))
cont.Insert(child);
_container.Insert(child, cont);
//Transfers all damage from the original to the new one
if (proto.TransferDamage &&

View File

@@ -201,7 +201,7 @@ public sealed partial class BorgSystem
continue;
}
component.ProvidedContainer.Remove(item, EntityManager, force: true);
_container.Remove(item, component.ProvidedContainer, force: true);
}
if (!item.IsValid())
@@ -245,7 +245,7 @@ public sealed partial class BorgSystem
if (LifeStage(item) <= EntityLifeStage.MapInitialized)
{
RemComp<UnremoveableComponent>(item);
component.ProvidedContainer.Insert(item, EntityManager);
_container.Insert(item, component.ProvidedContainer);
}
_hands.RemoveHand(chassis, handId, hands);
}

View File

@@ -33,7 +33,7 @@ public sealed partial class BorgSystem
_adminLog.Add(LogType.Action, LogImpact.Medium,
$"{ToPrettyString(attachedEntity):player} removed brain {ToPrettyString(brain)} from borg {ToPrettyString(uid)}");
component.BrainContainer.Remove(brain, EntityManager);
_container.Remove(brain, component.BrainContainer);
_hands.TryPickupAnyHand(attachedEntity, brain);
UpdateUI(uid, component);
}
@@ -91,7 +91,7 @@ public sealed partial class BorgSystem
_adminLog.Add(LogType.Action, LogImpact.Medium,
$"{ToPrettyString(attachedEntity):player} removed module {ToPrettyString(module)} from borg {ToPrettyString(uid)}");
component.ModuleContainer.Remove(module);
_container.Remove(module, component.ModuleContainer);
_hands.TryPickupAnyHand(attachedEntity, module);
UpdateUI(uid, component);

View File

@@ -46,6 +46,7 @@ public sealed partial class BorgSystem : SharedBorgSystem
[Dependency] private readonly PowerCellSystem _powerCell = default!;
[Dependency] private readonly ThrowingSystem _throwing = default!;
[Dependency] private readonly UserInterfaceSystem _ui = default!;
[Dependency] private readonly SharedContainerSystem _container = default!;
[ValidatePrototypeId<JobPrototype>]
public const string BorgJobId = "Borg";
@@ -109,7 +110,7 @@ public sealed partial class BorgSystem : SharedBorgSystem
}
}
component.BrainContainer.Insert(used);
_container.Insert(used, component.BrainContainer);
_adminLog.Add(LogType.Action, LogImpact.Medium,
$"{ToPrettyString(args.User):player} installed brain {ToPrettyString(used)} into borg {ToPrettyString(uid)}");
args.Handled = true;
@@ -118,7 +119,7 @@ public sealed partial class BorgSystem : SharedBorgSystem
if (module != null && CanInsertModule(uid, used, component, module, args.User))
{
component.ModuleContainer.Insert(used);
_container.Insert(used, component.ModuleContainer);
_adminLog.Add(LogType.Action, LogImpact.Low,
$"{ToPrettyString(args.User):player} installed module {ToPrettyString(used)} into borg {ToPrettyString(uid)}");
args.Handled = true;

View File

@@ -215,7 +215,7 @@ public sealed class EventHorizonSystem : SharedEventHorizonSystem
var target_container = outerContainer;
while (target_container != null)
{
if (target_container.Insert(entity))
if (_containerSystem.Insert(entity, target_container))
break;
_containerSystem.TryGetContainingContainer(target_container.Owner, out target_container);

View File

@@ -173,7 +173,7 @@ public sealed class StickySystem : EntitySystem
// add container to entity and insert sticker into it
var container = _containerSystem.EnsureContainer<Container>(target, StickerSlotId);
container.ShowContents = true;
if (!container.Insert(uid))
if (!_containerSystem.Insert(uid, container))
return;
// show message to user
@@ -207,11 +207,11 @@ public sealed class StickySystem : EntitySystem
return;
// try to remove sticky item from target container
if (!_containerSystem.TryGetContainer(stuckTo, StickerSlotId, out var container) || !container.Remove(uid))
if (!_containerSystem.TryGetContainer(stuckTo, StickerSlotId, out var container) || !_containerSystem.Remove(uid, container))
return;
// delete container if it's now empty
if (container.ContainedEntities.Count == 0)
container.Shutdown();
_containerSystem.ShutdownContainer(container);
// try place dropped entity into user hands
_handsSystem.PickupOrDrop(user, uid);

View File

@@ -11,6 +11,7 @@ using Content.Shared.Mind.Components;
using Content.Shared.Storage.Components;
using Content.Shared.Storage.EntitySystems;
using Content.Shared.Tools.Systems;
using Robust.Shared.Containers;
using Robust.Shared.Random;
using Robust.Shared.Timing;
@@ -20,6 +21,7 @@ public sealed class BluespaceLockerSystem : EntitySystem
{
[Dependency] private readonly IRobustRandom _robustRandom = default!;
[Dependency] private readonly IGameTiming _timing = default!;
[Dependency] private readonly SharedContainerSystem _containerSystem = default!;
[Dependency] private readonly EntityStorageSystem _entityStorage = default!;
[Dependency] private readonly WeldableSystem _weldableSystem = default!;
[Dependency] private readonly LockSystem _lockSystem = default!;
@@ -91,12 +93,12 @@ public sealed class BluespaceLockerSystem : EntitySystem
if (!component.BehaviorProperties.TransportSentient)
continue;
entityStorageComponent.Contents.Insert(entity, EntityManager);
_containerSystem.Insert(entity, entityStorageComponent.Contents);
transportedEntities++;
}
else if (component.BehaviorProperties.TransportEntities)
{
entityStorageComponent.Contents.Insert(entity, EntityManager);
_containerSystem.Insert(entity, entityStorageComponent.Contents);
transportedEntities++;
}
}
@@ -308,12 +310,12 @@ public sealed class BluespaceLockerSystem : EntitySystem
if (!component.BehaviorProperties.TransportSentient)
continue;
target.Value.storageComponent.Contents.Insert(entity, EntityManager);
_containerSystem.Insert(entity, target.Value.storageComponent.Contents);
transportedEntities++;
}
else if (component.BehaviorProperties.TransportEntities)
{
target.Value.storageComponent.Contents.Insert(entity, EntityManager);
_containerSystem.Insert(entity, target.Value.storageComponent.Contents);
transportedEntities++;
}
}

View File

@@ -8,12 +8,14 @@ using Robust.Shared.Random;
using System.Linq;
using Content.Shared.Storage.Components;
using Robust.Shared.Audio.Systems;
using Robust.Shared.Containers;
namespace Content.Server.Storage.EntitySystems;
public sealed class CursedEntityStorageSystem : EntitySystem
{
[Dependency] private readonly IRobustRandom _random = default!;
[Dependency] private readonly SharedContainerSystem _container = default!;
[Dependency] private readonly EntityStorageSystem _entityStorage = default!;
[Dependency] private readonly SharedAudioSystem _audio = default!;
@@ -48,7 +50,7 @@ public sealed class CursedEntityStorageSystem : EntitySystem
foreach (var entity in storage.Contents.ContainedEntities.ToArray())
{
storage.Contents.Remove(entity);
_container.Remove(entity, storage.Contents);
_entityStorage.AddToContents(entity, lockerEnt);
}

View File

@@ -16,7 +16,7 @@ public sealed partial class GunSystem
var existing = component.Entities[^1];
component.Entities.RemoveAt(component.Entities.Count - 1);
component.Container.Remove(existing);
Containers.Remove(existing, component.Container);
EnsureShootable(existing);
}
else if (component.UnspawnedCount > 0)

View File

@@ -187,7 +187,7 @@ public sealed class ActionContainerSystem : EntitySystem
DebugTools.AssertOwner(uid, comp);
comp ??= EnsureComp<ActionsContainerComponent>(uid);
if (!comp.Container.Insert(actionId))
if (!_container.Insert(actionId, comp.Container))
{
Log.Error($"Failed to insert action {ToPrettyString(actionId)} into {ToPrettyString(uid)}");
return false;
@@ -239,7 +239,7 @@ public sealed class ActionContainerSystem : EntitySystem
if (_timing.ApplyingState && component.NetSyncEnabled)
return; // The game state should handle the container removal & action deletion.
component.Container.Shutdown();
_container.ShutdownContainer(component.Container);
}
private void OnEntityInserted(EntityUid uid, ActionsContainerComponent component, EntInsertedIntoContainerMessage args)

View File

@@ -161,7 +161,7 @@ public partial class SharedBodySystem
var partSlot = CreatePartSlot(parentEntity, connection, childPartComponent.PartType, parentPartComponent);
var cont = Containers.GetContainer(parentEntity, GetPartSlotContainerId(connection));
if (partSlot == null || !cont.Insert(childPart))
if (partSlot == null || !Containers.Insert(childPart, cont))
{
Log.Error($"Could not create slot for connection {connection} in body {prototype.ID}");
QueueDel(childPart);

View File

@@ -98,7 +98,7 @@ public partial class SharedBodySystem
if (!Containers.TryGetContainer(partId, containerId, out var container))
return false;
return container.Insert(organId);
return Containers.Insert(organId, container);
}
/// <summary>
@@ -114,7 +114,7 @@ public partial class SharedBodySystem
if (!HasComp<BodyPartComponent>(parent))
return false;
return container.Remove(organId);
return Containers.Remove(organId, container);
}
/// <summary>

View File

@@ -396,7 +396,7 @@ public partial class SharedBodySystem
return false;
}
return body.RootContainer.Insert(partId);
return Containers.Insert(partId, body.RootContainer);
}
#endregion
@@ -446,7 +446,7 @@ public partial class SharedBodySystem
return false;
}
return container.Insert(partId);
return Containers.Insert(partId, container);
}
#endregion

View File

@@ -36,7 +36,7 @@ public abstract class SharedCartridgeLoaderSystem : EntitySystem
{
_itemSlotsSystem.RemoveItemSlot(uid, loader.CartridgeSlot);
if (_container.TryGetContainer(uid, InstalledContainerId, out var cont))
cont.Shutdown(EntityManager, _netMan);
_container.ShutdownContainer(cont);
}
protected virtual void OnItemInserted(EntityUid uid, CartridgeLoaderComponent loader, EntInsertedIntoContainerMessage args)

View File

@@ -143,7 +143,7 @@ public sealed class ToggleableClothingSystem : EntitySystem
if (!_inventorySystem.TryUnequip(Transform(uid).ParentUid, toggleCom.Slot, force: true))
return;
toggleCom.Container.Insert(uid, EntityManager);
_containerSystem.Insert(uid, toggleCom.Container);
args.Handled = true;
}
@@ -229,8 +229,8 @@ public sealed class ToggleableClothingSystem : EntitySystem
// As unequipped gets called in the middle of container removal, we cannot call a container-insert without causing issues.
// So we delay it and process it during a system update:
if (toggleComp.ClothingUid != null)
toggleComp.Container?.Insert(toggleComp.ClothingUid.Value);
if (toggleComp.ClothingUid != null && toggleComp.Container != null)
_containerSystem.Insert(toggleComp.ClothingUid.Value, toggleComp.Container);
}
/// <summary>
@@ -302,7 +302,7 @@ public sealed class ToggleableClothingSystem : EntitySystem
var attachedClothing = EnsureComp<AttachedClothingComponent>(component.ClothingUid.Value);
attachedClothing.AttachedUid = uid;
Dirty(component.ClothingUid.Value, attachedClothing);
component.Container.Insert(component.ClothingUid.Value, EntityManager, ownerTransform: xform);
_containerSystem.Insert(component.ClothingUid.Value, component.Container, containerXform: xform);
Dirty(uid, component);
}

View File

@@ -77,7 +77,7 @@ public sealed class PartAssemblySystem : EntitySystem
return false;
component.CurrentAssembly = assemblyId;
component.PartsContainer.Insert(part);
_container.Insert(part, component.PartsContainer);
var ev = new PartAssemblyPartInsertedEvent();
RaiseLocalEvent(uid, ev);
return true;

View File

@@ -33,7 +33,7 @@ public sealed class ContainerFillSystem : EntitySystem
foreach (var proto in prototypes)
{
var ent = Spawn(proto, coords);
if (!container.Insert(ent, EntityManager, null, xform))
if (!_containerSystem.Insert(ent, container, containerXform: xform))
{
Log.Error($"Entity {ToPrettyString(uid)} with a {nameof(ContainerFillComponent)} failed to insert an entity: {ToPrettyString(ent)}.");
Transform(ent).AttachToGridOrMap();

View File

@@ -68,7 +68,8 @@ namespace Content.Shared.Containers.ItemSlots
continue;
var item = EntityManager.SpawnEntity(slot.StartingItem, EntityManager.GetComponent<TransformComponent>(uid).Coordinates);
slot.ContainerSlot?.Insert(item);
if (slot.ContainerSlot != null)
_containers.Insert(item, slot.ContainerSlot);
}
}
@@ -115,7 +116,7 @@ namespace Content.Shared.Containers.ItemSlots
if (Terminating(uid) || slot.ContainerSlot == null)
return;
slot.ContainerSlot.Shutdown();
_containers.ShutdownContainer(slot.ContainerSlot);
// Don't log missing resolves. when an entity has all of its components removed, the ItemSlotsComponent may
// have been removed before some other component that added an item slot (and is now trying to remove it).
@@ -228,7 +229,7 @@ namespace Content.Shared.Containers.ItemSlots
/// Useful for predicted interactions</param>
private void Insert(EntityUid uid, ItemSlot slot, EntityUid item, EntityUid? user, bool excludeUserAudio = false)
{
var inserted = slot.ContainerSlot?.Insert(item);
bool? inserted = slot.ContainerSlot != null ? _containers.Insert(item, slot.ContainerSlot) : null;
// ContainerSlot automatically raises a directed EntInsertedIntoContainerMessage
// Logging
@@ -350,7 +351,7 @@ namespace Content.Shared.Containers.ItemSlots
/// Useful for predicted interactions</param>
private void Eject(EntityUid uid, ItemSlot slot, EntityUid item, EntityUid? user, bool excludeUserAudio = false)
{
var ejected = slot.ContainerSlot?.Remove(item);
bool? ejected = slot.ContainerSlot != null ? _containers.Remove(item, slot.ContainerSlot) : null;
// ContainerSlot automatically raises a directed EntRemovedFromContainerMessage
// Logging

View File

@@ -384,7 +384,7 @@ namespace Content.Shared.Cuffs
var container = cuffable.Container;
var entity = container.ContainedEntities[^1];
container.Remove(entity);
_container.Remove(entity, container);
_transform.SetWorldPosition(entity, _transform.GetWorldPosition(owner));
}
@@ -448,7 +448,7 @@ namespace Content.Shared.Cuffs
// Success!
_hands.TryDrop(user, handcuff);
component.Container.Insert(handcuff);
_container.Insert(handcuff, component.Container);
UpdateHeldItems(target, handcuff, component);
return true;
}
@@ -634,7 +634,7 @@ namespace Content.Shared.Cuffs
_audio.PlayPredicted(cuff.EndUncuffSound, target, user);
cuffable.Container.Remove(cuffsToRemove);
_container.Remove(cuffsToRemove, cuffable.Container);
if (_net.IsServer)
{

View File

@@ -17,7 +17,7 @@ public abstract class SharedDevourSystem : EntitySystem
[Dependency] private readonly SharedDoAfterSystem _doAfterSystem = default!;
[Dependency] private readonly SharedPopupSystem _popupSystem = default!;
[Dependency] private readonly SharedActionsSystem _actionsSystem = default!;
[Dependency] private readonly SharedContainerSystem _containerSystem = default!;
[Dependency] protected readonly SharedContainerSystem ContainerSystem = default!;
public override void Initialize()
{
@@ -31,7 +31,7 @@ public abstract class SharedDevourSystem : EntitySystem
{
//Devourer doesn't actually chew, since he sends targets right into his stomach.
//I did it mom, I added ERP content into upstream. Legally!
component.Stomach = _containerSystem.EnsureContainer<Container>(uid, "stomach");
component.Stomach = ContainerSystem.EnsureContainer<Container>(uid, "stomach");
_actionsSystem.AddAction(uid, ref component.DevourActionEntity, component.DevourAction);
}

View File

@@ -120,7 +120,7 @@ public abstract partial class SharedHandsSystem
if (!isInContainer
|| !ContainerSystem.TryGetContainingContainer(userXform.ParentUid, uid, out var container, skipExistCheck: true)
|| !container.Insert(entity, EntityManager, itemXform))
|| !ContainerSystem.Insert((entity, itemXform), container))
TransformSystem.AttachToGridOrMap(entity, itemXform);
return true;
}
@@ -148,7 +148,7 @@ public abstract partial class SharedHandsSystem
return false;
DoDrop(uid, hand, false, handsComp);
targetContainer.Insert(entity);
ContainerSystem.Insert(entity, targetContainer);
return true;
}
@@ -189,7 +189,7 @@ public abstract partial class SharedHandsSystem
if (TerminatingOrDeleted(uid) || TerminatingOrDeleted(entity))
return;
if (!hand.Container.Remove(entity, EntityManager))
if (!ContainerSystem.Remove(entity, hand.Container))
{
Log.Error($"Failed to remove {ToPrettyString(entity)} from users hand container when dropping. User: {ToPrettyString(uid)}. Hand: {hand.Name}.");
return;

View File

@@ -217,7 +217,7 @@ public abstract partial class SharedHandsSystem : EntitySystem
if (handContainer == null || handContainer.ContainedEntity != null)
return;
if (!handContainer.Insert(entity, EntityManager))
if (!ContainerSystem.Insert(entity, handContainer))
{
Log.Error($"Failed to insert {ToPrettyString(entity)} into users hand container when picking up. User: {ToPrettyString(uid)}. Hand: {hand.Name}.");
return;

View File

@@ -73,7 +73,8 @@ public abstract partial class SharedHandsSystem
handsComp.SortedHands.Remove(hand.Name);
TryDrop(uid, hand, null, false, true, handsComp);
hand.Container?.Shutdown();
if (hand.Container != null)
ContainerSystem.ShutdownContainer(hand.Container);
if (handsComp.ActiveHand == hand)
TrySetActiveHand(uid, handsComp.SortedHands.FirstOrDefault(), handsComp);

View File

@@ -63,10 +63,11 @@ public abstract class SharedImplanterSystem : EntitySystem
var implantedComp = EnsureComp<ImplantedComponent>(target);
var implantContainer = implantedComp.ImplantContainer;
component.ImplanterSlot.ContainerSlot?.Remove(implant.Value);
if (component.ImplanterSlot.ContainerSlot != null)
_container.Remove(implant.Value, component.ImplanterSlot.ContainerSlot);
implantComp.ImplantedEntity = target;
implantContainer.OccludesLight = false;
implantContainer.Insert(implant.Value);
_container.Insert(implant.Value, implantContainer);
if (component.CurrentMode == ImplanterToggleMode.Inject && !component.ImplantOnly)
DrawMode(implanter, component);
@@ -140,9 +141,9 @@ public abstract class SharedImplanterSystem : EntitySystem
continue;
}
implantContainer.Remove(implant);
_container.Remove(implant, implantContainer);
implantComp.ImplantedEntity = null;
implanterContainer.Insert(implant);
_container.Insert(implant, implanterContainer);
permanentFound = implantComp.Permanent;
var ev = new TransferDnaEvent { Donor = target, Recipient = implanter };

View File

@@ -48,7 +48,7 @@ public abstract class SharedSubdermalImplantSystem : EntitySystem
{
if (_tag.HasTag(implant, "MicroBomb"))
{
implantContainer.Remove(implant);
_container.Remove(implant, implantContainer);
QueueDel(implant);
}
}
@@ -124,7 +124,7 @@ public abstract class SharedSubdermalImplantSystem : EntitySystem
var implantContainer = implantedComp.ImplantContainer;
component.ImplantedEntity = target;
implantContainer.Insert(implant);
_container.Insert(implant, implantContainer);
}
/// <summary>
@@ -140,7 +140,7 @@ public abstract class SharedSubdermalImplantSystem : EntitySystem
var implantContainer = implanted.ImplantContainer;
implantContainer.Remove(implant);
_container.Remove(implant, implantContainer);
QueueDel(implant);
}

View File

@@ -190,7 +190,7 @@ public abstract partial class InventorySystem
return false;
}
if (!slotContainer.Insert(itemUid))
if (!_containerSystem.Insert(itemUid, slotContainer))
{
if(!silent && _gameTiming.IsFirstTimePredicted)
_popup.PopupCursor(Loc.GetString("inventory-component-can-unequip-cannot"));
@@ -374,7 +374,7 @@ public abstract partial class InventorySystem
}
}
if (!slotContainer.Remove(removedItem.Value, force: force))
if (!_containerSystem.Remove(removedItem.Value, slotContainer, force: force))
return false;
// TODO: Inventory needs a hot cleanup hoo boy

View File

@@ -26,7 +26,7 @@ public abstract class SharedMaterialReclaimerSystem : EntitySystem
[Dependency] protected readonly IGameTiming Timing = default!;
[Dependency] protected readonly SharedAmbientSoundSystem AmbientSound = default!;
[Dependency] private readonly SharedAudioSystem _audio = default!;
[Dependency] private readonly SharedContainerSystem _container = default!;
[Dependency] protected readonly SharedContainerSystem Container = default!;
public const string ActiveReclaimerContainerId = "active-material-reclaimer-container";
@@ -79,7 +79,7 @@ public abstract class SharedMaterialReclaimerSystem : EntitySystem
private void OnActiveStartup(EntityUid uid, ActiveMaterialReclaimerComponent component, ComponentStartup args)
{
component.ReclaimingContainer = _container.EnsureContainer<Container>(uid, ActiveReclaimerContainerId);
component.ReclaimingContainer = Container.EnsureContainer<Container>(uid, ActiveReclaimerContainerId);
}
private void OnActiveUnpaused(EntityUid uid, ActiveMaterialReclaimerComponent component, ref EntityUnpausedEvent args)
@@ -107,7 +107,7 @@ public abstract class SharedMaterialReclaimerSystem : EntitySystem
if (component.Blacklist is {} blacklist && blacklist.IsValid(item))
return false;
if (_container.TryGetContainingContainer(item, out _) && !_container.TryRemoveFromContainer(item))
if (Container.TryGetContainingContainer(item, out _) && !Container.TryRemoveFromContainer(item))
return false;
if (user != null)
@@ -133,7 +133,7 @@ public abstract class SharedMaterialReclaimerSystem : EntitySystem
var active = EnsureComp<ActiveMaterialReclaimerComponent>(uid);
active.Duration = duration;
active.EndTime = Timing.CurTime + duration;
active.ReclaimingContainer.Insert(item);
Container.Insert(item, active.ReclaimingContainer);
return true;
}

View File

@@ -220,7 +220,7 @@ public abstract class SharedMechSystem : EntitySystem
return;
equipmentComponent.EquipmentOwner = uid;
component.EquipmentContainer.Insert(toInsert, EntityManager);
_container.Insert(toInsert, component.EquipmentContainer);
var ev = new MechEquipmentInsertedEvent(uid);
RaiseLocalEvent(toInsert, ref ev);
UpdateUserInterface(uid, component);
@@ -258,7 +258,7 @@ public abstract class SharedMechSystem : EntitySystem
CycleEquipment(uid, component);
equipmentComponent.EquipmentOwner = null;
component.EquipmentContainer.Remove(toRemove, EntityManager);
_container.Remove(toRemove, component.EquipmentContainer);
UpdateUserInterface(uid, component);
}
@@ -364,7 +364,7 @@ public abstract class SharedMechSystem : EntitySystem
return false;
SetupUser(uid, toInsert.Value);
component.PilotSlot.Insert(toInsert.Value, EntityManager);
_container.Insert(toInsert.Value, component.PilotSlot);
UpdateAppearance(uid, component);
return true;
}

View File

@@ -76,7 +76,7 @@ public abstract partial class SharedCryoPodSystem: EntitySystem
return false;
var xform = Transform(target);
cryoPodComponent.BodyContainer.Insert(target, transform: xform);
_containerSystem.Insert((target, xform), cryoPodComponent.BodyContainer);
EnsureComp<InsideCryoPodComponent>(target);
_standingStateSystem.Stand(target, force: true); // Force-stand the mob so that the cryo pod sprite overlays it fully
@@ -117,7 +117,7 @@ public abstract partial class SharedCryoPodSystem: EntitySystem
if (cryoPodComponent.BodyContainer.ContainedEntity is not {Valid: true} contained)
return null;
cryoPodComponent.BodyContainer.Remove(contained);
_containerSystem.Remove(contained, cryoPodComponent.BodyContainer);
// InsideCryoPodComponent is removed automatically in its EntGotRemovedFromContainerMessage listener
// RemComp<InsideCryoPodComponent>(contained);

View File

@@ -134,7 +134,7 @@ public sealed partial class EncryptionKeySystem : EntitySystem
return;
}
if (component.KeyContainer.Insert(args.Used))
if (_container.Insert(args.Used, component.KeyContainer))
{
_popup.PopupClient(Loc.GetString("encryption-key-successfully-installed"), uid, args.User);
_audio.PlayPredicted(component.KeyInsertionSound, args.Target, args.User);

View File

@@ -138,7 +138,7 @@ public sealed class BinSystem : EntitySystem
if (component.Whitelist != null && !component.Whitelist.IsValid(toInsert))
return false;
component.ItemContainer.Insert(toInsert);
_container.Insert(toInsert, component.ItemContainer);
component.Items.Add(toInsert);
Dirty(component);
return true;
@@ -162,7 +162,7 @@ public sealed class BinSystem : EntitySystem
if (toRemove == null || toRemove != component.Items.LastOrDefault())
return false;
if (!component.ItemContainer.Remove(toRemove.Value))
if (!_container.Remove(toRemove.Value, component.ItemContainer))
return false;
component.Items.Remove(toRemove.Value);

View File

@@ -263,7 +263,7 @@ public abstract class SharedEntityStorageSystem : EntitySystem
}
_joints.RecursiveClearJoints(toInsert);
if (!component.Contents.Insert(toInsert, EntityManager))
if (!_container.Insert(toInsert, component.Contents))
return false;
var inside = EnsureComp<InsideEntityStorageComponent>(toInsert);
@@ -280,7 +280,7 @@ public abstract class SharedEntityStorageSystem : EntitySystem
return false;
RemComp<InsideEntityStorageComponent>(toRemove);
component.Contents.Remove(toRemove, EntityManager);
_container.Remove(toRemove, component.Contents);
var pos = TransformSystem.GetWorldPosition(xform) + TransformSystem.GetWorldRotation(xform).RotateVec(component.EnteringOffset);
TransformSystem.SetWorldPosition(toRemove, pos);
return true;

View File

@@ -48,7 +48,7 @@ public abstract partial class SharedGunSystem
return;
component.Entities.Add(args.Used);
component.Container.Insert(args.Used);
Containers.Insert(args.Used, component.Container);
// Not predicted so
Audio.PlayPredicted(component.SoundInsert, uid, args.User);
args.Handled = true;
@@ -241,7 +241,7 @@ public abstract partial class SharedGunSystem
args.Ammo.Add((entity, EnsureShootable(entity)));
component.Entities.RemoveAt(component.Entities.Count - 1);
component.Container.Remove(entity);
Containers.Remove(entity, component.Container);
}
else if (component.UnspawnedCount > 0)
{

View File

@@ -290,7 +290,7 @@ public abstract partial class SharedGunSystem
if (entity == null)
return false;
container.Remove(entity.Value);
Containers.Remove(entity.Value, container);
return true;
}
@@ -316,7 +316,7 @@ public abstract partial class SharedGunSystem
{
return Containers.TryGetContainer(uid, ChamberSlot, out var container) &&
container is ContainerSlot slot &&
slot.Insert(ammo);
Containers.Insert(ammo, slot);
}
private void OnChamberAmmoCount(EntityUid uid, ChamberMagazineAmmoProviderComponent component, ref GetAmmoCountEvent args)

View File

@@ -28,7 +28,7 @@ public partial class SharedGunSystem
var ent = container.ContainedEntities[0];
if (_netManager.IsServer)
container.Remove(ent);
Containers.Remove(ent, container);
args.Ammo.Add((ent, EnsureShootable(ent)));
}

View File

@@ -132,7 +132,7 @@ public partial class SharedGunSystem
}
component.AmmoSlots[index] = ent.Value;
component.AmmoContainer.Insert(ent.Value, EntityManager);
Containers.Insert(ent.Value, component.AmmoContainer);
if (ev.Ammo.Count == 0)
break;
@@ -160,7 +160,7 @@ public partial class SharedGunSystem
}
component.AmmoSlots[index] = uid;
component.AmmoContainer.Insert(uid);
Containers.Insert(uid, component.AmmoContainer);
Audio.PlayPredicted(component.SoundInsert, revolverUid, user);
Popup(Loc.GetString("gun-revolver-insert"), revolverUid, user);
UpdateRevolverAppearance(revolverUid, component);
@@ -283,7 +283,7 @@ public partial class SharedGunSystem
else
{
component.AmmoSlots[i] = null;
component.AmmoContainer.Remove(slot.Value);
Containers.Remove(slot.Value, component.AmmoContainer);
if (!_netManager.IsClient)
EjectCartridge(slot.Value);
@@ -366,7 +366,7 @@ public partial class SharedGunSystem
continue;
}
component.AmmoContainer.Remove(ent.Value);
Containers.Remove(ent.Value, component.AmmoContainer);
component.AmmoSlots[index] = null;
args.Ammo.Add((ent.Value, EnsureShootable(ent.Value)));
TransformSystem.SetCoordinates(ent.Value, args.Coordinates);