From dec28c5a010753be8a2c61de526541a92e5331fe Mon Sep 17 00:00:00 2001 From: richard Date: Fri, 13 Nov 2026 15:56:44 +0100 Subject: [PATCH] Let cursor aim turn as hard as the keys (0.4.5) - Rate loop gets an integral term with anti-windup, so held turns reach the commanded rate instead of settling below it (rateIntegralGain) - Cursor past full deflection asks for more pull than planned; a measured angle of attack limiter caps it at the wings' stall limit, like holding the key without stalling - Lift margin is now configurable (liftMargin, default 0.95, was a fixed 0.85) and also sets the angle of attack limit - fullDeflectionDegrees defaults to 20 (was 30) - Cursor aim options are settable in game with /aero - /aero cursor_debug shows commanded vs actual pitch rate, planned pull, lift limit and stall ratio above the hotbar Co-Authored-By: Claude Opus 5.5 --- gradle.properties | 2 +- .../lumareth/improvedAerodynamics/Config.java | 10 ++- .../improvedAerodynamics/ConfigCommands.java | 20 ++++- .../ImprovedAerodynamics.java | 1 + .../flight/AeroState.java | 21 ++++- .../flight/CursorAimDebug.java | 77 +++++++++++++++++++ .../flight/CursorPilot.java | 61 +++++++++++++-- .../flight/ImprovedAero.java | 19 +++++ 8 files changed, 198 insertions(+), 13 deletions(-) create mode 100644 src/main/java/dev/lumareth/improvedAerodynamics/flight/CursorAimDebug.java diff --git a/gradle.properties b/gradle.properties index 044d3bf..23e0989 100644 --- a/gradle.properties +++ b/gradle.properties @@ -12,7 +12,7 @@ mapping_version=2023.09.03-1.20.1 mod_id=improved_aerodynamics mod_name=VS: Improved Aerodynamics mod_license=MIT -mod_version=0.4.3 +mod_version=0.4.5 azurelib_version=3.2.7 mod_group_id=dev.lumareth.improvedaerodynamics mod_authors=Lumareth diff --git a/src/main/java/dev/lumareth/improvedAerodynamics/Config.java b/src/main/java/dev/lumareth/improvedAerodynamics/Config.java index dcb62ad..6b72d49 100644 --- a/src/main/java/dev/lumareth/improvedAerodynamics/Config.java +++ b/src/main/java/dev/lumareth/improvedAerodynamics/Config.java @@ -215,7 +215,7 @@ public final class Config { public static final ForgeConfigSpec.DoubleValue CURSOR_AIM_FULL_DEFLECTION_DEGREES = BUILDER.comment("Angle of the cursor from the gun reticle at which the virtual pilot turns as hard as it can: the maximum bank", "sideways, the full pitch rate up or down. Closer than that it turns more gently, so the reticle settles onto", "the cursor. How fast the craft can turn is worked out from the craft itself") - .defineInRange("fullDeflectionDegrees", 30.0, 5.0, 90.0); + .defineInRange("fullDeflectionDegrees", 20.0, 5.0, 90.0); public static final ForgeConfigSpec.DoubleValue CURSOR_AIM_DEADZONE_DEGREES = BUILDER.comment("Radius around the gun reticle in degrees inside which the pilot stops steering towards the cursor. The reticle", "then settles this far from the cursor. Outside it the command grows from zero, there is no jump at the edge") @@ -235,6 +235,14 @@ public final class Config { "higher follows the cursor tighter and can start to oscillate") .defineInRange("rateGain", 5.0, 0.5, 40.0); + public static final ForgeConfigSpec.DoubleValue CURSOR_AIM_RATE_INTEGRAL_GAIN = BUILDER.comment("How fast the pilot builds up extra deflection when the craft keeps turning slower than asked, so a held turn", + "reaches the rate it asks for. 0 turns it off, high values can make the nose overshoot") + .defineInRange("rateIntegralGain", 4.0, 0.0, 40.0); + + public static final ForgeConfigSpec.DoubleValue CURSOR_AIM_LIFT_MARGIN = BUILDER.comment("Share of the wings' stall limit the pilot uses: of the lift they can make before stalling when it plans a turn,", + "and of the stall angle of attack, which it never pulls past. 1 flies right at the edge of the stall") + .defineInRange("liftMargin", 0.95, 0.5, 1.0); + public static final ForgeConfigSpec.DoubleValue CURSOR_AIM_PUSH_FACTOR = BUILDER.comment("A cursor below the gun reticle pushes the nose down. This is how much of the pull rate that may be, since", "negative g is harder on the craft and the pilot") .defineInRange("pushFactor", 0.4, 0.0, 1.0); diff --git a/src/main/java/dev/lumareth/improvedAerodynamics/ConfigCommands.java b/src/main/java/dev/lumareth/improvedAerodynamics/ConfigCommands.java index 4f24684..87552f9 100644 --- a/src/main/java/dev/lumareth/improvedAerodynamics/ConfigCommands.java +++ b/src/main/java/dev/lumareth/improvedAerodynamics/ConfigCommands.java @@ -8,6 +8,7 @@ import com.mojang.brigadier.builder.LiteralArgumentBuilder; import com.mojang.brigadier.tree.LiteralCommandNode; import dev.lumareth.improvedAerodynamics.exhaust.NozzleCommands; import dev.lumareth.improvedAerodynamics.flight.ControlMode; +import dev.lumareth.improvedAerodynamics.flight.CursorAimDebug; import net.minecraft.commands.CommandSourceStack; import net.minecraft.commands.Commands; import net.minecraft.commands.SharedSuggestionProvider; @@ -23,7 +24,8 @@ import java.util.List; * /improvedaerodynamics (or /aero) to read and change the most important server config values in game. * {@code /aero} lists them, {@code /aero