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

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