Refactor station modules into typed runtime models

This commit is contained in:
2026-03-27 14:59:15 -04:00
parent f961ac62b6
commit e8fb033a01
13 changed files with 408 additions and 169 deletions

View File

@@ -101,13 +101,7 @@ internal static class LoaderSupport
return;
}
station.Modules.Add(new StationModuleRuntime
{
Id = $"{station.Id}-module-{station.Modules.Count + 1}",
ModuleId = moduleId,
Health = definition.Hull,
MaxHealth = definition.Hull,
});
station.Modules.Add(StationModuleRuntime.Create($"{station.Id}-module-{station.Modules.Count + 1}", definition));
station.Radius = GetStationRadius(moduleDefinitions, station);
}
@@ -126,14 +120,6 @@ internal static class LoaderSupport
internal static int CountModules(IEnumerable<string> modules, string moduleId) =>
modules.Count(candidate => string.Equals(candidate, moduleId, StringComparison.Ordinal));
internal static int CountModules(
IEnumerable<string> modules,
IReadOnlyDictionary<string, ModuleDefinition> moduleDefinitions,
ModuleType moduleType) =>
modules.Count(moduleId =>
moduleDefinitions.TryGetValue(moduleId, out var definition)
&& definition.ModuleType == moduleType);
internal static float ComputeWorkforceRatio(float population, float workforceRequired)
{
if (workforceRequired <= 0.01f)