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

@@ -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);