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

@@ -5,7 +5,7 @@ using Robust.Shared.Serialization;
namespace Content.Shared.Atmos.Components;
[RegisterComponent, NetworkedComponent]
public sealed class GasAnalyzerComponent : Component
public sealed partial class GasAnalyzerComponent : Component
{
[ViewVariables]
public EntityUid? Target;

View File

@@ -6,7 +6,7 @@ using Robust.Shared.Utility;
namespace Content.Shared.Atmos.Components;
[RegisterComponent, NetworkedComponent]
public sealed class GasTileOverlayComponent : Component
public sealed partial class GasTileOverlayComponent : Component
{
/// <summary>
/// The tiles that have had their atmos data updated since last tick

View File

@@ -3,7 +3,7 @@ using Robust.Shared.Utility;
namespace Content.Shared.Atmos.Components;
[RegisterComponent]
public sealed class PipeAppearanceComponent : Component
public sealed partial class PipeAppearanceComponent : Component
{
[DataField("sprite")]
public SpriteSpecifier.Rsi Sprite = new(new("Structures/Piping/Atmospherics/pipe.rsi"), "pipeConnector");

View File

@@ -5,7 +5,7 @@ using Robust.Shared.Serialization;
namespace Content.Shared.Atmos.Components;
[NetworkedComponent]
public abstract class SharedMapAtmosphereComponent : Component
public abstract partial class SharedMapAtmosphereComponent : Component
{
[ViewVariables] public SharedGasTileOverlaySystem.GasOverlayData OverlayData;
}

View File

@@ -4,7 +4,7 @@ namespace Content.Shared.Atmos.Miasma;
/// Entities inside this container will not rot.
/// </summary>
[RegisterComponent]
public sealed class AntiRottingContainerComponent : Component
public sealed partial class AntiRottingContainerComponent : Component
{
}

View File

@@ -7,7 +7,7 @@ namespace Content.Shared.Atmos.Miasma;
/// It may be expanded to food at some point, but it's just for mobs right now.
/// </summary>
[RegisterComponent]
public sealed class PerishableComponent : Component
public sealed partial class PerishableComponent : Component
{
/// <summary>
/// How long it takes after death to start rotting.

View File

@@ -9,7 +9,7 @@ namespace Content.Shared.Atmos.Miasma;
/// Used by raw meat to turn into rotten meat.
/// </summary>
[RegisterComponent, NetworkedComponent]
public sealed class RotIntoComponent : Component
public sealed partial class RotIntoComponent : Component
{
/// <summary>
/// Entity to rot into.

View File

@@ -8,7 +8,7 @@ namespace Content.Shared.Atmos.Miasma;
/// Tracking component for stuff that has started to rot.
/// </summary>
[RegisterComponent, NetworkedComponent]
public sealed class RottingComponent : Component
public sealed partial class RottingComponent : Component
{
/// <summary>
/// Whether or not the rotting should deal damage

View File

@@ -8,26 +8,26 @@ namespace Content.Shared.Atmos.Monitor;
public sealed class AtmosAlarmThresholdPrototype : IPrototype
{
[IdDataField]
public string ID { get; } = default!;
public string ID { get; private set; } = default!;
[DataField("ignore")]
public readonly bool Ignore;
public bool Ignore;
[DataField("upperBound")]
public readonly AlarmThresholdSetting UpperBound = AlarmThresholdSetting.Disabled;
public AlarmThresholdSetting UpperBound = AlarmThresholdSetting.Disabled;
[DataField("lowerBound")]
public readonly AlarmThresholdSetting LowerBound = AlarmThresholdSetting.Disabled;
public AlarmThresholdSetting LowerBound = AlarmThresholdSetting.Disabled;
[DataField("upperWarnAround")]
public readonly AlarmThresholdSetting UpperWarningPercentage = AlarmThresholdSetting.Disabled;
public AlarmThresholdSetting UpperWarningPercentage = AlarmThresholdSetting.Disabled;
[DataField("lowerWarnAround")]
public readonly AlarmThresholdSetting LowerWarningPercentage = AlarmThresholdSetting.Disabled;
public AlarmThresholdSetting LowerWarningPercentage = AlarmThresholdSetting.Disabled;
}
[Serializable, NetSerializable, DataDefinition]
public sealed class AtmosAlarmThreshold
public sealed partial class AtmosAlarmThreshold
{
[DataField("ignore")]
public bool Ignore;
@@ -256,7 +256,7 @@ public sealed class AtmosAlarmThreshold
}
[DataDefinition, Serializable]
public readonly struct AlarmThresholdSetting
public readonly partial struct AlarmThresholdSetting
{
[DataField("enabled")]
public bool Enabled { get; init; } = true;

View File

@@ -14,7 +14,7 @@ namespace Content.Shared.Atmos.Prototypes
[ViewVariables]
[IdDataField]
public string ID { get; } = default!;
public string ID { get; private set; } = default!;
/// <summary>
/// Specific heat for gas.
@@ -39,7 +39,7 @@ namespace Content.Shared.Atmos.Prototypes
/// Minimum amount of moles for this gas to be visible.
/// </summary>
[DataField("gasMolesVisible")]
public float GasMolesVisible { get; } = 0.25f;
public float GasMolesVisible { get; private set; } = 0.25f;
/// <summary>
/// Visibility for this gas will be max after this value.
@@ -53,7 +53,7 @@ namespace Content.Shared.Atmos.Prototypes
/// If this reagent is in gas form, this is the path to the overlay that will be used to make the gas visible.
/// </summary>
[DataField("gasOverlayTexture")]
public string GasOverlayTexture { get; } = string.Empty;
public string GasOverlayTexture { get; private set; } = string.Empty;
/// <summary>
/// If this reagent is in gas form, this will be the path to the RSI sprite that will be used to make the gas visible.
@@ -71,15 +71,15 @@ namespace Content.Shared.Atmos.Prototypes
/// Path to the tile overlay used when this gas appears visible.
/// </summary>
[DataField("overlayPath")]
public string OverlayPath { get; } = string.Empty;
public string OverlayPath { get; private set; } = string.Empty;
/// <summary>
/// The reagent that this gas will turn into when inhaled.
/// </summary>
[DataField("reagent", customTypeSerializer:typeof(PrototypeIdSerializer<ReagentPrototype>))]
public string? Reagent { get; } = default!;
public string? Reagent { get; private set; } = default!;
[DataField("color")] public string Color { get; } = string.Empty;
[DataField("color")] public string Color { get; private set; } = string.Empty;
[DataField("pricePerMole")]
public float PricePerMole { get; set; } = 0;