Refactor serialization copying to use source generators (#19412)
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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!;
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
{
|
||||
[Serializable]
|
||||
[DataDefinition]
|
||||
public struct MinMax
|
||||
public partial struct MinMax
|
||||
{
|
||||
[DataField("min")]
|
||||
public int Min;
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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!;
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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!;
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user