Refactor station modules into typed runtime models
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user