diff --git a/Content.Server/Spawners/Components/TimedSpawnerComponent.cs b/Content.Server/Spawners/Components/TimedSpawnerComponent.cs index a96060f74b..9b7d14bedd 100644 --- a/Content.Server/Spawners/Components/TimedSpawnerComponent.cs +++ b/Content.Server/Spawners/Components/TimedSpawnerComponent.cs @@ -51,6 +51,12 @@ public sealed partial class TimedSpawnerComponent : Component, ISerializationHoo [DataField(customTypeSerializer: typeof(TimeOffsetSerializer)), AutoPausedField] public TimeSpan NextFire = TimeSpan.Zero; + /// + /// Determines whether to allow spawning entities in the spawner's container, or if they should always be outside. + /// + [DataField] + public bool AllowContainerPlacement = false; + void ISerializationHooks.AfterDeserialization() { if (MinimumEntitiesSpawned > MaximumEntitiesSpawned) diff --git a/Content.Server/Spawners/EntitySystems/SpawnerSystem.cs b/Content.Server/Spawners/EntitySystems/SpawnerSystem.cs index bcbfdb626e..710672f17c 100644 --- a/Content.Server/Spawners/EntitySystems/SpawnerSystem.cs +++ b/Content.Server/Spawners/EntitySystems/SpawnerSystem.cs @@ -49,7 +49,10 @@ public sealed partial class SpawnerSystem : EntitySystem for (var i = 0; i < number; i++) { var entity = _random.Pick(component.Prototypes); - SpawnAtPosition(entity, coordinates); + if (component.AllowContainerPlacement) + SpawnNextToOrDrop(entity, uid); + else + SpawnAtPosition(entity, coordinates); } } } diff --git a/Resources/Prototypes/Entities/Mobs/NPCs/animals.yml b/Resources/Prototypes/Entities/Mobs/NPCs/animals.yml index b5c777fcb6..db09880ffa 100644 --- a/Resources/Prototypes/Entities/Mobs/NPCs/animals.yml +++ b/Resources/Prototypes/Entities/Mobs/NPCs/animals.yml @@ -357,6 +357,7 @@ - MobChicken1 - MobChicken2 intervalSeconds: 20 + allowContainerPlacement: true - type: TimedDespawn #delete the egg after the chicken spawns lifetime: 21 @@ -813,6 +814,7 @@ - MobDuckWhite - MobDuckBrown intervalSeconds: 20 + allowContainerPlacement: true - type: TimedDespawn #delete the egg after the chicken spawns lifetime: 21