Refactor serialization copying to use source generators (#19412)
This commit is contained in:
@@ -8,7 +8,7 @@ namespace Content.Shared.Procedural;
|
||||
public sealed class DungeonConfigPrototype : IPrototype
|
||||
{
|
||||
[IdDataField]
|
||||
public string ID { get; } = default!;
|
||||
public string ID { get; private set; } = default!;
|
||||
|
||||
[DataField("generator", required: true)]
|
||||
public IDunGen Generator = default!;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
namespace Content.Shared.Procedural.DungeonGenerators;
|
||||
|
||||
[ImplicitDataDefinitionForInheritors]
|
||||
public interface IDunGen
|
||||
public partial interface IDunGen
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ namespace Content.Shared.Procedural.DungeonGenerators;
|
||||
/// <summary>
|
||||
/// Places rooms in pre-selected pack layouts. Chooses rooms from the specified whitelist.
|
||||
/// </summary>
|
||||
public sealed class PrefabDunGen : IDunGen
|
||||
public sealed partial class PrefabDunGen : IDunGen
|
||||
{
|
||||
/// <summary>
|
||||
/// Rooms need to match any of these tags
|
||||
|
||||
@@ -6,7 +6,7 @@ namespace Content.Shared.Procedural;
|
||||
public sealed class DungeonRoomPackPrototype : IPrototype
|
||||
{
|
||||
[IdDataField]
|
||||
public string ID { get; } = string.Empty;
|
||||
public string ID { get; private set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// Used to associate the room pack with other room packs with the same dimensions.
|
||||
|
||||
@@ -7,7 +7,7 @@ namespace Content.Shared.Procedural.Loot;
|
||||
/// <summary>
|
||||
/// Adds a biome marker layer for dungeon loot.
|
||||
/// </summary>
|
||||
public sealed class BiomeMarkerLoot : IDungeonLoot
|
||||
public sealed partial class BiomeMarkerLoot : IDungeonLoot
|
||||
{
|
||||
[DataField("proto", required: true,
|
||||
customTypeSerializer: typeof(PrototypeIdValueDictionarySerializer<string, BiomeMarkerLayerPrototype>))]
|
||||
|
||||
@@ -6,7 +6,7 @@ namespace Content.Shared.Procedural.Loot;
|
||||
/// <summary>
|
||||
/// Adds a biome template layer for dungeon loot.
|
||||
/// </summary>
|
||||
public sealed class BiomeTemplateLoot : IDungeonLoot
|
||||
public sealed partial class BiomeTemplateLoot : IDungeonLoot
|
||||
{
|
||||
[DataField("proto", required: true, customTypeSerializer:typeof(PrototypeIdSerializer<BiomeTemplatePrototype>))]
|
||||
public string Prototype = string.Empty;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
namespace Content.Shared.Procedural.Loot;
|
||||
|
||||
[ImplicitDataDefinitionForInheritors]
|
||||
public interface IDungeonLoot
|
||||
public partial interface IDungeonLoot
|
||||
{
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ namespace Content.Shared.Procedural.PostGeneration;
|
||||
/// <summary>
|
||||
/// Runs cables throughout the dungeon.
|
||||
/// </summary>
|
||||
public sealed class AutoCablingPostGen : IPostDunGen
|
||||
public sealed partial class AutoCablingPostGen : IPostDunGen
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ namespace Content.Shared.Procedural.PostGeneration;
|
||||
/// <summary>
|
||||
/// Iterates room edges and places the relevant tiles and walls on any free indices.
|
||||
/// </summary>
|
||||
public sealed class BoundaryWallPostGen : IPostDunGen
|
||||
public sealed partial class BoundaryWallPostGen : IPostDunGen
|
||||
{
|
||||
[DataField("tile", customTypeSerializer:typeof(PrototypeIdSerializer<ContentTileDefinition>))]
|
||||
public string Tile = "FloorSteel";
|
||||
|
||||
@@ -5,7 +5,7 @@ namespace Content.Shared.Procedural.PostGeneration;
|
||||
/// <summary>
|
||||
/// Spawns entities inside corners.
|
||||
/// </summary>
|
||||
public sealed class CornerClutterPostGen : IPostDunGen
|
||||
public sealed partial class CornerClutterPostGen : IPostDunGen
|
||||
{
|
||||
[DataField("chance")]
|
||||
public float Chance = 0.50f;
|
||||
|
||||
@@ -7,7 +7,7 @@ namespace Content.Shared.Procedural.PostGeneration;
|
||||
/// <summary>
|
||||
/// Applies decal skirting to corridors.
|
||||
/// </summary>
|
||||
public sealed class CorridorDecalSkirtingPostGen : IPostDunGen
|
||||
public sealed partial class CorridorDecalSkirtingPostGen : IPostDunGen
|
||||
{
|
||||
/// <summary>
|
||||
/// Color to apply to decals.
|
||||
|
||||
@@ -3,7 +3,7 @@ namespace Content.Shared.Procedural.PostGeneration;
|
||||
/// <summary>
|
||||
/// Connects room entrances via corridor segments.
|
||||
/// </summary>
|
||||
public sealed class CorridorPostGen : IPostDunGen
|
||||
public sealed partial class CorridorPostGen : IPostDunGen
|
||||
{
|
||||
/// <summary>
|
||||
/// How far we're allowed to generate a corridor before calling it.
|
||||
|
||||
@@ -8,7 +8,7 @@ namespace Content.Shared.Procedural.PostGeneration;
|
||||
/// <summary>
|
||||
/// Selects [count] rooms and places external doors to them.
|
||||
/// </summary>
|
||||
public sealed class DungeonEntrancePostGen : IPostDunGen
|
||||
public sealed partial class DungeonEntrancePostGen : IPostDunGen
|
||||
{
|
||||
/// <summary>
|
||||
/// How many rooms we place doors on.
|
||||
|
||||
@@ -6,7 +6,7 @@ namespace Content.Shared.Procedural.PostGeneration;
|
||||
/// <summary>
|
||||
/// Spawns entities on either side of an entrance.
|
||||
/// </summary>
|
||||
public sealed class EntranceFlankPostGen : IPostDunGen
|
||||
public sealed partial class EntranceFlankPostGen : IPostDunGen
|
||||
{
|
||||
[DataField("tile", customTypeSerializer:typeof(PrototypeIdSerializer<ContentTileDefinition>))]
|
||||
public string Tile = "FloorSteel";
|
||||
|
||||
@@ -8,7 +8,7 @@ namespace Content.Shared.Procedural.PostGeneration;
|
||||
/// <summary>
|
||||
/// If external areas are found will try to generate windows.
|
||||
/// </summary>
|
||||
public sealed class ExternalWindowPostGen : IPostDunGen
|
||||
public sealed partial class ExternalWindowPostGen : IPostDunGen
|
||||
{
|
||||
[DataField("entities", customTypeSerializer: typeof(PrototypeIdListSerializer<EntityPrototype>))]
|
||||
public List<string?> Entities = new()
|
||||
|
||||
@@ -4,7 +4,7 @@ namespace Content.Shared.Procedural.PostGeneration;
|
||||
/// Ran after generating dungeon rooms. Can be used for additional loot, contents, etc.
|
||||
/// </summary>
|
||||
[ImplicitDataDefinitionForInheritors]
|
||||
public interface IPostDunGen
|
||||
public partial interface IPostDunGen
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ namespace Content.Shared.Procedural.PostGeneration;
|
||||
/// <summary>
|
||||
/// If internal areas are found will try to generate windows.
|
||||
/// </summary>
|
||||
public sealed class InternalWindowPostGen : IPostDunGen
|
||||
public sealed partial class InternalWindowPostGen : IPostDunGen
|
||||
{
|
||||
[DataField("entities", customTypeSerializer: typeof(PrototypeIdListSerializer<EntityPrototype>))]
|
||||
public List<string?> Entities = new()
|
||||
|
||||
@@ -8,7 +8,7 @@ namespace Content.Shared.Procedural.PostGeneration;
|
||||
/// <summary>
|
||||
/// Places the specified entities at junction areas.
|
||||
/// </summary>
|
||||
public sealed class JunctionPostGen : IPostDunGen
|
||||
public sealed partial class JunctionPostGen : IPostDunGen
|
||||
{
|
||||
/// <summary>
|
||||
/// Width to check for junctions.
|
||||
|
||||
@@ -8,7 +8,7 @@ namespace Content.Shared.Procedural.PostGeneration;
|
||||
/// <summary>
|
||||
/// Places the specified entities on the middle connections between rooms
|
||||
/// </summary>
|
||||
public sealed class MiddleConnectionPostGen : IPostDunGen
|
||||
public sealed partial class MiddleConnectionPostGen : IPostDunGen
|
||||
{
|
||||
/// <summary>
|
||||
/// How much overlap there needs to be between 2 rooms exactly.
|
||||
|
||||
@@ -8,7 +8,7 @@ namespace Content.Shared.Procedural.PostGeneration;
|
||||
/// <summary>
|
||||
/// Places tiles / entities onto room entrances.
|
||||
/// </summary>
|
||||
public sealed class RoomEntrancePostGen : IPostDunGen
|
||||
public sealed partial class RoomEntrancePostGen : IPostDunGen
|
||||
{
|
||||
[DataField("entities", customTypeSerializer: typeof(PrototypeIdListSerializer<EntityPrototype>))]
|
||||
public List<string?> Entities = new()
|
||||
|
||||
@@ -7,7 +7,7 @@ namespace Content.Shared.Procedural.PostGeneration;
|
||||
/// <summary>
|
||||
/// Spawns on the boundary tiles of rooms.
|
||||
/// </summary>
|
||||
public sealed class WallMountPostGen : IPostDunGen
|
||||
public sealed partial class WallMountPostGen : IPostDunGen
|
||||
{
|
||||
[DataField("tile", customTypeSerializer:typeof(PrototypeIdSerializer<ContentTileDefinition>))]
|
||||
public string Tile = "FloorSteel";
|
||||
|
||||
Reference in New Issue
Block a user