Move interaction priority into daemon operations

This commit is contained in:
Meta Vens 2026-06-21 11:51:37 +01:00
commit 7e80803a88
7 changed files with 188 additions and 27 deletions

View file

@ -2000,17 +2000,7 @@ public class ActionGameManager : MonoBehaviour
Dialog.Show();
Dialog.MoveToCursor();
}
else if (CurrentEntity.Parent == null)
{
foreach (var wormhole in ZoneRenderer.WormholeInstances.Keys)
{
if (!(CultMath.math.length(wormhole.Position - CurrentEntity.CultPositionXZ) < Settings.GameplaySettings.WormholeExitRadius)) continue;
RequestEnterWormhole(wormhole);
return;
}
RequestDock();
}
else RequestUndock();
else RequestInteract();
};
Input.Global.MainMenu.performed += context =>
@ -2165,35 +2155,29 @@ public class ActionGameManager : MonoBehaviour
foreach (var a in _actionBarActions) a.Disable();
}
private void RequestEnterWormhole(Wormhole wormhole)
private void RequestInteract()
{
TryRequestDaemonEnterWormhole(wormhole);
TryRequestDaemonInteract();
}
private bool TryRequestDaemonEnterWormhole(Wormhole wormhole)
private bool TryRequestDaemonInteract()
{
var observer = ResolveDaemonObserver();
if (observer == null ||
!observer.HasAuthoritativeState ||
wormhole == null)
{
return false;
}
var targetZoneIndex = ZoneIndex(wormhole.Target);
if (targetZoneIndex < 0)
if (observer == null || !observer.HasAuthoritativeState)
{
return false;
}
try
{
observer.Operations.EnterWormhole(targetZoneIndex, wormhole.Position.x, wormhole.Position.y);
observer.Operations.Interact(
Settings.GameplaySettings.DockingDistance,
Settings.GameplaySettings.WormholeExitRadius);
return true;
}
catch (Exception ex)
{
Debug.LogWarning($"Failed to send Aetheria daemon wormhole operation; operation not submitted: {ex.Message}");
Debug.LogWarning($"Failed to send Aetheria daemon interact operation; operation not submitted: {ex.Message}");
return false;
}
}

View file

@ -210,6 +210,11 @@ public sealed class AetheriaDaemonOperations
return Send((client, observed) => client.Undock(observed));
}
public AetheriaRuntimeDaemonCommandEnvelope Interact(double dockDistance, double wormholeDistance)
{
return Send((client, observed) => client.Interact(observed, dockDistance, wormholeDistance));
}
public AetheriaRuntimeDaemonCommandEnvelope SetDockedCurrentShip(string targetEntityKey)
{
return Send((client, observed) => client.SetDockedCurrentShip(observed, targetEntityKey));