mirror of
https://github.com/space-syndicate/space-station-14.git
synced 2026-10-09 10:21:18 +03:00
TimedSpawner can spawn objects in containers (#46212)
* TimedSpawner can spawn objects in containers * Hatch ducks and chickens into containers * Update Content.Server/Spawners/EntitySystems/SpawnerSystem.cs --------- Co-authored-by: Pok <113675512+Pok27@users.noreply.github.com>
This commit is contained in:
parent
6a8d5454a0
commit
8efb13db22
3 changed files with 12 additions and 1 deletions
|
|
@ -51,6 +51,12 @@ public sealed partial class TimedSpawnerComponent : Component, ISerializationHoo
|
|||
[DataField(customTypeSerializer: typeof(TimeOffsetSerializer)), AutoPausedField]
|
||||
public TimeSpan NextFire = TimeSpan.Zero;
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether to allow spawning entities in the spawner's container, or if they should always be outside.
|
||||
/// </summary>
|
||||
[DataField]
|
||||
public bool AllowContainerPlacement = false;
|
||||
|
||||
void ISerializationHooks.AfterDeserialization()
|
||||
{
|
||||
if (MinimumEntitiesSpawned > MaximumEntitiesSpawned)
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue