Fix cargo gifts (#18449)

Some of the IDs were invalid and no typeserializer.
This commit is contained in:
metalgearsloth
2023-07-31 04:53:54 +10:00
committed by GitHub
parent 9647d2cf59
commit b0b1597aad
5 changed files with 29 additions and 15 deletions

View File

@@ -1,6 +1,8 @@
using Content.Server.StationEvents.Events;
using Content.Shared.Cargo.Prototypes;
using Robust.Shared.Prototypes;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype.Dictionary;
namespace Content.Server.StationEvents.Components;
@@ -38,8 +40,8 @@ public sealed class CargoGiftsRuleComponent : Component
/// Cargo that you would like gifted to the station, with the quantity for each
/// Use Ids from cargoProduct Prototypes
/// </summary>
[DataField("gifts"), ViewVariables(VVAccess.ReadWrite)]
public Dictionary<string, int> Gifts = new Dictionary<string, int>();
[DataField("gifts", required: true, customTypeSerializer:typeof(PrototypeIdDictionarySerializer<int, CargoProductPrototype>)), ViewVariables(VVAccess.ReadWrite)]
public Dictionary<string, int> Gifts = new();
/// <summary>
/// How much space (minimum) you want to leave in the order database for supply to actually do their work