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

@@ -38,7 +38,7 @@ public sealed partial class SurveillanceCameraSetupWindow : DefaultWindow
}
// Pass in a list of frequency prototype IDs.
public void LoadAvailableNetworks(uint currentNetwork, List<string> networks)
public void LoadAvailableNetworks(uint currentNetwork, List<ProtoId<DeviceFrequencyPrototype>> networks)
{
NetworkSelector.Clear();

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.

View File

@@ -1,12 +1,12 @@
using System.Collections;
using System.Linq;
using Content.Shared.Chemistry.Components.SolutionManager;
using Content.Shared.Chemistry.Reagent;
using Content.Shared.FixedPoint;
using JetBrains.Annotations;
using Robust.Shared.Prototypes;
using Robust.Shared.Serialization;
using Robust.Shared.Utility;
using System.Collections;
using System.Linq;
using Content.Shared.Chemistry.Components.SolutionManager;
namespace Content.Shared.Chemistry.Components
{
@@ -583,6 +583,7 @@ namespace Content.Shared.Chemistry.Components
/// <summary>
/// Splits a solution without the specified reagent prototypes.
/// </summary>
[Obsolete("Use SplitSolutionWithout with params ProtoId<ReagentPrototype>")]
public Solution SplitSolutionWithout(FixedPoint2 toTake, params string[] excludedPrototypes)
{
// First remove the blacklisted prototypes
@@ -612,6 +613,38 @@ namespace Content.Shared.Chemistry.Components
return sol;
}
/// <summary>
/// Splits a solution without the specified reagent prototypes.
/// </summary>
public Solution SplitSolutionWithout(FixedPoint2 toTake, params ProtoId<ReagentPrototype>[] excludedPrototypes)
{
// First remove the blacklisted prototypes
List<ReagentQuantity> excluded = new();
foreach (var id in excludedPrototypes)
{
foreach (var tuple in Contents)
{
if (tuple.Reagent.Prototype != id)
continue;
excluded.Add(tuple);
RemoveReagent(tuple);
break;
}
}
// Then split the solution
var sol = SplitSolution(toTake);
// Then re-add the excluded reagents to the original solution.
foreach (var reagent in excluded)
{
AddReagent(reagent);
}
return sol;
}
/// <summary>
/// Splits a solution with only the specified reagent prototypes.
/// </summary>

View File

@@ -1,24 +1,24 @@
using Content.Shared.Chemistry.Components;
using Content.Shared.Chemistry.Components.SolutionManager;
using Content.Shared.Chemistry.Reaction;
using Content.Shared.Chemistry.Reagent;
using Content.Shared.Examine;
using Content.Shared.FixedPoint;
using Content.Shared.Verbs;
using JetBrains.Annotations;
using Robust.Shared.Containers;
using Robust.Shared.Prototypes;
using Robust.Shared.Utility;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using System.Numerics;
using System.Runtime.CompilerServices;
using System.Text;
using Content.Shared.Chemistry.Components;
using Content.Shared.Chemistry.Components.SolutionManager;
using Content.Shared.Chemistry.Reaction;
using Content.Shared.Chemistry.Reagent;
using Content.Shared.Containers;
using Content.Shared.Examine;
using Content.Shared.FixedPoint;
using Content.Shared.Hands.Components;
using Content.Shared.Hands.EntitySystems;
using Content.Shared.Verbs;
using JetBrains.Annotations;
using Robust.Shared.Containers;
using Robust.Shared.Map;
using Robust.Shared.Network;
using Robust.Shared.Prototypes;
using Robust.Shared.Utility;
using Dependency = Robust.Shared.IoC.DependencyAttribute;
namespace Content.Shared.Chemistry.EntitySystems;
@@ -61,14 +61,14 @@ public partial record struct SolutionAccessAttemptEvent(string SolutionName)
[UsedImplicitly]
public abstract partial class SharedSolutionContainerSystem : EntitySystem
{
[Dependency] protected readonly IPrototypeManager PrototypeManager = default!;
[Dependency] protected readonly ChemicalReactionSystem ChemicalReactionSystem = default!;
[Dependency] protected readonly ExamineSystemShared ExamineSystem = default!;
[Dependency] protected readonly SharedAppearanceSystem AppearanceSystem = default!;
[Dependency] protected readonly SharedHandsSystem Hands = default!;
[Dependency] protected readonly SharedContainerSystem ContainerSystem = default!;
[Dependency] protected readonly MetaDataSystem MetaDataSys = default!;
[Dependency] protected readonly INetManager NetManager = default!;
[Robust.Shared.IoC.Dependency] protected readonly IPrototypeManager PrototypeManager = default!;
[Robust.Shared.IoC.Dependency] protected readonly ChemicalReactionSystem ChemicalReactionSystem = default!;
[Robust.Shared.IoC.Dependency] protected readonly ExamineSystemShared ExamineSystem = default!;
[Robust.Shared.IoC.Dependency] protected readonly SharedAppearanceSystem AppearanceSystem = default!;
[Robust.Shared.IoC.Dependency] protected readonly SharedHandsSystem Hands = default!;
[Robust.Shared.IoC.Dependency] protected readonly SharedContainerSystem ContainerSystem = default!;
[Robust.Shared.IoC.Dependency] protected readonly MetaDataSystem MetaDataSys = default!;
[Robust.Shared.IoC.Dependency] protected readonly INetManager NetManager = default!;
public override void Initialize()
{
@@ -376,6 +376,7 @@ public abstract partial class SharedSolutionContainerSystem : EntitySystem
/// <summary>
/// Splits a solution without the specified reagent(s).
/// </summary>
[Obsolete("Use SplitSolutionWithout with params ProtoId<ReagentPrototype>")]
public Solution SplitSolutionWithout(Entity<SolutionComponent> soln, FixedPoint2 quantity, params string[] reagents)
{
var (uid, comp) = soln;
@@ -386,6 +387,19 @@ public abstract partial class SharedSolutionContainerSystem : EntitySystem
return splitSol;
}
/// <summary>
/// Splits a solution without the specified reagent(s).
/// </summary>
public Solution SplitSolutionWithout(Entity<SolutionComponent> soln, FixedPoint2 quantity, params ProtoId<ReagentPrototype>[] reagents)
{
var (uid, comp) = soln;
var solution = comp.Solution;
var splitSol = solution.SplitSolutionWithout(quantity, reagents);
UpdateChemicals(soln);
return splitSol;
}
public void RemoveAllSolution(Entity<SolutionComponent> soln)
{
var (uid, comp) = soln;

View File

@@ -1,6 +1,5 @@
using Robust.Shared.Prototypes;
using Robust.Shared.Serialization;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype.List;
namespace Content.Shared.Damage.Prototypes
{
@@ -22,14 +21,14 @@ namespace Content.Shared.Damage.Prototypes
/// <summary>
/// List of damage groups that are supported by this container.
/// </summary>
[DataField("supportedGroups", customTypeSerializer: typeof(PrototypeIdListSerializer<DamageGroupPrototype>))]
public List<string> SupportedGroups = new();
[DataField]
public List<ProtoId<DamageGroupPrototype>> SupportedGroups = new();
/// <summary>
/// Partial List of damage types supported by this container. Note that members of the damage groups listed
/// in <see cref="SupportedGroups"/> are also supported, but they are not included in this list.
/// </summary>
[DataField("supportedTypes", customTypeSerializer: typeof(PrototypeIdListSerializer<DamageTypePrototype>))]
public List<string> SupportedTypes = new();
[DataField]
public List<ProtoId<DamageTypePrototype>> SupportedTypes = new();
}
}

View File

@@ -1,6 +1,5 @@
using Robust.Shared.Prototypes;
using Robust.Shared.Serialization;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype.List;
namespace Content.Shared.Damage.Prototypes
{
@@ -22,7 +21,7 @@ namespace Content.Shared.Damage.Prototypes
[ViewVariables(VVAccess.ReadOnly)]
public string LocalizedName => Loc.GetString(Name);
[DataField("damageTypes", required: true, customTypeSerializer: typeof(PrototypeIdListSerializer<DamageTypePrototype>))]
public List<string> DamageTypes { get; private set; } = default!;
[DataField(required: true)]
public List<ProtoId<DamageTypePrototype>> DamageTypes { get; private set; } = default!;
}
}

View File

@@ -1,6 +1,5 @@
using System.Collections.Immutable;
using Robust.Shared.Prototypes;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype.List;
namespace Content.Shared.EntityList
{
@@ -11,14 +10,14 @@ namespace Content.Shared.EntityList
[IdDataField]
public string ID { get; private set; } = default!;
[DataField("entities", customTypeSerializer: typeof(PrototypeIdListSerializer<EntityPrototype>))]
public ImmutableList<string> EntityIds { get; private set; } = ImmutableList<string>.Empty;
[DataField]
public ImmutableList<EntProtoId> Entities { get; private set; } = ImmutableList<EntProtoId>.Empty;
public IEnumerable<EntityPrototype> Entities(IPrototypeManager? prototypeManager = null)
public IEnumerable<EntityPrototype> GetEntities(IPrototypeManager? prototypeManager = null)
{
prototypeManager ??= IoCManager.Resolve<IPrototypeManager>();
foreach (var entityId in EntityIds)
foreach (var entityId in Entities)
{
yield return prototypeManager.Index<EntityPrototype>(entityId);
}

View File

@@ -1,3 +1,4 @@
using System.Linq;
using Content.Shared.Actions;
using Content.Shared.Implants.Components;
using Content.Shared.Interaction;
@@ -6,9 +7,7 @@ using Content.Shared.Mobs;
using Content.Shared.Tag;
using JetBrains.Annotations;
using Robust.Shared.Containers;
using Robust.Shared.Network;
using Robust.Shared.Prototypes;
using System.Linq;
namespace Content.Shared.Implants;
@@ -91,7 +90,7 @@ public abstract class SharedSubdermalImplantSystem : EntitySystem
/// Add a list of implants to a person.
/// Logs any implant ids that don't have <see cref="SubdermalImplantComponent"/>.
/// </summary>
public void AddImplants(EntityUid uid, IEnumerable<String> implants)
public void AddImplants(EntityUid uid, IEnumerable<EntProtoId> implants)
{
foreach (var id in implants)
{

View File

@@ -1,8 +1,8 @@
using Content.Shared.Decals;
using Content.Shared.Maps;
using Robust.Shared.Noise;
using Robust.Shared.Prototypes;
using Robust.Shared.Serialization;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype.List;
namespace Content.Shared.Parallax.Biomes.Layers;
@@ -10,8 +10,8 @@ namespace Content.Shared.Parallax.Biomes.Layers;
public sealed partial class BiomeDecalLayer : IBiomeWorldLayer
{
/// <inheritdoc/>
[DataField("allowedTiles", customTypeSerializer:typeof(PrototypeIdListSerializer<ContentTileDefinition>))]
public List<string> AllowedTiles { get; private set; } = new();
[DataField]
public List<ProtoId<ContentTileDefinition>> AllowedTiles { get; private set; } = new();
/// <summary>
/// Divide each tile up by this amount.
@@ -29,6 +29,6 @@ public sealed partial class BiomeDecalLayer : IBiomeWorldLayer
/// <inheritdoc/>
[DataField("invert")] public bool Invert { get; private set; } = false;
[DataField("decals", required: true, customTypeSerializer:typeof(PrototypeIdListSerializer<DecalPrototype>))]
public List<string> Decals = new();
[DataField(required: true)]
public List<ProtoId<DecalPrototype>> Decals = new();
}

View File

@@ -2,7 +2,6 @@ using Content.Shared.Maps;
using Robust.Shared.Noise;
using Robust.Shared.Prototypes;
using Robust.Shared.Serialization;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype.List;
namespace Content.Shared.Parallax.Biomes.Layers;
@@ -10,8 +9,8 @@ namespace Content.Shared.Parallax.Biomes.Layers;
public sealed partial class BiomeEntityLayer : IBiomeWorldLayer
{
/// <inheritdoc/>
[DataField("allowedTiles", customTypeSerializer:typeof(PrototypeIdListSerializer<ContentTileDefinition>))]
public List<string> AllowedTiles { get; private set; } = new();
[DataField]
public List<ProtoId<ContentTileDefinition>> AllowedTiles { get; private set; } = new();
[DataField("noise")] public FastNoiseLite Noise { get; private set; } = new(0);
@@ -22,6 +21,6 @@ public sealed partial class BiomeEntityLayer : IBiomeWorldLayer
/// <inheritdoc/>
[DataField("invert")] public bool Invert { get; private set; } = false;
[DataField("entities", required: true, customTypeSerializer: typeof(PrototypeIdListSerializer<EntityPrototype>))]
public List<string> Entities = new();
[DataField(required: true)]
public List<EntProtoId> Entities = new();
}

View File

@@ -1,3 +1,6 @@
using Content.Shared.Maps;
using Robust.Shared.Prototypes;
namespace Content.Shared.Parallax.Biomes.Layers;
/// <summary>
@@ -8,5 +11,5 @@ public partial interface IBiomeWorldLayer : IBiomeLayer
/// <summary>
/// What tiles we're allowed to spawn on, real or biome.
/// </summary>
List<string> AllowedTiles { get; }
List<ProtoId<ContentTileDefinition>> AllowedTiles { get; }
}

View File

@@ -1,8 +1,7 @@
using Content.Shared.Chemistry.Reagent;
using Content.Shared.FixedPoint;
using Robust.Shared.Prototypes;
using Robust.Shared.Serialization;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype.List;
namespace Content.Shared.Random;
@@ -28,6 +27,6 @@ public sealed partial class RandomFillSolution
/// <summary>
/// Listed reagents that the weight and quantity apply to.
/// </summary>
[DataField("reagents", required: true, customTypeSerializer: typeof(PrototypeIdListSerializer<ReagentPrototype>))]
public List<string> Reagents = new();
[DataField(required: true)]
public List<ProtoId<ReagentPrototype>> Reagents = new();
}

View File

@@ -2,8 +2,8 @@ using Content.Shared.Lathe;
using Content.Shared.Research.Prototypes;
using Content.Shared.Research.Systems;
using Robust.Shared.GameStates;
using Robust.Shared.Prototypes;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype.List;
namespace Content.Shared.Research.Components;
@@ -25,15 +25,15 @@ public sealed partial class TechnologyDatabaseComponent : Component
/// Which research disciplines are able to be unlocked
/// </summary>
[AutoNetworkedField]
[DataField("supportedDisciplines", customTypeSerializer: typeof(PrototypeIdListSerializer<TechDisciplinePrototype>))]
public List<string> SupportedDisciplines = new();
[DataField]
public List<ProtoId<TechDisciplinePrototype>> SupportedDisciplines = new();
/// <summary>
/// The ids of all the technologies which have been unlocked.
/// </summary>
[AutoNetworkedField]
[DataField("unlockedTechnologies", customTypeSerializer: typeof(PrototypeIdListSerializer<TechnologyPrototype>))]
public List<string> UnlockedTechnologies = new();
[DataField]
public List<ProtoId<TechnologyPrototype>> UnlockedTechnologies = new();
/// <summary>
/// The ids of all the lathe recipes which have been unlocked.
@@ -41,8 +41,8 @@ public sealed partial class TechnologyDatabaseComponent : Component
/// </summary>
/// todo: if you unlock all the recipes in a tech, it doesn't count as unlocking the tech. sadge
[AutoNetworkedField]
[DataField("unlockedRecipes", customTypeSerializer: typeof(PrototypeIdListSerializer<LatheRecipePrototype>))]
public List<string> UnlockedRecipes = new();
[DataField]
public List<ProtoId<LatheRecipePrototype>> UnlockedRecipes = new();
}
/// <summary>

View File

@@ -1,3 +1,5 @@
using Robust.Shared.Prototypes;
namespace Content.Shared.Salvage.Expeditions.Modifiers;
public interface IBiomeSpecificMod : ISalvageMod
@@ -5,5 +7,5 @@ public interface IBiomeSpecificMod : ISalvageMod
/// <summary>
/// Whitelist for biomes. If null then any biome is allowed.
/// </summary>
List<string>? Biomes { get; }
List<ProtoId<SalvageBiomeModPrototype>>? Biomes { get; }
}

View File

@@ -1,6 +1,5 @@
using Content.Shared.Atmos;
using Robust.Shared.Prototypes;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype.List;
namespace Content.Shared.Salvage.Expeditions.Modifiers;
@@ -24,8 +23,8 @@ public sealed partial class SalvageAirMod : IPrototype, IBiomeSpecificMod
public float Cost { get; private set; } = 0f;
/// <inheritdoc/>
[DataField("biomes", customTypeSerializer: typeof(PrototypeIdListSerializer<SalvageBiomeModPrototype>))]
public List<string>? Biomes { get; private set; } = null;
[DataField]
public List<ProtoId<SalvageBiomeModPrototype>>? Biomes { get; private set; } = null;
/// <summary>
/// Set to true if this planet will have no atmosphere.

View File

@@ -1,7 +1,5 @@
using Content.Shared.Procedural;
using Robust.Shared.Prototypes;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype.List;
namespace Content.Shared.Salvage.Expeditions.Modifiers;
@@ -17,8 +15,8 @@ public sealed partial class SalvageDungeonModPrototype : IPrototype, IBiomeSpeci
public float Cost { get; private set; } = 0f;
/// <inheridoc/>
[DataField("biomes", customTypeSerializer: typeof(PrototypeIdListSerializer<SalvageBiomeModPrototype>))]
public List<string>? Biomes { get; private set; } = null;
[DataField]
public List<ProtoId<SalvageBiomeModPrototype>>? Biomes { get; private set; } = null;
/// <summary>
/// The config to use for spawning the dungeon.

View File

@@ -1,5 +1,4 @@
using Robust.Shared.Prototypes;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype.List;
namespace Content.Shared.Salvage.Expeditions.Modifiers;
@@ -15,8 +14,8 @@ public sealed partial class SalvageLightMod : IPrototype, IBiomeSpecificMod
public float Cost { get; private set; } = 0f;
/// <inheritdoc/>
[DataField("biomes", customTypeSerializer: typeof(PrototypeIdListSerializer<SalvageBiomeModPrototype>))]
public List<string>? Biomes { get; private set; } = null;
[DataField]
public List<ProtoId<SalvageBiomeModPrototype>>? Biomes { get; private set; } = null;
[DataField("color", required: true)] public Color? Color;
}

View File

@@ -1,5 +1,4 @@
using Robust.Shared.Prototypes;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype.List;
namespace Content.Shared.Salvage.Expeditions.Modifiers;
@@ -15,8 +14,8 @@ public sealed partial class SalvageTemperatureMod : IPrototype, IBiomeSpecificMo
public float Cost { get; private set; } = 0f;
/// <inheritdoc/>
[DataField("biomes", customTypeSerializer: typeof(PrototypeIdListSerializer<SalvageBiomeModPrototype>))]
public List<string>? Biomes { get; private set; } = null;
[DataField]
public List<ProtoId<SalvageBiomeModPrototype>>? Biomes { get; private set; } = null;
/// <summary>
/// Temperature in the planets air mix.

View File

@@ -1,7 +1,6 @@
using Content.Shared.Weather;
using Robust.Shared.Prototypes;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype.List;
namespace Content.Shared.Salvage.Expeditions.Modifiers;
@@ -17,8 +16,8 @@ public sealed partial class SalvageWeatherMod : IPrototype, IBiomeSpecificMod
public float Cost { get; private set; } = 0f;
/// <inheritdoc/>
[DataField("biomes", customTypeSerializer: typeof(PrototypeIdListSerializer<SalvageBiomeModPrototype>))]
public List<string>? Biomes { get; private set; } = null;
[DataField]
public List<ProtoId<SalvageBiomeModPrototype>>? Biomes { get; private set; } = null;
/// <summary>
/// Weather prototype to use on the planet.

View File

@@ -1,7 +1,6 @@
using Robust.Shared.Containers;
using Robust.Shared.GameStates;
using Robust.Shared.Prototypes;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype.List;
namespace Content.Shared.Silicons.Borgs.Components;
@@ -14,8 +13,8 @@ public sealed partial class ItemBorgModuleComponent : Component
/// <summary>
/// The items that are provided.
/// </summary>
[DataField("items", customTypeSerializer: typeof(PrototypeIdListSerializer<EntityPrototype>), required: true)]
public List<string> Items = new();
[DataField(required: true)]
public List<EntProtoId> Items = new();
/// <summary>
/// The entities from <see cref="Items"/> that were spawned.

View File

@@ -1,7 +1,5 @@
using Content.Shared.FixedPoint;
using Robust.Shared.Prototypes;
using Robust.Shared.Prototypes;
using Robust.Shared.Serialization;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype.List;
namespace Content.Shared.Silicons.Laws;
@@ -71,8 +69,8 @@ public sealed partial class SiliconLawsetPrototype : IPrototype
/// <summary>
/// List of law prototype ids in this lawset.
/// </summary>
[DataField(required: true, customTypeSerializer: typeof(PrototypeIdListSerializer<SiliconLawPrototype>))]
public List<string> Laws = new();
[DataField(required: true)]
public List<ProtoId<SiliconLawPrototype>> Laws = new();
/// <summary>
/// What entity the lawset considers as a figure of authority.

View File

@@ -4,7 +4,6 @@ using Robust.Shared.GameStates;
using Robust.Shared.Prototypes;
using Robust.Shared.Serialization;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype.List;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype.Dictionary;
namespace Content.Shared.Singularity.Components;
@@ -31,8 +30,8 @@ public sealed partial class EmitterComponent : Component
[DataField("boltType", customTypeSerializer: typeof(PrototypeIdSerializer<EntityPrototype>))]
public string BoltType = "EmitterBolt";
[DataField("selectableTypes", customTypeSerializer: typeof(PrototypeIdListSerializer<EntityPrototype>))]
public List<string> SelectableTypes = new();
[DataField]
public List<EntProtoId> SelectableTypes = new();
/// <summary>
/// The current amount of power being used.

View File

@@ -1,3 +1,5 @@
using Content.Shared.DeviceNetwork;
using Robust.Shared.Prototypes;
using Robust.Shared.Serialization;
namespace Content.Shared.SurveillanceCamera;
@@ -83,11 +85,11 @@ public sealed class SurveillanceCameraSetupBoundUiState : BoundUserInterfaceStat
{
public string Name { get; }
public uint Network { get; }
public List<string> Networks { get; }
public List<ProtoId<DeviceFrequencyPrototype>> Networks { get; }
public bool NameDisabled { get; }
public bool NetworkDisabled { get; }
public SurveillanceCameraSetupBoundUiState(string name, uint network, List<string> networks, bool nameDisabled, bool networkDisabled)
public SurveillanceCameraSetupBoundUiState(string name, uint network, List<ProtoId<DeviceFrequencyPrototype>> networks, bool nameDisabled, bool networkDisabled)
{
Name = name;
Network = network;

View File

@@ -1,7 +1,7 @@
using Content.Shared.Maps;
using Robust.Shared.Audio;
using Robust.Shared.GameStates;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype.List;
using Robust.Shared.Prototypes;
namespace Content.Shared.Tiles
{
@@ -12,8 +12,8 @@ namespace Content.Shared.Tiles
[RegisterComponent, NetworkedComponent]
public sealed partial class FloorTileComponent : Component
{
[DataField("outputs", customTypeSerializer: typeof(PrototypeIdListSerializer<ContentTileDefinition>))]
public List<string>? OutputTiles;
[DataField]
public List<ProtoId<ContentTileDefinition>>? Outputs;
[DataField("placeTileSound")] public SoundSpecifier PlaceTileSound =
new SoundPathSpecifier("/Audio/Items/genhit.ogg")

View File

@@ -2,7 +2,6 @@ using System.Diagnostics.CodeAnalysis;
using System.Linq;
using System.Numerics;
using Content.Shared.Administration.Logs;
using Content.Shared.Audio;
using Content.Shared.Database;
using Content.Shared.Interaction;
using Content.Shared.Maps;
@@ -17,7 +16,6 @@ using Robust.Shared.Network;
using Robust.Shared.Physics;
using Robust.Shared.Physics.Components;
using Robust.Shared.Physics.Systems;
using Robust.Shared.Random;
using Robust.Shared.Timing;
namespace Content.Shared.Tiles;
@@ -60,7 +58,7 @@ public sealed class FloorTileSystem : EntitySystem
if (!TryComp<StackComponent>(uid, out var stack))
return;
if (component.OutputTiles == null)
if (component.Outputs == null)
return;
// this looks a bit sussy but it might be because it needs to be able to place off of grids and expand them
@@ -127,7 +125,7 @@ public sealed class FloorTileSystem : EntitySystem
}
TryComp<MapGridComponent>(location.EntityId, out var mapGrid);
foreach (var currentTile in component.OutputTiles)
foreach (var currentTile in component.Outputs)
{
var currentTileDefinition = (ContentTileDefinition) _tileDefinitionManager[currentTile];
@@ -167,7 +165,7 @@ public sealed class FloorTileSystem : EntitySystem
var gridXform = Transform(grid);
_transform.SetWorldPosition((grid, gridXform), locationMap.Position);
location = new EntityCoordinates(grid, Vector2.Zero);
PlaceAt(args.User, grid, grid.Comp, location, _tileDefinitionManager[component.OutputTiles[0]].TileId, component.PlaceTileSound, grid.Comp.TileSize / 2f);
PlaceAt(args.User, grid, grid.Comp, location, _tileDefinitionManager[component.Outputs[0]].TileId, component.PlaceTileSound, grid.Comp.TileSize / 2f);
return;
}
}