Refactor serialization copying to use source generators (#19412)
This commit is contained in:
@@ -3,7 +3,7 @@ using Robust.Shared.Utility;
|
||||
|
||||
namespace Content.Shared.Construction.Steps
|
||||
{
|
||||
public abstract class ArbitraryInsertConstructionGraphStep : EntityInsertConstructionGraphStep
|
||||
public abstract partial class ArbitraryInsertConstructionGraphStep : EntityInsertConstructionGraphStep
|
||||
{
|
||||
[DataField("name")] public string Name { get; private set; } = string.Empty;
|
||||
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
namespace Content.Shared.Construction.Steps
|
||||
{
|
||||
[DataDefinition]
|
||||
public sealed class ComponentConstructionGraphStep : ArbitraryInsertConstructionGraphStep
|
||||
public sealed partial class ComponentConstructionGraphStep : ArbitraryInsertConstructionGraphStep
|
||||
{
|
||||
[DataField("component")] public string Component { get; } = string.Empty;
|
||||
[DataField("component")] public string Component { get; private set; } = string.Empty;
|
||||
|
||||
public override bool EntityValid(EntityUid uid, IEntityManager entityManager, IComponentFactory compFactory)
|
||||
{
|
||||
|
||||
@@ -4,11 +4,11 @@ namespace Content.Shared.Construction.Steps
|
||||
{
|
||||
[Serializable]
|
||||
[ImplicitDataDefinitionForInheritors]
|
||||
public abstract class ConstructionGraphStep
|
||||
public abstract partial class ConstructionGraphStep
|
||||
{
|
||||
[DataField("completed", serverOnly: true)] private IGraphAction[] _completed = Array.Empty<IGraphAction>();
|
||||
|
||||
[DataField("doAfter")] public float DoAfter { get; }
|
||||
[DataField("doAfter")] public float DoAfter { get; private set; }
|
||||
|
||||
public IReadOnlyList<IGraphAction> Completed => _completed;
|
||||
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
namespace Content.Shared.Construction.Steps
|
||||
{
|
||||
[ImplicitDataDefinitionForInheritors]
|
||||
public abstract class EntityInsertConstructionGraphStep : ConstructionGraphStep
|
||||
public abstract partial class EntityInsertConstructionGraphStep : ConstructionGraphStep
|
||||
{
|
||||
[DataField("store")] public string Store { get; } = string.Empty;
|
||||
[DataField("store")] public string Store { get; private set; } = string.Empty;
|
||||
|
||||
public abstract bool EntityValid(EntityUid uid, IEntityManager entityManager, IComponentFactory compFactory);
|
||||
}
|
||||
|
||||
@@ -7,14 +7,14 @@ using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototy
|
||||
namespace Content.Shared.Construction.Steps
|
||||
{
|
||||
[DataDefinition]
|
||||
public sealed class MaterialConstructionGraphStep : EntityInsertConstructionGraphStep
|
||||
public sealed partial class MaterialConstructionGraphStep : EntityInsertConstructionGraphStep
|
||||
{
|
||||
// TODO: Make this use the material system.
|
||||
// TODO TODO: Make the material system not shit.
|
||||
[DataField("material", required:true, customTypeSerializer:typeof(PrototypeIdSerializer<StackPrototype>))]
|
||||
public string MaterialPrototypeId { get; } = "Steel";
|
||||
public string MaterialPrototypeId { get; private set; } = "Steel";
|
||||
|
||||
[DataField("amount")] public int Amount { get; } = 1;
|
||||
[DataField("amount")] public int Amount { get; private set; } = 1;
|
||||
|
||||
public override void DoExamine(ExaminedEvent examinedEvent)
|
||||
{
|
||||
|
||||
@@ -2,7 +2,7 @@ using Content.Shared.Tag;
|
||||
|
||||
namespace Content.Shared.Construction.Steps
|
||||
{
|
||||
public sealed class MultipleTagsConstructionGraphStep : ArbitraryInsertConstructionGraphStep
|
||||
public sealed partial class MultipleTagsConstructionGraphStep : ArbitraryInsertConstructionGraphStep
|
||||
{
|
||||
[DataField("allTags")]
|
||||
private List<string>? _allTags;
|
||||
|
||||
@@ -5,7 +5,7 @@ using JetBrains.Annotations;
|
||||
namespace Content.Shared.Construction.Steps;
|
||||
|
||||
[DataDefinition]
|
||||
public sealed class PartAssemblyConstructionGraphStep : ConstructionGraphStep
|
||||
public sealed partial class PartAssemblyConstructionGraphStep : ConstructionGraphStep
|
||||
{
|
||||
/// <summary>
|
||||
/// A valid ID on <see cref="PartAssemblyComponent"/>'s dictionary of strings to part lists.
|
||||
|
||||
@@ -3,7 +3,7 @@ using Content.Shared.Tag;
|
||||
namespace Content.Shared.Construction.Steps
|
||||
{
|
||||
[DataDefinition]
|
||||
public sealed class TagConstructionGraphStep : ArbitraryInsertConstructionGraphStep
|
||||
public sealed partial class TagConstructionGraphStep : ArbitraryInsertConstructionGraphStep
|
||||
{
|
||||
[DataField("tag")]
|
||||
private string? _tag;
|
||||
|
||||
@@ -6,7 +6,7 @@ using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototy
|
||||
namespace Content.Shared.Construction.Steps
|
||||
{
|
||||
[DataDefinition]
|
||||
public sealed class TemperatureConstructionGraphStep : ConstructionGraphStep
|
||||
public sealed partial class TemperatureConstructionGraphStep : ConstructionGraphStep
|
||||
{
|
||||
[DataField("minTemperature")]
|
||||
public float? MinTemperature;
|
||||
|
||||
@@ -6,14 +6,14 @@ using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototy
|
||||
namespace Content.Shared.Construction.Steps
|
||||
{
|
||||
[DataDefinition]
|
||||
public sealed class ToolConstructionGraphStep : ConstructionGraphStep
|
||||
public sealed partial class ToolConstructionGraphStep : ConstructionGraphStep
|
||||
{
|
||||
[DataField("tool", required:true, customTypeSerializer:typeof(PrototypeIdSerializer<ToolQualityPrototype>))]
|
||||
public string Tool { get; } = string.Empty;
|
||||
public string Tool { get; private set; } = string.Empty;
|
||||
|
||||
[DataField("fuel")] public float Fuel { get; } = 10;
|
||||
[DataField("fuel")] public float Fuel { get; private set; } = 10;
|
||||
|
||||
[DataField("examine")] public string ExamineOverride { get; } = string.Empty;
|
||||
[DataField("examine")] public string ExamineOverride { get; private set; } = string.Empty;
|
||||
|
||||
public override void DoExamine(ExaminedEvent examinedEvent)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user