refactor(backend): align station module production semantics
This commit is contained in:
@@ -150,12 +150,6 @@ public sealed class RecipeInputDefinition
|
||||
}
|
||||
}
|
||||
|
||||
public sealed class ModuleConstructionDefinition
|
||||
{
|
||||
public required List<RecipeInputDefinition> Requirements { get; set; }
|
||||
public float ProductionTime { get; set; }
|
||||
}
|
||||
|
||||
public sealed class ModuleDockDefinition
|
||||
{
|
||||
public int Capacity { get; set; }
|
||||
@@ -168,10 +162,14 @@ public sealed class ModuleCargoDefinition
|
||||
public required string Type { get; set; }
|
||||
}
|
||||
|
||||
public sealed class ModuleWorkForceDefinition
|
||||
public sealed class ModuleWorkforceDefinition
|
||||
{
|
||||
public float Capacity { get; set; }
|
||||
public float Max { get; set; }
|
||||
[JsonPropertyName("capacity")]
|
||||
public float SupportedPopulation { get; set; }
|
||||
|
||||
[JsonPropertyName("max")]
|
||||
public float RequiredWorkforce { get; set; }
|
||||
|
||||
public string Race { get; set; } = string.Empty;
|
||||
}
|
||||
|
||||
@@ -183,7 +181,7 @@ public sealed class ModuleMountDefinition
|
||||
public List<string> Types { get; set; } = [];
|
||||
}
|
||||
|
||||
public sealed class ModuleProductionDefinition
|
||||
public sealed class ModuleBuildRecipeDefinition
|
||||
{
|
||||
public float Time { get; set; }
|
||||
public float Amount { get; set; }
|
||||
@@ -206,12 +204,9 @@ public class ModuleDefinition
|
||||
Description = source.Description;
|
||||
Type = source.Type;
|
||||
ModuleType = source.ModuleType;
|
||||
Product = source.Product;
|
||||
Products = [.. source.Products];
|
||||
ProductionMode = source.ProductionMode;
|
||||
ProductIds = [.. source.ProductIds];
|
||||
Radius = source.Radius;
|
||||
Hull = source.Hull;
|
||||
WorkforceNeeded = source.WorkforceNeeded;
|
||||
Version = source.Version;
|
||||
Macro = source.Macro;
|
||||
MakerRace = source.MakerRace;
|
||||
@@ -219,12 +214,11 @@ public class ModuleDefinition
|
||||
Price = source.Price;
|
||||
Owners = [.. source.Owners];
|
||||
Cargo = source.Cargo;
|
||||
WorkForce = source.WorkForce;
|
||||
SerializedWorkforce = source.SerializedWorkforce;
|
||||
Docks = [.. source.Docks];
|
||||
Shields = [.. source.Shields];
|
||||
Turrets = [.. source.Turrets];
|
||||
Production = [.. source.Production];
|
||||
Construction = source.Construction;
|
||||
BuildRecipes = [.. source.BuildRecipes];
|
||||
}
|
||||
|
||||
public required string Id { get; set; }
|
||||
@@ -233,13 +227,12 @@ public class ModuleDefinition
|
||||
public required string Type { get; set; }
|
||||
[JsonIgnore]
|
||||
public ModuleType ModuleType { get; set; }
|
||||
[JsonPropertyName("product")]
|
||||
public List<string> ProductIds { get; set; } = [];
|
||||
[JsonIgnore]
|
||||
public string? Product { get; set; }
|
||||
public List<string> Products { get; set; } = [];
|
||||
public string ProductionMode { get; set; } = "passive";
|
||||
public virtual IReadOnlyList<string> ProductItemIds => [];
|
||||
public float Radius { get; set; } = 12f;
|
||||
public float Hull { get; set; } = 100f;
|
||||
public float WorkforceNeeded { get; set; }
|
||||
public int Version { get; set; }
|
||||
public string Macro { get; set; } = string.Empty;
|
||||
public string MakerRace { get; set; } = string.Empty;
|
||||
@@ -247,30 +240,58 @@ public class ModuleDefinition
|
||||
public ItemPriceDefinition? Price { get; set; }
|
||||
public List<string> Owners { get; set; } = [];
|
||||
public ModuleCargoDefinition? Cargo { get; set; }
|
||||
public ModuleWorkForceDefinition? WorkForce { get; set; }
|
||||
[JsonPropertyName("workForce")]
|
||||
public ModuleWorkforceDefinition? SerializedWorkforce { get; set; }
|
||||
public List<ModuleDockDefinition> Docks { get; set; } = [];
|
||||
public List<ModuleMountDefinition> Shields { get; set; } = [];
|
||||
public List<ModuleMountDefinition> Turrets { get; set; } = [];
|
||||
public List<ModuleProductionDefinition> Production { get; set; } = [];
|
||||
public ModuleConstructionDefinition? Construction { get; set; }
|
||||
[JsonPropertyName("product")]
|
||||
public List<string> ProductIds
|
||||
[JsonPropertyName("production")]
|
||||
public List<ModuleBuildRecipeDefinition> BuildRecipes { get; set; } = [];
|
||||
}
|
||||
|
||||
public abstract class ProductionLaneModuleDefinition : ModuleDefinition
|
||||
{
|
||||
[SetsRequiredMembers]
|
||||
protected ProductionLaneModuleDefinition(ModuleDefinition source, float requiredWorkforce)
|
||||
: base(source)
|
||||
{
|
||||
RequiredWorkforce = requiredWorkforce;
|
||||
}
|
||||
|
||||
public float RequiredWorkforce { get; init; }
|
||||
}
|
||||
|
||||
public sealed class ProductionModuleDefinition : ProductionLaneModuleDefinition
|
||||
{
|
||||
[SetsRequiredMembers]
|
||||
internal ProductionModuleDefinition(ModuleDefinition source, float requiredWorkforce)
|
||||
: base(source, requiredWorkforce)
|
||||
{
|
||||
ProductItemIds = [.. source.ProductIds];
|
||||
}
|
||||
|
||||
public override IReadOnlyList<string> ProductItemIds { get; } = [];
|
||||
}
|
||||
|
||||
public sealed class BuildModuleDefinition : ProductionLaneModuleDefinition
|
||||
{
|
||||
[SetsRequiredMembers]
|
||||
internal BuildModuleDefinition(ModuleDefinition source, float requiredWorkforce)
|
||||
: base(source, requiredWorkforce)
|
||||
{
|
||||
get => Products;
|
||||
set => Products = value ?? [];
|
||||
}
|
||||
}
|
||||
|
||||
public sealed class ProductionModuleDefinition : ModuleDefinition
|
||||
public sealed class HabitationModuleDefinition : ModuleDefinition
|
||||
{
|
||||
[SetsRequiredMembers]
|
||||
internal ProductionModuleDefinition(ModuleDefinition source)
|
||||
internal HabitationModuleDefinition(ModuleDefinition source, float supportedPopulation)
|
||||
: base(source)
|
||||
{
|
||||
ProductItemIds = [.. source.Products];
|
||||
SupportedPopulation = supportedPopulation;
|
||||
}
|
||||
|
||||
public IReadOnlyList<string> ProductItemIds { get; init; } = [];
|
||||
public float SupportedPopulation { get; init; }
|
||||
}
|
||||
|
||||
public sealed class StorageModuleDefinition : ModuleDefinition
|
||||
|
||||
Reference in New Issue
Block a user