Add test for cargo products (#5470)

This commit is contained in:
metalgearsloth
2021-11-28 22:24:09 +11:00
committed by GitHub
parent 45ae0ffcf4
commit 2b3e144549
2 changed files with 7 additions and 2 deletions

View File

@@ -4,9 +4,11 @@ using System.Collections.Generic;
using Robust.Shared.GameObjects;
using Robust.Shared.GameStates;
using Robust.Shared.IoC;
using Robust.Shared.Log;
using Robust.Shared.Prototypes;
using Robust.Shared.Serialization;
using Robust.Shared.Serialization.Manager.Attributes;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype.List;
namespace Content.Shared.Cargo.Components
{
@@ -15,7 +17,7 @@ namespace Content.Shared.Cargo.Components
{
public sealed override string Name => "GalacticMarket";
[DataField("products")]
[DataField("products", customTypeSerializer: typeof(PrototypeIdListSerializer<CargoProductPrototype>))]
protected List<string> _productIds = new();
protected readonly List<CargoProductPrototype> _products = new();
@@ -35,6 +37,7 @@ namespace Content.Shared.Cargo.Components
{
if (!prototypeManager.TryIndex(id, out CargoProductPrototype? product))
{
Logger.ErrorS("cargo", $"Unable to find {nameof(CargoProductPrototype)} for {id}");
continue;
}