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,6 +1,6 @@
namespace Content.Server.Chemistry.Components;
[RegisterComponent]
public sealed class ActiveSolutionHeaterComponent : Component
public sealed partial class ActiveSolutionHeaterComponent : Component
{
}

View File

@@ -10,7 +10,7 @@ namespace Content.Server.Chemistry.Components
/// </summary>
[RegisterComponent]
[Access(typeof(ChemMasterSystem))]
public sealed class ChemMasterComponent : Component
public sealed partial class ChemMasterComponent : Component
{
[DataField("pillType"), ViewVariables(VVAccess.ReadWrite)]
public uint PillType = 0;

View File

@@ -6,7 +6,7 @@ using Robust.Shared.Audio;
namespace Content.Server.Chemistry.Components
{
[RegisterComponent]
public sealed class HyposprayComponent : SharedHyposprayComponent
public sealed partial class HyposprayComponent : SharedHyposprayComponent
{
// TODO: This should be on clumsycomponent.
[DataField("clumsyFailChance")]

View File

@@ -9,7 +9,7 @@ namespace Content.Server.Chemistry.Components
/// containers, and can directly inject into a mobs bloodstream.
/// </summary>
[RegisterComponent]
public sealed class InjectorComponent : SharedInjectorComponent
public sealed partial class InjectorComponent : SharedInjectorComponent
{
public const string SolutionName = "injector";

View File

@@ -3,7 +3,7 @@
namespace Content.Server.Chemistry.Components
{
[RegisterComponent]
public sealed class MeleeChemicalInjectorComponent : Component
public sealed partial class MeleeChemicalInjectorComponent : Component
{
[ViewVariables(VVAccess.ReadWrite)]
[DataField("transferAmount")]

View File

@@ -11,7 +11,7 @@ namespace Content.Server.Chemistry.Components
/// </summary>
[RegisterComponent]
[Access(typeof(ReagentDispenserSystem))]
public sealed class ReagentDispenserComponent : Component
public sealed partial class ReagentDispenserComponent : Component
{
[DataField("pack", customTypeSerializer:typeof(PrototypeIdSerializer<ReagentDispenserInventoryPrototype>))]

View File

@@ -4,7 +4,7 @@
namespace Content.Server.Chemistry.Components
{
[RegisterComponent]
public sealed class ReagentTankComponent : Component
public sealed partial class ReagentTankComponent : Component
{
[DataField("transferAmount")]
[ViewVariables(VVAccess.ReadWrite)]

View File

@@ -11,7 +11,7 @@ namespace Content.Server.Chemistry.Components;
/// But specifically, this component deletes the entity and spawns in a new entity when the entity is exposed to a certain amount of a given reagent.
/// </summary>
[RegisterComponent, Access(typeof(RehydratableSystem))]
public sealed class RehydratableComponent : Component
public sealed partial class RehydratableComponent : Component
{
/// <summary>
/// The reagent that must be present to count as hydrated.

View File

@@ -8,7 +8,7 @@ namespace Content.Server.Chemistry.Components;
/// to entities that collide with it. Similar to <see cref="PuddleComponent"/>
/// </summary>
[RegisterComponent]
public sealed class SmokeComponent : Component
public sealed partial class SmokeComponent : Component
{
public const string SolutionName = "solutionArea";

View File

@@ -9,7 +9,7 @@ namespace Content.Server.Chemistry.Components;
/// When a <see cref="SmokeComponent"/> despawns this will spawn another entity in its place.
/// </summary>
[RegisterComponent, Access(typeof(SmokeSystem))]
public sealed class SmokeDissipateSpawnComponent : Component
public sealed partial class SmokeDissipateSpawnComponent : Component
{
[DataField("prototype", required: true, customTypeSerializer:typeof(PrototypeIdSerializer<EntityPrototype>))]
public string Prototype = string.Empty;

View File

@@ -1,7 +1,7 @@
namespace Content.Server.Chemistry.Components;
[RegisterComponent]
public sealed class SolutionHeaterComponent : Component
public sealed partial class SolutionHeaterComponent : Component
{
/// <summary>
/// How much heat is added per second to the solution, with no upgrades.

View File

@@ -7,7 +7,7 @@ namespace Content.Server.Chemistry.Components
/// On colliding with an entity that has a bloodstream will dump its solution onto them.
/// </summary>
[RegisterComponent]
internal sealed class SolutionInjectOnCollideComponent : Component
internal sealed partial class SolutionInjectOnCollideComponent : Component
{
[ViewVariables(VVAccess.ReadWrite)]

View File

@@ -4,7 +4,7 @@
/// Denotes the solution that can removed be with syringes.
/// </summary>
[RegisterComponent]
public sealed class DrawableSolutionComponent : Component
public sealed partial class DrawableSolutionComponent : Component
{
/// <summary>
/// Solution name that can be removed with syringes.

View File

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

View File

@@ -4,7 +4,7 @@
/// Denotes a solution which can be added with syringes.
/// </summary>
[RegisterComponent]
public sealed class InjectableSolutionComponent : Component
public sealed partial class InjectableSolutionComponent : Component
{
/// <summary>

View File

@@ -8,7 +8,7 @@ namespace Content.Server.Chemistry.Components.SolutionManager;
/// Fills a solution container randomly using a weighted random prototype
/// </summary>
[RegisterComponent, Access(typeof(SolutionRandomFillSystem))]
public sealed class RandomFillSolutionComponent : Component
public sealed partial class RandomFillSolutionComponent : Component
{
/// <summary>
/// Solution name which to add reagents to.

View File

@@ -5,10 +5,10 @@ namespace Content.Server.Chemistry.Components.SolutionManager
{
[RegisterComponent]
[Access(typeof(SolutionContainerSystem))]
public sealed class SolutionContainerManagerComponent : Component
public sealed partial class SolutionContainerManagerComponent : Component
{
[DataField("solutions")]
[Access(typeof(SolutionContainerSystem), Other = AccessPermissions.ReadExecute)] // FIXME Friends
public readonly Dictionary<string, Solution> Solutions = new();
public Dictionary<string, Solution> Solutions = new();
}
}

View File

@@ -11,7 +11,7 @@ namespace Content.Server.Chemistry.Components;
/// </summary>
[RegisterComponent]
[Access(typeof(SolutionPurgeSystem))]
public sealed class SolutionPurgeComponent : Component
public sealed partial class SolutionPurgeComponent : Component
{
/// <summary>
/// The name of the solution to detract from.

View File

@@ -11,7 +11,7 @@ namespace Content.Server.Chemistry.Components;
/// </summary>
[RegisterComponent]
[Access(typeof(SolutionRegenerationSystem))]
public sealed class SolutionRegenerationComponent : Component
public sealed partial class SolutionRegenerationComponent : Component
{
/// <summary>
/// The name of the solution to add to.

View File

@@ -1,30 +1,30 @@
namespace Content.Server.Chemistry.Components;
[RegisterComponent]
public sealed class SolutionSpikerComponent : Component
public sealed partial class SolutionSpikerComponent : Component
{
/// <summary>
/// The source solution to take the reagents from in order
/// to spike the other solution container.
/// </summary>
[DataField("sourceSolution")]
public string SourceSolution { get; } = string.Empty;
public string SourceSolution { get; private set; } = string.Empty;
/// <summary>
/// If spiking with this entity should ignore empty containers or not.
/// </summary>
[DataField("ignoreEmpty")]
public bool IgnoreEmpty { get; }
public bool IgnoreEmpty { get; private set; }
/// <summary>
/// What should pop up when spiking with this entity.
/// </summary>
[DataField("popup")]
public string Popup { get; } = "spike-solution-generic";
public string Popup { get; private set; } = "spike-solution-generic";
/// <summary>
/// What should pop up when spiking fails because the container was empty.
/// </summary>
[DataField("popupEmpty")]
public string PopupEmpty { get; } = "spike-solution-empty-generic";
public string PopupEmpty { get; private set; } = "spike-solution-empty-generic";
}

View File

@@ -12,7 +12,7 @@ namespace Content.Server.Chemistry.Components;
/// Should probably be joined with SolutionContainerVisualsComponent when solutions are networked.
/// </summary>
[RegisterComponent, Access(typeof(TransformableContainerSystem))]
public sealed class TransformableContainerComponent : Component
public sealed partial class TransformableContainerComponent : Component
{
/// <summary>
/// This is the initial metadata name for the container.

View File

@@ -3,7 +3,7 @@
namespace Content.Server.Chemistry.Components
{
[RegisterComponent]
public sealed class VaporComponent : Component
public sealed partial class VaporComponent : Component
{
public const string SolutionName = "vapor";