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,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);
}