From 7bec14863440fbf51fd286fbb899ad33c0119057 Mon Sep 17 00:00:00 2001
From: Nemanja <98561806+EmoGarbage404@users.noreply.github.com>
Date: Thu, 8 May 2025 15:53:19 -0400
Subject: [PATCH] Validate Cargo Markets (#37271)
* Validate cargo markets
* readonly market ID
---
.../Cargo/Components/CargoOrderConsoleComponent.cs | 2 +-
.../Cargo/Prototypes/CargoMarketPrototype.cs | 14 ++++++++++++++
.../Cargo/Prototypes/CargoProductPrototype.cs | 2 +-
Resources/Prototypes/Catalog/Cargo/markets.yml | 2 ++
4 files changed, 18 insertions(+), 2 deletions(-)
create mode 100644 Content.Shared/Cargo/Prototypes/CargoMarketPrototype.cs
create mode 100644 Resources/Prototypes/Catalog/Cargo/markets.yml
diff --git a/Content.Shared/Cargo/Components/CargoOrderConsoleComponent.cs b/Content.Shared/Cargo/Components/CargoOrderConsoleComponent.cs
index 8b189313ae..44790d8881 100644
--- a/Content.Shared/Cargo/Components/CargoOrderConsoleComponent.cs
+++ b/Content.Shared/Cargo/Components/CargoOrderConsoleComponent.cs
@@ -78,7 +78,7 @@ public sealed partial class CargoOrderConsoleComponent : Component
/// All of the s that are supported.
///
[DataField, AutoNetworkedField]
- public List AllowedGroups = new() { "market" };
+ public List> AllowedGroups = new() { "market" };
///
/// 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
index 0000000000..32fe3a4dac
--- /dev/null
+++ b/Content.Shared/Cargo/Prototypes/CargoMarketPrototype.cs
@@ -0,0 +1,14 @@
+using Robust.Shared.Prototypes;
+
+namespace Content.Shared.Cargo.Prototypes;
+
+///
+/// Defines a "market" that a cargo computer can access and make orders from.
+///
+[Prototype]
+public sealed partial class CargoMarketPrototype : IPrototype
+{
+ ///
+ [IdDataField]
+ public string ID { get; private set; } = default!;
+}
diff --git a/Content.Shared/Cargo/Prototypes/CargoProductPrototype.cs b/Content.Shared/Cargo/Prototypes/CargoProductPrototype.cs
index 5a18b6becc..d98c9bd8f7 100644
--- a/Content.Shared/Cargo/Prototypes/CargoProductPrototype.cs
+++ b/Content.Shared/Cargo/Prototypes/CargoProductPrototype.cs
@@ -93,6 +93,6 @@ namespace Content.Shared.Cargo.Prototypes
/// The prototype group of the product. (e.g. Contraband)
///
[DataField]
- public string Group { get; private set; } = "market";
+ public ProtoId 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
index 0000000000..b6d8790a8f
--- /dev/null
+++ b/Resources/Prototypes/Catalog/Cargo/markets.yml
@@ -0,0 +1,2 @@
+- type: cargoMarket
+ id: market
--
2.51.2