refactor(backend): align api namespaces and project name
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
namespace SpaceGame.Simulation.Api.Contracts;
|
namespace SpaceGame.Api.Contracts;
|
||||||
|
|
||||||
public sealed record StarSnapshot(
|
public sealed record StarSnapshot(
|
||||||
string Kind,
|
string Kind,
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
namespace SpaceGame.Simulation.Api.Contracts;
|
namespace SpaceGame.Api.Contracts;
|
||||||
|
|
||||||
public sealed record Vector3Dto(float X, float Y, float Z);
|
public sealed record Vector3Dto(float X, float Y, float Z);
|
||||||
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
namespace SpaceGame.Simulation.Api.Contracts;
|
namespace SpaceGame.Api.Contracts;
|
||||||
|
|
||||||
public sealed record MarketOrderSnapshot(
|
public sealed record MarketOrderSnapshot(
|
||||||
string Id,
|
string Id,
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
namespace SpaceGame.Simulation.Api.Contracts;
|
namespace SpaceGame.Api.Contracts;
|
||||||
|
|
||||||
public sealed record FactionGoapStateSnapshot(
|
public sealed record FactionGoapStateSnapshot(
|
||||||
int MilitaryShipCount,
|
int MilitaryShipCount,
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
namespace SpaceGame.Simulation.Api.Contracts;
|
namespace SpaceGame.Api.Contracts;
|
||||||
|
|
||||||
public sealed record InventoryEntry(
|
public sealed record InventoryEntry(
|
||||||
string ItemId,
|
string ItemId,
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
namespace SpaceGame.Simulation.Api.Contracts;
|
namespace SpaceGame.Api.Contracts;
|
||||||
|
|
||||||
public sealed record ShipSnapshot(
|
public sealed record ShipSnapshot(
|
||||||
string Id,
|
string Id,
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
namespace SpaceGame.Simulation.Api.Contracts;
|
namespace SpaceGame.Api.Contracts;
|
||||||
|
|
||||||
public sealed record WorldSnapshot(
|
public sealed record WorldSnapshot(
|
||||||
string Label,
|
string Label,
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
using System.Text.Json.Serialization;
|
using System.Text.Json.Serialization;
|
||||||
|
|
||||||
namespace SpaceGame.Simulation.Api.Data;
|
namespace SpaceGame.Api.Data;
|
||||||
|
|
||||||
public sealed class ConstructionDefinition
|
public sealed class ConstructionDefinition
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
using FastEndpoints;
|
using FastEndpoints;
|
||||||
using SpaceGame.Simulation.Api.Simulation;
|
using SpaceGame.Api.Simulation;
|
||||||
|
|
||||||
namespace SpaceGame.Simulation.Api.Handlers;
|
namespace SpaceGame.Api.Handlers;
|
||||||
|
|
||||||
public sealed class GetWorldHandler(WorldService worldService) : EndpointWithoutRequest
|
public sealed class GetWorldHandler(WorldService worldService) : EndpointWithoutRequest
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
using FastEndpoints;
|
using FastEndpoints;
|
||||||
using SpaceGame.Simulation.Api.Simulation;
|
using SpaceGame.Api.Simulation;
|
||||||
|
|
||||||
namespace SpaceGame.Simulation.Api.Handlers;
|
namespace SpaceGame.Api.Handlers;
|
||||||
|
|
||||||
public sealed class GetWorldHealthHandler(WorldService worldService) : EndpointWithoutRequest
|
public sealed class GetWorldHealthHandler(WorldService worldService) : EndpointWithoutRequest
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
using FastEndpoints;
|
using FastEndpoints;
|
||||||
using SpaceGame.Simulation.Api.Simulation;
|
using SpaceGame.Api.Simulation;
|
||||||
|
|
||||||
namespace SpaceGame.Simulation.Api.Handlers;
|
namespace SpaceGame.Api.Handlers;
|
||||||
|
|
||||||
public sealed class ResetWorldHandler(WorldService worldService) : EndpointWithoutRequest
|
public sealed class ResetWorldHandler(WorldService worldService) : EndpointWithoutRequest
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
using FastEndpoints;
|
using FastEndpoints;
|
||||||
|
|
||||||
namespace SpaceGame.Simulation.Api.Handlers;
|
namespace SpaceGame.Api.Handlers;
|
||||||
|
|
||||||
public sealed class RootRedirectHandler : EndpointWithoutRequest
|
public sealed class RootRedirectHandler : EndpointWithoutRequest
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
using System.Text.Json;
|
using System.Text.Json;
|
||||||
using FastEndpoints;
|
using FastEndpoints;
|
||||||
using SpaceGame.Simulation.Api.Contracts;
|
using SpaceGame.Api.Contracts;
|
||||||
using SpaceGame.Simulation.Api.Simulation;
|
using SpaceGame.Api.Simulation;
|
||||||
|
|
||||||
namespace SpaceGame.Simulation.Api.Handlers;
|
namespace SpaceGame.Api.Handlers;
|
||||||
|
|
||||||
public sealed class StreamWorldHandler(WorldService worldService) : EndpointWithoutRequest
|
public sealed class StreamWorldHandler(WorldService worldService) : EndpointWithoutRequest
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
using FastEndpoints;
|
using FastEndpoints;
|
||||||
using SpaceGame.Simulation.Api.Simulation;
|
using SpaceGame.Api.Simulation;
|
||||||
|
|
||||||
var builder = WebApplication.CreateBuilder(args);
|
var builder = WebApplication.CreateBuilder(args);
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,7 @@
|
|||||||
namespace SpaceGame.Simulation.Api.Simulation;
|
using SpaceGame.Api.Simulation.Engine;
|
||||||
|
using SpaceGame.Api.Simulation.Model;
|
||||||
|
|
||||||
|
namespace SpaceGame.Api.Simulation.AI;
|
||||||
|
|
||||||
// ─── Planning State ────────────────────────────────────────────────────────────
|
// ─── Planning State ────────────────────────────────────────────────────────────
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,7 @@
|
|||||||
namespace SpaceGame.Simulation.Api.Simulation;
|
using SpaceGame.Api.Simulation.Engine;
|
||||||
|
using SpaceGame.Api.Simulation.Model;
|
||||||
|
|
||||||
|
namespace SpaceGame.Api.Simulation.AI;
|
||||||
|
|
||||||
public abstract class GoapAction<TState>
|
public abstract class GoapAction<TState>
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,4 +1,7 @@
|
|||||||
namespace SpaceGame.Simulation.Api.Simulation;
|
using SpaceGame.Api.Simulation.Engine;
|
||||||
|
using SpaceGame.Api.Simulation.Model;
|
||||||
|
|
||||||
|
namespace SpaceGame.Api.Simulation.AI;
|
||||||
|
|
||||||
internal interface IShipBehaviorState
|
internal interface IShipBehaviorState
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,4 +1,7 @@
|
|||||||
namespace SpaceGame.Simulation.Api.Simulation;
|
using SpaceGame.Api.Simulation.Engine;
|
||||||
|
using SpaceGame.Api.Simulation.Model;
|
||||||
|
|
||||||
|
namespace SpaceGame.Api.Simulation.AI;
|
||||||
|
|
||||||
internal sealed class ShipBehaviorStateMachine
|
internal sealed class ShipBehaviorStateMachine
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,4 +1,7 @@
|
|||||||
namespace SpaceGame.Simulation.Api.Simulation;
|
using SpaceGame.Api.Simulation.Engine;
|
||||||
|
using SpaceGame.Api.Simulation.Model;
|
||||||
|
|
||||||
|
namespace SpaceGame.Api.Simulation.AI;
|
||||||
|
|
||||||
internal sealed class IdleShipBehaviorState : IShipBehaviorState
|
internal sealed class IdleShipBehaviorState : IShipBehaviorState
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,4 +1,7 @@
|
|||||||
namespace SpaceGame.Simulation.Api.Simulation;
|
using SpaceGame.Api.Simulation.Engine;
|
||||||
|
using SpaceGame.Api.Simulation.Model;
|
||||||
|
|
||||||
|
namespace SpaceGame.Api.Simulation.AI;
|
||||||
|
|
||||||
// ─── Planning State ────────────────────────────────────────────────────────────
|
// ─── Planning State ────────────────────────────────────────────────────────────
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
namespace SpaceGame.Simulation.Api.Simulation;
|
namespace SpaceGame.Api.Simulation.Model;
|
||||||
|
|
||||||
public sealed class MarketOrderRuntime
|
public sealed class MarketOrderRuntime
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
namespace SpaceGame.Simulation.Api.Simulation;
|
namespace SpaceGame.Api.Simulation.Model;
|
||||||
|
|
||||||
public sealed class ClaimRuntime
|
public sealed class ClaimRuntime
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
namespace SpaceGame.Simulation.Api.Simulation;
|
using SpaceGame.Api.Simulation.AI;
|
||||||
|
|
||||||
|
namespace SpaceGame.Api.Simulation.Model;
|
||||||
|
|
||||||
public sealed class FactionRuntime
|
public sealed class FactionRuntime
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
using SpaceGame.Simulation.Api.Data;
|
using SpaceGame.Api.Data;
|
||||||
|
|
||||||
namespace SpaceGame.Simulation.Api.Simulation;
|
namespace SpaceGame.Api.Simulation.Model;
|
||||||
|
|
||||||
public sealed class ShipRuntime
|
public sealed class ShipRuntime
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
namespace SpaceGame.Simulation.Api.Simulation;
|
namespace SpaceGame.Api.Simulation.Model;
|
||||||
|
|
||||||
public enum SpatialNodeKind
|
public enum SpatialNodeKind
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
namespace SpaceGame.Simulation.Api.Simulation;
|
namespace SpaceGame.Api.Simulation.Model;
|
||||||
|
|
||||||
public static class SimulationUnits
|
public static class SimulationUnits
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
using SpaceGame.Simulation.Api.Data;
|
using SpaceGame.Api.Data;
|
||||||
|
|
||||||
namespace SpaceGame.Simulation.Api.Simulation;
|
namespace SpaceGame.Api.Simulation.Model;
|
||||||
|
|
||||||
public sealed class SimulationWorld
|
public sealed class SimulationWorld
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
using SpaceGame.Simulation.Api.Data;
|
using SpaceGame.Api.Data;
|
||||||
|
|
||||||
namespace SpaceGame.Simulation.Api.Simulation;
|
namespace SpaceGame.Api.Simulation.Model;
|
||||||
|
|
||||||
public sealed class SystemRuntime
|
public sealed class SystemRuntime
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
namespace SpaceGame.Simulation.Api.Simulation;
|
namespace SpaceGame.Api.Simulation.Model;
|
||||||
|
|
||||||
public sealed class StationRuntime
|
public sealed class StationRuntime
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
namespace SpaceGame.Simulation.Api.Simulation;
|
namespace SpaceGame.Api.Simulation.Model;
|
||||||
|
|
||||||
public readonly record struct Vector3(float X, float Y, float Z)
|
public readonly record struct Vector3(float X, float Y, float Z)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
namespace SpaceGame.Simulation.Api.Simulation;
|
namespace SpaceGame.Api.Simulation;
|
||||||
|
|
||||||
public sealed class OrbitalSimulationOptions
|
public sealed class OrbitalSimulationOptions
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
namespace SpaceGame.Simulation.Api.Simulation;
|
namespace SpaceGame.Api.Simulation;
|
||||||
|
|
||||||
public sealed class SimulationHostedService(WorldService worldService) : BackgroundService
|
public sealed class SimulationHostedService(WorldService worldService) : BackgroundService
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
namespace SpaceGame.Simulation.Api.Simulation;
|
namespace SpaceGame.Api.Simulation;
|
||||||
|
|
||||||
public sealed class WorldGenerationOptions
|
public sealed class WorldGenerationOptions
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,8 +1,10 @@
|
|||||||
using System.Threading.Channels;
|
using System.Threading.Channels;
|
||||||
using Microsoft.Extensions.Options;
|
using Microsoft.Extensions.Options;
|
||||||
using SpaceGame.Simulation.Api.Contracts;
|
using SpaceGame.Api.Contracts;
|
||||||
|
using SpaceGame.Api.Simulation.Engine;
|
||||||
|
using SpaceGame.Api.Simulation.Model;
|
||||||
|
|
||||||
namespace SpaceGame.Simulation.Api.Simulation;
|
namespace SpaceGame.Api.Simulation;
|
||||||
|
|
||||||
public sealed class WorldService(
|
public sealed class WorldService(
|
||||||
IWebHostEnvironment environment,
|
IWebHostEnvironment environment,
|
||||||
@@ -11,7 +13,7 @@ public sealed class WorldService(
|
|||||||
{
|
{
|
||||||
private const int DeltaHistoryLimit = 256;
|
private const int DeltaHistoryLimit = 256;
|
||||||
|
|
||||||
private readonly object _sync = new();
|
private readonly Lock _sync = new();
|
||||||
private readonly OrbitalSimulationSnapshot _orbitalSimulation = new(orbitalSimulationOptions.Value.SimulatedSecondsPerRealSecond);
|
private readonly OrbitalSimulationSnapshot _orbitalSimulation = new(orbitalSimulationOptions.Value.SimulatedSecondsPerRealSecond);
|
||||||
private readonly ScenarioLoader _loader = new(environment.ContentRootPath, worldGenerationOptions.Value);
|
private readonly ScenarioLoader _loader = new(environment.ContentRootPath, worldGenerationOptions.Value);
|
||||||
private readonly SimulationEngine _engine = new(orbitalSimulationOptions.Value);
|
private readonly SimulationEngine _engine = new(orbitalSimulationOptions.Value);
|
||||||
|
|||||||
Reference in New Issue
Block a user