]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Validate Cargo Markets (#37271)
authorNemanja <98561806+EmoGarbage404@users.noreply.github.com>
Thu, 8 May 2025 19:53:19 +0000 (15:53 -0400)
committerGitHub <noreply@github.com>
Thu, 8 May 2025 19:53:19 +0000 (21:53 +0200)
* Validate cargo markets

* readonly market ID

Content.Shared/Cargo/Components/CargoOrderConsoleComponent.cs
Content.Shared/Cargo/Prototypes/CargoMarketPrototype.cs [new file with mode: 0644]
Content.Shared/Cargo/Prototypes/CargoProductPrototype.cs
Resources/Prototypes/Catalog/Cargo/markets.yml [new file with mode: 0644]

index 8b189313ae4ce080b1ee41cacb61ed8e1573de3b..44790d8881f28ad1914b407bb4f1a565b1e4ac99 100644 (file)
@@ -78,7 +78,7 @@ public sealed partial class CargoOrderConsoleComponent : Component
     /// All of the <see cref="CargoProductPrototype.Group"/>s that are supported.
     /// </summary>
     [DataField, AutoNetworkedField]
-    public List<string> AllowedGroups = new() { "market" };
+    public List<ProtoId<CargoMarketPrototype>> AllowedGroups = new() { "market" };
 
     /// <summary>
     /// Access needed to toggle the limit on this console.
diff --git a/Content.Shared/Cargo/Prototypes/CargoMarketPrototype.cs b/Content.Shared/Cargo/Prototypes/CargoMarketPrototype.cs
new file mode 100644 (file)
index 0000000..32fe3a4
--- /dev/null
@@ -0,0 +1,14 @@
+using Robust.Shared.Prototypes;
+
+namespace Content.Shared.Cargo.Prototypes;
+
+/// <summary>
+/// Defines a "market" that a cargo computer can access and make orders from.
+/// </summary>
+[Prototype]
+public sealed partial class CargoMarketPrototype : IPrototype
+{
+    /// <inheritdoc/>
+    [IdDataField]
+    public string ID { get; private set; } = default!;
+}
index 5a18b6beccff898c7961544bb666c8d198dfe9f0..d98c9bd8f782c1128af1c49d6183e599c6bc4258 100644 (file)
@@ -93,6 +93,6 @@ namespace Content.Shared.Cargo.Prototypes
         ///     The prototype group of the product. (e.g. Contraband)
         /// </summary>
         [DataField]
-        public string Group { get; private set; } = "market";
+        public ProtoId<CargoMarketPrototype> Group { get; private set; } = "market";
     }
 }
diff --git a/Resources/Prototypes/Catalog/Cargo/markets.yml b/Resources/Prototypes/Catalog/Cargo/markets.yml
new file mode 100644 (file)
index 0000000..b6d8790
--- /dev/null
@@ -0,0 +1,2 @@
+- type: cargoMarket
+  id: market