diff --git a/Content.IntegrationTests/Tests/EntityTest.cs b/Content.IntegrationTests/Tests/EntityTest.cs index d0c4f67398b..051da50c95b 100644 --- a/Content.IntegrationTests/Tests/EntityTest.cs +++ b/Content.IntegrationTests/Tests/EntityTest.cs @@ -102,11 +102,21 @@ await server.WaitPost(() => .Where(p => !p.Components.ContainsKey("MapGrid")) // This will smash stuff otherwise. .Select(p => p.ID) .ToList(); + bool anyException = false; foreach (var protoId in protoIds) { Logger.Info($"Spawning proto {protoId}"); - entityMan.SpawnEntity(protoId, map.GridCoords); + try + { + entityMan.SpawnEntity(protoId, map.GridCoords); + } + catch (Exception e) + { + Logger.Info($"Exception while spawning proto {protoId}: \"{e.Message}\" {e.StackTrace}"); + anyException = true; + } } + Assert.That(anyException, Is.EqualTo(false), "One or more exceptions occurred during entity spawn."); }); await server.WaitRunTicks(15); await server.WaitPost(() => @@ -121,13 +131,26 @@ await server.WaitPost(() => } } + bool anyException = false; var entityMetas = Query(entityMan).ToList(); foreach (var (uid, meta) in entityMetas) { - if (!meta.EntityDeleted) - entityMan.DeleteEntity(uid); + Logger.Info($"Deleting entity {meta.EntityPrototype?.ID ?? "null"} ({uid})"); + try + { + if (!meta.EntityDeleted) + entityMan.DeleteEntity(uid); + } + catch (Exception e) + { + Logger.Info($"Exception while deleting entity {meta.EntityPrototype?.ID ?? "null"} ({uid}): \"{e.Message}\" {e.StackTrace}"); + anyException = true; + } } + Assert.That(anyException, Is.EqualTo(false), "One or more exceptions occurred during entity deletion."); + + Assert.That(entityMan.EntityCount, Is.Zero); }); diff --git a/Content.Server/_NF/SectorServices/SectorServiceSystem.cs b/Content.Server/_NF/SectorServices/SectorServiceSystem.cs index fd2fc8665ac..245c7461bb7 100644 --- a/Content.Server/_NF/SectorServices/SectorServiceSystem.cs +++ b/Content.Server/_NF/SectorServices/SectorServiceSystem.cs @@ -33,12 +33,17 @@ public override void Initialize() private void OnMapInit(EntityUid uid, StationSectorServiceHostComponent map, ComponentInit args) { - Log.Debug($"OnMapInit! Entity: {uid} internal: {_entity}"); + Log.Debug($"OnMapInit! Entity: {uid.Id} internal: {_entity.Id}"); if (_entity != EntityUid.Invalid) return; - Spawn(); + _entity = Spawn(); + if (!_entity.Valid) + { + Log.Error($"OnMapInit! Invalid host returned for Spawn."); + return; + } foreach (var servicePrototype in _prototypeManager.EnumeratePrototypes()) { @@ -49,7 +54,7 @@ private void OnMapInit(EntityUid uid, StationSectorServiceHostComponent map, Com private void OnMapRemove(EntityUid uid, StationSectorServiceHostComponent map, ComponentRemove args) { - Log.Debug($"OnMapRemove! Entity: {_entity}"); + Log.Debug($"OnMapRemove! Entity: {_entity.Id}"); if (_entity != EntityUid.Invalid) { Del(_entity); diff --git a/Resources/Prototypes/_NF/Entities/Objects/Tools/welders.yml b/Resources/Prototypes/_NF/Entities/Objects/Tools/welders.yml index 4649781f006..8f858a1371b 100644 --- a/Resources/Prototypes/_NF/Entities/Objects/Tools/welders.yml +++ b/Resources/Prototypes/_NF/Entities/Objects/Tools/welders.yml @@ -6,9 +6,7 @@ - type: SolutionContainerManager solutions: Welder: - reagents: - - ReagentId: WeldingFuel - Quantity: 0 + reagents: [] maxVol: 100 - type: entity @@ -19,9 +17,7 @@ - type: SolutionContainerManager solutions: Welder: - reagents: - - ReagentId: WeldingFuel - Quantity: 0 + reagents: [] maxVol: 250 - type: entity @@ -32,9 +28,7 @@ - type: SolutionContainerManager solutions: Welder: - reagents: - - ReagentId: WeldingFuel - Quantity: 0 + reagents: [] maxVol: 250 - type: entity @@ -45,7 +39,5 @@ - type: SolutionContainerManager solutions: Welder: - reagents: - - ReagentId: WeldingFuel - Quantity: 0 + reagents: [] maxVol: 1000 diff --git a/Resources/Prototypes/_NF/Entities/Structures/Machines/crate_machine.yml b/Resources/Prototypes/_NF/Entities/Structures/Machines/crate_machine.yml index 67b0cd910bd..09ab2851862 100644 --- a/Resources/Prototypes/_NF/Entities/Structures/Machines/crate_machine.yml +++ b/Resources/Prototypes/_NF/Entities/Structures/Machines/crate_machine.yml @@ -7,8 +7,12 @@ components: - type: ItemPlacer whitelist: + # Should match crates. + requireAll: true components: - - CrateGenericSteel + - EntityStorage + - PaperLabel + - ContainerContainer - type: CrateMachine - type: Sprite sprite: _NF/Structures/Machines/crate_machine.rsi