Refactor serialization copying to use source generators (#19412)
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
namespace Content.Server.Power.Components
|
||||
{
|
||||
[RegisterComponent]
|
||||
public sealed class ActivatableUIRequiresPowerComponent : Component
|
||||
public sealed partial class ActivatableUIRequiresPowerComponent : Component
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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");
|
||||
|
||||
@@ -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
|
||||
{ }
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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>
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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!;
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ namespace Content.Server.Power.Components
|
||||
|
||||
}
|
||||
|
||||
public abstract class BasePowerNetComponent : BaseNetConnectorComponent<IPowerNet>
|
||||
public abstract partial class BasePowerNetComponent : BaseNetConnectorComponent<IPowerNet>
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
@@ -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";
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
@@ -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; }
|
||||
|
||||
|
||||
@@ -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";
|
||||
|
||||
@@ -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";
|
||||
|
||||
@@ -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")]
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
namespace Content.Server.Power.Components
|
||||
{
|
||||
[RegisterComponent]
|
||||
public sealed class ExaminableBatteryComponent : Component
|
||||
public sealed partial class ExaminableBatteryComponent : Component
|
||||
{}
|
||||
}
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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; }
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
namespace Content.Server.Power.Components;
|
||||
|
||||
[RegisterComponent]
|
||||
public sealed class PowerMonitoringConsoleComponent : Component
|
||||
public sealed partial class PowerMonitoringConsoleComponent : Component
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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")]
|
||||
|
||||
@@ -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
|
||||
{}
|
||||
}
|
||||
|
||||
@@ -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";
|
||||
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user