DungeonData rework (#37172)

* DungeonData rework

Back to fields, serializes better, just make new layers dumby.

* wawawewa

* Fix this

* Fixes

* review

* thanks fork

* fix
This commit is contained in:
metalgearsloth
2025-05-18 03:10:30 +10:00
committed by GitHub
parent d72939ba4b
commit 4afccdd5db
57 changed files with 759 additions and 696 deletions

View File

@@ -1,20 +0,0 @@
using Content.Shared.Maps;
using Robust.Shared.Prototypes;
namespace Content.Shared.Procedural.DungeonGenerators;
/// <summary>
/// Fills unreserved tiles with the specified entity prototype.
/// </summary>
/// <remarks>
/// DungeonData keys are:
/// - Fill
/// </remarks>
public sealed partial class FillGridDunGen : IDunGenLayer
{
/// <summary>
/// Tiles the fill can occur on.
/// </summary>
[DataField]
public HashSet<ProtoId<ContentTileDefinition>>? AllowedTiles;
}

View File

@@ -1,3 +1,5 @@
using Content.Shared.Maps;
using Content.Shared.Whitelist;
using Robust.Shared.Prototypes;
namespace Content.Shared.Procedural.DungeonGenerators;
@@ -6,10 +8,6 @@ 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>
@@ -17,4 +15,10 @@ public sealed partial class PrefabDunGen : IDunGenLayer
/// </summary>
[DataField(required: true)]
public List<ProtoId<DungeonPresetPrototype>> Presets = new();
[DataField]
public EntityWhitelist? RoomWhitelist;
[DataField]
public ProtoId<ContentTileDefinition>? FallbackTile;
}

View File

@@ -8,6 +8,30 @@ namespace Content.Shared.Procedural.DungeonGenerators;
/// </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,
}