Move daemon command authority out of Unity

Shift docking, movement, target, shield, transfer, action-bar, and intent validation into daemon operations.

Add typed daemon operation/client surfaces and verifier fences so Unity remains a command lowerer and observer.
This commit is contained in:
Meta Vens 2026-06-21 08:56:07 +01:00
commit 030b4b5d74
7 changed files with 11656 additions and 2335 deletions

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,438 @@
using System;
using GameCult.Aetheria.State.Unity;
public sealed class AetheriaDaemonOperations
{
private readonly AetheriaDaemonObserver _observer;
internal AetheriaDaemonOperations(AetheriaDaemonObserver observer)
{
_observer = observer ?? throw new ArgumentNullException(nameof(observer));
}
public AetheriaRuntimeDaemonCommandEnvelope SetTarget(string targetEntityKey)
{
return _observer.SendOperation(AetheriaRuntimeDaemonCommandKinds.SetTarget, command =>
command.TargetEntityKey = targetEntityKey ?? "");
}
public AetheriaRuntimeDaemonCommandEnvelope ClearTarget()
{
return _observer.SendOperation(AetheriaRuntimeDaemonCommandKinds.ClearTarget);
}
public AetheriaRuntimeDaemonCommandEnvelope SetMoveVector(
double directionX,
double directionY,
double scalarValue = 1.0)
{
return _observer.SendOperation(AetheriaRuntimeDaemonCommandKinds.SetMoveVector, command =>
{
command.DirectionX = directionX;
command.DirectionY = directionY;
command.ScalarValue = scalarValue;
});
}
public AetheriaRuntimeDaemonCommandEnvelope SetLookDirection(double directionX, double directionY, double directionZ)
{
return _observer.SendOperation(AetheriaRuntimeDaemonCommandKinds.SetLookDirection, command =>
{
command.DirectionX = directionX;
command.DirectionY = directionY;
command.PositionZ = directionZ;
});
}
public AetheriaRuntimeDaemonCommandEnvelope SetTractorPower(double power)
{
return _observer.SendOperation(AetheriaRuntimeDaemonCommandKinds.SetTractorPower, command =>
command.ScalarValue = power);
}
public AetheriaRuntimeDaemonCommandEnvelope FireWeaponGroup(int weaponGroup)
{
return _observer.SendOperation(AetheriaRuntimeDaemonCommandKinds.FireWeaponGroup, command =>
command.WeaponGroup = weaponGroup);
}
public AetheriaRuntimeDaemonCommandEnvelope SetWeaponGroupActive(int weaponGroup, bool active)
{
return _observer.SendOperation(AetheriaRuntimeDaemonCommandKinds.SetWeaponGroupActive, command =>
{
command.WeaponGroup = weaponGroup;
command.ScalarValue = active ? 1.0 : 0.0;
});
}
public AetheriaRuntimeDaemonCommandEnvelope SetWeaponGroupMembership(
string targetEntityKey,
int equipmentIndex,
int weaponGroup,
bool assigned)
{
return _observer.SendOperation(AetheriaRuntimeDaemonCommandKinds.SetWeaponGroupMembership, command =>
{
command.TargetEntityKey = targetEntityKey ?? "";
command.EquipmentIndex = equipmentIndex;
command.WeaponGroup = weaponGroup;
command.ScalarValue = assigned ? 1.0 : 0.0;
});
}
public AetheriaRuntimeDaemonCommandEnvelope SetBehaviorActive(int equipmentIndex, int behaviorIndex, bool active)
{
return _observer.SendOperation(AetheriaRuntimeDaemonCommandKinds.SetBehaviorActive, command =>
{
command.EquipmentIndex = equipmentIndex;
command.BehaviorIndex = behaviorIndex;
command.ScalarValue = active ? 1.0 : 0.0;
});
}
public AetheriaRuntimeDaemonCommandEnvelope ActivateConsumable(string itemKey)
{
return _observer.SendOperation(AetheriaRuntimeDaemonCommandKinds.ActivateConsumable, command =>
command.TextValue = itemKey ?? "");
}
public AetheriaRuntimeDaemonCommandEnvelope SensorPing()
{
return _observer.SendOperation(AetheriaRuntimeDaemonCommandKinds.SensorPing);
}
public AetheriaRuntimeDaemonCommandEnvelope SetHeatsinksEnabled(bool enabled)
{
return _observer.SendOperation(AetheriaRuntimeDaemonCommandKinds.SetHeatsinksEnabled, command =>
command.ScalarValue = enabled ? 1.0 : 0.0);
}
public AetheriaRuntimeDaemonCommandEnvelope SetOverrideShutdown(bool enabled)
{
return _observer.SendOperation(AetheriaRuntimeDaemonCommandKinds.SetOverrideShutdown, command =>
command.ScalarValue = enabled ? 1.0 : 0.0);
}
public AetheriaRuntimeDaemonCommandEnvelope SetEntityOverrideShutdown(string targetEntityKey, bool enabled)
{
return _observer.SendOperation(AetheriaRuntimeDaemonCommandKinds.SetOverrideShutdown, command =>
{
command.TargetEntityKey = targetEntityKey ?? "";
command.ScalarValue = enabled ? 1.0 : 0.0;
});
}
public AetheriaRuntimeDaemonCommandEnvelope SetItemEnabled(int equipmentIndex, bool enabled)
{
return _observer.SendOperation(AetheriaRuntimeDaemonCommandKinds.SetItemEnabled, command =>
{
command.EquipmentIndex = equipmentIndex;
command.ScalarValue = enabled ? 1.0 : 0.0;
});
}
public AetheriaRuntimeDaemonCommandEnvelope ToggleShieldEnabled()
{
return _observer.SendOperation(AetheriaRuntimeDaemonCommandKinds.ToggleShieldEnabled);
}
public AetheriaRuntimeDaemonCommandEnvelope SetItemOverrideShutdown(
string targetEntityKey,
int equipmentIndex,
bool enabled)
{
return _observer.SendOperation(AetheriaRuntimeDaemonCommandKinds.SetItemOverrideShutdown, command =>
{
command.TargetEntityKey = targetEntityKey ?? "";
command.EquipmentIndex = equipmentIndex;
command.ScalarValue = enabled ? 1.0 : 0.0;
});
}
public AetheriaRuntimeDaemonCommandEnvelope SetThermotoggleTargetTemperature(
string targetEntityKey,
int equipmentIndex,
int behaviorIndex,
double targetTemperature)
{
return _observer.SendOperation(AetheriaRuntimeDaemonCommandKinds.SetThermotoggleTargetTemperature, command =>
{
command.TargetEntityKey = targetEntityKey ?? "";
command.EquipmentIndex = equipmentIndex;
command.BehaviorIndex = behaviorIndex;
command.ScalarValue = targetTemperature;
});
}
public AetheriaRuntimeDaemonCommandEnvelope SetShutdownPerformance(
string targetEntityKey,
double shutdownPerformance)
{
return _observer.SendOperation(AetheriaRuntimeDaemonCommandKinds.SetShutdownPerformance, command =>
{
command.TargetEntityKey = targetEntityKey ?? "";
command.ScalarValue = shutdownPerformance;
});
}
public AetheriaRuntimeDaemonCommandEnvelope SetActionBarBinding(
string controlPath,
string kind,
string itemKey,
int equipmentIndex,
int behaviorIndex,
int weaponGroup)
{
return _observer.SendOperation(AetheriaRuntimeDaemonCommandKinds.SetActionBarBinding, command =>
{
command.TextValue = controlPath ?? "";
command.EquipmentIndex = equipmentIndex;
command.BehaviorIndex = behaviorIndex;
command.WeaponGroup = weaponGroup;
command.ActionBarBinding.Kind = kind ?? "";
command.ActionBarBinding.ItemKey = itemKey ?? "";
});
}
public AetheriaRuntimeDaemonCommandEnvelope ClearActionBarBinding(string controlPath)
{
return _observer.SendOperation(AetheriaRuntimeDaemonCommandKinds.ClearActionBarBinding, command =>
command.TextValue = controlPath ?? "");
}
public AetheriaRuntimeDaemonCommandEnvelope ToggleHullConductivity(
string targetEntityKey,
int x,
int y,
int axis)
{
return _observer.SendOperation(AetheriaRuntimeDaemonCommandKinds.ToggleHullConductivity, command =>
{
command.TargetEntityKey = targetEntityKey ?? "";
command.PositionX = x;
command.PositionY = y;
command.ScalarValue = axis;
});
}
public AetheriaRuntimeDaemonCommandEnvelope SetEntityName(string targetEntityKey, string name)
{
return _observer.SendOperation(AetheriaRuntimeDaemonCommandKinds.SetEntityName, command =>
{
command.TargetEntityKey = targetEntityKey ?? "";
command.TextValue = name ?? "";
});
}
public AetheriaRuntimeDaemonCommandEnvelope Dock(string targetEntityKey)
{
return _observer.SendOperation(AetheriaRuntimeDaemonCommandKinds.Dock, command =>
command.TargetEntityKey = targetEntityKey ?? "");
}
public AetheriaRuntimeDaemonCommandEnvelope Undock()
{
return _observer.SendOperation(AetheriaRuntimeDaemonCommandKinds.Undock);
}
public AetheriaRuntimeDaemonCommandEnvelope SetDockedCurrentShip(string targetEntityKey)
{
return _observer.SendOperation(AetheriaRuntimeDaemonCommandKinds.SetDockedCurrentShip, command =>
command.TargetEntityKey = targetEntityKey ?? "");
}
public AetheriaRuntimeDaemonCommandEnvelope EnterWormhole(
int targetZoneIndex,
double positionX,
double positionY)
{
return _observer.SendOperation(AetheriaRuntimeDaemonCommandKinds.EnterWormhole, command =>
{
command.TargetZoneIndex = targetZoneIndex;
command.PositionX = positionX;
command.PositionY = positionY;
});
}
public AetheriaRuntimeDaemonCommandEnvelope TowToStation(
string stationEntityKey,
int targetZoneIndex,
double positionX,
double positionY)
{
return _observer.SendOperation(AetheriaRuntimeDaemonCommandKinds.TowToStation, command =>
{
command.TargetEntityKey = stationEntityKey ?? "";
command.TargetZoneIndex = targetZoneIndex;
command.PositionX = positionX;
command.PositionY = positionY;
});
}
public AetheriaRuntimeDaemonCommandEnvelope TransferCargoItem(
string originEntityKey,
int originCargoIndex,
string destinationEntityKey,
int destinationCargoIndex,
string itemKey,
int quantity,
int sourceX,
int sourceY,
int destinationX,
int destinationY,
bool hasDestinationPosition)
{
return _observer.SendOperation(AetheriaRuntimeDaemonCommandKinds.TransferCargoItem, command =>
{
command.TargetEntityKey = destinationEntityKey ?? "";
command.EquipmentIndex = destinationCargoIndex;
command.PositionX = destinationX;
command.PositionY = destinationY;
command.ScalarValue = quantity;
command.TextValue = itemKey ?? "";
command.CargoTransfer.OriginEntityKey = originEntityKey ?? "";
command.CargoTransfer.OriginCargoIndex = originCargoIndex;
command.CargoTransfer.DestinationEntityKey = destinationEntityKey ?? "";
command.CargoTransfer.DestinationCargoIndex = destinationCargoIndex;
command.CargoTransfer.SourceX = sourceX;
command.CargoTransfer.SourceY = sourceY;
command.CargoTransfer.DestinationX = destinationX;
command.CargoTransfer.DestinationY = destinationY;
command.CargoTransfer.HasDestinationPosition = hasDestinationPosition;
});
}
public AetheriaRuntimeDaemonCommandEnvelope TradePurchase(
string purchaseKind,
string itemKey,
int quantity,
int unitPrice,
int totalPrice,
string stationEntityKey,
int stationCargoIndex,
string targetEntityKey,
int targetCargoIndex,
int sourceX,
int sourceY,
bool createsDockedShip)
{
return _observer.SendOperation(AetheriaRuntimeDaemonCommandKinds.TradePurchase, command =>
{
command.TargetEntityKey = targetEntityKey ?? "";
command.EquipmentIndex = targetCargoIndex;
command.PositionX = sourceX;
command.PositionY = sourceY;
command.ScalarValue = totalPrice;
command.TextValue = itemKey ?? "";
command.TradePurchase.PurchaseKind = purchaseKind ?? "";
command.TradePurchase.ItemKey = itemKey ?? "";
command.TradePurchase.Quantity = quantity;
command.TradePurchase.UnitPrice = unitPrice;
command.TradePurchase.TotalPrice = totalPrice;
command.TradePurchase.StationEntityKey = stationEntityKey ?? "";
command.TradePurchase.StationCargoIndex = stationCargoIndex;
command.TradePurchase.TargetEntityKey = targetEntityKey ?? "";
command.TradePurchase.TargetCargoIndex = targetCargoIndex;
command.TradePurchase.SourceX = sourceX;
command.TradePurchase.SourceY = sourceY;
command.TradePurchase.CreatesDockedShip = createsDockedShip;
});
}
public AetheriaRuntimeDaemonCommandEnvelope PickUpLoot(
string targetEntityKey,
string itemKey,
int quantity,
double positionX,
double positionY,
double positionZ)
{
return _observer.SendOperation(AetheriaRuntimeDaemonCommandKinds.PickUpLoot, command =>
{
command.TargetEntityKey = targetEntityKey ?? "";
command.TextValue = itemKey ?? "";
command.ScalarValue = quantity;
command.PositionX = positionX;
command.PositionY = positionY;
command.PositionZ = positionZ;
command.LootPickup.ItemKey = itemKey ?? "";
command.LootPickup.Quantity = quantity;
command.LootPickup.PositionX = positionX;
command.LootPickup.PositionY = positionY;
command.LootPickup.PositionZ = positionZ;
});
}
public AetheriaRuntimeDaemonCommandEnvelope RestoreLoadout(
string dockedEntityKey,
string templateName,
int price)
{
return _observer.SendOperation(AetheriaRuntimeDaemonCommandKinds.RestoreLoadout, command =>
{
command.TargetEntityKey = dockedEntityKey ?? "";
command.TextValue = templateName ?? "";
command.ScalarValue = price;
command.LoadoutRestore.DockedEntityKey = dockedEntityKey ?? "";
command.LoadoutRestore.TemplateName = templateName ?? "";
command.LoadoutRestore.Price = price;
});
}
public AetheriaRuntimeDaemonCommandEnvelope EquipItem(
string sourceKind,
string originEntityKey,
int originIndex,
string destinationEntityKey,
string itemKey,
int sourceX,
int sourceY,
int destinationX,
int destinationY,
bool hasDestinationPosition)
{
return _observer.SendOperation(AetheriaRuntimeDaemonCommandKinds.EquipItem, command =>
{
command.TargetEntityKey = destinationEntityKey ?? "";
command.PositionX = destinationX;
command.PositionY = destinationY;
command.TextValue = itemKey ?? "";
command.EquipmentTransfer.SourceKind = sourceKind ?? "";
command.EquipmentTransfer.OriginEntityKey = originEntityKey ?? "";
command.EquipmentTransfer.OriginIndex = originIndex;
command.EquipmentTransfer.DestinationEntityKey = destinationEntityKey ?? "";
command.EquipmentTransfer.SourceX = sourceX;
command.EquipmentTransfer.SourceY = sourceY;
command.EquipmentTransfer.DestinationX = destinationX;
command.EquipmentTransfer.DestinationY = destinationY;
command.EquipmentTransfer.HasDestinationPosition = hasDestinationPosition;
});
}
public AetheriaRuntimeDaemonCommandEnvelope StoreItem(
string originEntityKey,
int sourceEquipmentIndex,
string destinationEntityKey,
int destinationCargoIndex,
string itemKey,
int destinationX,
int destinationY,
bool hasDestinationPosition)
{
return _observer.SendOperation(AetheriaRuntimeDaemonCommandKinds.StoreItem, command =>
{
command.TargetEntityKey = destinationEntityKey ?? "";
command.EquipmentIndex = sourceEquipmentIndex;
command.PositionX = destinationX;
command.PositionY = destinationY;
command.TextValue = itemKey ?? "";
command.StoreItem.OriginEntityKey = originEntityKey ?? "";
command.StoreItem.SourceEquipmentIndex = sourceEquipmentIndex;
command.StoreItem.DestinationEntityKey = destinationEntityKey ?? "";
command.StoreItem.DestinationCargoIndex = destinationCargoIndex;
command.StoreItem.DestinationX = destinationX;
command.StoreItem.DestinationY = destinationY;
command.StoreItem.HasDestinationPosition = hasDestinationPosition;
});
}
}

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,689 @@
using System;
using System.Collections.Generic;
using System.Linq;
using GameCult.Caching;
using MessagePack;
#nullable enable
namespace GameCult.Aetheria.State.Unity
{
public sealed class AetheriaRuntimeDaemonCommandEnvelope
{
public AetheriaRuntimeDaemonCommandEnvelope(
string schema,
string commandId,
string clientId,
string issuedAtUtc,
string sessionId,
long observedFrameId,
AetheriaRuntimeDaemonCommandKinds kind,
string actorEntityKey,
string path)
{
Schema = schema;
CommandId = commandId;
ClientId = clientId;
IssuedAtUtc = issuedAtUtc;
SessionId = sessionId;
ObservedFrameId = observedFrameId;
Kind = kind;
ActorEntityKey = actorEntityKey;
Path = path;
}
public string Schema { get; }
public string CommandId { get; }
public string ClientId { get; }
public string IssuedAtUtc { get; }
public string SessionId { get; }
public long ObservedFrameId { get; }
public AetheriaRuntimeDaemonCommandKinds Kind { get; }
public string ActorEntityKey { get; }
public string Path { get; }
}
public static class AetheriaRuntimeDaemonSchemas
{
public const string Frame = "gamecult.aetheria.daemon_frame.v1";
public const string Command = "gamecult.aetheria.daemon_command.v1";
public const string SoaView = "gamecult.aetheria.daemon_soa_view.v1";
public const string ProviderAdvertisement = "gamecult.aetheria.daemon_provider_advertisement.v1";
public const string Health = "gamecult.aetheria.daemon_health.v1";
public const string CommandBoundary = "gamecult.aetheria.daemon_command_boundary.v1";
public const string GameSurface = "gamecult.aetheria.daemon_game_surface.v1";
public const string EditorSurface = "gamecult.aetheria.daemon_editor_surface.v1";
}
public enum AetheriaRuntimeDaemonCommandKinds
{
None = 0,
Ping,
SetTarget,
ClearTarget,
SetMoveVector,
SetLookDirection,
SetTractorPower,
FireWeaponGroup,
SetWeaponGroupActive,
SetWeaponGroupMembership,
SetBehaviorActive,
ActivateConsumable,
SensorPing,
SetItemEnabled,
SetItemOverrideShutdown,
SetThermotoggleTargetTemperature,
SetActionBarBinding,
ClearActionBarBinding,
PickUpLoot,
RestoreLoadout,
Dock,
Undock,
SetDockedCurrentShip,
TowToStation,
EnterWormhole,
TradePurchase,
TransferCargoItem,
EquipItem,
StoreItem,
ToggleHullConductivity,
SetEntityName,
DestroyEntity,
SetOverrideShutdown,
SetHeatsinksEnabled,
SetShutdownPerformance,
ToggleShieldEnabled
}
[CultDocument("gamecult.aetheria.daemon_provider_advertisement", "gamecult.aetheria.daemon_provider_advertisement.v1")]
[MessagePackObject]
public sealed class AetheriaRuntimeDaemonProviderAdvertisementDocument
{
[Key(0)]
public string Schema { get; set; } = AetheriaRuntimeDaemonSchemas.ProviderAdvertisement;
[Key(1)]
public string VerseId { get; set; } = "aetheria.local";
[Key(2)]
public string ProviderId { get; set; } = "aetheria.daemon";
[Key(3)]
public string DaemonId { get; set; } = "aetheria-daemon";
[Key(4)]
public string PublishedAtUtc { get; set; } = "";
[Key(5)]
public string StateWitnessPath { get; set; } = "";
[Key(6)]
public string FrameWitnessPath { get; set; } = "";
[Key(7)]
public string SoaWitnessPath { get; set; } = "";
[Key(8)]
public string HealthWitnessPath { get; set; } = "";
[Key(9)]
public string CommandBoundaryWitnessPath { get; set; } = "";
[Key(10)]
public string EveGuiSurfaceWitnessPath { get; set; } = "";
[Key(11)]
public string EveTuiSurfaceWitnessPath { get; set; } = "";
[Key(12)]
public string EveGuiSurfaceId { get; set; } = "aetheria.game";
[Key(13)]
public string EveTuiSurfaceId { get; set; } = "aetheria.game.tui";
[Key(14)]
public string EditorGuiSurfaceWitnessPath { get; set; } = "";
[Key(15)]
public string EditorTuiSurfaceWitnessPath { get; set; } = "";
[Key(16)]
public string EditorGuiSurfaceId { get; set; } = "aetheria.daemon.editor";
[Key(17)]
public string EditorTuiSurfaceId { get; set; } = "aetheria.daemon.editor.tui";
[Key(18)]
public IReadOnlyList<string> PublishedSchemas { get; set; } = Array.Empty<string>();
[Key(19)]
public IReadOnlyList<string> CommandBoundaryIds { get; set; } = Array.Empty<string>();
[Key(20)]
public string CultMeshAddress { get; set; } = "cultmesh://aetheria.local/eve/providers/aetheria.daemon";
public static AetheriaRuntimeDaemonProviderAdvertisementDocument Create(
string stateFilePath,
string daemonId,
string verseId,
string cultMeshAddress)
{
return new AetheriaRuntimeDaemonProviderAdvertisementDocument
{
VerseId = string.IsNullOrWhiteSpace(verseId) ? "aetheria.local" : verseId,
DaemonId = string.IsNullOrWhiteSpace(daemonId) ? "aetheria-daemon" : daemonId,
PublishedAtUtc = DateTime.UtcNow.ToString("O"),
StateWitnessPath = stateFilePath ?? "",
FrameWitnessPath = AetheriaRuntimeStateBoundary.GetDaemonFramePath(stateFilePath ?? ""),
SoaWitnessPath = AetheriaRuntimeStateBoundary.GetDaemonSoaViewPath(stateFilePath ?? ""),
HealthWitnessPath = AetheriaRuntimeStateBoundary.GetDaemonHealthPath(stateFilePath ?? ""),
CommandBoundaryWitnessPath = AetheriaRuntimeStateBoundary.GetDaemonCommandBoundaryPath(stateFilePath ?? ""),
EveGuiSurfaceWitnessPath = AetheriaRuntimeStateBoundary.GetDaemonGameSurfacePath(stateFilePath ?? ""),
EveTuiSurfaceWitnessPath = AetheriaRuntimeStateBoundary.GetDaemonGameTuiSurfacePath(stateFilePath ?? ""),
EveGuiSurfaceId = AetheriaRuntimeDaemonGameSurfaceBuilder.SurfaceId,
EveTuiSurfaceId = AetheriaRuntimeDaemonGameSurfaceBuilder.TuiSurfaceId,
EditorGuiSurfaceWitnessPath = AetheriaRuntimeStateBoundary.GetDaemonEditorSurfacePath(stateFilePath ?? ""),
EditorTuiSurfaceWitnessPath = AetheriaRuntimeStateBoundary.GetDaemonEditorTuiSurfacePath(stateFilePath ?? ""),
EditorGuiSurfaceId = AetheriaRuntimeDaemonEditorSurfaceBuilder.SurfaceId,
EditorTuiSurfaceId = AetheriaRuntimeDaemonEditorSurfaceBuilder.TuiSurfaceId,
CultMeshAddress = string.IsNullOrWhiteSpace(cultMeshAddress)
? "cultmesh://aetheria.local/eve/providers/aetheria.daemon"
: cultMeshAddress,
PublishedSchemas = new[]
{
AetheriaRuntimeDaemonSchemas.Frame,
AetheriaRuntimeDaemonSchemas.SoaView,
AetheriaRuntimeDaemonSchemas.Health,
AetheriaRuntimeDaemonSchemas.CommandBoundary,
AetheriaRuntimeDaemonSchemas.GameSurface,
AetheriaRuntimeDaemonSchemas.EditorSurface,
AetheriaRuntimeDaemonSchemas.Command
},
CommandBoundaryIds = new[] { "aetheria.daemon.commands" }
};
}
}
[CultDocument("gamecult.aetheria.daemon_health", "gamecult.aetheria.daemon_health.v1")]
[MessagePackObject]
public sealed class AetheriaRuntimeDaemonHealthDocument
{
[Key(0)]
public string Schema { get; set; } = AetheriaRuntimeDaemonSchemas.Health;
[Key(1)]
public string DaemonId { get; set; } = "aetheria-daemon";
[Key(2)]
public string VerseId { get; set; } = "aetheria.local";
[Key(3)]
public string PublishedAtUtc { get; set; } = "";
[Key(4)]
public string StatePath { get; set; } = "";
[Key(5)]
public long FrameId { get; set; }
[Key(6)]
public int PendingBeforeApply { get; set; }
[IgnoreMember]
public int ObservedCommandCount
{
get => PendingBeforeApply;
set => PendingBeforeApply = value;
}
[Key(7)]
public int AppliedCommandCount { get; set; }
[Key(8)]
public int RejectedCommandCount { get; set; }
[Key(9)]
public string Status { get; set; } = "healthy";
[Key(10)]
public string PublicationSource { get; set; } = "daemon-published";
[Key(11)]
public string Transport { get; set; } = "cultcache-witness";
[Key(12)]
public string CommandBoundaryPath { get; set; } = "";
}
[CultDocument("gamecult.aetheria.daemon_command_boundary", "gamecult.aetheria.daemon_command_boundary.v1")]
[MessagePackObject]
public sealed class AetheriaRuntimeDaemonCommandBoundaryDocument
{
[Key(0)]
public string Schema { get; set; } = AetheriaRuntimeDaemonSchemas.CommandBoundary;
[Key(1)]
public string BoundaryId { get; set; } = "aetheria.daemon.commands";
[Key(2)]
public string DaemonId { get; set; } = "aetheria-daemon";
[Key(3)]
public string PublishedAtUtc { get; set; } = "";
[Key(4)]
public string CommandSchema { get; set; } = AetheriaRuntimeDaemonSchemas.Command;
[Key(5)]
public string ReceiptSchema { get; set; } = AetheriaRuntimeDaemonSchemas.Frame;
[Key(6)]
public string Delivery { get; set; } = "cultnet-document-put";
[Key(7)]
public IReadOnlyList<AetheriaRuntimeDaemonCommandBoundaryEntry> Commands { get; set; } =
Array.Empty<AetheriaRuntimeDaemonCommandBoundaryEntry>();
public static AetheriaRuntimeDaemonCommandBoundaryDocument Create(string daemonId)
{
return new AetheriaRuntimeDaemonCommandBoundaryDocument
{
DaemonId = string.IsNullOrWhiteSpace(daemonId) ? "aetheria-daemon" : daemonId,
PublishedAtUtc = DateTime.UtcNow.ToString("O"),
Commands = Enum
.GetValues(typeof(AetheriaRuntimeDaemonCommandKinds))
.Cast<AetheriaRuntimeDaemonCommandKinds>()
.Where(kind => kind != AetheriaRuntimeDaemonCommandKinds.None)
.Select(kind => new AetheriaRuntimeDaemonCommandBoundaryEntry
{
Kind = kind,
CommandBody = CommandBodyFor(kind),
Authority = "local-player-input",
Receipt = "applied-or-rejected-command-id-in-frame"
})
.ToArray()
};
}
private static string CommandBodyFor(AetheriaRuntimeDaemonCommandKinds kind)
{
switch (kind)
{
case AetheriaRuntimeDaemonCommandKinds.SetActionBarBinding:
return nameof(AetheriaRuntimeActionBarBindingCommand);
case AetheriaRuntimeDaemonCommandKinds.TransferCargoItem:
return nameof(AetheriaRuntimeCargoTransferCommand);
case AetheriaRuntimeDaemonCommandKinds.TradePurchase:
return nameof(AetheriaRuntimeTradePurchaseCommand);
case AetheriaRuntimeDaemonCommandKinds.PickUpLoot:
return nameof(AetheriaRuntimeLootPickupCommand);
case AetheriaRuntimeDaemonCommandKinds.RestoreLoadout:
return nameof(AetheriaRuntimeLoadoutRestoreCommand);
case AetheriaRuntimeDaemonCommandKinds.EquipItem:
return nameof(AetheriaRuntimeEquipmentTransferCommand);
case AetheriaRuntimeDaemonCommandKinds.StoreItem:
return nameof(AetheriaRuntimeStoreItemCommand);
default:
return nameof(AetheriaRuntimeDaemonCommandDocument);
}
}
}
[MessagePackObject]
public sealed class AetheriaRuntimeDaemonCommandBoundaryEntry
{
[Key(0)]
public AetheriaRuntimeDaemonCommandKinds Kind { get; set; }
[Key(1)]
public string CommandBody { get; set; } = "";
[Key(2)]
public string Authority { get; set; } = "";
[Key(3)]
public string Receipt { get; set; } = "";
}
[CultDocument("gamecult.aetheria.daemon_frame", "gamecult.aetheria.daemon_frame.v1")]
[MessagePackObject]
public sealed class AetheriaRuntimeDaemonFrameDocument
{
[Key(0)]
public string Schema { get; set; } = AetheriaRuntimeDaemonSchemas.Frame;
[Key(1)]
public string DaemonId { get; set; } = "local";
[Key(2)]
public string SessionId { get; set; } = "local";
[Key(3)]
public long FrameId { get; set; }
[Key(4)]
public string PublishedAtUtc { get; set; } = "";
[Key(5)]
public double SimulationTimeSeconds { get; set; }
[Key(6)]
public double FixedDeltaSeconds { get; set; }
[Key(7)]
public bool IsAuthoritative { get; set; } = true;
[Key(8)]
public string StateSource { get; set; } = "daemon";
[Key(9)]
public AetheriaRuntimeRunCheckpointCommit Run { get; set; } = new AetheriaRuntimeRunCheckpointCommit();
[Key(10)]
public IReadOnlyList<string> Capabilities { get; set; } = Array.Empty<string>();
[Key(11)]
public IReadOnlyList<string> AppliedCommandIds { get; set; } = Array.Empty<string>();
[Key(12)]
public IReadOnlyList<string> RejectedCommandIds { get; set; } = Array.Empty<string>();
public static AetheriaRuntimeDaemonFrameDocument Create(
AetheriaRuntimeRunCheckpointCommit run,
string daemonId,
string sessionId,
long frameId,
double simulationTimeSeconds,
double fixedDeltaSeconds,
bool isAuthoritative = true,
string stateSource = "daemon")
{
return new AetheriaRuntimeDaemonFrameDocument
{
DaemonId = string.IsNullOrWhiteSpace(daemonId) ? "local" : daemonId,
SessionId = string.IsNullOrWhiteSpace(sessionId) ? "local" : sessionId,
FrameId = frameId,
PublishedAtUtc = DateTime.UtcNow.ToString("O"),
SimulationTimeSeconds = simulationTimeSeconds,
FixedDeltaSeconds = fixedDeltaSeconds,
IsAuthoritative = isAuthoritative,
StateSource = string.IsNullOrWhiteSpace(stateSource) ? "daemon" : stateSource,
Run = run ?? new AetheriaRuntimeRunCheckpointCommit()
};
}
}
[CultDocument("gamecult.aetheria.daemon_command", "gamecult.aetheria.daemon_command.v1")]
[MessagePackObject]
public sealed class AetheriaRuntimeDaemonCommandDocument
{
[Key(0)]
public string Schema { get; set; } = AetheriaRuntimeDaemonSchemas.Command;
[Key(1)]
public string CommandId { get; set; } = "";
[Key(2)]
public string ClientId { get; set; } = "";
[Key(3)]
public string IssuedAtUtc { get; set; } = "";
[Key(4)]
public string SessionId { get; set; } = "";
[Key(5)]
public long ObservedFrameId { get; set; } = -1;
[Key(6)]
public AetheriaRuntimeDaemonCommandKinds Kind { get; set; } = AetheriaRuntimeDaemonCommandKinds.None;
[Key(7)]
public string ActorEntityKey { get; set; } = "";
[Key(8)]
public string TargetEntityKey { get; set; } = "";
[Key(9)]
public int TargetZoneIndex { get; set; } = -1;
[Key(10)]
public int EquipmentIndex { get; set; } = -1;
[Key(11)]
public int BehaviorIndex { get; set; } = -1;
[Key(12)]
public int WeaponGroup { get; set; } = -1;
[Key(13)]
public double PositionX { get; set; }
[Key(14)]
public double PositionY { get; set; }
[Key(15)]
public double PositionZ { get; set; }
[Key(16)]
public double DirectionX { get; set; }
[Key(17)]
public double DirectionY { get; set; }
[Key(18)]
public double ScalarValue { get; set; }
[Key(19)]
public string TextValue { get; set; } = "";
[Key(20)]
public AetheriaRuntimeActionBarBindingCommand ActionBarBinding { get; set; } = new AetheriaRuntimeActionBarBindingCommand();
[Key(21)]
public AetheriaRuntimeCargoTransferCommand CargoTransfer { get; set; } = new AetheriaRuntimeCargoTransferCommand();
[Key(22)]
public AetheriaRuntimeTradePurchaseCommand TradePurchase { get; set; } = new AetheriaRuntimeTradePurchaseCommand();
[Key(23)]
public AetheriaRuntimeLootPickupCommand LootPickup { get; set; } = new AetheriaRuntimeLootPickupCommand();
[Key(24)]
public AetheriaRuntimeLoadoutRestoreCommand LoadoutRestore { get; set; } = new AetheriaRuntimeLoadoutRestoreCommand();
[Key(25)]
public AetheriaRuntimeEquipmentTransferCommand EquipmentTransfer { get; set; } = new AetheriaRuntimeEquipmentTransferCommand();
[Key(26)]
public AetheriaRuntimeStoreItemCommand StoreItem { get; set; } = new AetheriaRuntimeStoreItemCommand();
public static AetheriaRuntimeDaemonCommandDocument Create(
AetheriaRuntimeDaemonCommandKinds kind,
string clientId,
string sessionId,
long observedFrameId,
string actorEntityKey)
{
return new AetheriaRuntimeDaemonCommandDocument
{
CommandId = Guid.NewGuid().ToString("N"),
ClientId = clientId ?? "",
IssuedAtUtc = DateTime.UtcNow.ToString("O"),
SessionId = sessionId ?? "",
ObservedFrameId = observedFrameId,
Kind = kind,
ActorEntityKey = actorEntityKey ?? ""
};
}
}
[MessagePackObject]
public sealed class AetheriaRuntimeActionBarBindingCommand
{
[Key(0)]
public string Kind { get; set; } = "";
[Key(1)]
public string ItemKey { get; set; } = "";
}
[MessagePackObject]
public sealed class AetheriaRuntimeCargoTransferCommand
{
[Key(0)]
public string OriginEntityKey { get; set; } = "";
[Key(1)]
public int OriginCargoIndex { get; set; } = -1;
[Key(2)]
public string DestinationEntityKey { get; set; } = "";
[Key(3)]
public int DestinationCargoIndex { get; set; } = -1;
[Key(4)]
public int SourceX { get; set; } = int.MinValue;
[Key(5)]
public int SourceY { get; set; } = int.MinValue;
[Key(6)]
public int DestinationX { get; set; }
[Key(7)]
public int DestinationY { get; set; }
[Key(8)]
public bool HasDestinationPosition { get; set; }
}
[MessagePackObject]
public sealed class AetheriaRuntimeTradePurchaseCommand
{
[Key(0)]
public string PurchaseKind { get; set; } = "";
[Key(1)]
public string ItemKey { get; set; } = "";
[Key(2)]
public int Quantity { get; set; } = 1;
[Key(3)]
public int UnitPrice { get; set; }
[Key(4)]
public int TotalPrice { get; set; }
[Key(5)]
public string StationEntityKey { get; set; } = "";
[Key(6)]
public int StationCargoIndex { get; set; } = -1;
[Key(7)]
public string TargetEntityKey { get; set; } = "";
[Key(8)]
public int TargetCargoIndex { get; set; } = -1;
[Key(9)]
public int SourceX { get; set; } = int.MinValue;
[Key(10)]
public int SourceY { get; set; } = int.MinValue;
[Key(11)]
public bool CreatesDockedShip { get; set; }
}
[MessagePackObject]
public sealed class AetheriaRuntimeLootPickupCommand
{
[Key(0)]
public string ItemKey { get; set; } = "";
[Key(1)]
public int Quantity { get; set; } = 1;
[Key(2)]
public double PositionX { get; set; }
[Key(3)]
public double PositionY { get; set; }
[Key(4)]
public double PositionZ { get; set; }
}
[MessagePackObject]
public sealed class AetheriaRuntimeLoadoutRestoreCommand
{
[Key(0)]
public string DockedEntityKey { get; set; } = "";
[Key(1)]
public string TemplateName { get; set; } = "";
[Key(2)]
public int Price { get; set; }
}
[MessagePackObject]
public sealed class AetheriaRuntimeEquipmentTransferCommand
{
[Key(0)]
public string SourceKind { get; set; } = "";
[Key(1)]
public string OriginEntityKey { get; set; } = "";
[Key(2)]
public int OriginIndex { get; set; } = -1;
[Key(3)]
public string DestinationEntityKey { get; set; } = "";
[Key(4)]
public int SourceX { get; set; } = int.MinValue;
[Key(5)]
public int SourceY { get; set; } = int.MinValue;
[Key(6)]
public int DestinationX { get; set; }
[Key(7)]
public int DestinationY { get; set; }
[Key(8)]
public bool HasDestinationPosition { get; set; }
}
[MessagePackObject]
public sealed class AetheriaRuntimeStoreItemCommand
{
[Key(0)]
public string OriginEntityKey { get; set; } = "";
[Key(1)]
public int SourceEquipmentIndex { get; set; } = -1;
[Key(2)]
public string DestinationEntityKey { get; set; } = "";
[Key(3)]
public int DestinationCargoIndex { get; set; } = -1;
[Key(4)]
public int DestinationX { get; set; }
[Key(5)]
public int DestinationY { get; set; }
[Key(6)]
public bool HasDestinationPosition { get; set; }
}
}

View file

@ -0,0 +1,570 @@
using System;
#nullable enable
namespace GameCult.Aetheria.State.Unity
{
public sealed class AetheriaRuntimeDaemonOperationClient
{
public AetheriaRuntimeDaemonOperationClient(
string stateFilePath,
string clientId = "unity-observer",
string sessionId = "local")
{
if (string.IsNullOrWhiteSpace(stateFilePath))
throw new ArgumentException("State file path must be non-empty.", nameof(stateFilePath));
StateFilePath = stateFilePath;
ClientId = string.IsNullOrWhiteSpace(clientId) ? "unity-observer" : clientId;
SessionId = string.IsNullOrWhiteSpace(sessionId) ? "local" : sessionId;
}
public string StateFilePath { get; }
public string ClientId { get; }
public string SessionId { get; }
public AetheriaRuntimeDaemonCommandEnvelope Send(
AetheriaRuntimeDaemonCommandKinds kind,
AetheriaRuntimeObservedDaemonState? observed,
Action<AetheriaRuntimeDaemonCommandDocument>? configure = null)
{
var command = Create(kind, observed);
configure?.Invoke(command);
if (!TrySend(command, out var envelope, out var error))
{
throw new InvalidOperationException(
$"Failed to submit Aetheria daemon operation {kind}: {error}");
}
return envelope!;
}
public bool TrySend(
AetheriaRuntimeDaemonCommandKinds kind,
AetheriaRuntimeObservedDaemonState? observed,
Action<AetheriaRuntimeDaemonCommandDocument>? configure,
out AetheriaRuntimeDaemonCommandEnvelope? envelope,
out string error)
{
var command = Create(kind, observed);
configure?.Invoke(command);
return TrySend(command, out envelope, out error);
}
public bool TrySend(
AetheriaRuntimeDaemonCommandDocument command,
out AetheriaRuntimeDaemonCommandEnvelope? envelope,
out string error)
{
return AetheriaRuntimeCommandSubmitter.TrySubmitDaemonCommand(
StateFilePath,
command,
ClientId,
out envelope,
out error);
}
public AetheriaRuntimeDaemonCommandDocument Create(
AetheriaRuntimeDaemonCommandKinds kind,
AetheriaRuntimeObservedDaemonState? observed)
{
return AetheriaRuntimeDaemonCommandDocument.Create(
kind,
ClientId,
observed?.Frame.SessionId ?? SessionId,
observed?.Frame.FrameId ?? -1,
observed?.Run.CurrentEntityKey ?? "");
}
public static AetheriaRuntimeDaemonCommandEnvelope ToEnvelope(AetheriaRuntimeDaemonCommandDocument command)
{
return new AetheriaRuntimeDaemonCommandEnvelope(
command.Schema ?? "",
command.CommandId ?? "",
command.ClientId ?? "",
command.IssuedAtUtc ?? "",
command.SessionId ?? "",
command.ObservedFrameId,
command.Kind,
command.ActorEntityKey ?? "",
"");
}
public AetheriaRuntimeDaemonCommandEnvelope SetTarget(
AetheriaRuntimeObservedDaemonState? observed,
string targetEntityKey)
{
return Send(AetheriaRuntimeDaemonCommandKinds.SetTarget, observed, command =>
command.TargetEntityKey = targetEntityKey ?? "");
}
public AetheriaRuntimeDaemonCommandEnvelope ClearTarget(AetheriaRuntimeObservedDaemonState? observed)
{
return Send(AetheriaRuntimeDaemonCommandKinds.ClearTarget, observed);
}
public AetheriaRuntimeDaemonCommandEnvelope SetMoveVector(
AetheriaRuntimeObservedDaemonState? observed,
double directionX,
double directionY,
double scalarValue = 1.0)
{
return Send(AetheriaRuntimeDaemonCommandKinds.SetMoveVector, observed, command =>
{
command.DirectionX = directionX;
command.DirectionY = directionY;
command.ScalarValue = scalarValue;
});
}
public AetheriaRuntimeDaemonCommandEnvelope SetLookDirection(
AetheriaRuntimeObservedDaemonState? observed,
double directionX,
double directionY,
double directionZ)
{
return Send(AetheriaRuntimeDaemonCommandKinds.SetLookDirection, observed, command =>
{
command.DirectionX = directionX;
command.DirectionY = directionY;
command.PositionZ = directionZ;
});
}
public AetheriaRuntimeDaemonCommandEnvelope SetTractorPower(
AetheriaRuntimeObservedDaemonState? observed,
double power)
{
return Send(AetheriaRuntimeDaemonCommandKinds.SetTractorPower, observed, command =>
command.ScalarValue = power);
}
public AetheriaRuntimeDaemonCommandEnvelope FireWeaponGroup(
AetheriaRuntimeObservedDaemonState? observed,
int weaponGroup)
{
return Send(AetheriaRuntimeDaemonCommandKinds.FireWeaponGroup, observed, command =>
command.WeaponGroup = weaponGroup);
}
public AetheriaRuntimeDaemonCommandEnvelope SetWeaponGroupActive(
AetheriaRuntimeObservedDaemonState? observed,
int weaponGroup,
bool active)
{
return Send(AetheriaRuntimeDaemonCommandKinds.SetWeaponGroupActive, observed, command =>
{
command.WeaponGroup = weaponGroup;
command.ScalarValue = active ? 1.0 : 0.0;
});
}
public AetheriaRuntimeDaemonCommandEnvelope SetWeaponGroupMembership(
AetheriaRuntimeObservedDaemonState? observed,
string targetEntityKey,
int equipmentIndex,
int weaponGroup,
bool assigned)
{
return Send(AetheriaRuntimeDaemonCommandKinds.SetWeaponGroupMembership, observed, command =>
{
command.TargetEntityKey = targetEntityKey ?? "";
command.EquipmentIndex = equipmentIndex;
command.WeaponGroup = weaponGroup;
command.ScalarValue = assigned ? 1.0 : 0.0;
});
}
public AetheriaRuntimeDaemonCommandEnvelope SetBehaviorActive(
AetheriaRuntimeObservedDaemonState? observed,
int equipmentIndex,
int behaviorIndex,
bool active)
{
return Send(AetheriaRuntimeDaemonCommandKinds.SetBehaviorActive, observed, command =>
{
command.EquipmentIndex = equipmentIndex;
command.BehaviorIndex = behaviorIndex;
command.ScalarValue = active ? 1.0 : 0.0;
});
}
public AetheriaRuntimeDaemonCommandEnvelope ActivateConsumable(
AetheriaRuntimeObservedDaemonState? observed,
string itemKey)
{
return Send(AetheriaRuntimeDaemonCommandKinds.ActivateConsumable, observed, command =>
command.TextValue = itemKey ?? "");
}
public AetheriaRuntimeDaemonCommandEnvelope SensorPing(AetheriaRuntimeObservedDaemonState? observed)
{
return Send(AetheriaRuntimeDaemonCommandKinds.SensorPing, observed);
}
public AetheriaRuntimeDaemonCommandEnvelope SetHeatsinksEnabled(
AetheriaRuntimeObservedDaemonState? observed,
bool enabled)
{
return Send(AetheriaRuntimeDaemonCommandKinds.SetHeatsinksEnabled, observed, command =>
command.ScalarValue = enabled ? 1.0 : 0.0);
}
public AetheriaRuntimeDaemonCommandEnvelope SetOverrideShutdown(
AetheriaRuntimeObservedDaemonState? observed,
bool enabled)
{
return Send(AetheriaRuntimeDaemonCommandKinds.SetOverrideShutdown, observed, command =>
command.ScalarValue = enabled ? 1.0 : 0.0);
}
public AetheriaRuntimeDaemonCommandEnvelope SetOverrideShutdown(
AetheriaRuntimeObservedDaemonState? observed,
string targetEntityKey,
bool enabled)
{
return Send(AetheriaRuntimeDaemonCommandKinds.SetOverrideShutdown, observed, command =>
{
command.TargetEntityKey = targetEntityKey ?? "";
command.ScalarValue = enabled ? 1.0 : 0.0;
});
}
public AetheriaRuntimeDaemonCommandEnvelope SetItemEnabled(
AetheriaRuntimeObservedDaemonState? observed,
int equipmentIndex,
bool enabled)
{
return Send(AetheriaRuntimeDaemonCommandKinds.SetItemEnabled, observed, command =>
{
command.EquipmentIndex = equipmentIndex;
command.ScalarValue = enabled ? 1.0 : 0.0;
});
}
public AetheriaRuntimeDaemonCommandEnvelope ToggleShieldEnabled(AetheriaRuntimeObservedDaemonState? observed)
{
return Send(AetheriaRuntimeDaemonCommandKinds.ToggleShieldEnabled, observed);
}
public AetheriaRuntimeDaemonCommandEnvelope SetItemOverrideShutdown(
AetheriaRuntimeObservedDaemonState? observed,
string targetEntityKey,
int equipmentIndex,
bool enabled)
{
return Send(AetheriaRuntimeDaemonCommandKinds.SetItemOverrideShutdown, observed, command =>
{
command.TargetEntityKey = targetEntityKey ?? "";
command.EquipmentIndex = equipmentIndex;
command.ScalarValue = enabled ? 1.0 : 0.0;
});
}
public AetheriaRuntimeDaemonCommandEnvelope SetThermotoggleTargetTemperature(
AetheriaRuntimeObservedDaemonState? observed,
string targetEntityKey,
int equipmentIndex,
int behaviorIndex,
double targetTemperature)
{
return Send(AetheriaRuntimeDaemonCommandKinds.SetThermotoggleTargetTemperature, observed, command =>
{
command.TargetEntityKey = targetEntityKey ?? "";
command.EquipmentIndex = equipmentIndex;
command.BehaviorIndex = behaviorIndex;
command.ScalarValue = targetTemperature;
});
}
public AetheriaRuntimeDaemonCommandEnvelope SetShutdownPerformance(
AetheriaRuntimeObservedDaemonState? observed,
string targetEntityKey,
double shutdownPerformance)
{
return Send(AetheriaRuntimeDaemonCommandKinds.SetShutdownPerformance, observed, command =>
{
command.TargetEntityKey = targetEntityKey ?? "";
command.ScalarValue = shutdownPerformance;
});
}
public AetheriaRuntimeDaemonCommandEnvelope SetActionBarBinding(
AetheriaRuntimeObservedDaemonState? observed,
string controlPath,
string kind,
string itemKey,
int equipmentIndex,
int behaviorIndex,
int weaponGroup)
{
return Send(AetheriaRuntimeDaemonCommandKinds.SetActionBarBinding, observed, command =>
{
command.TextValue = controlPath ?? "";
command.EquipmentIndex = equipmentIndex;
command.BehaviorIndex = behaviorIndex;
command.WeaponGroup = weaponGroup;
command.ActionBarBinding.Kind = kind ?? "";
command.ActionBarBinding.ItemKey = itemKey ?? "";
});
}
public AetheriaRuntimeDaemonCommandEnvelope ClearActionBarBinding(
AetheriaRuntimeObservedDaemonState? observed,
string controlPath)
{
return Send(AetheriaRuntimeDaemonCommandKinds.ClearActionBarBinding, observed, command =>
command.TextValue = controlPath ?? "");
}
public AetheriaRuntimeDaemonCommandEnvelope ToggleHullConductivity(
AetheriaRuntimeObservedDaemonState? observed,
string targetEntityKey,
int x,
int y,
int axis)
{
return Send(AetheriaRuntimeDaemonCommandKinds.ToggleHullConductivity, observed, command =>
{
command.TargetEntityKey = targetEntityKey ?? "";
command.PositionX = x;
command.PositionY = y;
command.ScalarValue = axis;
});
}
public AetheriaRuntimeDaemonCommandEnvelope SetEntityName(
AetheriaRuntimeObservedDaemonState? observed,
string targetEntityKey,
string name)
{
return Send(AetheriaRuntimeDaemonCommandKinds.SetEntityName, observed, command =>
{
command.TargetEntityKey = targetEntityKey ?? "";
command.TextValue = name ?? "";
});
}
public AetheriaRuntimeDaemonCommandEnvelope Dock(AetheriaRuntimeObservedDaemonState? observed, string targetEntityKey)
{
return Send(AetheriaRuntimeDaemonCommandKinds.Dock, observed, command =>
command.TargetEntityKey = targetEntityKey ?? "");
}
public AetheriaRuntimeDaemonCommandEnvelope Undock(AetheriaRuntimeObservedDaemonState? observed)
{
return Send(AetheriaRuntimeDaemonCommandKinds.Undock, observed);
}
public AetheriaRuntimeDaemonCommandEnvelope SetDockedCurrentShip(
AetheriaRuntimeObservedDaemonState? observed,
string targetEntityKey)
{
return Send(AetheriaRuntimeDaemonCommandKinds.SetDockedCurrentShip, observed, command =>
command.TargetEntityKey = targetEntityKey ?? "");
}
public AetheriaRuntimeDaemonCommandEnvelope EnterWormhole(
AetheriaRuntimeObservedDaemonState? observed,
int targetZoneIndex,
double positionX,
double positionY)
{
return Send(AetheriaRuntimeDaemonCommandKinds.EnterWormhole, observed, command =>
{
command.TargetZoneIndex = targetZoneIndex;
command.PositionX = positionX;
command.PositionY = positionY;
});
}
public AetheriaRuntimeDaemonCommandEnvelope TowToStation(
AetheriaRuntimeObservedDaemonState? observed,
string stationEntityKey,
int targetZoneIndex,
double positionX,
double positionY)
{
return Send(AetheriaRuntimeDaemonCommandKinds.TowToStation, observed, command =>
{
command.TargetEntityKey = stationEntityKey ?? "";
command.TargetZoneIndex = targetZoneIndex;
command.PositionX = positionX;
command.PositionY = positionY;
});
}
public AetheriaRuntimeDaemonCommandEnvelope TransferCargoItem(
AetheriaRuntimeObservedDaemonState? observed,
string originEntityKey,
int originCargoIndex,
string destinationEntityKey,
int destinationCargoIndex,
string itemKey,
int quantity,
int sourceX,
int sourceY,
int destinationX,
int destinationY,
bool hasDestinationPosition)
{
return Send(AetheriaRuntimeDaemonCommandKinds.TransferCargoItem, observed, command =>
{
command.TargetEntityKey = destinationEntityKey ?? "";
command.EquipmentIndex = destinationCargoIndex;
command.PositionX = destinationX;
command.PositionY = destinationY;
command.ScalarValue = quantity;
command.TextValue = itemKey ?? "";
command.CargoTransfer.OriginEntityKey = originEntityKey ?? "";
command.CargoTransfer.OriginCargoIndex = originCargoIndex;
command.CargoTransfer.DestinationEntityKey = destinationEntityKey ?? "";
command.CargoTransfer.DestinationCargoIndex = destinationCargoIndex;
command.CargoTransfer.SourceX = sourceX;
command.CargoTransfer.SourceY = sourceY;
command.CargoTransfer.DestinationX = destinationX;
command.CargoTransfer.DestinationY = destinationY;
command.CargoTransfer.HasDestinationPosition = hasDestinationPosition;
});
}
public AetheriaRuntimeDaemonCommandEnvelope TradePurchase(
AetheriaRuntimeObservedDaemonState? observed,
string purchaseKind,
string itemKey,
int quantity,
int unitPrice,
int totalPrice,
string stationEntityKey,
int stationCargoIndex,
string targetEntityKey,
int targetCargoIndex,
int sourceX,
int sourceY,
bool createsDockedShip)
{
return Send(AetheriaRuntimeDaemonCommandKinds.TradePurchase, observed, command =>
{
command.TargetEntityKey = targetEntityKey ?? "";
command.EquipmentIndex = targetCargoIndex;
command.PositionX = sourceX;
command.PositionY = sourceY;
command.ScalarValue = totalPrice;
command.TextValue = itemKey ?? "";
command.TradePurchase.PurchaseKind = purchaseKind ?? "";
command.TradePurchase.ItemKey = itemKey ?? "";
command.TradePurchase.Quantity = quantity;
command.TradePurchase.UnitPrice = unitPrice;
command.TradePurchase.TotalPrice = totalPrice;
command.TradePurchase.StationEntityKey = stationEntityKey ?? "";
command.TradePurchase.StationCargoIndex = stationCargoIndex;
command.TradePurchase.TargetEntityKey = targetEntityKey ?? "";
command.TradePurchase.TargetCargoIndex = targetCargoIndex;
command.TradePurchase.SourceX = sourceX;
command.TradePurchase.SourceY = sourceY;
command.TradePurchase.CreatesDockedShip = createsDockedShip;
});
}
public AetheriaRuntimeDaemonCommandEnvelope PickUpLoot(
AetheriaRuntimeObservedDaemonState? observed,
string targetEntityKey,
string itemKey,
int quantity,
double positionX,
double positionY,
double positionZ)
{
return Send(AetheriaRuntimeDaemonCommandKinds.PickUpLoot, observed, command =>
{
command.TargetEntityKey = targetEntityKey ?? "";
command.TextValue = itemKey ?? "";
command.ScalarValue = quantity;
command.PositionX = positionX;
command.PositionY = positionY;
command.PositionZ = positionZ;
command.LootPickup.ItemKey = itemKey ?? "";
command.LootPickup.Quantity = quantity;
command.LootPickup.PositionX = positionX;
command.LootPickup.PositionY = positionY;
command.LootPickup.PositionZ = positionZ;
});
}
public AetheriaRuntimeDaemonCommandEnvelope RestoreLoadout(
AetheriaRuntimeObservedDaemonState? observed,
string dockedEntityKey,
string templateName,
int price)
{
return Send(AetheriaRuntimeDaemonCommandKinds.RestoreLoadout, observed, command =>
{
command.TargetEntityKey = dockedEntityKey ?? "";
command.TextValue = templateName ?? "";
command.ScalarValue = price;
command.LoadoutRestore.DockedEntityKey = dockedEntityKey ?? "";
command.LoadoutRestore.TemplateName = templateName ?? "";
command.LoadoutRestore.Price = price;
});
}
public AetheriaRuntimeDaemonCommandEnvelope EquipItem(
AetheriaRuntimeObservedDaemonState? observed,
string sourceKind,
string originEntityKey,
int originIndex,
string destinationEntityKey,
string itemKey,
int sourceX,
int sourceY,
int destinationX,
int destinationY,
bool hasDestinationPosition)
{
return Send(AetheriaRuntimeDaemonCommandKinds.EquipItem, observed, command =>
{
command.TargetEntityKey = destinationEntityKey ?? "";
command.PositionX = destinationX;
command.PositionY = destinationY;
command.TextValue = itemKey ?? "";
command.EquipmentTransfer.SourceKind = sourceKind ?? "";
command.EquipmentTransfer.OriginEntityKey = originEntityKey ?? "";
command.EquipmentTransfer.OriginIndex = originIndex;
command.EquipmentTransfer.DestinationEntityKey = destinationEntityKey ?? "";
command.EquipmentTransfer.SourceX = sourceX;
command.EquipmentTransfer.SourceY = sourceY;
command.EquipmentTransfer.DestinationX = destinationX;
command.EquipmentTransfer.DestinationY = destinationY;
command.EquipmentTransfer.HasDestinationPosition = hasDestinationPosition;
});
}
public AetheriaRuntimeDaemonCommandEnvelope StoreItem(
AetheriaRuntimeObservedDaemonState? observed,
string originEntityKey,
int sourceEquipmentIndex,
string destinationEntityKey,
int destinationCargoIndex,
string itemKey,
int destinationX,
int destinationY,
bool hasDestinationPosition)
{
return Send(AetheriaRuntimeDaemonCommandKinds.StoreItem, observed, command =>
{
command.TargetEntityKey = destinationEntityKey ?? "";
command.EquipmentIndex = sourceEquipmentIndex;
command.PositionX = destinationX;
command.PositionY = destinationY;
command.TextValue = itemKey ?? "";
command.StoreItem.OriginEntityKey = originEntityKey ?? "";
command.StoreItem.SourceEquipmentIndex = sourceEquipmentIndex;
command.StoreItem.DestinationEntityKey = destinationEntityKey ?? "";
command.StoreItem.DestinationCargoIndex = destinationCargoIndex;
command.StoreItem.DestinationX = destinationX;
command.StoreItem.DestinationY = destinationY;
command.StoreItem.HasDestinationPosition = hasDestinationPosition;
});
}
}
}

File diff suppressed because it is too large Load diff