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 @@ namespace Content.Server.Construction.Completions
{
[UsedImplicitly]
[DataDefinition]
public sealed class AddContainer : IGraphAction
public sealed partial class AddContainer : IGraphAction
{
[DataField("container")] public string? Container { get; private set; }

View File

@@ -9,7 +9,7 @@ namespace Content.Server.Construction.Completions;
/// Generate an admin log upon reaching this node. Useful for dangerous construction (e.g., modular grenades)
/// </summary>
[UsedImplicitly]
public sealed class AdminLog : IGraphAction
public sealed partial class AdminLog : IGraphAction
{
[DataField("logType")]
public LogType LogType = LogType.Construction;

View File

@@ -7,7 +7,7 @@ namespace Content.Server.Construction.Completions;
[UsedImplicitly]
[DataDefinition]
public sealed class AppearanceChange : IGraphAction
public sealed partial class AppearanceChange : IGraphAction
{
/// <summary>
/// The appearance key to use.

View File

@@ -4,7 +4,7 @@ using Content.Shared.Construction;
namespace Content.Server.Construction.Completions;
[DataDefinition]
public sealed class AttemptElectrocute : IGraphAction
public sealed partial class AttemptElectrocute : IGraphAction
{
public void PerformAction(EntityUid uid, EntityUid? userUid, IEntityManager entityManager)
{

View File

@@ -15,7 +15,7 @@ namespace Content.Server.Construction.Completions;
/// for right now, the cell that was used in construction.
/// </summary>
[UsedImplicitly, DataDefinition]
public sealed class BuildMech : IGraphAction
public sealed partial class BuildMech : IGraphAction
{
[DataField("mechPrototype", required: true, customTypeSerializer: typeof(PrototypeIdSerializer<EntityPrototype>))]
public string MechPrototype = string.Empty;

View File

@@ -7,7 +7,7 @@ namespace Content.Server.Construction.Completions;
[UsedImplicitly]
[DataDefinition]
public sealed class ChangeWiresPanelSecurityLevel : IGraphAction
public sealed partial class ChangeWiresPanelSecurityLevel : IGraphAction
{
[DataField("level")]
[ValidatePrototypeId<WiresPanelSecurityLevelPrototype>]

View File

@@ -5,15 +5,15 @@ namespace Content.Server.Construction.Completions
{
[UsedImplicitly]
[DataDefinition]
public sealed class ConditionalAction : IGraphAction
public sealed partial class ConditionalAction : IGraphAction
{
[DataField("passUser")] public bool PassUser { get; }
[DataField("passUser")] public bool PassUser { get; private set; }
[DataField("condition", required:true)] public IGraphCondition? Condition { get; }
[DataField("condition", required:true)] public IGraphCondition? Condition { get; private set; }
[DataField("action", required:true)] public IGraphAction? Action { get; }
[DataField("action", required:true)] public IGraphAction? Action { get; private set; }
[DataField("else")] public IGraphAction? Else { get; }
[DataField("else")] public IGraphAction? Else { get; private set; }
public void PerformAction(EntityUid uid, EntityUid? userUid, IEntityManager entityManager)
{

View File

@@ -6,9 +6,9 @@ using Robust.Shared.Containers;
namespace Content.Server.Construction.Completions
{
[DataDefinition]
public sealed class DeleteEntitiesInContainer : IGraphAction
public sealed partial class DeleteEntitiesInContainer : IGraphAction
{
[DataField("container")] public string Container { get; } = string.Empty;
[DataField("container")] public string Container { get; private set; } = string.Empty;
public void PerformAction(EntityUid uid, EntityUid? userUid, IEntityManager entityManager)
{

View File

@@ -15,7 +15,7 @@ namespace Content.Server.Construction.Completions
[UsedImplicitly]
[DataDefinition]
public sealed class DeleteEntity : IGraphAction
public sealed partial class DeleteEntity : IGraphAction
{
public void PerformAction(EntityUid uid, EntityUid? userUid, IEntityManager entityManager)
{

View File

@@ -6,7 +6,7 @@ namespace Content.Server.Construction.Completions
{
[UsedImplicitly]
[DataDefinition]
public sealed class DestroyEntity : IGraphAction
public sealed partial class DestroyEntity : IGraphAction
{
public void PerformAction(EntityUid uid, EntityUid? userUid, IEntityManager entityManager)
{

View File

@@ -9,7 +9,7 @@ namespace Content.Server.Construction.Completions
{
[UsedImplicitly]
[DataDefinition]
public sealed class EmptyAllContainers : IGraphAction
public sealed partial class EmptyAllContainers : IGraphAction
{
/// <summary>
/// Whether or not the user should attempt to pick up the removed entities.

View File

@@ -9,7 +9,7 @@ namespace Content.Server.Construction.Completions
{
[UsedImplicitly]
[DataDefinition]
public sealed class EmptyContainer : IGraphAction
public sealed partial class EmptyContainer : IGraphAction
{
[DataField("container")] public string Container { get; private set; } = string.Empty;

View File

@@ -11,7 +11,7 @@ namespace Content.Server.Construction.Completions
{
[UsedImplicitly]
[DataDefinition]
public sealed class GivePrototype : IGraphAction
public sealed partial class GivePrototype : IGraphAction
{
[DataField("prototype", customTypeSerializer:typeof(PrototypeIdSerializer<EntityPrototype>))]
public string Prototype { get; private set; } = string.Empty;

View File

@@ -6,7 +6,7 @@ namespace Content.Server.Construction.Completions
{
[UsedImplicitly]
[DataDefinition]
public sealed class MachineFrameRegenerateProgress : IGraphAction
public sealed partial class MachineFrameRegenerateProgress : IGraphAction
{
public void PerformAction(EntityUid uid, EntityUid? userUid, IEntityManager entityManager)
{

View File

@@ -8,10 +8,10 @@ namespace Content.Server.Construction.Completions
{
[UsedImplicitly]
[DataDefinition]
public sealed class MoveContainer : IGraphAction
public sealed partial class MoveContainer : IGraphAction
{
[DataField("from")] public string? FromContainer { get; }
[DataField("to")] public string? ToContainer { get; }
[DataField("from")] public string? FromContainer { get; private set; }
[DataField("to")] public string? ToContainer { get; private set; }
public void PerformAction(EntityUid uid, EntityUid? userUid, IEntityManager entityManager)
{

View File

@@ -7,7 +7,7 @@ namespace Content.Server.Construction.Completions
{
[UsedImplicitly]
[DataDefinition]
public sealed class PlaySound : IGraphAction
public sealed partial class PlaySound : IGraphAction
{
[DataField("sound", required: true)] public SoundSpecifier Sound { get; private set; } = default!;

View File

@@ -5,9 +5,9 @@ using Robust.Shared.Player;
namespace Content.Server.Construction.Completions
{
[DataDefinition]
public sealed class PopupEveryone : IGraphAction
public sealed partial class PopupEveryone : IGraphAction
{
[DataField("text")] public string Text { get; } = string.Empty;
[DataField("text")] public string Text { get; private set; } = string.Empty;
public void PerformAction(EntityUid uid, EntityUid? userUid, IEntityManager entityManager)
{

View File

@@ -7,10 +7,10 @@ namespace Content.Server.Construction.Completions
{
[UsedImplicitly]
[DataDefinition]
public sealed class PopupUser : IGraphAction
public sealed partial class PopupUser : IGraphAction
{
[DataField("cursor")] public bool Cursor { get; }
[DataField("text")] public string Text { get; } = string.Empty;
[DataField("cursor")] public bool Cursor { get; private set; }
[DataField("text")] public string Text { get; private set; } = string.Empty;
public void PerformAction(EntityUid uid, EntityUid? userUid, IEntityManager entityManager)
{

View File

@@ -4,16 +4,16 @@ using JetBrains.Annotations;
namespace Content.Server.Construction.Completions
{
[UsedImplicitly]
public sealed class RaiseEvent : IGraphAction
public sealed partial class RaiseEvent : IGraphAction
{
[DataField("event", required:true)]
public EntityEventArgs? Event { get; }
public EntityEventArgs? Event { get; private set; }
[DataField("directed")]
public bool Directed { get; } = true;
public bool Directed { get; private set; } = true;
[DataField("broadcast")]
public bool Broadcast { get; } = true;
public bool Broadcast { get; private set; } = true;
public void PerformAction(EntityUid uid, EntityUid? userUid, IEntityManager entityManager)
{

View File

@@ -5,7 +5,7 @@ namespace Content.Server.Construction.Completions
{
[UsedImplicitly]
[DataDefinition]
public sealed class SetAnchor : IGraphAction
public sealed partial class SetAnchor : IGraphAction
{
[DataField("value")] public bool Value { get; private set; } = true;

View File

@@ -6,9 +6,9 @@ namespace Content.Server.Construction.Completions
{
[UsedImplicitly]
[DataDefinition]
public sealed class SetStackCount : IGraphAction
public sealed partial class SetStackCount : IGraphAction
{
[DataField("amount")] public int Amount { get; } = 1;
[DataField("amount")] public int Amount { get; private set; } = 1;
public void PerformAction(EntityUid uid, EntityUid? userUid, IEntityManager entityManager)
{

View File

@@ -6,7 +6,7 @@ namespace Content.Server.Construction.Completions
{
[UsedImplicitly]
[DataDefinition]
public sealed class SnapToGrid : IGraphAction
public sealed partial class SnapToGrid : IGraphAction
{
[DataField("southRotation")] public bool SouthRotation { get; private set; }

View File

@@ -10,7 +10,7 @@ namespace Content.Server.Construction.Completions
{
[UsedImplicitly]
[DataDefinition]
public sealed class SpawnPrototype : IGraphAction
public sealed partial class SpawnPrototype : IGraphAction
{
[DataField("prototype", customTypeSerializer:typeof(PrototypeIdSerializer<EntityPrototype>))]
public string Prototype { get; private set; } = string.Empty;

View File

@@ -7,11 +7,11 @@ namespace Content.Server.Construction.Completions
{
[UsedImplicitly]
[DataDefinition]
public sealed class SpawnPrototypeAtContainer : IGraphAction
public sealed partial class SpawnPrototypeAtContainer : IGraphAction
{
[DataField("prototype")] public string Prototype { get; } = string.Empty;
[DataField("container")] public string Container { get; } = string.Empty;
[DataField("amount")] public int Amount { get; } = 1;
[DataField("prototype")] public string Prototype { get; private set; } = string.Empty;
[DataField("container")] public string Container { get; private set; } = string.Empty;
[DataField("amount")] public int Amount { get; private set; } = 1;
public void PerformAction(EntityUid uid, EntityUid? userUid, IEntityManager entityManager)
{

View File

@@ -8,7 +8,7 @@ namespace Content.Server.Construction.Completions
{
[UsedImplicitly]
[DataDefinition]
public sealed class VisualizerDataInt : IGraphAction
public sealed partial class VisualizerDataInt : IGraphAction
{
[DataField("key")] public string Key { get; private set; } = string.Empty;
[DataField("data")] public int Data { get; private set; } = 0;