Refactor serialization copying to use source generators (#19412)

This commit is contained in:
DrSmugleaf
2023-08-22 18:14:33 -07:00
committed by GitHub
parent 08b43990ab
commit a88e747a0b
1737 changed files with 2532 additions and 2521 deletions

View File

@@ -7,11 +7,11 @@ using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototy
namespace Content.Shared.Parallax.Biomes.Layers;
[Serializable, NetSerializable]
public sealed class BiomeDecalLayer : IBiomeWorldLayer
public sealed partial class BiomeDecalLayer : IBiomeWorldLayer
{
/// <inheritdoc/>
[DataField("allowedTiles", customTypeSerializer:typeof(PrototypeIdListSerializer<ContentTileDefinition>))]
public List<string> AllowedTiles { get; } = new();
public List<string> AllowedTiles { get; private set; } = new();
/// <summary>
/// Divide each tile up by this amount.
@@ -20,14 +20,14 @@ public sealed class BiomeDecalLayer : IBiomeWorldLayer
public float Divisions = 1f;
[DataField("noise")]
public FastNoiseLite Noise { get; } = new(0);
public FastNoiseLite Noise { get; private set; } = new(0);
/// <inheritdoc/>
[DataField("threshold")]
public float Threshold { get; } = 0.8f;
public float Threshold { get; private set; } = 0.8f;
/// <inheritdoc/>
[DataField("invert")] public bool Invert { get; } = false;
[DataField("invert")] public bool Invert { get; private set; } = false;
[DataField("decals", required: true, customTypeSerializer:typeof(PrototypeIdListSerializer<DecalPrototype>))]
public List<string> Decals = new();

View File

@@ -8,7 +8,7 @@ namespace Content.Shared.Parallax.Biomes.Layers;
/// For example if they wish to add their own layers at specific points across different templates.
/// </summary>
[Serializable, NetSerializable]
public sealed class BiomeDummyLayer : IBiomeLayer
public sealed partial class BiomeDummyLayer : IBiomeLayer
{
[DataField("id", required: true)] public string ID = string.Empty;

View File

@@ -7,20 +7,20 @@ using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototy
namespace Content.Shared.Parallax.Biomes.Layers;
[Serializable, NetSerializable]
public sealed class BiomeEntityLayer : IBiomeWorldLayer
public sealed partial class BiomeEntityLayer : IBiomeWorldLayer
{
/// <inheritdoc/>
[DataField("allowedTiles", customTypeSerializer:typeof(PrototypeIdListSerializer<ContentTileDefinition>))]
public List<string> AllowedTiles { get; } = new();
public List<string> AllowedTiles { get; private set; } = new();
[DataField("noise")] public FastNoiseLite Noise { get; } = new(0);
[DataField("noise")] public FastNoiseLite Noise { get; private set; } = new(0);
/// <inheritdoc/>
[DataField("threshold")]
public float Threshold { get; } = 0.5f;
public float Threshold { get; private set; } = 0.5f;
/// <inheritdoc/>
[DataField("invert")] public bool Invert { get; } = false;
[DataField("invert")] public bool Invert { get; private set; } = false;
[DataField("entities", required: true, customTypeSerializer: typeof(PrototypeIdListSerializer<EntityPrototype>))]
public List<string> Entities = new();

View File

@@ -9,18 +9,18 @@ namespace Content.Shared.Parallax.Biomes.Layers;
/// Can be used for sub-biomes.
/// </summary>
[Serializable, NetSerializable]
public sealed class BiomeMetaLayer : IBiomeLayer
public sealed partial class BiomeMetaLayer : IBiomeLayer
{
[DataField("noise")]
public FastNoiseLite Noise { get; } = new(0);
public FastNoiseLite Noise { get; private set; } = new(0);
/// <inheritdoc/>
[DataField("threshold")]
public float Threshold { get; } = -1f;
public float Threshold { get; private set; } = -1f;
/// <inheritdoc/>
[DataField("invert")]
public bool Invert { get; }
public bool Invert { get; private set; }
[DataField("template", required: true, customTypeSerializer: typeof(PrototypeIdSerializer<BiomeTemplatePrototype>))]
public string Template = string.Empty;

View File

@@ -6,16 +6,16 @@ using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototy
namespace Content.Shared.Parallax.Biomes.Layers;
[Serializable, NetSerializable]
public sealed class BiomeTileLayer : IBiomeLayer
public sealed partial class BiomeTileLayer : IBiomeLayer
{
[DataField("noise")] public FastNoiseLite Noise { get; } = new(0);
[DataField("noise")] public FastNoiseLite Noise { get; private set; } = new(0);
/// <inheritdoc/>
[DataField("threshold")]
public float Threshold { get; } = 0.5f;
public float Threshold { get; private set; } = 0.5f;
/// <inheritdoc/>
[DataField("invert")] public bool Invert { get; } = false;
[DataField("invert")] public bool Invert { get; private set; } = false;
/// <summary>
/// Which tile variants to use for this layer. Uses all of the tile's variants if none specified

View File

@@ -3,7 +3,7 @@ using Robust.Shared.Noise;
namespace Content.Shared.Parallax.Biomes.Layers;
[ImplicitDataDefinitionForInheritors]
public interface IBiomeLayer
public partial interface IBiomeLayer
{
/// <summary>
/// Seed is used an offset from the relevant BiomeComponent's seed.
@@ -19,4 +19,4 @@ public interface IBiomeLayer
/// Is the thresold inverted so we need to be lower than it.
/// </summary>
public bool Invert { get; }
}
}

View File

@@ -3,7 +3,7 @@ namespace Content.Shared.Parallax.Biomes.Layers;
/// <summary>
/// Handles actual objects such as decals and entities.
/// </summary>
public interface IBiomeWorldLayer : IBiomeLayer
public partial interface IBiomeWorldLayer : IBiomeLayer
{
/// <summary>
/// What tiles we're allowed to spawn on, real or biome.