/// <summary>
/// <see cref="AutoCablingDunGen"/>
/// </summary>
- private async Task PostGen(AutoCablingDunGen gen, DungeonData data, Dungeon dungeon, HashSet<Vector2i> reservedTiles, Random random)
+ private async Task PostGen(AutoCablingDunGen gen, Dungeon dungeon, HashSet<Vector2i> reservedTiles, Random random)
{
- if (!data.Entities.TryGetValue(DungeonDataKey.Cabling, out var ent))
- {
- LogDataError(typeof(AutoCablingDunGen));
- return;
- }
-
// There's a lot of ways you could do this.
// For now we'll just connect every LV cable in the dungeon.
var cableTiles = new HashSet<Vector2i>();
if (found)
continue;
- _entManager.SpawnEntity(ent, _maps.GridTileToLocal(_gridUid, _grid, tile));
+ _entManager.SpawnEntity(gen.Entity, _maps.GridTileToLocal(_gridUid, _grid, tile));
}
}
}
/// <summary>
/// <see cref="BiomeDunGen"/>
/// </summary>
- private async Task PostGen(BiomeDunGen dunGen, DungeonData data, Dungeon dungeon, HashSet<Vector2i> reservedTiles, Random random)
+ private async Task PostGen(BiomeDunGen dunGen, Dungeon dungeon, HashSet<Vector2i> reservedTiles, Random random)
{
if (!_prototype.TryIndex(dunGen.BiomeTemplate, out var indexedBiome))
return;
if (reservedTiles.Contains(node))
continue;
-
+
if (dunGen.TileMask is not null)
{
if (!dunGen.TileMask.Contains(((ContentTileDefinition) _tileDefManager[tileRef.Value.Tile.TypeId]).ID))
/// <summary>
/// <see cref="BiomeMarkerLayerDunGen"/>
/// </summary>
- private async Task PostGen(BiomeMarkerLayerDunGen dunGen, DungeonData data, Dungeon dungeon, HashSet<Vector2i> reservedTiles, Random random)
+ private async Task PostGen(BiomeMarkerLayerDunGen dunGen, Dungeon dungeon, HashSet<Vector2i> reservedTiles, Random random)
{
// If we're adding biome then disable it and just use for markers.
if (_entManager.EnsureComponent(_gridUid, out BiomeComponent biomeComp))
/// <summary>
/// <see cref="BoundaryWallDunGen"/>
/// </summary>
- private async Task PostGen(BoundaryWallDunGen gen, DungeonData data, Dungeon dungeon, HashSet<Vector2i> reservedTiles, Random random)
+ private async Task PostGen(BoundaryWallDunGen gen, Dungeon dungeon, HashSet<Vector2i> reservedTiles, Random random)
{
- if (!data.Tiles.TryGetValue(DungeonDataKey.FallbackTile, out var protoTileDef) ||
- !data.Entities.TryGetValue(DungeonDataKey.Walls, out var wall))
- {
- _sawmill.Error($"Error finding dungeon data for {nameof(gen)}");
- return;
- }
-
- var tileDef = _tileDefManager[protoTileDef];
+ var tileDef = _tileDefManager[gen.Tile];
var tiles = new List<(Vector2i Index, Tile Tile)>(dungeon.RoomExteriorTiles.Count);
- if (!data.Entities.TryGetValue(DungeonDataKey.CornerWalls, out var cornerWall))
- {
- cornerWall = wall;
- }
-
- if (cornerWall == default)
- {
- cornerWall = wall;
- }
+ var wall = gen.Wall;
+ var cornerWall = gen.CornerWall ?? gen.Wall;
// Spawn wall outline
// - Tiles first
using System.Threading.Tasks;
using Content.Shared.Procedural;
using Content.Shared.Procedural.PostGeneration;
-using Content.Shared.Storage;
-using Robust.Shared.Physics.Components;
using Robust.Shared.Random;
namespace Content.Server.Procedural.DungeonJob;
/// <summary>
/// <see cref="CornerClutterDunGen"/>
/// </summary>
- private async Task PostGen(CornerClutterDunGen gen, DungeonData data, Dungeon dungeon, HashSet<Vector2i> reservedTiles, Random random)
+ private async Task PostGen(CornerClutterDunGen gen, Dungeon dungeon, HashSet<Vector2i> reservedTiles, Random random)
{
- if (!data.SpawnGroups.TryGetValue(DungeonDataKey.CornerClutter, out var corner))
- {
- _sawmill.Error(Environment.StackTrace);
- return;
- }
+ var contentsTable = _prototype.Index(gen.Contents);
foreach (var tile in dungeon.CorridorTiles)
{
+ if (reservedTiles.Contains(tile))
+ continue;
+
var blocked = _anchorable.TileFree(_grid, tile, DungeonSystem.CollisionLayer, DungeonSystem.CollisionMask);
if (blocked)
if (random.Prob(gen.Chance))
{
var coords = _maps.GridTileToLocal(_gridUid, _grid, tile);
- var protos = EntitySpawnCollection.GetSpawns(_prototype.Index(corner).Entries, random);
- _entManager.SpawnEntities(coords, protos);
+ var protos = contentsTable.Table.GetSpawns(random, _entManager, _prototype);
+ _entManager.SpawnEntitiesAttachedTo(coords, protos);
}
break;
/// <summary>
/// <see cref="CorridorDunGen"/>
/// </summary>
- private async Task PostGen(CorridorDunGen gen, DungeonData data, Dungeon dungeon, HashSet<Vector2i> reservedTiles, Random random)
+ private async Task PostGen(CorridorDunGen gen, Dungeon dungeon, HashSet<Vector2i> reservedTiles, Random random)
{
- if (!data.Tiles.TryGetValue(DungeonDataKey.FallbackTile, out var tileProto))
- {
- LogDataError(typeof(CorridorDunGen));
- return;
- }
-
var entrances = new List<Vector2i>(dungeon.Rooms.Count);
// Grab entrances
WidenCorridor(dungeon, gen.Width, corridorTiles);
var setTiles = new List<(Vector2i, Tile)>();
- var tileDef = (ContentTileDefinition) _tileDefManager[tileProto];
+ var tileDef = (ContentTileDefinition) _tileDefManager[gen.Tile];
foreach (var tile in corridorTiles)
{
/// <summary>
/// <see cref="CorridorClutterDunGen"/>
/// </summary>
- private async Task PostGen(CorridorClutterDunGen gen, DungeonData data, Dungeon dungeon, HashSet<Vector2i> reservedTiles, Random random)
+ private async Task PostGen(CorridorClutterDunGen gen, Dungeon dungeon, HashSet<Vector2i> reservedTiles, Random random)
{
var physicsQuery = _entManager.GetEntityQuery<PhysicsComponent>();
var count = (int) Math.Ceiling(dungeon.CorridorTiles.Count * gen.Chance);
+ var contents = _prototype.Index(gen.Contents);
while (count > 0)
{
count--;
- var protos = EntitySpawnCollection.GetSpawns(gen.Contents, random);
+ if (reservedTiles.Contains(tile))
+ continue;
+
+ var protos = _entTable.GetSpawns(contents, random);
var coords = _maps.ToCenterCoordinates(_gridUid, tile, _grid);
- _entManager.SpawnEntities(coords, protos);
+ _entManager.SpawnEntitiesAttachedTo(coords, protos);
await SuspendIfOutOfTime();
if (!ValidateResume())
/// <summary>
/// <see cref="CorridorDecalSkirtingDunGen"/>
/// </summary>
- private async Task PostGen(CorridorDecalSkirtingDunGen decks, DungeonData data, Dungeon dungeon, HashSet<Vector2i> reservedTiles, Random random)
+ private async Task PostGen(CorridorDecalSkirtingDunGen decks, Dungeon dungeon, HashSet<Vector2i> reservedTiles, Random random)
{
- if (!data.Colors.TryGetValue(DungeonDataKey.Decals, out var color))
- {
- _sawmill.Error(Environment.StackTrace);
- }
-
var directions = new ValueList<DirectionFlag>(4);
var pocketDirections = new ValueList<Direction>(4);
var doorQuery = _entManager.GetEntityQuery<DoorComponent>();
{
// Decals not being centered biting my ass again
var gridPos = _maps.GridTileToLocal(_gridUid, _grid, tile).Offset(offset);
- _decals.TryAddDecal(cDir, gridPos, out _, color: color);
+ _decals.TryAddDecal(cDir, gridPos, out _, color: decks.Color);
}
}
{
// Decals not being centered biting my ass again
var gridPos = _maps.GridTileToLocal(_gridUid, _grid, tile).Offset(offset);
- _decals.TryAddDecal(cDir, gridPos, out _, color: color);
+ _decals.TryAddDecal(cDir, gridPos, out _, color: decks.Color);
}
continue;
if (decks.CornerDecals.TryGetValue(dirFlag, out var cDir))
{
var gridPos = _maps.GridTileToLocal(_gridUid, _grid, tile).Offset(offset);
- _decals.TryAddDecal(cDir, gridPos, out _, color: color);
+ _decals.TryAddDecal(cDir, gridPos, out _, color: decks.Color);
}
}
}
+++ /dev/null
-using System.Numerics;
-using System.Threading.Tasks;
-using Content.Shared.Maps;
-using Content.Shared.Procedural;
-using Content.Shared.Procedural.DungeonGenerators;
-
-namespace Content.Server.Procedural.DungeonJob;
-
-public sealed partial class DungeonJob
-{
- /// <summary>
- /// <see cref="FillGridDunGen"/>
- /// </summary>
- private async Task<Dungeon> GenerateFillDunGen(FillGridDunGen fill, DungeonData data, HashSet<Vector2i> reservedTiles)
- {
- if (!data.Entities.TryGetValue(DungeonDataKey.Fill, out var fillEnt))
- {
- LogDataError(typeof(FillGridDunGen));
- return Dungeon.Empty;
- }
-
- var roomTiles = new HashSet<Vector2i>();
- var tiles = _maps.GetAllTilesEnumerator(_gridUid, _grid);
-
- while (tiles.MoveNext(out var tileRef))
- {
- var tile = tileRef.Value.GridIndices;
-
- if (reservedTiles.Contains(tile))
- continue;
-
- if (fill.AllowedTiles != null && !fill.AllowedTiles.Contains(((ContentTileDefinition) _tileDefManager[tileRef.Value.Tile.TypeId]).ID))
- continue;
-
- if (!_anchorable.TileFree(_grid, tile, DungeonSystem.CollisionLayer, DungeonSystem.CollisionMask))
- continue;
-
- var gridPos = _maps.GridTileToLocal(_gridUid, _grid, tile);
- _entManager.SpawnEntity(fillEnt, gridPos);
-
- roomTiles.Add(tile);
-
- await SuspendDungeon();
- if (!ValidateResume())
- break;
- }
-
- var dungeon = new Dungeon();
- var room = new DungeonRoom(roomTiles, Vector2.Zero, Box2i.Empty, new HashSet<Vector2i>());
- dungeon.AddRoom(room);
-
- return dungeon;
- }
-}
/// <summary>
/// <see cref="PrefabDunGen"/>
/// </summary>
- private async Task<Dungeon> GeneratePrefabDunGen(Vector2i position, DungeonData data, PrefabDunGen prefab, HashSet<Vector2i> reservedTiles, Random random)
+ private async Task<Dungeon> GeneratePrefabDunGen(Vector2i position, PrefabDunGen prefab, HashSet<Vector2i> reservedTiles, Random random)
{
- if (!data.Tiles.TryGetValue(DungeonDataKey.FallbackTile, out var tileProto) ||
- !data.Whitelists.TryGetValue(DungeonDataKey.Rooms, out var roomWhitelist))
- {
- LogDataError(typeof(PrefabDunGen));
- return Dungeon.Empty;
- }
-
var preset = prefab.Presets[random.Next(prefab.Presets.Count)];
var gen = _prototype.Index(preset);
{
var whitelisted = false;
- if (roomWhitelist?.Tags != null)
+ if (prefab.RoomWhitelist?.Tags != null)
{
- foreach (var tag in roomWhitelist.Tags)
+ foreach (var tag in prefab.RoomWhitelist.Tags)
{
if (proto.Tags.Contains(tag))
{
// Then for overlaps choose either 1x1 / 3x1
// Pick a random tile for it and then expand outwards as relevant (weighted towards middle?)
+ var fallbackTile = prefab.FallbackTile;
for (var i = 0; i < chosenPacks.Length; i++)
{
Angle roomRotation = Angle.Zero;
Matrix3x2 matty;
+ // If no room found then try rotated dimensions
if (!roomProtos.TryGetValue(roomDimensions, out var roomProto))
{
roomDimensions = new Vector2i(roomDimensions.Y, roomDimensions.X);
+ // If nothing at all then no valid rooms, try fallback tile and log it.
if (!roomProtos.TryGetValue(roomDimensions, out roomProto))
{
- matty = Matrix3x2.Multiply(packTransform, dungeonTransform);
-
- for (var x = roomSize.Left; x < roomSize.Right; x++)
+ if (fallbackTile != null)
{
- for (var y = roomSize.Bottom; y < roomSize.Top; y++)
+ matty = Matrix3x2.Multiply(packTransform, dungeonTransform);
+
+ for (var x = roomSize.Left; x < roomSize.Right; x++)
{
- var index = Vector2.Transform(new Vector2(x, y) + _grid.TileSizeHalfVector - packCenter, matty).Floored();
+ for (var y = roomSize.Bottom; y < roomSize.Top; y++)
+ {
+ var index = Vector2.Transform(new Vector2(x, y) + _grid.TileSizeHalfVector - packCenter, matty).Floored();
- if (reservedTiles.Contains(index))
- continue;
+ if (reservedTiles.Contains(index))
+ continue;
- tiles.Add((index, new Tile(_tileDefManager[tileProto].TileId)));
+ tiles.Add((index, new Tile(_tileDefManager[fallbackTile.Value].TileId)));
+ }
}
+
+ _maps.SetTiles(_gridUid, _grid, tiles);
+ tiles.Clear();
}
- _maps.SetTiles(_gridUid, _grid, tiles);
- tiles.Clear();
_sawmill.Error($"Unable to find room variant for {roomDimensions}, leaving empty.");
continue;
}
/// <summary>
/// <see cref="ReplaceTileDunGen"/>
/// </summary>
- private async Task<Dungeon> GenerateTileReplacementDunGen(ReplaceTileDunGen gen, DungeonData data, HashSet<Vector2i> reservedTiles, Random random)
+ private async Task GenerateTileReplacementDunGen(ReplaceTileDunGen gen, List<Dungeon> dungeons, HashSet<Vector2i> reservedTiles, Random random)
{
- var tiles = _maps.GetAllTilesEnumerator(_gridUid, _grid);
var replacements = new List<(Vector2i Index, Tile Tile)>();
- var reserved = new HashSet<Vector2i>();
- while (tiles.MoveNext(out var tileRef))
+ foreach (var dungeon in dungeons)
{
- var node = tileRef.Value.GridIndices;
+ foreach (var node in dungeon.AllTiles)
+ {
+ if (reservedTiles.Contains(node))
+ continue;
- if (reservedTiles.Contains(node))
- continue;
+ foreach (var layer in gen.Layers)
+ {
+ var value = layer.Noise.GetNoise(node.X, node.Y);
- foreach (var layer in gen.Layers)
- {
- var value = layer.Noise.GetNoise(node.X, node.Y);
+ if (value < layer.Threshold)
+ continue;
- if (value < layer.Threshold)
- continue;
+ Tile tile;
- Tile tile;
+ if (random.Prob(gen.VariantWeight))
+ {
+ tile = _tileDefManager.GetVariantTile(_prototype.Index(layer.Tile), random);
+ }
+ else
+ {
+ tile = new Tile(_prototype.Index(layer.Tile).TileId);
+ }
- if (random.Prob(gen.VariantWeight))
- {
- tile = _tileDefManager.GetVariantTile(_prototype.Index(layer.Tile), random);
- }
- else
- {
- tile = new Tile(_prototype.Index(layer.Tile).TileId);
+ replacements.Add((node, tile));
+ break;
}
- replacements.Add((node, tile));
- reserved.Add(node);
- break;
+ await SuspendDungeon();
}
- await SuspendDungeon();
+ _maps.SetTiles(_gridUid, _grid, replacements);
}
-
- _maps.SetTiles(_gridUid, _grid, replacements);
- return new Dungeon(new List<DungeonRoom>()
- {
- new DungeonRoom(reserved, _position, Box2i.Empty, new HashSet<Vector2i>()),
- });
}
}
/// <summary>
/// <see cref="DungeonEntranceDunGen"/>
/// </summary>
- private async Task PostGen(DungeonEntranceDunGen gen, DungeonData data, Dungeon dungeon, HashSet<Vector2i> reservedTiles, Random random)
+ private async Task PostGen(DungeonEntranceDunGen gen, Dungeon dungeon, HashSet<Vector2i> reservedTiles, Random random)
{
- if (!data.Tiles.TryGetValue(DungeonDataKey.FallbackTile, out var tileProto) ||
- !data.SpawnGroups.TryGetValue(DungeonDataKey.Entrance, out var entrance))
- {
- LogDataError(typeof(DungeonEntranceDunGen));
- return;
- }
-
var rooms = new List<DungeonRoom>(dungeon.Rooms);
var roomTiles = new List<Vector2i>();
- var tileDef = (ContentTileDefinition) _tileDefManager[tileProto];
+ var tileDef = (ContentTileDefinition) _tileDefManager[gen.Tile];
+ var contents = _prototype.Index(gen.Contents);
for (var i = 0; i < gen.Count; i++)
{
var gridCoords = _maps.GridTileToLocal(_gridUid, _grid, tile);
// Need to offset the spawn to avoid spawning in the room.
- foreach (var ent in EntitySpawnCollection.GetSpawns(_prototype.Index(entrance).Entries, random))
+ foreach (var ent in _entTable.GetSpawns(contents, random))
{
_entManager.SpawnAtPosition(ent, gridCoords);
}
/// <summary>
/// <see cref="EntranceFlankDunGen"/>
/// </summary>
- private async Task PostGen(EntranceFlankDunGen gen, DungeonData data, Dungeon dungeon, HashSet<Vector2i> reservedTiles, Random random)
+ private async Task PostGen(EntranceFlankDunGen gen, Dungeon dungeon, HashSet<Vector2i> reservedTiles, Random random)
{
- if (!data.Tiles.TryGetValue(DungeonDataKey.FallbackTile, out var tileProto) ||
- !data.SpawnGroups.TryGetValue(DungeonDataKey.EntranceFlank, out var flankProto))
- {
- _sawmill.Error($"Unable to get dungeon data for {nameof(gen)}");
- return;
- }
-
var tiles = new List<(Vector2i Index, Tile)>();
- var tileDef = _tileDefManager[tileProto];
+ var tileDef = _tileDefManager[gen.Tile];
var spawnPositions = new ValueList<Vector2i>(dungeon.Rooms.Count);
+ var contents = _prototype.Index(gen.Contents);
foreach (var room in dungeon.Rooms)
{
}
_maps.SetTiles(_gridUid, _grid, tiles);
- var entGroup = _prototype.Index(flankProto);
foreach (var entrance in spawnPositions)
{
- _entManager.SpawnEntities(_maps.GridTileToLocal(_gridUid, _grid, entrance), EntitySpawnCollection.GetSpawns(entGroup.Entries, random));
+ _entManager.SpawnEntitiesAttachedTo(_maps.GridTileToLocal(_gridUid, _grid, entrance), _entTable.GetSpawns(contents, random));
}
}
}
using System.Threading.Tasks;
-using Content.Server.NPC.Pathfinding;
using Content.Shared.Maps;
using Content.Shared.NPC;
using Content.Shared.Procedural;
using Content.Shared.Procedural.DungeonGenerators;
-using Robust.Shared.Collections;
using Robust.Shared.Random;
using Robust.Shared.Utility;
var startTile = new Vector2i(0, (int) distance).Rotate(angle);
Vector2i? dungeonSpawn = null;
- var pathfinder = _entManager.System<PathfindingSystem>();
// Gridcast
SharedPathfindingSystem.GridCast(startTile, position, tile =>
var config = _prototype.Index(dungen.Proto);
var nextSeed = random.Next();
- var dungeons = await GetDungeons(dungeonSpawn.Value, config, config.Data, config.Layers, reservedTiles, nextSeed, new Random(nextSeed));
+ var dungeons = await GetDungeons(dungeonSpawn.Value, config, config.Layers, reservedTiles, nextSeed, new Random(nextSeed));
return dungeons;
}
/// <summary>
/// <see cref="ExternalWindowDunGen"/>
/// </summary>
- private async Task PostGen(ExternalWindowDunGen gen, DungeonData data, Dungeon dungeon, HashSet<Vector2i> reservedTiles, Random random)
+ private async Task PostGen(ExternalWindowDunGen gen, Dungeon dungeon, HashSet<Vector2i> reservedTiles, Random random)
{
- if (!data.Tiles.TryGetValue(DungeonDataKey.FallbackTile, out var tileProto) ||
- !data.SpawnGroups.TryGetValue(DungeonDataKey.Window, out var windowGroup))
- {
- _sawmill.Error($"Unable to get dungeon data for {nameof(gen)}");
- return;
- }
-
// Iterate every tile with N chance to spawn windows on that wall per cardinal dir.
var chance = 0.25 / 3f;
random.Shuffle(validTiles);
var tiles = new List<(Vector2i, Tile)>();
- var tileDef = _tileDefManager[tileProto];
+ var tileDef = _tileDefManager[gen.Tile];
var count = Math.Floor(validTiles.Count * chance);
var index = 0;
var takenTiles = new HashSet<Vector2i>();
}
_maps.SetTiles(_gridUid, _grid, tiles);
- index = 0;
- var spawnEntry = _prototype.Index(windowGroup);
+ var contents = _prototype.Index(gen.Contents);
foreach (var tile in tiles)
{
var gridPos = _maps.GridTileToLocal(_gridUid, _grid, tile.Item1);
- index += spawnEntry.Entries.Count;
- _entManager.SpawnEntities(gridPos, EntitySpawnCollection.GetSpawns(spawnEntry.Entries, random));
+ _entManager.SpawnEntitiesAttachedTo(gridPos, _entTable.GetSpawns(contents, random));
await SuspendDungeon();
if (!ValidateResume())
--- /dev/null
+using System.Threading.Tasks;
+using Content.Shared.Procedural;
+using Content.Shared.Procedural.DungeonLayers;
+
+namespace Content.Server.Procedural.DungeonJob;
+
+public sealed partial class DungeonJob
+{
+ /// <summary>
+ /// <see cref="Shared.Procedural.DungeonLayers.FillGridDunGen"/>
+ /// </summary>
+ private async Task GenerateFillDunGen(FillGridDunGen fill, List<Dungeon> dungeons, HashSet<Vector2i> reservedTiles)
+ {
+ foreach (var dungeon in dungeons)
+ {
+ foreach (var tile in dungeon.AllTiles)
+ {
+ if (reservedTiles.Contains(tile))
+ continue;
+
+ if (!_maps.TryGetTileDef(_grid, tile, out var tileDef))
+ continue;
+
+ if (fill.AllowedTiles != null && !fill.AllowedTiles.Contains(tileDef.ID))
+ continue;
+
+ if (!_anchorable.TileFree(_grid, tile, DungeonSystem.CollisionLayer, DungeonSystem.CollisionMask))
+ continue;
+
+ var gridPos = _maps.GridTileToLocal(_gridUid, _grid, tile);
+ _entManager.SpawnEntity(fill.Entity, gridPos);
+
+ await SuspendDungeon();
+ if (!ValidateResume())
+ break;
+ }
+ }
+ }
+}
public sealed partial class DungeonJob
{
- /*
- * Run after the main dungeon generation
- */
+ // Various helper methods.
private static readonly ProtoId<TagPrototype> WallTag = "Wall";
/// <summary>
/// <see cref="InternalWindowDunGen"/>
/// </summary>
- private async Task PostGen(InternalWindowDunGen gen, DungeonData data, Dungeon dungeon, HashSet<Vector2i> reservedTiles, Random random)
+ private async Task PostGen(InternalWindowDunGen gen, Dungeon dungeon, HashSet<Vector2i> reservedTiles, Random random)
{
- if (!data.Tiles.TryGetValue(DungeonDataKey.FallbackTile, out var tileProto) ||
- !data.SpawnGroups.TryGetValue(DungeonDataKey.Window, out var windowGroup))
- {
- _sawmill.Error($"Unable to find dungeon data keys for {nameof(gen)}");
- return;
- }
-
// Iterate every room and check if there's a gap beyond it that leads to another room within N tiles
// If so then consider windows
var minDistance = 4;
var maxDistance = 6;
- var tileDef = _tileDefManager[tileProto];
- var window = _prototype.Index(windowGroup);
+ var tileDef = _tileDefManager[gen.Tile];
+ var contents = _prototype.Index(gen.Contents);
foreach (var room in dungeon.Rooms)
{
var gridPos = _maps.GridTileToLocal(_gridUid, _grid, tile);
_maps.SetTile(_gridUid, _grid, tile, _tile.GetVariantTile((ContentTileDefinition) tileDef, random));
- _entManager.SpawnEntities(gridPos, EntitySpawnCollection.GetSpawns(window.Entries, random));
+ _entManager.SpawnEntitiesAttachedTo(gridPos, _entTable.GetSpawns(contents, random));
}
if (validTiles.Count > 0)
/// <summary>
/// <see cref="JunctionDunGen"/>
/// </summary>
- private async Task PostGen(JunctionDunGen gen, DungeonData data, Dungeon dungeon, HashSet<Vector2i> reservedTiles, Random random)
+ private async Task PostGen(JunctionDunGen gen, Dungeon dungeon, HashSet<Vector2i> reservedTiles, Random random)
{
- if (!data.Tiles.TryGetValue(DungeonDataKey.FallbackTile, out var tileProto) ||
- !data.SpawnGroups.TryGetValue(DungeonDataKey.Junction, out var junctionProto))
- {
- _sawmill.Error($"Dungeon data keys are missing for {nameof(gen)}");
- return;
- }
-
- var tileDef = _tileDefManager[tileProto];
- var entranceGroup = _prototype.Index(junctionProto);
+ var tileDef = _tileDefManager[gen.Tile];
+ var contents = _prototype.Index(gen.Contents);
// N-wide junctions
foreach (var tile in dungeon.CorridorTiles)
_maps.SetTile(_gridUid, _grid, weh, _tile.GetVariantTile((ContentTileDefinition) tileDef, random));
var coords = _maps.GridTileToLocal(_gridUid, _grid, weh);
- _entManager.SpawnEntities(coords, EntitySpawnCollection.GetSpawns(entranceGroup.Entries, random));
+ _entManager.SpawnEntitiesAttachedTo(coords, _entTable.GetSpawns(contents, random));
}
break;
/// <summary>
/// <see cref="MiddleConnectionDunGen"/>
/// </summary>
- private async Task PostGen(MiddleConnectionDunGen gen, DungeonData data, Dungeon dungeon, HashSet<Vector2i> reservedTiles, Random random)
+ private async Task PostGen(MiddleConnectionDunGen gen, Dungeon dungeon, HashSet<Vector2i> reservedTiles, Random random)
{
- if (!data.Tiles.TryGetValue(DungeonDataKey.FallbackTile, out var tileProto) ||
- !data.SpawnGroups.TryGetValue(DungeonDataKey.Entrance, out var entranceProto) ||
- !_prototype.TryIndex(entranceProto, out var entrance))
- {
- _sawmill.Error($"Tried to run {nameof(MiddleConnectionDunGen)} without any dungeon data set which is unsupported");
- return;
- }
-
- data.SpawnGroups.TryGetValue(DungeonDataKey.EntranceFlank, out var flankProto);
- _prototype.TryIndex(flankProto, out var flank);
-
// Grab all of the room bounds
// Then, work out connections between them
var roomBorders = new Dictionary<DungeonRoom, HashSet<Vector2i>>(dungeon.Rooms.Count);
// TODO: Optional loops
var roomConnections = new Dictionary<DungeonRoom, List<DungeonRoom>>();
- var tileDef = _tileDefManager[tileProto];
+ var tileDef = _tileDefManager[gen.Tile];
+ _prototype.TryIndex(gen.Flank, out var flankContents);
+ var contents = _prototype.Index(gen.Contents);
foreach (var (room, border) in roomBorders)
{
width--;
_maps.SetTile(_gridUid, _grid, node, _tile.GetVariantTile((ContentTileDefinition) tileDef, random));
- if (flank != null && nodeDistances.Count - i <= 2)
+ if (flankContents != null && nodeDistances.Count - i <= 2)
{
- _entManager.SpawnEntities(gridPos, EntitySpawnCollection.GetSpawns(flank.Entries, random));
+ _entManager.SpawnEntitiesAttachedTo(gridPos, _entTable.GetSpawns(flankContents, random));
}
else
{
// Iterate neighbors and check for blockers, if so bulldoze
ClearDoor(dungeon, _grid, node);
- _entManager.SpawnEntities(gridPos, EntitySpawnCollection.GetSpawns(entrance.Entries, random));
+ _entManager.SpawnEntitiesAttachedTo(gridPos, _entTable.GetSpawns(contents, random));
}
if (width == 0)
public sealed partial class DungeonJob
{
+ /// <summary>
+ /// <see cref="MobsDunGen"/>
+ /// </summary>
private async Task PostGen(
MobsDunGen gen,
Dungeon dungeon,
var availableRooms = new ValueList<DungeonRoom>();
availableRooms.AddRange(dungeon.Rooms);
var availableTiles = new ValueList<Vector2i>(dungeon.AllTiles);
+ var contents = _prototype.Index(gen.Contents);
- var entities = EntitySpawnCollection.GetSpawns(gen.Groups, random);
var count = random.Next(gen.MinCount, gen.MaxCount + 1);
var npcs = _entManager.System<NPCSystem>();
continue;
}
+ var entities = _entTable.GetSpawns(contents, random);
+
foreach (var ent in entities)
{
var uid = _entManager.SpawnAtPosition(ent, _maps.GridTileToLocal(_gridUid, _grid, tile));
+++ /dev/null
-namespace Content.Server.Procedural.DungeonJob;
-
-public sealed partial class DungeonJob
-{
-
-}
/// <summary>
/// <see cref="RoomEntranceDunGen"/>
/// </summary>
- private async Task PostGen(RoomEntranceDunGen gen, DungeonData data, Dungeon dungeon, HashSet<Vector2i> reservedTiles, Random random)
+ private async Task PostGen(RoomEntranceDunGen gen, Dungeon dungeon, HashSet<Vector2i> reservedTiles, Random random)
{
- if (!data.Tiles.TryGetValue(DungeonDataKey.FallbackTile, out var tileProto) ||
- !data.SpawnGroups.TryGetValue(DungeonDataKey.Entrance, out var entranceProtos) ||
- !_prototype.TryIndex(entranceProtos, out var entranceIn))
- {
- LogDataError(typeof(RoomEntranceDunGen));
- return;
- }
-
var setTiles = new List<(Vector2i, Tile)>();
- var tileDef = _tileDefManager[tileProto];
+ var tileDef = _tileDefManager[gen.Tile];
+ var contents = _prototype.Index(gen.Contents);
foreach (var room in dungeon.Rooms)
{
foreach (var entrance in room.Entrances)
{
+ if (reservedTiles.Contains(entrance))
+ continue;
+
setTiles.Add((entrance, _tile.GetVariantTile((ContentTileDefinition) tileDef, random)));
}
}
{
foreach (var entrance in room.Entrances)
{
- _entManager.SpawnEntities(
+ if (reservedTiles.Contains(entrance))
+ continue;
+
+ _entManager.SpawnEntitiesAttachedTo(
_maps.GridTileToLocal(_gridUid, _grid, entrance),
- EntitySpawnCollection.GetSpawns(entranceIn.Entries, random));
+ _entTable.GetSpawns(contents, random));
+
+ await SuspendDungeon();
+
+ if (!ValidateResume())
+ return;
}
}
}
/// </summary>
private async Task<Dungeon> PostGen(
SplineDungeonConnectorDunGen gen,
- DungeonData data,
List<Dungeon> dungeons,
HashSet<Vector2i> reservedTiles,
Random random)
{
- // TODO: The path itself use the tile
- // Widen it randomly (probably for each tile offset it by some changing amount).
-
// NOOP
if (dungeons.Count <= 1)
return Dungeon.Empty;
- if (!data.Tiles.TryGetValue(DungeonDataKey.FallbackTile, out var fallback) ||
- !data.Tiles.TryGetValue(DungeonDataKey.WidenTile, out var widen))
- {
- LogDataError(typeof(SplineDungeonConnectorDunGen));
- return Dungeon.Empty;
- }
-
var nodes = new List<Vector2i>();
foreach (var dungeon in dungeons)
var tiles = new List<(Vector2i Index, Tile Tile)>();
var pathfinding = _entManager.System<PathfindingSystem>();
var allTiles = new HashSet<Vector2i>();
- var fallbackTile = new Tile(_prototype.Index(fallback).TileId);
+ var pathTile = new Tile(_prototype.Index(gen.Tile).TileId);
+ var widen = _prototype.Index(gen.WidenTile ?? gen.Tile);
foreach (var pair in tree)
{
if (random.Prob(0.9f))
{
- tile = new Tile(_prototype.Index(widen).TileId);
+ tile = new Tile(widen.TileId);
}
else
{
continue;
allTiles.Add(node);
- tiles.Add((node, fallbackTile));
+ tiles.Add((node, pathTile));
}
_maps.SetTiles(_gridUid, _grid, tiles);
using System.Threading.Tasks;
+using Content.Shared.Maps;
using Content.Shared.Procedural;
using Content.Shared.Procedural.PostGeneration;
using Content.Shared.Storage;
/// <summary>
/// <see cref="WallMountDunGen"/>
/// </summary>
- private async Task PostGen(WallMountDunGen gen, DungeonData data, Dungeon dungeon, HashSet<Vector2i> reservedTiles, Random random)
+ private async Task PostGen(WallMountDunGen gen, Dungeon dungeon, HashSet<Vector2i> reservedTiles, Random random)
{
- if (!data.Tiles.TryGetValue(DungeonDataKey.FallbackTile, out var tileProto))
- {
- _sawmill.Error($"Tried to run {nameof(WallMountDunGen)} without any dungeon data set which is unsupported");
- return;
- }
-
- var tileDef = _prototype.Index(tileProto);
- if (!data.SpawnGroups.TryGetValue(DungeonDataKey.WallMounts, out var spawnProto))
- {
- // caves can have no walls
- return;
- }
-
var checkedTiles = new HashSet<Vector2i>();
var allExterior = new HashSet<Vector2i>(dungeon.CorridorExteriorTiles);
allExterior.UnionWith(dungeon.RoomExteriorTiles);
- var count = 0;
+ var tileDef = (ContentTileDefinition) _tileDefManager[gen.Tile];
+ var contents = _prototype.Index(gen.Contents);
foreach (var neighbor in allExterior)
{
if (!random.Prob(gen.Prob) || !checkedTiles.Add(neighbor))
continue;
+ if (reservedTiles.Contains(neighbor))
+ continue;
+
_maps.SetTile(_gridUid, _grid, neighbor, _tile.GetVariantTile(tileDef, random));
var gridPos = _maps.GridTileToLocal(_gridUid, _grid, neighbor);
- var protoNames = EntitySpawnCollection.GetSpawns(_prototype.Index(spawnProto).Entries, random);
-
- _entManager.SpawnEntities(gridPos, protoNames);
- count += protoNames.Count;
+ var protoNames = _entTable.GetSpawns(contents, random);
- if (count > 20)
- {
- count -= 20;
- await SuspendDungeon();
+ _entManager.SpawnEntitiesAttachedTo(gridPos, protoNames);
- if (!ValidateResume())
- return;
- }
+ await SuspendDungeon();
+ if (!ValidateResume())
+ return;
}
}
}
using System.Linq;
using System.Threading.Tasks;
+using Content.Shared.Maps;
using Content.Shared.Procedural;
using Content.Shared.Procedural.PostGeneration;
using Robust.Shared.Collections;
/// <summary>
/// <see cref="WormCorridorDunGen"/>
/// </summary>
- private async Task PostGen(WormCorridorDunGen gen, DungeonData data, Dungeon dungeon, HashSet<Vector2i> reservedTiles, Random random)
+ private async Task PostGen(WormCorridorDunGen gen, Dungeon dungeon, HashSet<Vector2i> reservedTiles, Random random)
{
- if (!data.Tiles.TryGetValue(DungeonDataKey.FallbackTile, out var tileProto) || !_prototype.TryIndex(tileProto, out var tileDef))
- {
- _sawmill.Error($"Tried to run {nameof(WormCorridorDunGen)} without any dungeon data set which is unsupported");
- return;
- }
-
var networks = new List<(Vector2i Start, HashSet<Vector2i> Network)>();
// List of places to start from.
var worm = new ValueList<Vector2i>();
var startAngles = new Dictionary<Vector2i, Angle>();
+ var tileDef = (ContentTileDefinition) _tileDefManager[gen.Tile];
foreach (var room in dungeon.Rooms)
{
+using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Content.Server.Decals;
using Content.Server.NPC.Systems;
using Content.Server.Shuttles.Systems;
using Content.Shared.Construction.EntitySystems;
+using Content.Shared.EntityTable;
using Content.Shared.Maps;
using Content.Shared.Procedural;
using Content.Shared.Procedural.DungeonGenerators;
private readonly DecalSystem _decals;
private readonly DungeonSystem _dungeon;
private readonly EntityLookupSystem _lookup;
+ private readonly EntityTableSystem _entTable;
private readonly TagSystem _tags;
private readonly TileSystem _tile;
private readonly SharedMapSystem _maps;
_tile = tile;
_tags = _entManager.System<TagSystem>();
_maps = _entManager.System<SharedMapSystem>();
+ _entTable = _entManager.System<EntityTableSystem>();
_transform = transform;
_physicsQuery = _entManager.GetEntityQuery<PhysicsComponent>();
private async Task<List<Dungeon>> GetDungeons(
Vector2i position,
DungeonConfig config,
- DungeonData data,
List<IDunGenLayer> layers,
HashSet<Vector2i> reservedTiles,
int seed,
- Random random)
+ Random random,
+ List<Dungeon>? existing = null)
{
var dungeons = new List<Dungeon>();
+
+ // Don't pass dungeons back up the "stack". They are ref types though it's a caller problem if they start trying to mutate it.
+ if (existing != null)
+ {
+ dungeons.AddRange(existing);
+ }
+
var count = random.Next(config.MinCount, config.MaxCount + 1);
for (var i = 0; i < count; i++)
foreach (var layer in layers)
{
- await RunLayer(dungeons, data, position, layer, reservedTiles, seed, random);
+ await RunLayer(dungeons, position, layer, reservedTiles, seed, random);
if (config.ReserveTiles)
{
+ // Remove any dungeons passed in so we don't interfere with them
+ // This is kinda goofy but okay for now.
+ if (existing != null)
+ {
+ for (var j = 0; j < dungeons.Count; j++)
+ {
+ var dung = dungeons[j];
+
+ if (existing.Contains(dung))
+ {
+ dungeons.RemoveSwap(j);
+ }
+ }
+ }
+
foreach (var dungeon in dungeons)
{
reservedTiles.UnionWith(dungeon.AllTiles);
// Tiles we can no longer generate on due to being reserved elsewhere.
var reservedTiles = new HashSet<Vector2i>();
- var dungeons = await GetDungeons(position, _gen, _gen.Data, _gen.Layers, reservedTiles, _seed, random);
+ var dungeons = await GetDungeons(position, _gen, _gen.Layers, reservedTiles, _seed, random);
// To make it slightly more deterministic treat this RNG as separate ig.
// Post-processing after finishing loading.
private async Task RunLayer(
List<Dungeon> dungeons,
- DungeonData data,
Vector2i position,
IDunGenLayer layer,
HashSet<Vector2i> reservedTiles,
switch (layer)
{
case AutoCablingDunGen cabling:
- await PostGen(cabling, data, dungeons[^1], reservedTiles, random);
+ await PostGen(cabling, dungeons[^1], reservedTiles, random);
break;
case BiomeMarkerLayerDunGen markerPost:
- await PostGen(markerPost, data, dungeons[^1], reservedTiles, random);
+ await PostGen(markerPost, dungeons[^1], reservedTiles, random);
break;
case BiomeDunGen biome:
- await PostGen(biome, data, dungeons[^1], reservedTiles, random);
+ await PostGen(biome, dungeons[^1], reservedTiles, random);
break;
case BoundaryWallDunGen boundary:
- await PostGen(boundary, data, dungeons[^1], reservedTiles, random);
+ await PostGen(boundary, dungeons[^1], reservedTiles, random);
break;
case CornerClutterDunGen clutter:
- await PostGen(clutter, data, dungeons[^1], reservedTiles, random);
+ await PostGen(clutter, dungeons[^1], reservedTiles, random);
break;
case CorridorClutterDunGen corClutter:
- await PostGen(corClutter, data, dungeons[^1], reservedTiles, random);
+ await PostGen(corClutter, dungeons[^1], reservedTiles, random);
break;
case CorridorDunGen cordor:
- await PostGen(cordor, data, dungeons[^1], reservedTiles, random);
+ await PostGen(cordor, dungeons[^1], reservedTiles, random);
break;
case CorridorDecalSkirtingDunGen decks:
- await PostGen(decks, data, dungeons[^1], reservedTiles, random);
+ await PostGen(decks, dungeons[^1], reservedTiles, random);
break;
case EntranceFlankDunGen flank:
- await PostGen(flank, data, dungeons[^1], reservedTiles, random);
+ await PostGen(flank, dungeons[^1], reservedTiles, random);
break;
case ExteriorDunGen exterior:
dungeons.AddRange(await GenerateExteriorDungen(position, exterior, reservedTiles, random));
break;
case FillGridDunGen fill:
- dungeons.Add(await GenerateFillDunGen(fill, data, reservedTiles));
+ await GenerateFillDunGen(fill, dungeons, reservedTiles);
break;
case JunctionDunGen junc:
- await PostGen(junc, data, dungeons[^1], reservedTiles, random);
+ await PostGen(junc, dungeons[^1], reservedTiles, random);
break;
case MiddleConnectionDunGen dordor:
- await PostGen(dordor, data, dungeons[^1], reservedTiles, random);
+ await PostGen(dordor, dungeons[^1], reservedTiles, random);
break;
case DungeonEntranceDunGen entrance:
- await PostGen(entrance, data, dungeons[^1], reservedTiles, random);
+ await PostGen(entrance, dungeons[^1], reservedTiles, random);
break;
case ExternalWindowDunGen externalWindow:
- await PostGen(externalWindow, data, dungeons[^1], reservedTiles, random);
+ await PostGen(externalWindow, dungeons[^1], reservedTiles, random);
break;
case InternalWindowDunGen internalWindow:
- await PostGen(internalWindow, data, dungeons[^1], reservedTiles, random);
+ await PostGen(internalWindow, dungeons[^1], reservedTiles, random);
break;
case MobsDunGen mob:
await PostGen(mob, dungeons[^1], random);
await PostGen(ore, dungeons[^1], random);
break;
case PrefabDunGen prefab:
- dungeons.Add(await GeneratePrefabDunGen(position, data, prefab, reservedTiles, random));
+ dungeons.Add(await GeneratePrefabDunGen(position, prefab, reservedTiles, random));
break;
case PrototypeDunGen prototypo:
var groupConfig = _prototype.Index(prototypo.Proto);
position = (position + random.NextPolarVector2(groupConfig.MinOffset, groupConfig.MaxOffset)).Floored();
- var dataCopy = groupConfig.Data.Clone();
- dataCopy.Apply(data);
+ switch (prototypo.InheritDungeons)
+ {
+ case DungeonInheritance.All:
+ dungeons.AddRange(await GetDungeons(position, groupConfig, groupConfig.Layers, reservedTiles, seed, random, existing: dungeons));
+ break;
+ case DungeonInheritance.Last:
+ dungeons.AddRange(await GetDungeons(position, groupConfig, groupConfig.Layers, reservedTiles, seed, random, existing: dungeons.GetRange(dungeons.Count - 1, 1)));
+ break;
+ case DungeonInheritance.None:
+ dungeons.AddRange(await GetDungeons(position, groupConfig, groupConfig.Layers, reservedTiles, seed, random));
+ break;
+ }
- dungeons.AddRange(await GetDungeons(position, groupConfig, dataCopy, groupConfig.Layers, reservedTiles, seed, random));
break;
case ReplaceTileDunGen replace:
- dungeons.Add(await GenerateTileReplacementDunGen(replace, data, reservedTiles, random));
+ await GenerateTileReplacementDunGen(replace, dungeons, reservedTiles, random);
break;
case RoomEntranceDunGen rEntrance:
- await PostGen(rEntrance, data, dungeons[^1], reservedTiles, random);
+ await PostGen(rEntrance, dungeons[^1], reservedTiles, random);
break;
case SplineDungeonConnectorDunGen spline:
- dungeons.Add(await PostGen(spline, data, dungeons, reservedTiles, random));
+ dungeons.Add(await PostGen(spline, dungeons, reservedTiles, random));
break;
case WallMountDunGen wall:
- await PostGen(wall, data, dungeons[^1], reservedTiles, random);
+ await PostGen(wall, dungeons[^1], reservedTiles, random);
break;
case WormCorridorDunGen worm:
- await PostGen(worm, data, dungeons[^1], reservedTiles, random);
+ await PostGen(worm, dungeons[^1], reservedTiles, random);
break;
default:
throw new NotImplementedException();
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
[Dependency] private readonly IRobustRandom _random = default!;
+ public IEnumerable<EntProtoId> GetSpawns(EntityTablePrototype entTableProto, System.Random? rand = null)
+ {
+ // convenient
+ return GetSpawns(entTableProto.Table, rand);
+ }
+
public IEnumerable<EntProtoId> GetSpawns(EntityTableSelector? table, System.Random? rand = null)
{
if (table == null)
[Virtual, DataDefinition]
public partial class DungeonConfig
{
- /// <summary>
- /// <see cref="Data"/>
- /// </summary>
- [DataField]
- public DungeonData Data = DungeonData.Empty;
-
/// <summary>
/// The secret sauce, procedural generation layers that get run.
/// </summary>
+++ /dev/null
-using System.Linq;
-using Content.Shared.Maps;
-using Content.Shared.Storage;
-using Content.Shared.Whitelist;
-using Robust.Shared.Prototypes;
-using Robust.Shared.Utility;
-
-namespace Content.Shared.Procedural;
-
-/// <summary>
-/// Used to set dungeon values for all layers.
-/// </summary>
-/// <remarks>
-/// This lets us share data between different dungeon configs without having to repeat entire configs.
-/// </remarks>
-[DataRecord]
-public sealed partial class DungeonData
-{
- // I hate this but it also significantly reduces yaml bloat if we add like 10 variations on the same set of layers
- // e.g. science rooms, engi rooms, cargo rooms all under PlanetBase for example.
- // without having to do weird nesting. It also means we don't need to copy-paste the same prototype across several layers
- // The alternative is doing like,
- // 2 layer prototype, 1 layer with the specified data, 3 layer prototype, 2 layers with specified data, etc.
- // As long as we just keep the code clean over time it won't be bad to maintain.
-
- public static DungeonData Empty = new();
-
- public Dictionary<DungeonDataKey, Color> Colors = new();
- public Dictionary<DungeonDataKey, EntProtoId> Entities = new();
- public Dictionary<DungeonDataKey, ProtoId<EntitySpawnEntryPrototype>> SpawnGroups = new();
- public Dictionary<DungeonDataKey, ProtoId<ContentTileDefinition>> Tiles = new();
- public Dictionary<DungeonDataKey, EntityWhitelist> Whitelists = new();
-
- /// <summary>
- /// Applies the specified data to this data.
- /// </summary>
- public void Apply(DungeonData data)
- {
- // Copy-paste moment.
- foreach (var color in data.Colors)
- {
- Colors[color.Key] = color.Value;
- }
-
- foreach (var color in data.Entities)
- {
- Entities[color.Key] = color.Value;
- }
-
- foreach (var color in data.SpawnGroups)
- {
- SpawnGroups[color.Key] = color.Value;
- }
-
- foreach (var color in data.Tiles)
- {
- Tiles[color.Key] = color.Value;
- }
-
- foreach (var color in data.Whitelists)
- {
- Whitelists[color.Key] = color.Value;
- }
- }
-
- public DungeonData Clone()
- {
- return new DungeonData
- {
- // Only shallow clones but won't matter for DungeonJob purposes.
- Colors = Colors.ShallowClone(),
- Entities = Entities.ShallowClone(),
- SpawnGroups = SpawnGroups.ShallowClone(),
- Tiles = Tiles.ShallowClone(),
- Whitelists = Whitelists.ShallowClone(),
- };
- }
-}
-
-public enum DungeonDataKey : byte
-{
- // Colors
- Decals,
-
- // Entities
- Cabling,
- CornerWalls,
- Fill,
- Junction,
- Walls,
-
- // SpawnGroups
- CornerClutter,
- Entrance,
- EntranceFlank,
- WallMounts,
- Window,
-
- // Tiles
- FallbackTile,
- WidenTile,
-
- // Whitelists
- Rooms,
-}
+using Content.Shared.Maps;
+using Content.Shared.Whitelist;
using Robust.Shared.Prototypes;
namespace Content.Shared.Procedural.DungeonGenerators;
/// Places rooms in pre-selected pack layouts. Chooses rooms from the specified whitelist.
/// </summary>
/// <remarks>
-/// DungeonData keys are:
-/// - FallbackTile
-/// - Rooms
-/// </remarks>
public sealed partial class PrefabDunGen : IDunGenLayer
{
/// <summary>
/// </summary>
[DataField(required: true)]
public List<ProtoId<DungeonPresetPrototype>> Presets = new();
+
+ [DataField]
+ public EntityWhitelist? RoomWhitelist;
+
+ [DataField]
+ public ProtoId<ContentTileDefinition>? FallbackTile;
}
/// </summary>
public sealed partial class PrototypeDunGen : IDunGenLayer
{
+ /// <summary>
+ /// Should we pass in the current level's dungeons to the prototype.
+ /// </summary>
+ [DataField]
+ public DungeonInheritance InheritDungeons = DungeonInheritance.None;
+
[DataField(required: true)]
public ProtoId<DungeonConfigPrototype> Proto;
}
+
+public enum DungeonInheritance : byte
+{
+ /// <summary>
+ /// Don't inherit any of the current layer's dungeons for this <see cref="PrototypeDunGen"/>
+ /// </summary>
+ None,
+
+ /// <summary>
+ /// Inherit only the last dungeon ran.
+ /// </summary>
+ Last,
+
+ /// <summary>
+ /// Inherit all of the current layer's dungeons.
+ /// </summary>
+ All,
+}
using Content.Shared.Maps;
using Robust.Shared.Prototypes;
-namespace Content.Shared.Procedural.DungeonGenerators;
+namespace Content.Shared.Procedural.DungeonLayers;
/// <summary>
/// Fills unreserved tiles with the specified entity prototype.
/// </summary>
[DataField]
public HashSet<ProtoId<ContentTileDefinition>>? AllowedTiles;
+
+ [DataField(required: true)]
+ public EntProtoId Entity;
}
+using Content.Shared.EntityTable;
using Content.Shared.Storage;
+using Robust.Shared.Prototypes;
namespace Content.Shared.Procedural.DungeonLayers;
public int MaxCount = 1;
[DataField(required: true)]
- public List<EntitySpawnEntry> Groups = new();
+ public ProtoId<EntityTablePrototype> Contents;
}
using Content.Shared.Parallax.Biomes;
+using Robust.Shared.Prototypes;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
namespace Content.Shared.Procedural.Loot;
/// </summary>
public sealed partial class BiomeTemplateLoot : IDungeonLoot
{
- [DataField("proto", required: true, customTypeSerializer:typeof(PrototypeIdSerializer<BiomeTemplatePrototype>))]
- public string Prototype = string.Empty;
+ [DataField("proto", required: true)]
+ public ProtoId<BiomeTemplatePrototype> Prototype = string.Empty;
}
+using Robust.Shared.Prototypes;
+
namespace Content.Shared.Procedural.PostGeneration;
/// <summary>
/// Runs cables throughout the dungeon.
/// </summary>
-/// <remarks>
-/// DungeonData keys are:
-/// - Cabling
-/// </remarks>
-public sealed partial class AutoCablingDunGen : IDunGenLayer;
+public sealed partial class AutoCablingDunGen : IDunGenLayer
+{
+ [DataField(required: true)]
+ public EntProtoId Entity;
+}
+using Content.Shared.Maps;
+using Robust.Shared.Prototypes;
+
namespace Content.Shared.Procedural.PostGeneration;
/// <summary>
{
[DataField]
public BoundaryWallFlags Flags = BoundaryWallFlags.Corridors | BoundaryWallFlags.Rooms;
+
+ [DataField(required: true)]
+ public EntProtoId Wall;
+
+ [DataField]
+ public EntProtoId? CornerWall;
+
+ [DataField(required: true)]
+ public ProtoId<ContentTileDefinition> Tile;
}
[Flags]
+using Content.Shared.EntityTable;
+using Content.Shared.Storage;
+using Robust.Shared.Prototypes;
+
namespace Content.Shared.Procedural.PostGeneration;
/// <summary>
/// Spawns entities inside corners.
/// </summary>
-/// <remarks>
-/// Dungeon data keys are:
-/// - CornerClutter
-/// </remarks>
public sealed partial class CornerClutterDunGen : IDunGenLayer
{
[DataField]
public float Chance = 0.50f;
+
+ [DataField(required:true)]
+ public ProtoId<EntityTablePrototype> Contents = new();
}
+using Content.Shared.EntityTable;
using Content.Shared.Storage;
+using Robust.Shared.Prototypes;
namespace Content.Shared.Procedural.PostGeneration;
/// The default starting bulbs
/// </summary>
[DataField(required: true)]
- public List<EntitySpawnEntry> Contents = new();
+ public ProtoId<EntityTablePrototype> Contents;
}
-using Content.Shared.Decals;
-using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
-using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype.Dictionary;
-
namespace Content.Shared.Procedural.PostGeneration;
/// <summary>
/// </summary>
[DataField]
public Dictionary<DirectionFlag, string> CornerDecals = new();
+
+ /// <summary>
+ /// Optional color to apply to the decals.
+ /// </summary>
+ [DataField]
+ public Color? Color;
}
+using Content.Shared.Maps;
+using Robust.Shared.Prototypes;
+
namespace Content.Shared.Procedural.PostGeneration;
/// <summary>
/// Connects room entrances via corridor segments.
/// </summary>
-/// <remarks>
-/// Dungeon data keys are:
-/// - FallbackTile
-/// </remarks>
public sealed partial class CorridorDunGen : IDunGenLayer
{
/// <summary>
/// </summary>
[DataField]
public float Width = 3f;
+
+ [DataField(required: true)]
+ public ProtoId<ContentTileDefinition> Tile;
}
+using Content.Shared.EntityTable;
+using Content.Shared.Maps;
+using Content.Shared.Storage;
+using Robust.Shared.Prototypes;
+
namespace Content.Shared.Procedural.PostGeneration;
/// <summary>
/// Selects [count] rooms and places external doors to them.
/// </summary>
-/// <remarks>
-/// Dungeon data keys are:
-/// - Entrance
-/// - FallbackTile
-/// </remarks>
public sealed partial class DungeonEntranceDunGen : IDunGenLayer
{
/// <summary>
/// </summary>
[DataField]
public int Count = 1;
+
+ [DataField(required: true)]
+ public ProtoId<ContentTileDefinition> Tile;
+
+ [DataField(required: true)]
+ public ProtoId<EntityTablePrototype> Contents;
}
+using Content.Shared.EntityTable;
+using Content.Shared.Maps;
+using Robust.Shared.Prototypes;
+
namespace Content.Shared.Procedural.PostGeneration;
/// <summary>
/// Spawns entities on either side of an entrance.
/// </summary>
-/// <remarks>
-/// Dungeon data keys are:
-/// - FallbackTile
-/// -
-/// </remarks>
-public sealed partial class EntranceFlankDunGen : IDunGenLayer;
+public sealed partial class EntranceFlankDunGen : IDunGenLayer
+{
+ [DataField(required: true)]
+ public ProtoId<ContentTileDefinition> Tile;
+
+ [DataField(required: true)]
+ public ProtoId<EntityTablePrototype> Contents = new();
+}
+using Content.Shared.EntityTable;
+using Content.Shared.Maps;
+using Content.Shared.Storage;
+using Robust.Shared.Prototypes;
+
namespace Content.Shared.Procedural.PostGeneration;
/// <summary>
/// If external areas are found will try to generate windows.
/// </summary>
-/// <remarks>
-/// Dungeon data keys are:
-/// - EntranceFlank
-/// - FallbackTile
-/// </remarks>
-public sealed partial class ExternalWindowDunGen : IDunGenLayer;
+public sealed partial class ExternalWindowDunGen : IDunGenLayer
+{
+ [DataField(required: true)]
+ public ProtoId<ContentTileDefinition> Tile;
+
+ [DataField(required: true)]
+ public ProtoId<EntityTablePrototype> Contents;
+}
+using Content.Shared.EntityTable;
+using Content.Shared.Maps;
+using Robust.Shared.Prototypes;
+
namespace Content.Shared.Procedural.PostGeneration;
/// <summary>
/// If internal areas are found will try to generate windows.
/// </summary>
-/// <remarks>
-/// Dungeon data keys are:
-/// - FallbackTile
-/// - Window
-/// </remarks>
-public sealed partial class InternalWindowDunGen : IDunGenLayer;
+public sealed partial class InternalWindowDunGen : IDunGenLayer
+{
+ [DataField(required: true)]
+ public ProtoId<ContentTileDefinition> Tile;
+
+ [DataField(required: true)]
+ public ProtoId<EntityTablePrototype> Contents;
+}
+using Content.Shared.EntityTable;
+using Content.Shared.Maps;
+using Content.Shared.Storage;
+using Robust.Shared.Prototypes;
+
namespace Content.Shared.Procedural.PostGeneration;
/// <summary>
/// Places the specified entities at junction areas.
/// </summary>
-/// <remarks>
-/// Dungeon data keys are:
-/// - Entrance
-/// - FallbackTile
-/// </remarks>
public sealed partial class JunctionDunGen : IDunGenLayer
{
/// <summary>
/// </summary>
[DataField]
public int Width = 3;
+
+ [DataField(required: true)]
+ public ProtoId<ContentTileDefinition> Tile;
+
+ [DataField(required: true)]
+ public ProtoId<EntityTablePrototype> Contents;
}
+using Content.Shared.EntityTable;
+using Content.Shared.Maps;
+using Content.Shared.Storage;
+using Robust.Shared.Prototypes;
+
namespace Content.Shared.Procedural.PostGeneration;
/// <summary>
/// </summary>
[DataField]
public int Count = 1;
+
+ [DataField(required: true)]
+ public ProtoId<ContentTileDefinition> Tile;
+
+ [DataField(required: true)]
+ public ProtoId<EntityTablePrototype> Contents;
+
+ [DataField]
+ public ProtoId<EntityTablePrototype>? Flank;
}
+using Content.Shared.EntityTable;
+using Content.Shared.Maps;
+using Content.Shared.Storage;
+using Robust.Shared.Prototypes;
+
namespace Content.Shared.Procedural.PostGeneration;
/// <summary>
/// Places tiles / entities onto room entrances.
/// </summary>
-/// <remarks>
-/// DungeonData keys are:
-/// - Entrance
-/// - FallbackTile
-/// </remarks>
-public sealed partial class RoomEntranceDunGen : IDunGenLayer;
+public sealed partial class RoomEntranceDunGen : IDunGenLayer
+{
+ [DataField(required: true)]
+ public ProtoId<ContentTileDefinition> Tile;
+
+ [DataField]
+ public ProtoId<EntityTablePrototype> Contents;
+}
+using Content.Shared.Maps;
+using Robust.Shared.Prototypes;
+
namespace Content.Shared.Procedural.PostGeneration;
/// <summary>
/// </summary>
public sealed partial class SplineDungeonConnectorDunGen : IDunGenLayer
{
+ [DataField(required: true)]
+ public ProtoId<ContentTileDefinition> Tile;
+
+ [DataField]
+ public ProtoId<ContentTileDefinition>? WidenTile;
+
/// <summary>
/// Will divide the distance between the start and end points so that no subdivision is more than these metres away.
/// </summary>
+using Content.Shared.EntityTable;
+using Content.Shared.Maps;
+using Content.Shared.Storage;
+using Robust.Shared.Prototypes;
+
namespace Content.Shared.Procedural.PostGeneration;
/// <summary>
/// </summary>
[DataField]
public double Prob = 0.1;
+
+ [DataField(required: true)]
+ public ProtoId<ContentTileDefinition> Tile;
+
+ [DataField(required: true)]
+ public ProtoId<EntityTablePrototype> Contents;
}
+using Content.Shared.Maps;
+using Robust.Shared.Prototypes;
+
namespace Content.Shared.Procedural.PostGeneration;
// Ime a worm
/// </summary>
[DataField]
public float Width = 3f;
+
+ [DataField(required: true)]
+ public ProtoId<ContentTileDefinition> Tile;
}
var configProto =_proto.Index(configId);
var layers = new Dictionary<string, int>();
- var data = new DungeonData();
- data.Apply(configProto.Data);
-
var config = new DungeonConfig
{
- Data = data,
Layers = new(configProto.Layers),
MaxCount = configProto.MaxCount,
MaxOffset = configProto.MaxOffset,
public float CumulativeProbability { get; set; } = 0f;
}
+ public static List<string> GetSpawns(ProtoId<EntitySpawnEntryPrototype> proto, IPrototypeManager? protoManager = null, IRobustRandom? random = null)
+ {
+ IoCManager.Resolve(ref protoManager, ref random);
+ return GetSpawns(protoManager.Index(proto).Entries, random);
+ }
+
+ public static List<string?> GetSpawns(ProtoId<EntitySpawnEntryPrototype> proto, System.Random random, IPrototypeManager? protoManager = null)
+ {
+ IoCManager.Resolve(ref protoManager);
+ return GetSpawns(protoManager.Index(proto).Entries, random);
+ }
+
/// <summary>
/// Using a collection of entity spawn entries, picks a random list of entity prototypes to spawn from that collection.
/// </summary>
-# Base configs
+# Setups
- type: dungeonConfig
- id: PlanetBase
+ id: Experiment
layers:
- !type:PrefabDunGen
+ roomWhitelist:
+ tags:
+ - SalvageExperiment
presets:
- Bucket
- Wow
- !type:CorridorDunGen
width: 3
+ tile: FloorSteel
- !type:DungeonEntranceDunGen
count: 2
+ tile: FloorSteel
+ contents: BaseAirlock
- !type:RoomEntranceDunGen
+ tile: FloorSteel
+ contents: BaseAirlock
- !type:EntranceFlankDunGen
+ tile: FloorSteel
+ contents: BaseWindow
- !type:ExternalWindowDunGen
+ tile: FloorSteel
+ contents: BaseWindow
- !type:WallMountDunGen
+ contents: ScienceLabsWalls
+ tile: FloorSteel
- !type:BoundaryWallDunGen
+ wall: WallSolid
+ cornerWall: WallReinforced
+ tile: FloorSteel
- !type:JunctionDunGen
width: 1
+ tile: FloorSteel
+ contents: BaseAirlock
- !type:JunctionDunGen
+ width: 3
+ tile: FloorSteel
+ contents: BaseAirlock
- !type:AutoCablingDunGen
+ entity: CableApcExtension
- !type:CornerClutterDunGen
+ contents: BaseClutter
- !type:CorridorDecalSkirtingDunGen
cardinalDecals:
NorthWest: BrickTileWhiteInnerNw
NorthEast: BrickTileWhiteInnerNe
-# Setups
-- type: dungeonConfig
- id: Experiment
- data:
- colors:
- Decals: "#D381C996"
- entities:
- Cabling: CableApcExtension
- CornerWalls: WallReinforced
- Walls: WallSolid
- spawnGroups:
- CornerClutter: BaseClutter
- Entrance: BaseAirlock
- EntranceFlank: BaseWindow
- Junction: BaseAirlock
- WallMounts: ScienceLabsWalls
- Window: BaseWindow
- tiles:
- FallbackTile: FloorSteel
- whitelists:
- Rooms:
- tags:
- - SalvageExperiment
- layers:
- - !type:PrototypeDunGen
- proto: PlanetBase
-
- type: dungeonConfig
id: Haunted
- data:
- entities:
- Walls: WallRock
- tiles:
- FallbackTile: FloorCaveDrought
- whitelists:
- Rooms:
- tags:
- - Mineshaft
layers:
- !type:PrefabDunGen
presets:
- !type:WormCorridorDunGen
width: 3
+ tile: FloorCaveDrought
- !type:CorridorClutterDunGen
- contents:
- - id: FloraStalagmite
+ contents: HauntedClutter
- !type:BoundaryWallDunGen
+ tile: FloorCaveDrought
+ wall: WallRock
+
+- type: entityTable
+ id: HauntedClutter
+ table: !type:GroupSelector
+ children:
+ - id: FloraStalagmite
- type: dungeonConfig
id: LavaBrig
- data:
- colors:
- Decals: "#DE3A3A96"
- entities:
- Cabling: CableApcExtension
- CornerWalls: WallReinforced
- Walls: WallSolid
- spawnGroups:
- CornerClutter: BaseClutter
- Entrance: LavaBrigEntrance
- EntranceFlank: BaseWindow
- Junction: BaseAirlock
- WallMounts: ScienceLabsWalls
- Window: BaseWindow
- tiles:
- FallbackTile: FloorDark
- whitelists:
- Rooms:
- tags:
- - LavaBrig
layers:
- - !type:PrototypeDunGen
- proto: PlanetBase
+ - !type:PrefabDunGen
+ roomWhitelist:
+ tags:
+ - LavaBrig
+ presets:
+ - Bucket
+ - Wow
+ - SpaceShip
+ - Tall
+
+ - !type:CorridorDunGen
+ width: 3
+ tile: FloorDark
+
+ - !type:DungeonEntranceDunGen
+ count: 2
+ tile: FloorDark
+ contents: LavaBrigEntrance
+
+ - !type:RoomEntranceDunGen
+ tile: FloorDark
+ contents: BaseAirlock
+
+ - !type:EntranceFlankDunGen
+ tile: FloorDark
+ contents: BaseWindow
+
+ - !type:ExternalWindowDunGen
+ tile: FloorDark
+ contents: BaseWindow
+
+ - !type:WallMountDunGen
+ contents: ScienceLabsWalls
+ tile: FloorDark
+
+ - !type:BoundaryWallDunGen
+ wall: WallSolid
+ cornerWall: WallReinforced
+ tile: FloorDark
+
+ - !type:JunctionDunGen
+ width: 1
+ tile: FloorDark
+ contents: BaseAirlock
+
+ - !type:JunctionDunGen
+ width: 3
+ tile: FloorDark
+ contents: BaseAirlock
+
+ - !type:AutoCablingDunGen
+ entity: CableApcExtension
+
+ - !type:CornerClutterDunGen
+ contents: BaseClutter
+
+ - !type:CorridorDecalSkirtingDunGen
+ cardinalDecals:
+ South: BrickTileWhiteLineS
+ East: BrickTileWhiteLineE
+ North: BrickTileWhiteLineN
+ West: BrickTileWhiteLineW
+ cornerDecals:
+ SouthEast: BrickTileWhiteCornerSe
+ SouthWest: BrickTileWhiteCornerSw
+ NorthEast: BrickTileWhiteCornerNe
+ NorthWest: BrickTileWhiteCornerNw
+ pocketDecals:
+ SouthWest: BrickTileWhiteInnerSw
+ SouthEast: BrickTileWhiteInnerSe
+ NorthWest: BrickTileWhiteInnerNw
+ NorthEast: BrickTileWhiteInnerNe
- type: dungeonConfig
id: Mineshaft
- data:
- entities:
- Cabling: Catwalk
- spawnGroups:
- CornerClutter: MineshaftClutter
- Entrance: BaseWoodWall
- EntranceFlank: BaseWoodWall
- Junction: BaseWoodSupport
- Window: BaseWoodWall
- tiles:
- FallbackTile: FloorCaveDrought
- whitelists:
- Rooms:
- tags:
- - Mineshaft
layers:
- - !type:PrototypeDunGen
- proto: PlanetBase
+ - !type:PrefabDunGen
+ roomWhitelist:
+ tags:
+ - Mineshaft
+ presets:
+ - Bucket
+ - Wow
+ - SpaceShip
+ - Tall
+
+ - !type:CorridorDunGen
+ width: 3
+ tile: FloorCaveDrought
+
+ - !type:DungeonEntranceDunGen
+ count: 2
+ tile: FloorCaveDrought
+ contents: BaseWoodWall
+
+ - !type:RoomEntranceDunGen
+ tile: FloorCaveDrought
+ contents: BaseWoodWall
+
+ - !type:EntranceFlankDunGen
+ tile: FloorCaveDrought
+ contents: BaseWoodWall
+
+ - !type:ExternalWindowDunGen
+ tile: FloorCaveDrought
+ contents: BaseWoodWall
+
+ # No wallmounts
+
+ # No boundary wall
+
+ - !type:JunctionDunGen
+ width: 1
+ tile: FloorCaveDrought
+ contents: BaseWoodSupport
+
+ - !type:JunctionDunGen
+ width: 3
+ tile: FloorCaveDrought
+ contents: BaseWoodSupport
+
+ - !type:AutoCablingDunGen
+ entity: Catwalk
+
+ - !type:CornerClutterDunGen
+ contents: MineshaftClutter
+
+# TODO: Check decal skirting fix contents in code.
- type: dungeonConfig
id: SnowyLabs
- data:
- colors:
- Decals: "#4cc7aa96"
- entities:
- Cabling: CableApcExtension
- CornerWalls: WallSilver
- Walls: WallSilver
- spawnGroups:
- CornerClutter: BaseClutter
- Entrance: SnowyLabsEntrance
- EntranceFlank: BaseWindow
- Junction: BaseAirlock
- WallMounts: SnowyLabsWalls
- Window: BaseWindow
- tiles:
- FallbackTile: FloorSteel
- whitelists:
- Rooms:
- tags:
- - SnowyLabs
layers:
- - !type:PrototypeDunGen
- proto: PlanetBase
+ - !type:PrefabDunGen
+ roomWhitelist:
+ tags:
+ - SnowyLabs
+ presets:
+ - Bucket
+ - Wow
+ - SpaceShip
+ - Tall
+
+ - !type:CorridorDunGen
+ width: 3
+ tile: FloorSteel
+
+ - !type:DungeonEntranceDunGen
+ count: 2
+ tile: FloorSteel
+ contents: BaseAirlock
+
+ - !type:RoomEntranceDunGen
+ tile: FloorSteel
+ contents: BaseAirlock
+
+ - !type:EntranceFlankDunGen
+ tile: FloorSteel
+ contents: BaseWindow
+
+ - !type:ExternalWindowDunGen
+ tile: FloorSteel
+ contents: BaseWindow
+
+ - !type:WallMountDunGen
+ contents: SnowyLabsWalls
+ tile: FloorSteel
+
+ - !type:BoundaryWallDunGen
+ wall: WallSilver
+ tile: FloorSteel
+
+ - !type:JunctionDunGen
+ width: 1
+ tile: FloorSteel
+ contents: BaseAirlock
+
+ - !type:JunctionDunGen
+ width: 3
+ tile: FloorSteel
+ contents: BaseAirlock
+
+ - !type:AutoCablingDunGen
+ entity: CableApcExtension
# Spawn groups
# Basic
-- type: entitySpawnEntry
+- type: entityTable
id: BaseClutter
- entries:
- - id: PottedPlantRandom
- amount: 1
+ table: !type:GroupSelector
+ children:
+ - id: PottedPlantRandom
+ amount: 1
-- type: entitySpawnEntry
+- type: entityTable
id: BaseAirlock
- entries:
- - id: CableApcExtension
- - id: AirlockGlass
+ table: !type:GroupSelector
+ children:
+ - id: CableApcExtension
+ - id: AirlockGlass
-- type: entitySpawnEntry
+- type: entityTable
id: BaseWindow
- entries:
- - id: Grille
- - id: Window
+ table: !type:GroupSelector
+ children:
+ - id: Grille
+ - id: Window
# Lava brig
-- type: entitySpawnEntry
+- type: entityTable
id: LavaBrigEntrance
- entries:
- - id: CableApcExtension
- - id: AirlockSecurityGlassLocked
+ table: !type:GroupSelector
+ children:
+ - id: CableApcExtension
+ - id: AirlockSecurityGlassLocked
# Mineshaft
-- type: entitySpawnEntry
+- type: entityTable
id: BaseWoodWall
- entries:
- - id: RandomWoodenWall
+ table: !type:GroupSelector
+ children:
+ - id: RandomWoodenWall
-- type: entitySpawnEntry
+- type: entityTable
id: BaseWoodSupport
- entries:
- - id: RandomWoodenSupport
+ table: !type:GroupSelector
+ children:
+ - id: RandomWoodenSupport
-- type: entitySpawnEntry
+- type: entityTable
id: MineshaftClutter
- entries:
- - id: RandomStalagmiteOrCrystal
- amount: 1
+ table: !type:GroupSelector
+ children:
+ - id: RandomStalagmiteOrCrystal
+ amount: 1
-- type: entitySpawnEntry
+- type: entityTable
id: MineshaftWalls
- entries:
- # Ore
- - id: WallRockSalt
- prob: 0.6
- orGroup: content
- - id: WallRockCoal
- prob: 0.6
- orGroup: content
- - id: WallRockTin
- prob: 0.4
- orGroup: content
- - id: WallMining
- prob: 0.8
- orGroup: content
+ table: !type:GroupSelector
+ children:
+ # Ore
+ - id: WallRockSalt
+ prob: 0.6
+ - id: WallRockCoal
+ prob: 0.6
+ - id: WallRockTin
+ prob: 0.4
+ - id: WallMining
+ prob: 0.8
# Science lab
-- type: entitySpawnEntry
+- type: entityTable
id: ScienceLabsWalls
- entries:
- # Posters
- - id: RandomPosterLegit
- orGroup: content
- - id: ExtinguisherCabinetFilled
- prob: 0.2
- orGroup: content
- - id: RandomPainting
- prob: 0.05
- orGroup: content
- - id: IntercomCommon
- prob: 0.1
- orGroup: content
+ table: !type:GroupSelector
+ children:
+ # Posters
+ - id: RandomPosterLegit
+ - id: ExtinguisherCabinetFilled
+ prob: 0.2
+ - id: RandomPainting
+ prob: 0.05
+ - id: IntercomCommon
+ prob: 0.1
# Snowy labs
-- type: entitySpawnEntry
+- type: entityTable
id: SnowyLabsEntrance
- entries:
- - id: CableApcExtension
- - id: AirlockFreezerHydroponicsLocked
+ table: !type:GroupSelector
+ children:
+ - id: CableApcExtension
+ - id: AirlockFreezerHydroponicsLocked
-- type: entitySpawnEntry
+- type: entityTable
id: SnowyLabsWalls
- entries:
- # Posters
- - id: RandomPosterLegit
- orGroup: content
- - id: ExtinguisherCabinetFilled
- prob: 0.2
- orGroup: content
- - id: RandomPainting
- prob: 0.05
- orGroup: content
- - id: IntercomScience
- prob: 0.1
- orGroup: content
+ table: !type:GroupSelector
+ children:
+ # Posters
+ - id: RandomPosterLegit
+ - id: ExtinguisherCabinetFilled
+ prob: 0.2
+ - id: RandomPainting
+ prob: 0.05
+ - id: IntercomScience
+ prob: 0.1
proto: VGRoidSmaller
- !type:PrototypeDunGen
proto: VGRoidSmallPaths
+ inheritDungeons: All
- !type:EntityTableDunGen
minCount: 7
maxCount: 12
# Fill
- !type:PrototypeDunGen
proto: VGRoidFill
+ inheritDungeons: All
# Ores
- !type:OreDunGen
replacement: IronRock
- type: dungeonConfig
id: VGRoidExterior
reserveTiles: true
- data:
- tiles:
- FallbackTile: PlatingAsteroid
- WidenTile: FloorAsteroidSand
layers:
- !type:PrototypeDunGen
proto: VGRoidExteriorDungeons
- !type:SplineDungeonConnectorDunGen
+ tile: PlatingAsteroid
+ widenTile: FloorAsteroidSand
- type: dungeonConfig
id: VGRoidExteriorDungeons
- !type:MobsDunGen
minCount: 8
maxCount: 15
- groups:
+ contents: VGRoidExteriorDungeonsMobs
+
+- type: entityTable
+ id: VGRoidExteriorDungeonsMobs
+ table: !type:GroupSelector
+ children:
- id: SalvageSpawnerMobMiningAsteroid
amount: 1
- !type:MobsDunGen
minCount: 25
maxCount: 35
- groups:
+ contents: VGRoidSmallPathsMobs
+
+- type: entityTable
+ id: VGRoidSmallPathsMobs
+ table: !type:GroupSelector
+ children:
- id: SalvageSpawnerMobMiningAsteroid
amount: 1
# Fill with rocks.
- type: dungeonConfig
id: VGRoidFill
- data:
- entities:
- Fill: IronRock
layers:
- !type:FillGridDunGen
+ entity: IronRock
allowedTiles:
- FloorAsteroidSand