Validate prototype ids in c# fields (#18224)

This commit is contained in:
Leon Friedrich
2023-07-30 05:34:51 +12:00
committed by GitHub
parent d4a85afb88
commit 385b587cfc
21 changed files with 116 additions and 74 deletions

View File

@@ -676,9 +676,9 @@ namespace Content.Shared.Chemistry.Components
[DataDefinition]
public readonly struct ReagentQuantity: IComparable<ReagentQuantity>
{
[DataField("ReagentId", customTypeSerializer:typeof(PrototypeIdSerializer<ReagentPrototype>))]
[DataField("ReagentId", customTypeSerializer:typeof(PrototypeIdSerializer<ReagentPrototype>), required:true)]
public readonly string ReagentId;
[DataField("Quantity")]
[DataField("Quantity", required:true)]
public readonly FixedPoint2 Quantity;
public ReagentQuantity(string reagentId, FixedPoint2 quantity)
@@ -687,6 +687,10 @@ namespace Content.Shared.Chemistry.Components
Quantity = quantity;
}
public ReagentQuantity() : this(string.Empty, default)
{
}
[ExcludeFromCodeCoverage]
public override string ToString()
{