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,4 +4,4 @@ namespace Content.Server.NPC.Components;
/// Added to NPCs that are actively being updated.
/// </summary>
[RegisterComponent]
public sealed class ActiveNPCComponent : Component {}
public sealed partial class ActiveNPCComponent : Component {}

View File

@@ -7,7 +7,7 @@ namespace Content.Server.NPC.Components;
/// Can be added to if pettable, see PettableFriendComponent.
/// </summary>
[RegisterComponent, Access(typeof(FactionExceptionSystem))]
public sealed class FactionExceptionComponent : Component
public sealed partial class FactionExceptionComponent : Component
{
/// <summary>
/// List of entities that this NPC will refuse to attack

View File

@@ -4,7 +4,7 @@ namespace Content.Server.NPC.Components;
/// Should this entity be considered for collision avoidance
/// </summary>
[RegisterComponent]
public sealed class NPCAvoidanceComponent : Component
public sealed partial class NPCAvoidanceComponent : Component
{
[ViewVariables(VVAccess.ReadWrite), DataField("enabled")]
public bool Enabled = true;

View File

@@ -2,7 +2,7 @@ using Content.Shared.NPC;
namespace Content.Server.NPC.Components
{
public abstract class NPCComponent : SharedNPCComponent
public abstract partial class NPCComponent : SharedNPCComponent
{
/// <summary>
/// Contains all of the world data for a particular NPC in terms of how it sees the world.

View File

@@ -4,7 +4,7 @@ using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom;
namespace Content.Server.NPC.Components;
[RegisterComponent]
public sealed class NPCJukeComponent : Component
public sealed partial class NPCJukeComponent : Component
{
[DataField("jukeType")]
public JukeType JukeType = JukeType.Away;

View File

@@ -4,7 +4,7 @@ namespace Content.Server.NPC.Components;
/// Added to NPCs whenever they're in melee combat so they can be handled by the dedicated system.
/// </summary>
[RegisterComponent]
public sealed class NPCMeleeCombatComponent : Component
public sealed partial class NPCMeleeCombatComponent : Component
{
/// <summary>
/// If the target is moving what is the chance for this NPC to miss.

View File

@@ -1,7 +1,7 @@
namespace Content.Server.NPC.Components;
[RegisterComponent]
public sealed class NPCPathfindPointComponent : Component
public sealed partial class NPCPathfindPointComponent : Component
{
// /// <summary>
// /// Next point for the NPC to head to.

View File

@@ -7,7 +7,7 @@ namespace Content.Server.NPC.Components;
/// Added to an NPC doing ranged combat.
/// </summary>
[RegisterComponent]
public sealed class NPCRangedCombatComponent : Component
public sealed partial class NPCRangedCombatComponent : Component
{
[ViewVariables]
public EntityUid Target;

View File

@@ -3,7 +3,7 @@ namespace Content.Server.NPC.Components
/// Added when a medibot injects someone
/// So they don't get injected again for at least a minute.
[RegisterComponent]
public sealed class NPCRecentlyInjectedComponent : Component
public sealed partial class NPCRecentlyInjectedComponent : Component
{
[ViewVariables(VVAccess.ReadWrite), DataField("accumulator")]
public float Accumulator = 0f;

View File

@@ -12,7 +12,7 @@ namespace Content.Server.NPC.Components;
/// Added to NPCs that are moving.
/// </summary>
[RegisterComponent]
public sealed class NPCSteeringComponent : Component
public sealed partial class NPCSteeringComponent : Component
{
#region Context Steering

View File

@@ -5,7 +5,7 @@ namespace Content.Server.NPC.Components
{
[RegisterComponent]
[Access(typeof(NpcFactionSystem))]
public sealed class NpcFactionMemberComponent : Component
public sealed partial class NpcFactionMemberComponent : Component
{
/// <summary>
/// Factions this entity is a part of.

View File

@@ -11,7 +11,7 @@ namespace Content.Server.NPC.Components
{
[ViewVariables]
[IdDataField]
public string ID { get; } = default!;
public string ID { get; private set; } = default!;
[ViewVariables(VVAccess.ReadWrite), DataField("friendly", customTypeSerializer:typeof(PrototypeIdListSerializer<NpcFactionPrototype>))]
public List<string> Friendly = new();