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

@@ -4,7 +4,7 @@ namespace Content.Server.Destructible.Thresholds.Behaviors
{
[Serializable]
[DataDefinition]
public sealed class ChangeConstructionNodeBehavior : IThresholdBehavior
public sealed partial class ChangeConstructionNodeBehavior : IThresholdBehavior
{
[DataField("node")]
public string Node { get; private set; } = string.Empty;

View File

@@ -2,7 +2,7 @@
{
[Serializable]
[DataDefinition]
public sealed class DoActsBehavior : IThresholdBehavior
public sealed partial class DoActsBehavior : IThresholdBehavior
{
/// <summary>
/// What acts should be triggered upon activation.

View File

@@ -4,7 +4,7 @@ namespace Content.Server.Destructible.Thresholds.Behaviors
{
[Serializable]
[DataDefinition]
public sealed class DumpCanisterBehavior : IThresholdBehavior
public sealed partial class DumpCanisterBehavior : IThresholdBehavior
{
public void Execute(EntityUid owner, DestructibleSystem system, EntityUid? cause = null)
{

View File

@@ -11,7 +11,7 @@ namespace Content.Server.Destructible.Thresholds.Behaviors
/// </summary>
[Serializable]
[DataDefinition]
public sealed class DumpRestockInventory: IThresholdBehavior
public sealed partial class DumpRestockInventory: IThresholdBehavior
{
/// <summary>
/// The percent of each inventory entry that will be salvaged

View File

@@ -8,7 +8,7 @@ namespace Content.Server.Destructible.Thresholds.Behaviors
/// </summary>
[Serializable]
[DataDefinition]
public sealed class EjectVendorItems : IThresholdBehavior
public sealed partial class EjectVendorItems : IThresholdBehavior
{
/// <summary>
/// The percent amount of the total inventory that will be ejected.

View File

@@ -6,7 +6,7 @@ namespace Content.Server.Destructible.Thresholds.Behaviors
/// Drop all items from all containers
/// </summary>
[DataDefinition]
public sealed class EmptyAllContainersBehaviour : IThresholdBehavior
public sealed partial class EmptyAllContainersBehaviour : IThresholdBehavior
{
public void Execute(EntityUid owner, DestructibleSystem system, EntityUid? cause = null)
{

View File

@@ -7,7 +7,7 @@ namespace Content.Server.Destructible.Thresholds.Behaviors
/// Drop all items from specified containers
/// </summary>
[DataDefinition]
public sealed class EmptyContainersBehaviour : IThresholdBehavior
public sealed partial class EmptyContainersBehaviour : IThresholdBehavior
{
[DataField("containers")]
public List<string> Containers = new();

View File

@@ -8,7 +8,7 @@ namespace Content.Server.Destructible.Thresholds.Behaviors
/// </summary>
[UsedImplicitly]
[DataDefinition]
public sealed class ExplodeBehavior : IThresholdBehavior
public sealed partial class ExplodeBehavior : IThresholdBehavior
{
public void Execute(EntityUid owner, DestructibleSystem system, EntityUid? cause = null)
{

View File

@@ -5,7 +5,7 @@ namespace Content.Server.Destructible.Thresholds.Behaviors
{
[UsedImplicitly]
[DataDefinition]
public sealed class GibBehavior : IThresholdBehavior
public sealed partial class GibBehavior : IThresholdBehavior
{
[DataField("recursive")] private bool _recursive = true;

View File

@@ -6,7 +6,7 @@ namespace Content.Server.Destructible.Thresholds.Behaviors
{
[Serializable]
[DataDefinition]
public sealed class PlaySoundBehavior : IThresholdBehavior
public sealed partial class PlaySoundBehavior : IThresholdBehavior
{
/// <summary>
/// Sound played upon destruction.

View File

@@ -11,7 +11,7 @@ namespace Content.Server.Destructible.Thresholds.Behaviors
/// </summary>
[UsedImplicitly]
[DataDefinition]
public sealed class SolutionExplosionBehavior : IThresholdBehavior
public sealed partial class SolutionExplosionBehavior : IThresholdBehavior
{
[DataField("solution", required: true)]
public string Solution = default!;

View File

@@ -11,7 +11,7 @@ namespace Content.Server.Destructible.Thresholds.Behaviors
{
[Serializable]
[DataDefinition]
public sealed class SpawnEntitiesBehavior : IThresholdBehavior
public sealed partial class SpawnEntitiesBehavior : IThresholdBehavior
{
/// <summary>
/// Entities spawned on reaching this threshold, from a min to a max.

View File

@@ -5,7 +5,7 @@ namespace Content.Server.Destructible.Thresholds.Behaviors;
[UsedImplicitly]
[DataDefinition]
public sealed class SpawnGasBehavior : IThresholdBehavior
public sealed partial class SpawnGasBehavior : IThresholdBehavior
{
[DataField("gasMixture", required: true)]
public GasMixture Gas = new();

View File

@@ -7,7 +7,7 @@ namespace Content.Server.Destructible.Thresholds.Behaviors
{
[UsedImplicitly]
[DataDefinition]
public sealed class SpillBehavior : IThresholdBehavior
public sealed partial class SpillBehavior : IThresholdBehavior
{
[DataField("solution")]
public string? Solution;

View File

@@ -1,7 +1,7 @@
namespace Content.Server.Destructible.Thresholds.Behaviors;
[DataDefinition]
public sealed class TriggerBehavior : IThresholdBehavior
public sealed partial class TriggerBehavior : IThresholdBehavior
{
public void Execute(EntityUid owner, DestructibleSystem system, EntityUid? cause = null)
{

View File

@@ -5,7 +5,7 @@ using Content.Shared.Damage;
namespace Content.Server.Destructible.Thresholds
{
[DataDefinition]
public sealed class DamageThreshold
public sealed partial class DamageThreshold
{
[DataField("behaviors")]
private List<IThresholdBehavior> _behaviors = new();

View File

@@ -2,7 +2,7 @@
{
[Serializable]
[DataDefinition]
public struct MinMax
public partial struct MinMax
{
[DataField("min")]
public int Min;

View File

@@ -7,7 +7,7 @@ namespace Content.Server.Destructible.Thresholds.Triggers
/// </summary>
[Serializable]
[DataDefinition]
public sealed class AndTrigger : IThresholdTrigger
public sealed partial class AndTrigger : IThresholdTrigger
{
[DataField("triggers")]
public List<IThresholdTrigger> Triggers { get; set; } = new();

View File

@@ -10,7 +10,7 @@ namespace Content.Server.Destructible.Thresholds.Triggers
/// </summary>
[Serializable]
[DataDefinition]
public sealed class DamageGroupTrigger : IThresholdTrigger
public sealed partial class DamageGroupTrigger : IThresholdTrigger
{
[DataField("damageGroup", required: true, customTypeSerializer: typeof(PrototypeIdSerializer<DamageGroupPrototype>))]
public string DamageGroup { get; set; } = default!;

View File

@@ -8,7 +8,7 @@ namespace Content.Server.Destructible.Thresholds.Triggers
/// </summary>
[Serializable]
[DataDefinition]
public sealed class DamageTrigger : IThresholdTrigger
public sealed partial class DamageTrigger : IThresholdTrigger
{
/// <summary>
/// The amount of damage at which this threshold will trigger.

View File

@@ -10,7 +10,7 @@ namespace Content.Server.Destructible.Thresholds.Triggers
/// </summary>
[Serializable]
[DataDefinition]
public sealed class DamageTypeTrigger : IThresholdTrigger
public sealed partial class DamageTypeTrigger : IThresholdTrigger
{
[DataField("damageType", required:true, customTypeSerializer: typeof(PrototypeIdSerializer<DamageTypePrototype>))]
public string DamageType { get; set; } = default!;

View File

@@ -7,10 +7,10 @@ namespace Content.Server.Destructible.Thresholds.Triggers
/// </summary>
[Serializable]
[DataDefinition]
public sealed class OrTrigger : IThresholdTrigger
public sealed partial class OrTrigger : IThresholdTrigger
{
[DataField("triggers")]
public List<IThresholdTrigger> Triggers { get; } = new();
public List<IThresholdTrigger> Triggers { get; private set; } = new();
public bool Reached(DamageableComponent damageable, DestructibleSystem system)
{