Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01YVREx3uo7nz1FEhzveWTUh
57 lines
3.9 KiB
Java
57 lines
3.9 KiB
Java
package dev.lumareth.improvedAerodynamics.flight;
|
|
|
|
import net.minecraftforge.common.ForgeConfigSpec;
|
|
|
|
/** Server side settings of the cursor aim virtual pilot. Lives in improved_aerodynamics-cursor-aim.toml. */
|
|
public final class CursorAimConfig {
|
|
public static final ForgeConfigSpec SPEC;
|
|
|
|
public static final ForgeConfigSpec.BooleanValue ENABLED;
|
|
public static final ForgeConfigSpec.DoubleValue FULL_DEFLECTION_DEGREES;
|
|
public static final ForgeConfigSpec.DoubleValue DEADZONE_DEGREES;
|
|
public static final ForgeConfigSpec.DoubleValue MAX_TURN_RATE_DEGREES;
|
|
public static final ForgeConfigSpec.DoubleValue MAX_ROLL_RATE_DEGREES;
|
|
public static final ForgeConfigSpec.DoubleValue MAX_BANK_DEGREES;
|
|
public static final ForgeConfigSpec.DoubleValue BANK_GAIN;
|
|
public static final ForgeConfigSpec.DoubleValue RATE_GAIN;
|
|
public static final ForgeConfigSpec.DoubleValue PUSH_FACTOR;
|
|
public static final ForgeConfigSpec.DoubleValue STALLED_PITCH_FACTOR;
|
|
public static final ForgeConfigSpec.DoubleValue MIN_SPEED;
|
|
|
|
static {
|
|
ForgeConfigSpec.Builder builder = new ForgeConfigSpec.Builder();
|
|
builder.comment("Cursor aim: the mouse moves a cursor on screen, a virtual pilot flies the control node's craft by it").push("cursor_aim");
|
|
ENABLED = builder.comment("Whether pilots may use cursor aim on this server")
|
|
.define("enabled", true);
|
|
FULL_DEFLECTION_DEGREES = builder.comment("Angle of the cursor from the gun reticle at which the virtual pilot asks for full deflection: the maximum bank",
|
|
"sideways, the full pitch rate up or down")
|
|
.defineInRange("fullDeflectionDegrees", 30.0, 5.0, 90.0);
|
|
DEADZONE_DEGREES = builder.comment("Radius around the gun reticle in degrees inside which the cursor commands nothing, so the craft flies straight.",
|
|
"Outside it the command grows from zero, there is no jump at the edge")
|
|
.defineInRange("deadzoneDegrees", 3.0, 0.0, 15.0);
|
|
MAX_TURN_RATE_DEGREES = builder.comment("Turn rate in degrees per second the pilot asks for at full deflection, both for the turn at maximum bank and for pitching")
|
|
.defineInRange("maxTurnRateDegrees", 40.0, 5.0, 360.0);
|
|
MAX_ROLL_RATE_DEGREES = builder.comment("Fastest roll in degrees per second the pilot asks for when it rolls to a bank angle")
|
|
.defineInRange("maxRollRateDegrees", 150.0, 10.0, 720.0);
|
|
MAX_BANK_DEGREES = builder.comment("Bank angle the pilot rolls to when the cursor is at full sideways deflection")
|
|
.defineInRange("maxBankDegrees", 70.0, 10.0, 90.0);
|
|
BANK_GAIN = builder.comment("Roll rate in rad/s per radian of bank angle error, how eagerly the pilot rolls to the wanted bank and levels the wings")
|
|
.defineInRange("bankGain", 3.0, 0.2, 20.0);
|
|
RATE_GAIN = builder.comment("How hard the pilot corrects its turn rate, in angular acceleration per rad/s of rate error. Lower is smoother,",
|
|
"higher follows the cursor tighter and can start to oscillate")
|
|
.defineInRange("rateGain", 5.0, 0.5, 40.0);
|
|
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);
|
|
STALLED_PITCH_FACTOR = builder.comment("Multiplier for the pitch rate the pilot asks for while the wings are stalled, so it does not keep pulling")
|
|
.defineInRange("stalledPitchFactor", 0.3, 0.0, 1.0);
|
|
MIN_SPEED = builder.comment("Below this speed in blocks per second the pilot does nothing, the surfaces have no effect anyway")
|
|
.defineInRange("minSpeed", 15.0, 0.0, 200.0);
|
|
builder.pop();
|
|
SPEC = builder.build();
|
|
}
|
|
|
|
private CursorAimConfig() {
|
|
}
|
|
}
|