Refactor serialization copying to use source generators (#19412)
This commit is contained in:
@@ -11,7 +11,7 @@ namespace Content.Shared.Random;
|
||||
/// </summary>
|
||||
[Serializable, NetSerializable]
|
||||
[DataDefinition]
|
||||
public sealed class RandomFillSolution
|
||||
public sealed partial class RandomFillSolution
|
||||
{
|
||||
/// <summary>
|
||||
/// Quantity of listed reagents.
|
||||
|
||||
@@ -21,7 +21,7 @@ public sealed class RulesPrototype : IPrototype
|
||||
}
|
||||
|
||||
[ImplicitDataDefinitionForInheritors]
|
||||
public abstract class RulesRule
|
||||
public abstract partial class RulesRule
|
||||
{
|
||||
|
||||
}
|
||||
@@ -29,7 +29,7 @@ public abstract class RulesRule
|
||||
/// <summary>
|
||||
/// Returns true if the attached entity is in space.
|
||||
/// </summary>
|
||||
public sealed class InSpaceRule : RulesRule
|
||||
public sealed partial class InSpaceRule : RulesRule
|
||||
{
|
||||
|
||||
}
|
||||
@@ -38,7 +38,7 @@ public sealed class InSpaceRule : RulesRule
|
||||
/// Checks for entities matching the whitelist in range.
|
||||
/// This is more expensive than <see cref="NearbyComponentsRule"/> so prefer that!
|
||||
/// </summary>
|
||||
public sealed class NearbyEntitiesRule : RulesRule
|
||||
public sealed partial class NearbyEntitiesRule : RulesRule
|
||||
{
|
||||
/// <summary>
|
||||
/// How many of the entity need to be nearby.
|
||||
@@ -53,7 +53,7 @@ public sealed class NearbyEntitiesRule : RulesRule
|
||||
public float Range = 10f;
|
||||
}
|
||||
|
||||
public sealed class NearbyTilesPercentRule : RulesRule
|
||||
public sealed partial class NearbyTilesPercentRule : RulesRule
|
||||
{
|
||||
/// <summary>
|
||||
/// If there are anchored entities on the tile do we ignore the tile.
|
||||
@@ -73,7 +73,7 @@ public sealed class NearbyTilesPercentRule : RulesRule
|
||||
/// <summary>
|
||||
/// Always returns true. Used for fallbacks.
|
||||
/// </summary>
|
||||
public sealed class AlwaysTrueRule : RulesRule
|
||||
public sealed partial class AlwaysTrueRule : RulesRule
|
||||
{
|
||||
|
||||
}
|
||||
@@ -81,7 +81,7 @@ public sealed class AlwaysTrueRule : RulesRule
|
||||
/// <summary>
|
||||
/// Returns true if on a grid or in range of one.
|
||||
/// </summary>
|
||||
public sealed class GridInRangeRule : RulesRule
|
||||
public sealed partial class GridInRangeRule : RulesRule
|
||||
{
|
||||
[DataField("range")]
|
||||
public float Range = 10f;
|
||||
@@ -93,7 +93,7 @@ public sealed class GridInRangeRule : RulesRule
|
||||
/// <summary>
|
||||
/// Returns true if griduid and mapuid match (AKA on 'planet').
|
||||
/// </summary>
|
||||
public sealed class OnMapGridRule : RulesRule
|
||||
public sealed partial class OnMapGridRule : RulesRule
|
||||
{
|
||||
|
||||
}
|
||||
@@ -101,7 +101,7 @@ public sealed class OnMapGridRule : RulesRule
|
||||
/// <summary>
|
||||
/// Checks for an entity nearby with the specified access.
|
||||
/// </summary>
|
||||
public sealed class NearbyAccessRule : RulesRule
|
||||
public sealed partial class NearbyAccessRule : RulesRule
|
||||
{
|
||||
// This exists because of doorelectronics contained inside doors.
|
||||
/// <summary>
|
||||
@@ -123,7 +123,7 @@ public sealed class NearbyAccessRule : RulesRule
|
||||
public float Range = 10f;
|
||||
}
|
||||
|
||||
public sealed class NearbyComponentsRule : RulesRule
|
||||
public sealed partial class NearbyComponentsRule : RulesRule
|
||||
{
|
||||
/// <summary>
|
||||
/// Does the entity need to be anchored.
|
||||
|
||||
@@ -10,8 +10,8 @@ namespace Content.Shared.Random;
|
||||
public sealed class WeightedRandomEntityPrototype : IWeightedRandomPrototype
|
||||
{
|
||||
[IdDataField]
|
||||
public string ID { get; } = default!;
|
||||
public string ID { get; private set; } = default!;
|
||||
|
||||
[DataField("weights", customTypeSerializer: typeof(PrototypeIdDictionarySerializer<float, EntityPrototype>))]
|
||||
public Dictionary<string, float> Weights { get; } = new();
|
||||
public Dictionary<string, float> Weights { get; private set; } = new();
|
||||
}
|
||||
|
||||
@@ -11,8 +11,8 @@ namespace Content.Shared.Random;
|
||||
public sealed class WeightedRandomOrePrototype : IWeightedRandomPrototype
|
||||
{
|
||||
[IdDataField]
|
||||
public string ID { get; } = default!;
|
||||
public string ID { get; private set; } = default!;
|
||||
|
||||
[DataField("weights", customTypeSerializer: typeof(PrototypeIdDictionarySerializer<float, OrePrototype>))]
|
||||
public Dictionary<string, float> Weights { get; } = new();
|
||||
public Dictionary<string, float> Weights { get; private set; } = new();
|
||||
}
|
||||
|
||||
@@ -9,8 +9,8 @@ namespace Content.Shared.Random;
|
||||
public sealed class WeightedRandomPrototype : IWeightedRandomPrototype
|
||||
{
|
||||
[IdDataField]
|
||||
public string ID { get; } = default!;
|
||||
public string ID { get; private set; } = default!;
|
||||
|
||||
[DataField("weights")]
|
||||
public Dictionary<string, float> Weights { get; } = new();
|
||||
public Dictionary<string, float> Weights { get; private set; } = new();
|
||||
}
|
||||
|
||||
@@ -11,8 +11,8 @@ namespace Content.Shared.Random;
|
||||
public sealed class WeightedRandomSpeciesPrototype : IWeightedRandomPrototype
|
||||
{
|
||||
[IdDataField]
|
||||
public string ID { get; } = default!;
|
||||
public string ID { get; private set; } = default!;
|
||||
|
||||
[DataField("weights", customTypeSerializer: typeof(PrototypeIdDictionarySerializer<float, SpeciesPrototype>))]
|
||||
public Dictionary<string, float> Weights { get; } = new();
|
||||
public Dictionary<string, float> Weights { get; private set; } = new();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user