Content ecs containers (#22484)
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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}!");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
{
|
||||
|
||||
@@ -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"}");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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 &&
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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++;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user