Refactor runtime bootstrap and ship control flows

This commit is contained in:
2026-04-03 01:12:26 -04:00
parent 0bb72bee35
commit 706e1cda8f
129 changed files with 9588 additions and 3548 deletions

View File

@@ -1,5 +1,7 @@
using System.Globalization;
using static SpaceGame.Api.Shared.Runtime.SimulationRuntimeSupport;
namespace SpaceGame.Api.Geopolitics.Simulation;
internal sealed class GeopoliticalSimulationService
@@ -198,14 +200,24 @@ internal sealed class GeopoliticalSimulationService
var stationStrength = (stationsByFaction.FirstOrDefault(group => group.Key == factionId)?.Count() ?? 0) * 50f;
var siteStrength = (sitesByFaction.FirstOrDefault(group => group.Key == factionId)?.Count() ?? 0) * 18f;
var shipStrength = shipsByFaction.FirstOrDefault(group => group.Key == factionId)?.Sum(ship =>
ship.Definition.Kind switch
{
"military" => 9f,
"construction" => 4f,
"transport" => 3f,
_ when ship.Definition.Kind == "mining" || ship.Definition.Kind == "miner" => 3f,
_ => 2f,
}) ?? 0f;
{
if (IsMilitaryShip(ship.Definition))
{
return 9f;
}
if (IsConstructionShip(ship.Definition))
{
return 4f;
}
if (IsTransportShip(ship.Definition) || IsMiningShip(ship.Definition))
{
return 3f;
}
return 2f;
}) ?? 0f;
var logisticsStrength = MathF.Min(30f, stationStrength * 0.18f) + siteStrength;
influences.Add(new TerritoryInfluenceRuntime
{