Refactor backend into domain-first slices
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace SpaceGame.Api.Data;
|
||||
namespace SpaceGame.Api.Definitions;
|
||||
|
||||
public sealed class ConstructionDefinition
|
||||
{
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace SpaceGame.Api.Contracts;
|
||||
namespace SpaceGame.Api.Economy.Contracts;
|
||||
|
||||
public sealed record MarketOrderSnapshot(
|
||||
string Id,
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace SpaceGame.Api.Simulation.Model;
|
||||
namespace SpaceGame.Api.Economy.Runtime;
|
||||
|
||||
public sealed class MarketOrderRuntime
|
||||
{
|
||||
@@ -1,10 +1,6 @@
|
||||
using SpaceGame.Api.Contracts;
|
||||
using SpaceGame.Api.Simulation.AI;
|
||||
using SpaceGame.Api.Simulation.Engine;
|
||||
using SpaceGame.Api.Simulation.Model;
|
||||
using static SpaceGame.Api.Simulation.Support.SimulationRuntimeSupport;
|
||||
using static SpaceGame.Api.Shared.Runtime.SimulationRuntimeSupport;
|
||||
|
||||
namespace SpaceGame.Api.Simulation.Systems;
|
||||
namespace SpaceGame.Api.Factions.AI;
|
||||
|
||||
internal sealed class CommanderPlanningService
|
||||
{
|
||||
@@ -1,7 +1,5 @@
|
||||
using SpaceGame.Api.Simulation.Engine;
|
||||
using SpaceGame.Api.Simulation.Model;
|
||||
|
||||
namespace SpaceGame.Api.Simulation.AI;
|
||||
namespace SpaceGame.Api.Factions.AI;
|
||||
|
||||
// ─── Planning State ────────────────────────────────────────────────────────────
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace SpaceGame.Api.Contracts;
|
||||
namespace SpaceGame.Api.Factions.Contracts;
|
||||
|
||||
public sealed record FactionGoapStateSnapshot(
|
||||
int MilitaryShipCount,
|
||||
@@ -1,6 +1,5 @@
|
||||
using SpaceGame.Api.Simulation.AI;
|
||||
|
||||
namespace SpaceGame.Api.Simulation.Model;
|
||||
namespace SpaceGame.Api.Factions.Runtime;
|
||||
|
||||
public sealed class FactionRuntime
|
||||
{
|
||||
21
apps/backend/GlobalUsings.cs
Normal file
21
apps/backend/GlobalUsings.cs
Normal file
@@ -0,0 +1,21 @@
|
||||
global using SpaceGame.Api.Definitions;
|
||||
global using SpaceGame.Api.Economy.Contracts;
|
||||
global using SpaceGame.Api.Economy.Runtime;
|
||||
global using SpaceGame.Api.Factions.AI;
|
||||
global using SpaceGame.Api.Factions.Contracts;
|
||||
global using SpaceGame.Api.Factions.Runtime;
|
||||
global using SpaceGame.Api.Shared.AI;
|
||||
global using SpaceGame.Api.Shared.Contracts;
|
||||
global using SpaceGame.Api.Shared.Runtime;
|
||||
global using SpaceGame.Api.Ships.AI;
|
||||
global using SpaceGame.Api.Ships.Contracts;
|
||||
global using SpaceGame.Api.Ships.Runtime;
|
||||
global using SpaceGame.Api.Ships.Simulation;
|
||||
global using SpaceGame.Api.Simulation.Core;
|
||||
global using SpaceGame.Api.Stations.Contracts;
|
||||
global using SpaceGame.Api.Stations.Runtime;
|
||||
global using SpaceGame.Api.Stations.Simulation;
|
||||
global using SpaceGame.Api.Universe.Contracts;
|
||||
global using SpaceGame.Api.Universe.Runtime;
|
||||
global using SpaceGame.Api.Universe.Scenario;
|
||||
global using SpaceGame.Api.Universe.Simulation;
|
||||
@@ -1,5 +1,5 @@
|
||||
using FastEndpoints;
|
||||
using SpaceGame.Api.Simulation;
|
||||
using SpaceGame.Api.Universe.Simulation;
|
||||
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
using SpaceGame.Api.Simulation.Engine;
|
||||
using SpaceGame.Api.Simulation.Model;
|
||||
|
||||
namespace SpaceGame.Api.Simulation.AI;
|
||||
namespace SpaceGame.Api.Shared.AI;
|
||||
|
||||
public abstract class GoapAction<TState>
|
||||
{
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace SpaceGame.Api.Contracts;
|
||||
namespace SpaceGame.Api.Shared.Contracts;
|
||||
|
||||
public sealed record Vector3Dto(float X, float Y, float Z);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace SpaceGame.Api.Simulation.Model;
|
||||
namespace SpaceGame.Api.Shared.Runtime;
|
||||
|
||||
public enum SpatialNodeKind
|
||||
{
|
||||
@@ -1,7 +1,5 @@
|
||||
using SpaceGame.Api.Data;
|
||||
using SpaceGame.Api.Simulation.Model;
|
||||
|
||||
namespace SpaceGame.Api.Simulation.Support;
|
||||
namespace SpaceGame.Api.Shared.Runtime;
|
||||
|
||||
internal static class SimulationRuntimeSupport
|
||||
{
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace SpaceGame.Api.Simulation.Model;
|
||||
namespace SpaceGame.Api.Shared.Runtime;
|
||||
|
||||
public static class SimulationUnits
|
||||
{
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace SpaceGame.Api.Simulation.Model;
|
||||
namespace SpaceGame.Api.Shared.Runtime;
|
||||
|
||||
public readonly record struct Vector3(float X, float Y, float Z)
|
||||
{
|
||||
@@ -1,7 +1,5 @@
|
||||
using SpaceGame.Api.Simulation.Engine;
|
||||
using SpaceGame.Api.Simulation.Model;
|
||||
|
||||
namespace SpaceGame.Api.Simulation.AI;
|
||||
namespace SpaceGame.Api.Ships.AI;
|
||||
|
||||
internal interface IShipBehaviorState
|
||||
{
|
||||
@@ -1,7 +1,5 @@
|
||||
using SpaceGame.Api.Simulation.Engine;
|
||||
using SpaceGame.Api.Simulation.Model;
|
||||
|
||||
namespace SpaceGame.Api.Simulation.AI;
|
||||
namespace SpaceGame.Api.Ships.AI;
|
||||
|
||||
internal sealed class ShipBehaviorStateMachine
|
||||
{
|
||||
@@ -1,7 +1,5 @@
|
||||
using SpaceGame.Api.Simulation.Engine;
|
||||
using SpaceGame.Api.Simulation.Model;
|
||||
|
||||
namespace SpaceGame.Api.Simulation.AI;
|
||||
namespace SpaceGame.Api.Ships.AI;
|
||||
|
||||
internal sealed class IdleShipBehaviorState : IShipBehaviorState
|
||||
{
|
||||
@@ -1,7 +1,5 @@
|
||||
using SpaceGame.Api.Simulation.Engine;
|
||||
using SpaceGame.Api.Simulation.Model;
|
||||
|
||||
namespace SpaceGame.Api.Simulation.AI;
|
||||
namespace SpaceGame.Api.Ships.AI;
|
||||
|
||||
// ─── Planning State ────────────────────────────────────────────────────────────
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace SpaceGame.Api.Contracts;
|
||||
namespace SpaceGame.Api.Ships.Contracts;
|
||||
|
||||
public sealed record ShipSnapshot(
|
||||
string Id,
|
||||
@@ -1,6 +1,5 @@
|
||||
using SpaceGame.Api.Data;
|
||||
|
||||
namespace SpaceGame.Api.Simulation.Model;
|
||||
namespace SpaceGame.Api.Ships.Runtime;
|
||||
|
||||
public sealed class ShipRuntime
|
||||
{
|
||||
@@ -1,11 +1,7 @@
|
||||
using SpaceGame.Api.Contracts;
|
||||
using SpaceGame.Api.Simulation.AI;
|
||||
using SpaceGame.Api.Simulation.Engine;
|
||||
using SpaceGame.Api.Simulation.Model;
|
||||
using static SpaceGame.Api.Simulation.Systems.InfrastructureSimulationService;
|
||||
using static SpaceGame.Api.Simulation.Support.SimulationRuntimeSupport;
|
||||
using static SpaceGame.Api.Stations.Simulation.InfrastructureSimulationService;
|
||||
using static SpaceGame.Api.Shared.Runtime.SimulationRuntimeSupport;
|
||||
|
||||
namespace SpaceGame.Api.Simulation.Systems;
|
||||
namespace SpaceGame.Api.Ships.Simulation;
|
||||
|
||||
internal sealed class ShipControlService
|
||||
{
|
||||
@@ -1,9 +1,7 @@
|
||||
using SpaceGame.Api.Simulation.Model;
|
||||
using SpaceGame.Api.Simulation.Support;
|
||||
using static SpaceGame.Api.Simulation.Systems.InfrastructureSimulationService;
|
||||
using static SpaceGame.Api.Simulation.Support.SimulationRuntimeSupport;
|
||||
using static SpaceGame.Api.Stations.Simulation.InfrastructureSimulationService;
|
||||
using static SpaceGame.Api.Shared.Runtime.SimulationRuntimeSupport;
|
||||
|
||||
namespace SpaceGame.Api.Simulation.Systems;
|
||||
namespace SpaceGame.Api.Ships.Simulation;
|
||||
|
||||
internal sealed partial class ShipTaskExecutionService
|
||||
{
|
||||
@@ -1,8 +1,7 @@
|
||||
using SpaceGame.Api.Simulation.Model;
|
||||
using static SpaceGame.Api.Simulation.Systems.InfrastructureSimulationService;
|
||||
using static SpaceGame.Api.Simulation.Support.SimulationRuntimeSupport;
|
||||
using static SpaceGame.Api.Stations.Simulation.InfrastructureSimulationService;
|
||||
using static SpaceGame.Api.Shared.Runtime.SimulationRuntimeSupport;
|
||||
|
||||
namespace SpaceGame.Api.Simulation.Systems;
|
||||
namespace SpaceGame.Api.Ships.Simulation;
|
||||
|
||||
internal sealed partial class ShipTaskExecutionService
|
||||
{
|
||||
@@ -1,9 +1,5 @@
|
||||
using SpaceGame.Api.Contracts;
|
||||
using SpaceGame.Api.Simulation.Model;
|
||||
using SpaceGame.Api.Simulation.Support;
|
||||
using SpaceGame.Api.Simulation.Systems;
|
||||
|
||||
namespace SpaceGame.Api.Simulation.Engine;
|
||||
namespace SpaceGame.Api.Simulation.Core;
|
||||
|
||||
public sealed class SimulationEngine
|
||||
{
|
||||
@@ -1,10 +1,8 @@
|
||||
using SpaceGame.Api.Contracts;
|
||||
using SpaceGame.Api.Simulation.Model;
|
||||
using static SpaceGame.Api.Simulation.Systems.InfrastructureSimulationService;
|
||||
using static SpaceGame.Api.Simulation.Systems.StationSimulationService;
|
||||
using static SpaceGame.Api.Simulation.Support.SimulationRuntimeSupport;
|
||||
using static SpaceGame.Api.Stations.Simulation.InfrastructureSimulationService;
|
||||
using static SpaceGame.Api.Stations.Simulation.StationSimulationService;
|
||||
using static SpaceGame.Api.Shared.Runtime.SimulationRuntimeSupport;
|
||||
|
||||
namespace SpaceGame.Api.Simulation.Systems;
|
||||
namespace SpaceGame.Api.Simulation.Core;
|
||||
|
||||
internal sealed class SimulationProjectionService
|
||||
{
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace SpaceGame.Api.Contracts;
|
||||
namespace SpaceGame.Api.Stations.Contracts;
|
||||
|
||||
public sealed record InventoryEntry(
|
||||
string ItemId,
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace SpaceGame.Api.Simulation.Model;
|
||||
namespace SpaceGame.Api.Stations.Runtime;
|
||||
|
||||
public sealed class ClaimRuntime
|
||||
{
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace SpaceGame.Api.Simulation.Model;
|
||||
namespace SpaceGame.Api.Stations.Runtime;
|
||||
|
||||
public sealed class StationRuntime
|
||||
{
|
||||
@@ -1,9 +1,6 @@
|
||||
using SpaceGame.Api.Contracts;
|
||||
using SpaceGame.Api.Data;
|
||||
using SpaceGame.Api.Simulation.Model;
|
||||
using static SpaceGame.Api.Simulation.Support.SimulationRuntimeSupport;
|
||||
using static SpaceGame.Api.Shared.Runtime.SimulationRuntimeSupport;
|
||||
|
||||
namespace SpaceGame.Api.Simulation.Systems;
|
||||
namespace SpaceGame.Api.Stations.Simulation;
|
||||
|
||||
internal sealed class InfrastructureSimulationService
|
||||
{
|
||||
@@ -1,10 +1,7 @@
|
||||
using SpaceGame.Api.Data;
|
||||
using SpaceGame.Api.Contracts;
|
||||
using SpaceGame.Api.Simulation.Model;
|
||||
using static SpaceGame.Api.Simulation.Systems.ShipControlService;
|
||||
using static SpaceGame.Api.Simulation.Support.SimulationRuntimeSupport;
|
||||
using static SpaceGame.Api.Ships.Simulation.ShipControlService;
|
||||
using static SpaceGame.Api.Shared.Runtime.SimulationRuntimeSupport;
|
||||
|
||||
namespace SpaceGame.Api.Simulation.Systems;
|
||||
namespace SpaceGame.Api.Stations.Simulation;
|
||||
|
||||
internal sealed class StationLifecycleService
|
||||
{
|
||||
@@ -1,10 +1,7 @@
|
||||
using SpaceGame.Api.Data;
|
||||
using SpaceGame.Api.Contracts;
|
||||
using SpaceGame.Api.Simulation.Model;
|
||||
using static SpaceGame.Api.Simulation.Systems.CommanderPlanningService;
|
||||
using static SpaceGame.Api.Simulation.Support.SimulationRuntimeSupport;
|
||||
using static SpaceGame.Api.Factions.AI.CommanderPlanningService;
|
||||
using static SpaceGame.Api.Shared.Runtime.SimulationRuntimeSupport;
|
||||
|
||||
namespace SpaceGame.Api.Simulation.Systems;
|
||||
namespace SpaceGame.Api.Stations.Simulation;
|
||||
|
||||
internal sealed class StationSimulationService
|
||||
{
|
||||
@@ -1,7 +1,6 @@
|
||||
using FastEndpoints;
|
||||
using SpaceGame.Api.Simulation;
|
||||
|
||||
namespace SpaceGame.Api.Handlers;
|
||||
namespace SpaceGame.Api.Universe.Api;
|
||||
|
||||
public sealed class GetWorldHandler(WorldService worldService) : EndpointWithoutRequest
|
||||
{
|
||||
@@ -1,7 +1,6 @@
|
||||
using FastEndpoints;
|
||||
using SpaceGame.Api.Simulation;
|
||||
|
||||
namespace SpaceGame.Api.Handlers;
|
||||
namespace SpaceGame.Api.Universe.Api;
|
||||
|
||||
public sealed class GetWorldHealthHandler(WorldService worldService) : EndpointWithoutRequest
|
||||
{
|
||||
@@ -1,7 +1,6 @@
|
||||
using FastEndpoints;
|
||||
using SpaceGame.Api.Simulation;
|
||||
|
||||
namespace SpaceGame.Api.Handlers;
|
||||
namespace SpaceGame.Api.Universe.Api;
|
||||
|
||||
public sealed class ResetWorldHandler(WorldService worldService) : EndpointWithoutRequest
|
||||
{
|
||||
@@ -1,6 +1,6 @@
|
||||
using FastEndpoints;
|
||||
|
||||
namespace SpaceGame.Api.Handlers;
|
||||
namespace SpaceGame.Api.Universe.Api;
|
||||
|
||||
public sealed class RootRedirectHandler : EndpointWithoutRequest
|
||||
{
|
||||
@@ -1,9 +1,7 @@
|
||||
using System.Text.Json;
|
||||
using FastEndpoints;
|
||||
using SpaceGame.Api.Contracts;
|
||||
using SpaceGame.Api.Simulation;
|
||||
|
||||
namespace SpaceGame.Api.Handlers;
|
||||
namespace SpaceGame.Api.Universe.Api;
|
||||
|
||||
public sealed class StreamWorldHandler(WorldService worldService) : EndpointWithoutRequest
|
||||
{
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace SpaceGame.Api.Contracts;
|
||||
namespace SpaceGame.Api.Universe.Contracts;
|
||||
|
||||
public sealed record StarSnapshot(
|
||||
string Kind,
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace SpaceGame.Api.Contracts;
|
||||
namespace SpaceGame.Api.Universe.Contracts;
|
||||
|
||||
public sealed record WorldSnapshot(
|
||||
string Label,
|
||||
@@ -1,6 +1,5 @@
|
||||
using SpaceGame.Api.Data;
|
||||
|
||||
namespace SpaceGame.Api.Simulation.Model;
|
||||
namespace SpaceGame.Api.Universe.Runtime;
|
||||
|
||||
public sealed class SimulationWorld
|
||||
{
|
||||
@@ -1,6 +1,5 @@
|
||||
using SpaceGame.Api.Data;
|
||||
|
||||
namespace SpaceGame.Api.Simulation.Model;
|
||||
namespace SpaceGame.Api.Universe.Runtime;
|
||||
|
||||
public sealed class SystemRuntime
|
||||
{
|
||||
@@ -1,9 +1,7 @@
|
||||
using System.Text.Json;
|
||||
using SpaceGame.Api.Data;
|
||||
using SpaceGame.Api.Simulation.Model;
|
||||
using static SpaceGame.Api.Simulation.LoaderSupport;
|
||||
using static SpaceGame.Api.Universe.Scenario.LoaderSupport;
|
||||
|
||||
namespace SpaceGame.Api.Simulation;
|
||||
namespace SpaceGame.Api.Universe.Scenario;
|
||||
|
||||
internal sealed class DataCatalogLoader(string dataRoot)
|
||||
{
|
||||
@@ -1,7 +1,5 @@
|
||||
using SpaceGame.Api.Data;
|
||||
using SpaceGame.Api.Simulation.Model;
|
||||
|
||||
namespace SpaceGame.Api.Simulation;
|
||||
namespace SpaceGame.Api.Universe.Scenario;
|
||||
|
||||
internal static class LoaderSupport
|
||||
{
|
||||
@@ -1,6 +1,5 @@
|
||||
using SpaceGame.Api.Simulation.Model;
|
||||
|
||||
namespace SpaceGame.Api.Simulation;
|
||||
namespace SpaceGame.Api.Universe.Scenario;
|
||||
|
||||
public sealed class ScenarioLoader
|
||||
{
|
||||
@@ -1,8 +1,6 @@
|
||||
using SpaceGame.Api.Data;
|
||||
using SpaceGame.Api.Simulation.Model;
|
||||
using static SpaceGame.Api.Simulation.LoaderSupport;
|
||||
using static SpaceGame.Api.Universe.Scenario.LoaderSupport;
|
||||
|
||||
namespace SpaceGame.Api.Simulation;
|
||||
namespace SpaceGame.Api.Universe.Scenario;
|
||||
|
||||
internal sealed class SpatialBuilder
|
||||
{
|
||||
@@ -1,8 +1,6 @@
|
||||
using SpaceGame.Api.Data;
|
||||
using SpaceGame.Api.Simulation.Model;
|
||||
using static SpaceGame.Api.Simulation.LoaderSupport;
|
||||
using static SpaceGame.Api.Universe.Scenario.LoaderSupport;
|
||||
|
||||
namespace SpaceGame.Api.Simulation;
|
||||
namespace SpaceGame.Api.Universe.Scenario;
|
||||
|
||||
internal sealed class SystemGenerationService
|
||||
{
|
||||
@@ -1,8 +1,6 @@
|
||||
using SpaceGame.Api.Data;
|
||||
using SpaceGame.Api.Simulation.Model;
|
||||
using static SpaceGame.Api.Simulation.LoaderSupport;
|
||||
using static SpaceGame.Api.Universe.Scenario.LoaderSupport;
|
||||
|
||||
namespace SpaceGame.Api.Simulation;
|
||||
namespace SpaceGame.Api.Universe.Scenario;
|
||||
|
||||
internal sealed class WorldBuilder(
|
||||
WorldGenerationOptions worldGeneration,
|
||||
@@ -1,8 +1,6 @@
|
||||
using SpaceGame.Api.Data;
|
||||
using SpaceGame.Api.Simulation.Model;
|
||||
using static SpaceGame.Api.Simulation.LoaderSupport;
|
||||
using static SpaceGame.Api.Universe.Scenario.LoaderSupport;
|
||||
|
||||
namespace SpaceGame.Api.Simulation;
|
||||
namespace SpaceGame.Api.Universe.Scenario;
|
||||
|
||||
internal sealed class WorldSeedingService
|
||||
{
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace SpaceGame.Api.Simulation;
|
||||
namespace SpaceGame.Api.Universe.Simulation;
|
||||
|
||||
public sealed class OrbitalSimulationOptions
|
||||
{
|
||||
@@ -1,8 +1,6 @@
|
||||
using SpaceGame.Api.Data;
|
||||
using SpaceGame.Api.Simulation.Model;
|
||||
using static SpaceGame.Api.Simulation.Systems.InfrastructureSimulationService;
|
||||
using static SpaceGame.Api.Stations.Simulation.InfrastructureSimulationService;
|
||||
|
||||
namespace SpaceGame.Api.Simulation.Systems;
|
||||
namespace SpaceGame.Api.Universe.Simulation;
|
||||
|
||||
internal sealed class OrbitalStateUpdater
|
||||
{
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace SpaceGame.Api.Simulation;
|
||||
namespace SpaceGame.Api.Universe.Simulation;
|
||||
|
||||
public sealed class SimulationHostedService(WorldService worldService) : BackgroundService
|
||||
{
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace SpaceGame.Api.Simulation;
|
||||
namespace SpaceGame.Api.Universe.Simulation;
|
||||
|
||||
public sealed class WorldGenerationOptions
|
||||
{
|
||||
@@ -1,10 +1,7 @@
|
||||
using System.Threading.Channels;
|
||||
using Microsoft.Extensions.Options;
|
||||
using SpaceGame.Api.Contracts;
|
||||
using SpaceGame.Api.Simulation.Engine;
|
||||
using SpaceGame.Api.Simulation.Model;
|
||||
|
||||
namespace SpaceGame.Api.Simulation;
|
||||
namespace SpaceGame.Api.Universe.Simulation;
|
||||
|
||||
public sealed class WorldService(
|
||||
IWebHostEnvironment environment,
|
||||
Reference in New Issue
Block a user