chore: convert movement regime kinds to enum
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using System.Text.Json;
|
||||
using SpaceGame.Api.Shared.Runtime;
|
||||
using static SpaceGame.Api.Universe.Scenario.LoaderSupport;
|
||||
|
||||
namespace SpaceGame.Api.Universe.Scenario;
|
||||
@@ -271,6 +272,17 @@ internal sealed class DataCatalogLoader(string dataRoot)
|
||||
{
|
||||
foreach (var module in modules)
|
||||
{
|
||||
try
|
||||
{
|
||||
module.ModuleType = module.Type.ToModuleType();
|
||||
}
|
||||
catch (ArgumentOutOfRangeException exception)
|
||||
{
|
||||
throw new InvalidOperationException($"Module '{module.Id}' has unsupported type '{module.Type}'.", exception);
|
||||
}
|
||||
|
||||
module.Type = module.ModuleType.ToDataValue();
|
||||
|
||||
if (module.Products.Count == 0 && !string.IsNullOrWhiteSpace(module.Product))
|
||||
{
|
||||
module.Products = [module.Product];
|
||||
@@ -278,7 +290,7 @@ internal sealed class DataCatalogLoader(string dataRoot)
|
||||
|
||||
if (string.IsNullOrWhiteSpace(module.ProductionMode))
|
||||
{
|
||||
module.ProductionMode = string.Equals(module.Type, "buildmodule", StringComparison.Ordinal)
|
||||
module.ProductionMode = module.ModuleType == ModuleType.BuildModule
|
||||
? "commanded"
|
||||
: "passive";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user