Narrow pilot command runtime access

This commit is contained in:
Meta Vens 2026-06-29 06:38:28 +01:00
commit faf1d31a43
3 changed files with 16 additions and 16 deletions

View file

@ -14931,9 +14931,9 @@ static void RequireUnityObserverDoesNotTickLocalSimulation(string root)
"_hasSentDaemonMoveVector",
"_hasSentDaemonLookDirection",
"_hasSentDaemonTractorPower",
"Func<AetheriaClient> _resolveClient",
"Func<AetheriaControl> _resolveControl",
"Action<AetheriaControl> submit",
"submit(client.Control)",
"submit(control)",
"Failed to send Aetheria daemon pilot {label} operation",
"operations => operations.SetMoveVector",
"operations => operations.SetLookDirection",
@ -14951,6 +14951,8 @@ static void RequireUnityObserverDoesNotTickLocalSimulation(string root)
var forbiddenSentOperationSymbols = new[]
{
"Func<AetheriaClient> _resolveClient",
"submit(client.Control)",
"Func<AetheriaDaemonObserver> _resolveObserver",
"Action<AetheriaRuntimeDaemonOperationsClient> submit",
"submit(observer.Operations)"

View file

@ -32,7 +32,9 @@ public class ActionGameManager : MonoBehaviour
private AetheriaUnityGameplayBootShell _gameplayBootShell;
private AetheriaUnityGameplaySceneWiring _sceneWiring;
private AetheriaUnityPilotCommandSender PilotCommands =>
_pilotCommands ??= new AetheriaUnityPilotCommandSender(ResolveCurrentRuntimeClient, () => Time.unscaledTime);
_pilotCommands ??= new AetheriaUnityPilotCommandSender(
() => AetheriaUnityRuntimeClientProvider.Control("unity-pilot-commands"),
() => Time.unscaledTime);
private AetheriaUnityObservedDockingIndex ObservedDocking =>
_observedDocking ??= new AetheriaUnityObservedDockingIndex(_observedEntityIndex);
private AetheriaUnityObservedEntityRestorer ObservedEntityRestorer =>
@ -291,12 +293,6 @@ public class ActionGameManager : MonoBehaviour
private readonly AetheriaUnityDragSession _dragSession = new AetheriaUnityDragSession();
private readonly AetheriaUnityActionBarPresentation _actionBarPresentation = new AetheriaUnityActionBarPresentation();
private static AetheriaClient ResolveCurrentRuntimeClient()
{
return AetheriaUnityRuntimeClientProvider.CurrentClientForStateFile(
AetheriaUnityRuntimePaths.RuntimeStateFilePath);
}
private void OnDisable()
{
_gameplayInputShell?.Dispose();

View file

@ -15,7 +15,7 @@ public sealed class AetheriaUnityPilotCommandSender
private const float DaemonTractorCommandIntervalSeconds = 0.05f;
private const float DaemonTractorCommandChangeThreshold = 0.001f;
private readonly Func<AetheriaClient> _resolveClient;
private readonly Func<AetheriaControl> _resolveControl;
private readonly Func<float> _time;
private Vector2 _lastSentDaemonMoveVector;
private Vector3 _lastSentDaemonLookDirection;
@ -28,10 +28,10 @@ public sealed class AetheriaUnityPilotCommandSender
private bool _hasSentDaemonTractorPower;
public AetheriaUnityPilotCommandSender(
Func<AetheriaClient> resolveClient,
Func<AetheriaControl> resolveControl,
Func<float> time)
{
_resolveClient = resolveClient ?? throw new ArgumentNullException(nameof(resolveClient));
_resolveControl = resolveControl ?? throw new ArgumentNullException(nameof(resolveControl));
_time = time ?? throw new ArgumentNullException(nameof(time));
}
@ -99,16 +99,18 @@ public sealed class AetheriaUnityPilotCommandSender
Action<AetheriaControl> submit,
string label)
{
var client = _resolveClient();
if (client == null ||
submit == null)
if (submit == null)
{
return false;
}
try
{
submit(client.Control);
var control = _resolveControl();
if (control == null)
return false;
submit(control);
return true;
}
catch (Exception ex)