Replace usages of customTypeSerializer PrototypeIdListSerializer with something that doesn't take 20 separate words to type out (#37959)

* Replace usages of customTypeSerializer PrototypeIdListSerializer with something that doesn't take 20 separate words to type out

* Missed one

* Missed another

* Fix data field ids
This commit is contained in:
DrSmugleaf
2025-07-09 20:06:51 -07:00
committed by GitHub
parent 326712faca
commit 00826aaad6
39 changed files with 184 additions and 155 deletions

View File

@@ -1,7 +1,6 @@
using Content.Shared.Arcade;
using Robust.Shared.Audio;
using Robust.Shared.Prototypes;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype.List;
namespace Content.Server.Arcade.SpaceVillain;
@@ -90,8 +89,8 @@ public sealed partial class SpaceVillainArcadeComponent : SharedSpaceVillainArca
/// The prototypes that can be dispensed as a reward for winning the game.
/// </summary>
[ViewVariables(VVAccess.ReadWrite)]
[DataField("possibleRewards", customTypeSerializer: typeof(PrototypeIdListSerializer<EntityPrototype>))]
public List<string> PossibleRewards = new();
[DataField]
public List<EntProtoId> PossibleRewards = new();
/// <summary>
/// The minimum number of prizes the arcade machine can have.

View File

@@ -1,17 +1,14 @@
using Content.Server.Botany.Components;
using Content.Server.Botany.Systems;
using Content.Server.EntityEffects;
using Content.Shared.Atmos;
using Content.Shared.Database;
using Content.Shared.EntityEffects;
using Content.Shared.Random;
using Robust.Shared.Audio;
using Robust.Shared.Prototypes;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype.List;
using Robust.Shared.Utility;
using Content.Server.EntityEffects;
namespace Content.Server.Botany;
[Prototype]
@@ -133,8 +130,8 @@ public partial class SeedData
/// <summary>
/// The entity prototype this seed spawns when it gets harvested.
/// </summary>
[DataField("productPrototypes", customTypeSerializer: typeof(PrototypeIdListSerializer<EntityPrototype>))]
public List<string> ProductPrototypes = new();
[DataField]
public List<EntProtoId> ProductPrototypes = new();
[DataField] public Dictionary<string, SeedChemQuantity> Chemicals = new();
@@ -243,8 +240,8 @@ public partial class SeedData
/// <summary>
/// The seed prototypes this seed may mutate into when prompted to.
/// </summary>
[DataField(customTypeSerializer: typeof(PrototypeIdListSerializer<SeedPrototype>))]
public List<string> MutationPrototypes = new();
[DataField]
public List<ProtoId<SeedPrototype>> MutationPrototypes = new();
/// <summary>
/// Log impact for when the seed is planted.
@@ -270,8 +267,8 @@ public partial class SeedData
Mysterious = Mysterious,
PacketPrototype = PacketPrototype,
ProductPrototypes = new List<string>(ProductPrototypes),
MutationPrototypes = new List<string>(MutationPrototypes),
ProductPrototypes = new List<EntProtoId>(ProductPrototypes),
MutationPrototypes = new List<ProtoId<SeedPrototype>>(MutationPrototypes),
Chemicals = new Dictionary<string, SeedChemQuantity>(Chemicals),
ConsumeGasses = new Dictionary<Gas, float>(ConsumeGasses),
ExudeGasses = new Dictionary<Gas, float>(ExudeGasses),
@@ -330,8 +327,8 @@ public partial class SeedData
Mysterious = other.Mysterious,
PacketPrototype = other.PacketPrototype,
ProductPrototypes = new List<string>(other.ProductPrototypes),
MutationPrototypes = new List<string>(other.MutationPrototypes),
ProductPrototypes = new List<EntProtoId>(other.ProductPrototypes),
MutationPrototypes = new List<ProtoId<SeedPrototype>>(other.MutationPrototypes),
Chemicals = new Dictionary<string, SeedChemQuantity>(Chemicals),
ConsumeGasses = new Dictionary<Gas, float>(ConsumeGasses),

View File

@@ -43,7 +43,7 @@ namespace Content.Server.EntityList
var i = 0;
foreach (var entity in prototype.Entities(_prototypeManager))
foreach (var entity in prototype.GetEntities(_prototypeManager))
{
EntityManager.SpawnEntity(entity.ID, EntityManager.GetComponent<TransformComponent>(attached).Coordinates);
i++;

View File

@@ -1,8 +1,6 @@
using Content.Server.Maps;
using Robust.Shared.Prototypes;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype.List;
namespace Content.Server.GameTicking.Presets
{
@@ -33,8 +31,8 @@ namespace Content.Server.GameTicking.Presets
[DataField("maxPlayers")]
public int? MaxPlayers;
[DataField("rules", customTypeSerializer: typeof(PrototypeIdListSerializer<EntityPrototype>))]
public IReadOnlyList<string> Rules { get; private set; } = Array.Empty<string>();
[DataField]
public IReadOnlyList<EntProtoId> Rules { get; private set; } = Array.Empty<EntProtoId>();
/// <summary>
/// If specified, the gamemode will only be run with these maps.

View File

@@ -1,5 +1,4 @@
using Robust.Shared.Prototypes;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype.List;
namespace Content.Server.Implants.Components;
@@ -12,6 +11,6 @@ public sealed partial class AutoImplantComponent : Component
/// <summary>
/// List of implants to inject.
/// </summary>
[DataField("implants", required: true, customTypeSerializer: typeof(PrototypeIdListSerializer<EntityPrototype>))]
public List<string> Implants = new();
[DataField(required: true)]
public List<EntProtoId> Implants = new();
}

View File

@@ -2,7 +2,6 @@
using Content.Shared.Roles;
using JetBrains.Annotations;
using Robust.Shared.Prototypes;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype.Set;
namespace Content.Server.Jobs;
@@ -12,8 +11,8 @@ namespace Content.Server.Jobs;
[UsedImplicitly]
public sealed partial class AddImplantSpecial : JobSpecial
{
[DataField("implants", customTypeSerializer: typeof(PrototypeIdHashSetSerializer<EntityPrototype>))]
public HashSet<String> Implants { get; private set; } = new();
[DataField]
public HashSet<EntProtoId> Implants { get; private set; } = new();
public override void AfterEquip(EntityUid mob)
{

View File

@@ -2,6 +2,7 @@ using Content.Shared.Database;
using Content.Shared.Research.Components;
using Content.Shared.Research.Prototypes;
using JetBrains.Annotations;
using Robust.Shared.Prototypes;
namespace Content.Server.Research.Systems;
@@ -165,9 +166,9 @@ public sealed partial class ResearchSystem
return;
component.MainDiscipline = null;
component.CurrentTechnologyCards = new List<string>();
component.SupportedDisciplines = new List<string>();
component.UnlockedTechnologies = new List<string>();
component.UnlockedRecipes = new List<string>();
component.SupportedDisciplines = new List<ProtoId<TechDisciplinePrototype>>();
component.UnlockedTechnologies = new List<ProtoId<TechnologyPrototype>>();
component.UnlockedRecipes = new List<ProtoId<LatheRecipePrototype>>();
Dirty(uid, component);
}
}

View File

@@ -199,7 +199,7 @@ public sealed partial class BorgSystem
else
{
item = component.ProvidedContainer.ContainedEntities
.FirstOrDefault(ent => Prototype(ent)?.ID == itemProto);
.FirstOrDefault(ent => Prototype(ent)?.ID == itemProto.Id);
if (!item.IsValid())
{
Log.Debug($"no items found: {component.ProvidedContainer.ContainedEntities.Count}");

View File

@@ -1,6 +1,6 @@
using Content.Server.StationEvents.Events;
using Content.Shared.Radio;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype.List;
using Robust.Shared.Prototypes;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype.Set;
namespace Content.Server.StationEvents.Components;
@@ -29,8 +29,8 @@ public sealed partial class SolarFlareRuleComponent : Component
/// <remarks>
/// Channels are not removed from this, so its possible to roll the same channel multiple times.
/// </remarks>
[DataField("extraChannels", customTypeSerializer: typeof(PrototypeIdListSerializer<RadioChannelPrototype>))]
public List<String> ExtraChannels = new();
[DataField]
public List<ProtoId<RadioChannelPrototype>> ExtraChannels = new();
/// <summary>
/// Number of times to roll a channel from ExtraChannels.

View File

@@ -1,7 +1,7 @@
using Content.Server.StationEvents.Events;
using Content.Shared.Chemistry.Reagent;
using Robust.Shared.Audio;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype.List;
using Robust.Shared.Prototypes;
namespace Content.Server.StationEvents.Components;
@@ -12,8 +12,8 @@ public sealed partial class VentClogRuleComponent : Component
/// Somewhat safe chemicals to put in foam that probably won't instantly kill you.
/// There is a small chance of using any reagent, ignoring this.
/// </summary>
[DataField(customTypeSerializer: typeof(PrototypeIdListSerializer<ReagentPrototype>))]
public IReadOnlyList<string> SafeishVentChemicals = new[]
[DataField]
public IReadOnlyList<ProtoId<ReagentPrototype>> SafeishVentChemicals = new ProtoId<ReagentPrototype>[]
{
"Water", "Blood", "Slime", "SpaceDrugs", "SpaceCleaner", "Nutriment", "Sugar", "SpaceLube", "Ephedrine", "Ale", "Beer", "SpaceGlue"
};
@@ -45,8 +45,8 @@ public sealed partial class VentClogRuleComponent : Component
/// <summary>
/// Reagents that gets the weak numbers used instead of regular ones.
/// </summary>
[DataField(customTypeSerializer: typeof(PrototypeIdListSerializer<ReagentPrototype>))]
public IReadOnlyList<string> WeakReagents = new[]
[DataField]
public IReadOnlyList<ProtoId<ReagentPrototype>> WeakReagents = new ProtoId<ReagentPrototype>[]
{
"SpaceLube", "SpaceGlue"
};

View File

@@ -1,14 +1,15 @@
using System.Linq;
using Content.Server.Atmos.Piping.Unary.Components;
using Content.Server.Fluids.EntitySystems;
using Content.Server.StationEvents.Components;
using Content.Shared.Chemistry.Components;
using Content.Shared.Chemistry.Reaction;
using Content.Shared.Chemistry.Reagent;
using Content.Shared.GameTicking.Components;
using Content.Shared.Station.Components;
using JetBrains.Annotations;
using Robust.Shared.Prototypes;
using Robust.Shared.Random;
using System.Linq;
using Content.Shared.Chemistry.Reaction;
namespace Content.Server.StationEvents.Events;
@@ -27,7 +28,7 @@ public sealed class VentClogRule : StationEventSystem<VentClogRuleComponent>
// TODO: "safe random" for chems. Right now this includes admin chemicals.
var allReagents = PrototypeManager.EnumeratePrototypes<ReagentPrototype>()
.Where(x => !x.Abstract)
.Select(x => x.ID).ToList();
.Select(x => new ProtoId<ReagentPrototype>(x.ID)).ToList();
foreach (var (_, transform) in EntityQuery<GasVentPumpComponent, TransformComponent>())
{

View File

@@ -1,5 +1,5 @@
using Content.Shared.DeviceNetwork;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype.List;
using Robust.Shared.Prototypes;
namespace Content.Server.SurveillanceCamera;
@@ -43,6 +43,6 @@ public sealed partial class SurveillanceCameraComponent : Component
public bool NetworkSet { get; set; }
// This has to be device network frequency prototypes.
[DataField("setupAvailableNetworks", customTypeSerializer:typeof(PrototypeIdListSerializer<DeviceFrequencyPrototype>))]
public List<string> AvailableNetworks { get; private set; } = new();
[DataField("setupAvailableNetworks")]
public List<ProtoId<DeviceFrequencyPrototype>> AvailableNetworks { get; private set; } = new();
}

View File

@@ -1,6 +1,6 @@
using Content.Shared.DeviceNetwork;
using Robust.Shared.Prototypes;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype.List;
namespace Content.Server.SurveillanceCamera;
@@ -26,6 +26,6 @@ public sealed partial class SurveillanceCameraRouterComponent : Component
[DataField("subnetFrequency", customTypeSerializer:typeof(PrototypeIdSerializer<DeviceFrequencyPrototype>))]
public string? SubnetFrequencyId { get; set; }
[DataField("setupAvailableNetworks", customTypeSerializer:typeof(PrototypeIdListSerializer<DeviceFrequencyPrototype>))]
public List<string> AvailableNetworks { get; private set; } = new();
[DataField("setupAvailableNetworks")]
public List<ProtoId<DeviceFrequencyPrototype>> AvailableNetworks { get; private set; } = new();
}

View File

@@ -1,6 +1,6 @@
using Content.Server.Worldgen.Systems.Biomes;
using Content.Server.Worldgen.Prototypes;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype.List;
using Content.Server.Worldgen.Prototypes;
using Content.Server.Worldgen.Systems.Biomes;
using Robust.Shared.Prototypes;
namespace Content.Server.Worldgen.Components;
@@ -15,7 +15,7 @@ public sealed partial class BiomeSelectionComponent : Component
/// The list of biomes available to this selector.
/// </summary>
/// <remarks>This is always sorted by priority after ComponentStartup.</remarks>
[DataField("biomes", required: true,
customTypeSerializer: typeof(PrototypeIdListSerializer<BiomePrototype>))] public List<string> Biomes = new();
[DataField(required: true)]
public List<ProtoId<BiomePrototype>> Biomes = new();
}

View File

@@ -1,6 +1,6 @@
using Content.Server.Worldgen.Systems.Debris;
using Content.Shared.Maps;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype.List;
using Robust.Shared.Prototypes;
namespace Content.Server.Worldgen.Components.Debris;
@@ -24,9 +24,8 @@ public sealed partial class BlobFloorPlanBuilderComponent : Component
/// <summary>
/// The tiles to be used for the floor plan.
/// </summary>
[DataField("floorTileset", required: true,
customTypeSerializer: typeof(PrototypeIdListSerializer<ContentTileDefinition>))]
public List<string> FloorTileset { get; private set; } = default!;
[DataField(required: true)]
public List<ProtoId<ContentTileDefinition>> FloorTileset { get; private set; } = default!;
/// <summary>
/// The number of floor tiles to place when drawing the asteroid layout.