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;
|
||||
|
||||
@@ -9,7 +9,7 @@ namespace Content.Server.Power.Generation.Teg;
|
||||
/// <seealso cref="TegSystem"/>
|
||||
[RegisterComponent]
|
||||
[Access(typeof(TegSystem))]
|
||||
public sealed class TegCirculatorComponent : Component
|
||||
public sealed partial class TegCirculatorComponent : Component
|
||||
{
|
||||
/// <summary>
|
||||
/// The difference between the inlet and outlet pressure at the start of the previous tick.
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
/// <seealso cref="TegSystem"/>
|
||||
[RegisterComponent]
|
||||
[Access(typeof(TegSystem))]
|
||||
public sealed class TegGeneratorComponent : Component
|
||||
public sealed partial class TegGeneratorComponent : Component
|
||||
{
|
||||
/// <summary>
|
||||
/// When transferring energy from the hot to cold side,
|
||||
|
||||
@@ -117,7 +117,7 @@ public sealed class TegNodeGroup : BaseNodeGroup
|
||||
/// <seealso cref="TegNodeGroup"/>
|
||||
/// <seealso cref="TegGeneratorComponent"/>
|
||||
[DataDefinition]
|
||||
public sealed class TegNodeGenerator : Node
|
||||
public sealed partial class TegNodeGenerator : Node
|
||||
{
|
||||
public override IEnumerable<Node> GetReachableNodes(
|
||||
TransformComponent xform,
|
||||
@@ -169,7 +169,7 @@ public sealed class TegNodeGenerator : Node
|
||||
/// <seealso cref="TegNodeGroup"/>
|
||||
/// <seealso cref="TegCirculatorComponent"/>
|
||||
[DataDefinition]
|
||||
public sealed class TegNodeCirculator : Node
|
||||
public sealed partial class TegNodeCirculator : Node
|
||||
{
|
||||
public override IEnumerable<Node> GetReachableNodes(
|
||||
TransformComponent xform,
|
||||
|
||||
@@ -8,7 +8,7 @@ namespace Content.Server.Power.Generator;
|
||||
/// This is used for chemical fuel input into generators.
|
||||
/// </summary>
|
||||
[RegisterComponent, Access(typeof(GeneratorSystem))]
|
||||
public sealed class ChemicalFuelGeneratorAdapterComponent : Component
|
||||
public sealed partial class ChemicalFuelGeneratorAdapterComponent : Component
|
||||
{
|
||||
/// <summary>
|
||||
/// The acceptable list of input entities.
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
/// This is used for stuff that can directly be shoved into a generator.
|
||||
/// </summary>
|
||||
[RegisterComponent, Access(typeof(GeneratorSystem))]
|
||||
public sealed class ChemicalFuelGeneratorDirectSourceComponent : Component
|
||||
public sealed partial class ChemicalFuelGeneratorDirectSourceComponent : Component
|
||||
{
|
||||
/// <summary>
|
||||
/// The solution to pull fuel material from.
|
||||
|
||||
@@ -7,7 +7,7 @@ namespace Content.Server.Power.Generator;
|
||||
/// This is used for providing gas power to machinery.
|
||||
/// </summary>
|
||||
[RegisterComponent, Access(typeof(GasPowerReceiverSystem))]
|
||||
public sealed class GasPowerReceiverComponent : Component
|
||||
public sealed partial class GasPowerReceiverComponent : Component
|
||||
{
|
||||
/// <summary>
|
||||
/// Past this temperature we assume we're in reaction mass mode and not magic mode.
|
||||
|
||||
@@ -7,7 +7,7 @@ namespace Content.Server.Power.Generator;
|
||||
/// This is used for allowing you to insert fuel into gens.
|
||||
/// </summary>
|
||||
[RegisterComponent, Access(typeof(GeneratorSystem))]
|
||||
public sealed class SolidFuelGeneratorAdapterComponent : Component
|
||||
public sealed partial class SolidFuelGeneratorAdapterComponent : Component
|
||||
{
|
||||
/// <summary>
|
||||
/// The material to accept as fuel.
|
||||
|
||||
@@ -24,7 +24,7 @@ namespace Content.Server.Power.NodeGroups
|
||||
|
||||
[NodeGroup(NodeGroupID.Apc)]
|
||||
[UsedImplicitly]
|
||||
public sealed class ApcNet : BaseNetConnectorNodeGroup<IApcNet>, IApcNet
|
||||
public sealed partial class ApcNet : BaseNetConnectorNodeGroup<IApcNet>, IApcNet
|
||||
{
|
||||
private PowerNetSystem? _powerNetSystem;
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ namespace Content.Server.Power.NodeGroups
|
||||
|
||||
[NodeGroup(NodeGroupID.HVPower, NodeGroupID.MVPower)]
|
||||
[UsedImplicitly]
|
||||
public sealed class PowerNet : BaseNetConnectorNodeGroup<IPowerNet>, IPowerNet
|
||||
public sealed partial class PowerNet : BaseNetConnectorNodeGroup<IPowerNet>, IPowerNet
|
||||
{
|
||||
private PowerNetSystem? _powerNetSystem;
|
||||
private IEntityManager? _entMan;
|
||||
|
||||
@@ -10,7 +10,7 @@ namespace Content.Server.Power.Nodes
|
||||
/// </summary>
|
||||
[DataDefinition]
|
||||
[Virtual]
|
||||
public class CableDeviceNode : Node
|
||||
public partial class CableDeviceNode : Node
|
||||
{
|
||||
public override IEnumerable<Node> GetReachableNodes(TransformComponent xform,
|
||||
EntityQuery<NodeContainerComponent> nodeQuery,
|
||||
|
||||
@@ -6,7 +6,7 @@ using Robust.Shared.Map.Components;
|
||||
namespace Content.Server.Power.Nodes
|
||||
{
|
||||
[DataDefinition]
|
||||
public sealed class CableNode : Node
|
||||
public sealed partial class CableNode : Node
|
||||
{
|
||||
public override IEnumerable<Node> GetReachableNodes(TransformComponent xform,
|
||||
EntityQuery<NodeContainerComponent> nodeQuery,
|
||||
|
||||
@@ -6,7 +6,7 @@ using Robust.Shared.Map.Components;
|
||||
namespace Content.Server.Power.Nodes
|
||||
{
|
||||
[DataDefinition]
|
||||
public sealed class CableTerminalNode : CableDeviceNode
|
||||
public sealed partial class CableTerminalNode : CableDeviceNode
|
||||
{
|
||||
public override IEnumerable<Node> GetReachableNodes(TransformComponent xform,
|
||||
EntityQuery<NodeContainerComponent> nodeQuery,
|
||||
|
||||
@@ -6,7 +6,7 @@ using Robust.Shared.Map.Components;
|
||||
namespace Content.Server.Power.Nodes
|
||||
{
|
||||
[DataDefinition]
|
||||
public sealed class CableTerminalPortNode : Node
|
||||
public sealed partial class CableTerminalPortNode : Node
|
||||
{
|
||||
public override IEnumerable<Node> GetReachableNodes(TransformComponent xform,
|
||||
EntityQuery<NodeContainerComponent> nodeQuery,
|
||||
|
||||
@@ -8,7 +8,7 @@ namespace Content.Server.Power;
|
||||
|
||||
// Generic power wire action. Use on anything
|
||||
// that requires power.
|
||||
public sealed class PowerWireAction : BaseWireAction
|
||||
public sealed partial class PowerWireAction : BaseWireAction
|
||||
{
|
||||
public override Color Color { get; set; } = Color.Red;
|
||||
public override string Name { get; set; } = "wire-name-power";
|
||||
|
||||
@@ -10,7 +10,7 @@ namespace Content.Server.Power.SMES;
|
||||
/// Code interfacing with the powernet is handled in <see cref="BatteryStorageComponent"/> and <see cref="BatteryDischargerComponent"/>.
|
||||
/// </summary>
|
||||
[RegisterComponent, Access(typeof(SmesSystem))]
|
||||
public sealed class SmesComponent : Component
|
||||
public sealed partial class SmesComponent : Component
|
||||
{
|
||||
[ViewVariables]
|
||||
public ChargeState LastChargeState;
|
||||
|
||||
Reference in New Issue
Block a user