Refactor serialization copying to use source generators (#19412)
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
namespace Content.Server.NPC.Queries.Considerations;
|
||||
|
||||
public sealed class DrinkValueCon : UtilityConsideration
|
||||
public sealed partial class DrinkValueCon : UtilityConsideration
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
namespace Content.Server.NPC.Queries.Considerations;
|
||||
|
||||
public sealed class FoodValueCon : UtilityConsideration
|
||||
public sealed partial class FoodValueCon : UtilityConsideration
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ namespace Content.Server.NPC.Queries.Considerations;
|
||||
/// <summary>
|
||||
/// Returns 1f if the target is freely accessible (e.g. not in locked storage).
|
||||
/// </summary>
|
||||
public sealed class TargetAccessibleCon : UtilityConsideration
|
||||
public sealed partial class TargetAccessibleCon : UtilityConsideration
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
namespace Content.Server.NPC.Queries.Considerations;
|
||||
|
||||
public sealed class TargetAmmoCon : UtilityConsideration
|
||||
public sealed partial class TargetAmmoCon : UtilityConsideration
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ namespace Content.Server.NPC.Queries.Considerations;
|
||||
/// <summary>
|
||||
/// Returns 1f where the specified target is valid for the active hand's whitelist.
|
||||
/// </summary>
|
||||
public sealed class TargetAmmoMatchesCon : UtilityConsideration
|
||||
public sealed partial class TargetAmmoMatchesCon : UtilityConsideration
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
namespace Content.Server.NPC.Queries.Considerations;
|
||||
|
||||
public sealed class TargetDistanceCon : UtilityConsideration
|
||||
public sealed partial class TargetDistanceCon : UtilityConsideration
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
namespace Content.Server.NPC.Queries.Considerations;
|
||||
|
||||
public sealed class TargetHealthCon : UtilityConsideration
|
||||
public sealed partial class TargetHealthCon : UtilityConsideration
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ namespace Content.Server.NPC.Queries.Considerations;
|
||||
/// <summary>
|
||||
/// Returns whether the target is in line-of-sight.
|
||||
/// </summary>
|
||||
public sealed class TargetInLOSCon : UtilityConsideration
|
||||
public sealed partial class TargetInLOSCon : UtilityConsideration
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ namespace Content.Server.NPC.Queries.Considerations;
|
||||
/// <summary>
|
||||
/// Placeholder considerations -> returns 1f if they're in LOS or the current target.
|
||||
/// </summary>
|
||||
public sealed class TargetInLOSOrCurrentCon : UtilityConsideration
|
||||
public sealed partial class TargetInLOSOrCurrentCon : UtilityConsideration
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ namespace Content.Server.NPC.Queries.Considerations;
|
||||
/// <summary>
|
||||
/// Returns 1f if the target is alive or 0f if not.
|
||||
/// </summary>
|
||||
public sealed class TargetIsAliveCon : UtilityConsideration
|
||||
public sealed partial class TargetIsAliveCon : UtilityConsideration
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ namespace Content.Server.NPC.Queries.Considerations;
|
||||
/// <summary>
|
||||
/// Returns 1f if the target is crit or 0f if not.
|
||||
/// </summary>
|
||||
public sealed class TargetIsCritCon : UtilityConsideration
|
||||
public sealed partial class TargetIsCritCon : UtilityConsideration
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ namespace Content.Server.NPC.Queries.Considerations;
|
||||
/// <summary>
|
||||
/// Returns 1f if the target is dead or 0f if not.
|
||||
/// </summary>
|
||||
public sealed class TargetIsDeadCon : UtilityConsideration
|
||||
public sealed partial class TargetIsDeadCon : UtilityConsideration
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ namespace Content.Server.NPC.Queries.Considerations;
|
||||
/// <summary>
|
||||
/// Gets the DPS out of 100.
|
||||
/// </summary>
|
||||
public sealed class TargetMeleeCon : UtilityConsideration
|
||||
public sealed partial class TargetMeleeCon : UtilityConsideration
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ using JetBrains.Annotations;
|
||||
namespace Content.Server.NPC.Queries.Considerations;
|
||||
|
||||
[ImplicitDataDefinitionForInheritors, MeansImplicitUse]
|
||||
public abstract class UtilityConsideration
|
||||
public abstract partial class UtilityConsideration
|
||||
{
|
||||
[DataField("curve", required: true)]
|
||||
public IUtilityCurve Curve = default!;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
namespace Content.Server.NPC.Queries.Curves;
|
||||
|
||||
public sealed class BoolCurve : IUtilityCurve
|
||||
public sealed partial class BoolCurve : IUtilityCurve
|
||||
{
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
namespace Content.Server.NPC.Queries.Curves;
|
||||
|
||||
[ImplicitDataDefinitionForInheritors]
|
||||
public interface IUtilityCurve
|
||||
public partial interface IUtilityCurve
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
namespace Content.Server.NPC.Queries.Curves;
|
||||
|
||||
public sealed class InverseBoolCurve : IUtilityCurve
|
||||
public sealed partial class InverseBoolCurve : IUtilityCurve
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@ using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototy
|
||||
|
||||
namespace Content.Server.NPC.Queries.Curves;
|
||||
|
||||
public sealed class PresetCurve : IUtilityCurve
|
||||
public sealed partial class PresetCurve : IUtilityCurve
|
||||
{
|
||||
[DataField("preset", required: true, customTypeSerializer:typeof(PrototypeIdSerializer<UtilityCurvePresetPrototype>))] public readonly string Preset = default!;
|
||||
[DataField("preset", required: true, customTypeSerializer:typeof(PrototypeIdSerializer<UtilityCurvePresetPrototype>))] public string Preset = default!;
|
||||
}
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
namespace Content.Server.NPC.Queries.Curves;
|
||||
|
||||
public sealed class QuadraticCurve : IUtilityCurve
|
||||
public sealed partial class QuadraticCurve : IUtilityCurve
|
||||
{
|
||||
[DataField("slope")] public readonly float Slope = 1f;
|
||||
[DataField("slope")] public float Slope = 1f;
|
||||
|
||||
[DataField("exponent")] public readonly float Exponent = 1f;
|
||||
[DataField("exponent")] public float Exponent = 1f;
|
||||
|
||||
[DataField("yOffset")] public readonly float YOffset;
|
||||
[DataField("yOffset")] public float YOffset;
|
||||
|
||||
[DataField("xOffset")] public readonly float XOffset;
|
||||
[DataField("xOffset")] public float XOffset;
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@ using Content.Shared.Inventory;
|
||||
|
||||
namespace Content.Server.NPC.Queries.Queries;
|
||||
|
||||
public sealed class ClothingSlotFilter : UtilityQueryFilter
|
||||
public sealed partial class ClothingSlotFilter : UtilityQueryFilter
|
||||
{
|
||||
[DataField("slotFlags", required: true)]
|
||||
public SlotFlags SlotFlags = SlotFlags.NONE;
|
||||
|
||||
@@ -2,7 +2,7 @@ using Robust.Shared.Prototypes;
|
||||
|
||||
namespace Content.Server.NPC.Queries.Queries;
|
||||
|
||||
public sealed class ComponentFilter : UtilityQueryFilter
|
||||
public sealed partial class ComponentFilter : UtilityQueryFilter
|
||||
{
|
||||
/// <summary>
|
||||
/// Components to filter for.
|
||||
|
||||
@@ -5,7 +5,7 @@ namespace Content.Server.NPC.Queries.Queries;
|
||||
/// <summary>
|
||||
/// Returns nearby components that match the specified components.
|
||||
/// </summary>
|
||||
public sealed class ComponentQuery : UtilityQuery
|
||||
public sealed partial class ComponentQuery : UtilityQuery
|
||||
{
|
||||
[DataField("components", required: true)]
|
||||
public ComponentRegistry Components = default!;
|
||||
|
||||
@@ -3,7 +3,7 @@ namespace Content.Server.NPC.Queries.Queries;
|
||||
/// <summary>
|
||||
/// Returns inventory entities recursively.
|
||||
/// </summary>
|
||||
public sealed class InventoryQuery : UtilityQuery
|
||||
public sealed partial class InventoryQuery : UtilityQuery
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ namespace Content.Server.NPC.Queries.Queries;
|
||||
/// <summary>
|
||||
/// Returns nearby entities considered hostile from <see cref="FactionSystem"/>
|
||||
/// </summary>
|
||||
public sealed class NearbyHostilesQuery : UtilityQuery
|
||||
public sealed partial class NearbyHostilesQuery : UtilityQuery
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
namespace Content.Server.NPC.Queries.Queries;
|
||||
|
||||
public sealed class PuddleFilter : UtilityQueryFilter
|
||||
public sealed partial class PuddleFilter : UtilityQueryFilter
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
namespace Content.Server.NPC.Queries.Queries;
|
||||
|
||||
public sealed class PuddlesQuery : UtilityQuery
|
||||
public sealed partial class PuddlesQuery : UtilityQuery
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ namespace Content.Server.NPC.Queries.Queries;
|
||||
/// Adds entities to a query.
|
||||
/// </summary>
|
||||
[ImplicitDataDefinitionForInheritors]
|
||||
public abstract class UtilityQuery
|
||||
public abstract partial class UtilityQuery
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ namespace Content.Server.NPC.Queries.Queries;
|
||||
/// <summary>
|
||||
/// Removes entities from a query.
|
||||
/// </summary>
|
||||
public abstract class UtilityQueryFilter : UtilityQuery
|
||||
public abstract partial class UtilityQueryFilter : UtilityQuery
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ namespace Content.Server.NPC.Queries;
|
||||
public sealed class UtilityQueryPrototype : IPrototype
|
||||
{
|
||||
[IdDataField]
|
||||
public string ID { get; } = default!;
|
||||
public string ID { get; private set; } = default!;
|
||||
|
||||
[ViewVariables(VVAccess.ReadWrite), DataField("query")]
|
||||
public List<UtilityQuery> Query = new();
|
||||
|
||||
@@ -6,7 +6,7 @@ namespace Content.Server.NPC.Queries;
|
||||
/// Utility queries that run regularly to update an NPC without re-doing their thinking logic.
|
||||
/// </summary>
|
||||
[DataDefinition]
|
||||
public sealed class UtilityService
|
||||
public sealed partial class UtilityService
|
||||
{
|
||||
/// <summary>
|
||||
/// Identifier to use for this service. This is used to track its cooldown.
|
||||
|
||||
Reference in New Issue
Block a user