Add flaps: flappable tag, flap lever on the control node, flap physics (0.4.0)

Shift-right-click a block in improved_aerodynamics:flappable to make it a flap.
G/H step the node's flap lever UP/TAKEOFF/LANDING; flaps slew to the configured
angle, add lift and drag and raise the stall angle, and retract above a max speed.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01YVREx3uo7nz1FEhzveWTUh
This commit is contained in:
Claude committed 2026-11-11 18:36:28 +01:00
1 parent 70eb237d70
commit 1be7e90ec2
18 files changed
+525 -13

No files matched your search

@@ -31,6 +31,9 @@ import org.valkyrienskies.mod.common.VSGameUtilsKt;
public final class WariumCapture {
public static final String AUTO_TRIM_TAG = "improved_aerodynamics_autotrim";
public static final String TRIM_TAG = "improved_aerodynamics_trim";
/** Block entity flag of a surface that is a flap, and the flap lever of a control node. */
public static final String FLAP_TAG = "improved_aerodynamics_flap";
public static final String FLAP_SETTING_TAG = "improved_aerodynamics_flap_setting";
private static final int TRIM_SAVE_INTERVAL = 20;
// The procedure currently running, procedures run one at a time on the server thread
@@ -77,10 +80,12 @@ public final class WariumCapture {
String key = "Null";
String key2 = "Null";
double brakeInput = 0.0;
boolean flap = false;
if (type.controllable || type == SurfaceType.AIR_BRAKE) {
BlockEntity blockEntity = level.getBlockEntity(pos);
if (blockEntity != null) {
CompoundTag tag = blockEntity.getPersistentData();
flap = type == SurfaceType.CONTROL_SURFACE && tag.getBoolean(FLAP_TAG);
key = tag.getString("Key");
key2 = type == SurfaceType.AIR_BRAKE ? "Null" : tag.getString("Key2");
BlockPos nodePos = BlockPos.containing(tag.getDouble("ControlX"), tag.getDouble("ControlY"), tag.getDouble("ControlZ"));
@@ -97,7 +102,7 @@ public final class WariumCapture {
return new AeroSurface(pos.asLong(), type, slab, pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5,
facing.getStepX(), facing.getStepZ(), pressure, fluidFactor(level), speedMultiplier,
node, ControlAxis.of(key), ControlAxis.multiplier(key), ControlAxis.of(key2), ControlAxis.multiplier(key2),
brakeInput, 0.0, false);
brakeInput, 0.0, false, flap);
}
/** Registers a node's inputs once per tick, and saves its trim to it now and then so it survives reloading. */
@@ -119,7 +124,8 @@ public final class WariumCapture {
}
}
aero.addNode(new NodeData(nodeKey, tag.getDouble("Pitch"), tag.getDouble("Yaw"), tag.getDouble("Roll"),
tag.getDouble("Throttle"), autoTrim, storedTrim));
tag.getDouble("Throttle"), autoTrim, storedTrim,
FlapSetting.of(tag.getInt(FLAP_SETTING_TAG)).ordinal()));
}
/** Raw node value for a key like "Pitch+", as Warium's air brakes read it. */