Add new entity spawn test & fix misc bugs (#19953)

This commit is contained in:
Leon Friedrich
2023-10-16 16:54:10 +11:00
committed by GitHub
parent 1f0c9314fd
commit 00e274ea38
14 changed files with 149 additions and 36 deletions

View File

@@ -1,6 +1,10 @@
using Content.Server.Spawners.Components;
using Content.Server.Storage.Components;
using Content.Shared.Prototypes;
using Content.Shared.Storage;
using Content.Shared.Storage.Components;
using Robust.Shared.Prototypes;
using Robust.Shared.Utility;
namespace Content.Server.Storage.EntitySystems;
@@ -25,10 +29,13 @@ public sealed partial class StorageSystem
var spawnItems = EntitySpawnCollection.GetSpawns(component.Contents, Random);
foreach (var item in spawnItems)
{
// No, you are not allowed to fill a container with entity spawners.
DebugTools.Assert(!_prototype.Index<EntityPrototype>(item)
.HasComponent(typeof(RandomSpawnerComponent)));
var ent = EntityManager.SpawnEntity(item, coordinates);
// handle depending on storage component, again this should be unified after ECS
if (entityStorageComp != null && EntityStorage.Insert(ent, uid))
if (entityStorageComp != null && EntityStorage.Insert(ent, uid, entityStorageComp))
continue;
if (storageComp != null && Insert(uid, ent, out _, storageComp: storageComp, playSound: false))