Restore authoritative continuous pilot aim

This commit is contained in:
Meta Vens 2026-07-15 05:57:17 +01:00
commit 947c591ebd
6 changed files with 50 additions and 6 deletions

View file

@ -608,6 +608,8 @@ namespace GameCult.Aetheria.State.Verse
["movementEnabled"] = isDocked ? "false" : "true",
["presentationMode"] = isDocked ? "docked" : "world",
["movementCommand"] = CommandName(AetheriaRuntimeDaemonCommandKinds.SetMoveVector),
["lookCommand"] = CommandName(AetheriaRuntimeDaemonCommandKinds.SetLookDirection),
["lookSensitivityRadians"] = "-0.001",
["focusCommand"] = CommandName(AetheriaRuntimeDaemonCommandKinds.TargetNearest),
["targetCommand"] = CommandName(AetheriaRuntimeDaemonCommandKinds.SetTarget),
["actionCommand"] = CommandName(AetheriaRuntimeDaemonCommandKinds.FireWeaponGroup),
@ -625,6 +627,9 @@ namespace GameCult.Aetheria.State.Verse
var combatPresentation = CombatPresentation(run, zone, playerEntityId, simulationSettings);
if (combatPresentation != null)
presentationChildren.Insert(0, combatPresentation);
var aimPresentation = AimPresentation(run, zone, playerEntityId);
if (aimPresentation != null)
presentationChildren.Insert(0, aimPresentation);
return new AetheriaRuntimeSurfaceComponent(
id,
@ -647,6 +652,30 @@ namespace GameCult.Aetheria.State.Verse
});
}
private static AetheriaRuntimeSurfaceComponent? AimPresentation(
AetheriaRuntimeRunCheckpointCommit run,
AetheriaRuntimeZoneSnapshotCommit zone,
string playerEntityId)
{
var player = FindCurrentEntity(run, zone);
if (player == null)
return null;
var target = FindTargetEntity(zone, player);
var props = new Dictionary<string, string>(StringComparer.Ordinal)
{
["controlledEntityId"] = playerEntityId,
["controlledEntityIndex"] = player.EntityIndex.ToString(CultureInfo.InvariantCulture),
["convergenceTargetEntityId"] = target == null
? ""
: run.EntityRecordKey(zone.ZoneIndex, target.EntityIndex),
["viewDotRole"] = "aim.marker.view-direction",
["minimumConvergenceDistance"] = "50",
["viewDotRadius"] = "0.8"
};
return Node("aetheria.daemon.game.world.aim", "aim.presentation", props.Select(value => (value.Key, value.Value)).ToArray());
}
private static AetheriaRuntimeSurfaceComponent? CombatPresentation(
AetheriaRuntimeRunCheckpointCommit run,
AetheriaRuntimeZoneSnapshotCommit zone,

View file

@ -529,10 +529,16 @@ namespace GameCult.Aetheria.State.Verse
AetheriaRuntimeRunCheckpointCommit run,
AetheriaRuntimeDaemonCommandDocument command)
{
if (!IsFinite(command.DirectionX) || !IsFinite(command.PositionZ))
return false;
var length = Math.Sqrt(command.DirectionX * command.DirectionX + command.PositionZ * command.PositionZ);
if (length <= 0.000001)
return false;
return ApplyCurrentEntity(run, command, entity =>
{
entity.DirectionX = command.DirectionX;
entity.DirectionY = command.PositionZ;
entity.DirectionX = command.DirectionX / length;
entity.DirectionY = command.PositionZ / length;
});
}