refactor(backend): align station module production semantics
This commit is contained in:
@@ -34,17 +34,16 @@ internal sealed class StationLifecycleService
|
||||
|
||||
private void UpdateStationPopulation(SimulationWorld world, StationRuntime station, float deltaSeconds, ICollection<SimulationEventRecord> events)
|
||||
{
|
||||
station.WorkforceRequired = MathF.Max(12f, station.Modules.Count * 14f);
|
||||
station.WorkforceRequired = GetStationRequiredWorkforce(world.ModuleDefinitions, station);
|
||||
|
||||
var requiredWater = station.Population * WaterConsumptionPerWorkerPerSecond * deltaSeconds;
|
||||
var consumedWater = RemoveInventory(station.Inventory, "water", requiredWater);
|
||||
var waterSatisfied = requiredWater <= 0.01f || consumedWater + 0.001f >= requiredWater;
|
||||
var habitatModules = CountStationModules(station, ModuleType.Habitation);
|
||||
station.PopulationCapacity = 40f + (habitatModules * 220f);
|
||||
station.PopulationCapacity = GetStationSupportedPopulation(world.ModuleDefinitions, station);
|
||||
|
||||
if (waterSatisfied)
|
||||
{
|
||||
if (habitatModules > 0 && station.Population < station.PopulationCapacity)
|
||||
if (station.PopulationCapacity > 40f && station.Population < station.PopulationCapacity)
|
||||
{
|
||||
station.Population = MathF.Min(station.PopulationCapacity, station.Population + (PopulationGrowthPerSecond * deltaSeconds));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user