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

@@ -1,7 +1,7 @@
namespace Content.Server.Power.Components
{
[RegisterComponent]
public sealed class ActivatableUIRequiresPowerComponent : Component
public sealed partial class ActivatableUIRequiresPowerComponent : Component
{
}
}

View File

@@ -4,7 +4,7 @@ using Content.Shared.Power;
namespace Content.Server.Power.Components
{
[RegisterComponent]
public sealed class ActiveChargerComponent : Component
public sealed partial class ActiveChargerComponent : Component
{
}
}

View File

@@ -5,7 +5,7 @@ using Robust.Shared.Audio;
namespace Content.Server.Power.Components;
[RegisterComponent]
public sealed class ApcComponent : BaseApcNetComponent
public sealed partial class ApcComponent : BaseApcNetComponent
{
[DataField("onReceiveMessageSound")]
public SoundSpecifier OnReceiveMessageSound = new SoundPathSpecifier("/Audio/Machines/machine_switch.ogg");

View File

@@ -6,6 +6,6 @@ namespace Content.Server.Power.Components
/// This object is an APC electronics, used for constructing APCs
/// </summary>
[RegisterComponent]
public sealed class ApcElectronicsComponent : Component
public sealed partial class ApcElectronicsComponent : Component
{ }
}

View File

@@ -4,7 +4,7 @@ namespace Content.Server.Power.Components
{
[RegisterComponent]
[ComponentProtoName("PowerProvider")]
public sealed class ApcPowerProviderComponent : BaseApcNetComponent
public sealed partial class ApcPowerProviderComponent : BaseApcNetComponent
{
[ViewVariables] public List<ApcPowerReceiverComponent> LinkedReceivers { get; } = new();

View File

@@ -8,7 +8,7 @@ namespace Content.Server.Power.Components
/// so that it can receive power from a <see cref="IApcNet"/>.
/// </summary>
[RegisterComponent]
public sealed class ApcPowerReceiverComponent : Component
public sealed partial class ApcPowerReceiverComponent : Component
{
[ViewVariables]
public bool Powered => (MathHelper.CloseToPercent(NetworkLoad.ReceivingPower, Load) || !NeedsPower) && !PowerDisabled;

View File

@@ -2,7 +2,7 @@ using Content.Server.Power.NodeGroups;
namespace Content.Server.Power.Components
{
public abstract class BaseApcNetComponent : BaseNetConnectorComponent<IApcNet>
public abstract partial class BaseApcNetComponent : BaseNetConnectorComponent<IApcNet>
{
}
}

View File

@@ -12,7 +12,7 @@ namespace Content.Server.Power.Components
public string? NodeId { get; }
}
public abstract class BaseNetConnectorComponent<TNetType> : Component, IBaseNetConnectorComponent<TNetType>
public abstract partial class BaseNetConnectorComponent<TNetType> : Component, IBaseNetConnectorComponent<TNetType>
{
[Dependency] private readonly IEntityManager _entMan = default!;

View File

@@ -7,7 +7,7 @@ namespace Content.Server.Power.Components
}
public abstract class BasePowerNetComponent : BaseNetConnectorComponent<IPowerNet>
public abstract partial class BasePowerNetComponent : BaseNetConnectorComponent<IPowerNet>
{
}
}

View File

@@ -6,7 +6,7 @@ namespace Content.Server.Power.Components
/// Connects the loading side of a <see cref="BatteryComponent"/> to a non-APC power network.
/// </summary>
[RegisterComponent]
public sealed class BatteryChargerComponent : BasePowerNetComponent
public sealed partial class BatteryChargerComponent : BasePowerNetComponent
{
protected override void AddSelfToNet(IPowerNet net)
{

View File

@@ -7,7 +7,7 @@ namespace Content.Server.Power.Components
/// </summary>
[RegisterComponent]
[Virtual]
public class BatteryComponent : Component
public partial class BatteryComponent : Component
{
[Dependency] private readonly IEntityManager _entMan = default!;
public string SolutionName = "battery";

View File

@@ -3,7 +3,7 @@
namespace Content.Server.Power.Components
{
[RegisterComponent]
public sealed class BatteryDischargerComponent : BasePowerNetComponent
public sealed partial class BatteryDischargerComponent : BasePowerNetComponent
{
protected override void AddSelfToNet(IPowerNet net)
{

View File

@@ -4,7 +4,7 @@ namespace Content.Server.Power.Components
/// Self-recharging battery.
/// </summary>
[RegisterComponent]
public sealed class BatterySelfRechargerComponent : Component
public sealed partial class BatterySelfRechargerComponent : Component
{
[ViewVariables(VVAccess.ReadWrite)] [DataField("autoRecharge")] public bool AutoRecharge { get; set; }

View File

@@ -10,10 +10,10 @@ namespace Content.Server.Power.Components
/// </summary>
[RegisterComponent]
[Access(typeof(CableSystem))]
public sealed class CableComponent : Component
public sealed partial class CableComponent : Component
{
[DataField("cableDroppedOnCutPrototype", customTypeSerializer: typeof(PrototypeIdSerializer<EntityPrototype>))]
public readonly string CableDroppedOnCutPrototype = "CableHVStack1";
public string CableDroppedOnCutPrototype = "CableHVStack1";
[DataField("cuttingQuality", customTypeSerializer:typeof(PrototypeIdSerializer<ToolQualityPrototype>))]
public string CuttingQuality = "Cutting";

View File

@@ -4,7 +4,7 @@ using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototy
namespace Content.Server.Power.Components
{
[RegisterComponent]
public sealed class CablePlacerComponent : Component
public sealed partial class CablePlacerComponent : Component
{
[DataField("cablePrototypeID", customTypeSerializer:typeof(PrototypeIdSerializer<EntityPrototype>))]
public string? CablePrototypeId = "CableHV";

View File

@@ -1,7 +1,7 @@
namespace Content.Server.Power.Components
{
[RegisterComponent]
public sealed class CableVisComponent : Component
public sealed partial class CableVisComponent : Component
{
[ViewVariables(VVAccess.ReadWrite)]
[DataField("node")]

View File

@@ -6,7 +6,7 @@ using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototy
namespace Content.Server.Power.Components
{
[RegisterComponent]
public sealed class ChargerComponent : Component
public sealed partial class ChargerComponent : Component
{
[ViewVariables]
public CellChargerStatus Status;

View File

@@ -1,6 +1,6 @@
namespace Content.Server.Power.Components
{
[RegisterComponent]
public sealed class ExaminableBatteryComponent : Component
public sealed partial class ExaminableBatteryComponent : Component
{}
}

View File

@@ -4,7 +4,7 @@ namespace Content.Server.Power.Components
{
[RegisterComponent]
[Access(typeof(ExtensionCableSystem))]
public sealed class ExtensionCableProviderComponent : Component
public sealed partial class ExtensionCableProviderComponent : Component
{
/// <summary>
/// The max distance this can connect to <see cref="ExtensionCableReceiverComponent"/>s from.

View File

@@ -4,7 +4,7 @@ namespace Content.Server.Power.Components
{
[RegisterComponent]
[Access(typeof(ExtensionCableSystem))]
public sealed class ExtensionCableReceiverComponent : Component
public sealed partial class ExtensionCableReceiverComponent : Component
{
[ViewVariables]
public ExtensionCableProviderComponent? Provider { get; set; }

View File

@@ -7,7 +7,7 @@ namespace Content.Server.Power.Components
/// Draws power directly from an MV or HV wire it is on top of.
/// </summary>
[RegisterComponent]
public sealed class PowerConsumerComponent : BaseNetConnectorComponent<IBasePowerNet>
public sealed partial class PowerConsumerComponent : BaseNetConnectorComponent<IBasePowerNet>
{
/// <summary>
/// How much power this needs to be fully powered.

View File

@@ -1,7 +1,7 @@
namespace Content.Server.Power.Components;
[RegisterComponent]
public sealed class PowerMonitoringConsoleComponent : Component
public sealed partial class PowerMonitoringConsoleComponent : Component
{
}

View File

@@ -10,7 +10,7 @@ namespace Content.Server.Power.Components
/// and battery storage should be handed off to components like <see cref="BatteryComponent"/>.
/// </remarks>
[RegisterComponent]
public sealed class PowerNetworkBatteryComponent : Component
public sealed partial class PowerNetworkBatteryComponent : Component
{
[ViewVariables] public float LastSupply = 0f;

View File

@@ -4,7 +4,7 @@ using Content.Server.Power.Pow3r;
namespace Content.Server.Power.Components
{
[RegisterComponent]
public sealed class PowerSupplierComponent : BasePowerNetComponent
public sealed partial class PowerSupplierComponent : BasePowerNetComponent
{
[ViewVariables(VVAccess.ReadWrite)]
[DataField("supplyRate")]

View File

@@ -4,6 +4,6 @@ namespace Content.Server.Power.Components
/// Provides an alt verb to toggle power.
/// </summary>
[RegisterComponent]
public sealed class PowerSwitchComponent : Component
public sealed partial class PowerSwitchComponent : Component
{}
}

View File

@@ -1,7 +1,7 @@
namespace Content.Server.Power.Components;
[RegisterComponent]
public sealed class RiggableComponent : Component
public sealed partial class RiggableComponent : Component
{
public const string SolutionName = "battery";

View File

@@ -5,7 +5,7 @@ namespace Content.Server.Power.Components
{
[RegisterComponent]
public sealed class UpgradeBatteryComponent : Component
public sealed partial class UpgradeBatteryComponent : Component
{
/// <summary>
/// The machine part that affects the power capacity.

View File

@@ -9,7 +9,7 @@ namespace Content.Server.Power.Components;
/// can be decreased through machine part upgrades.
/// </summary>
[RegisterComponent]
public sealed class UpgradePowerDrawComponent : Component
public sealed partial class UpgradePowerDrawComponent : Component
{
/// <summary>
/// The base power draw of the machine.

View File

@@ -5,7 +5,7 @@ using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototy
namespace Content.Server.Power.Components;
[RegisterComponent]
public sealed class UpgradePowerSupplierComponent : Component
public sealed partial class UpgradePowerSupplierComponent : Component
{
[ViewVariables(VVAccess.ReadWrite)]
public float BaseSupplyRate;