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