From 08eeaf7469ff7c0abe2c9e0ba99f78ad2492df7c Mon Sep 17 00:00:00 2001 From: Ryan Barlow <7389646+ryanbarlow97@users.noreply.github.com> Date: Thu, 15 Oct 2026 23:13:02 +0000 Subject: [PATCH] fix: stop landings from wrecking vehicle weapons Vehicle weapons had no damage modifiers, so the FALL damage an armour stand takes on landing hit them in full while armour templates spared every component. Weapons now default FALL to 0 unless their own damage list sets it. Co-Authored-By: Claude Opus 5.5 --- .../tfminecraft/vehicleframework/weapons/Weapon.java | 2 ++ .../weapons/WeaponsCoverageTest.java | 12 ++++++++++++ 2 files changed, 14 insertions(+) diff --git a/src/main/java/net/tfminecraft/vehicleframework/weapons/Weapon.java b/src/main/java/net/tfminecraft/vehicleframework/weapons/Weapon.java index a9e2422..1305d19 100644 --- a/src/main/java/net/tfminecraft/vehicleframework/weapons/Weapon.java +++ b/src/main/java/net/tfminecraft/vehicleframework/weapons/Weapon.java @@ -92,6 +92,8 @@ public Weapon(String key, ConfigurationSection config) { projectileClusterAmount = config.getInt("projectile-cluster-amount"); } damageData = new DamageData((List) config.getList("damage", new ArrayList())); + // Landing must not wreck guns; components already get FALL 0 from armour templates. + damageData.getModifiers().putIfAbsent("FALL", 0.0); if(config.isConfigurationSection("animations")) { animationHandler = new AnimationHandler(config.getConfigurationSection("animations")); } else { diff --git a/src/test/java/net/tfminecraft/vehicleframework/weapons/WeaponsCoverageTest.java b/src/test/java/net/tfminecraft/vehicleframework/weapons/WeaponsCoverageTest.java index 355f791..9f046bb 100644 --- a/src/test/java/net/tfminecraft/vehicleframework/weapons/WeaponsCoverageTest.java +++ b/src/test/java/net/tfminecraft/vehicleframework/weapons/WeaponsCoverageTest.java @@ -252,6 +252,18 @@ void configurationAndActiveCopiesPreserveAllWeaponFields() throws Exception { assertFalse(active.isControlled()); } + @Test + void fallDamageSparesWeaponsUnlessConfigured() throws Exception { + Weapon stored = new Weapon("aa", new YamlConfiguration()); + ActiveWeapon active = new ActiveWeapon(model, vehicle, stored, null); + active.damage("FALL", 40); + active.damage("PROJECTILE", 10); + assertEquals(10, active.getHealthData().getDamage()); + + Weapon fragile = new Weapon("fragile", Rig.yaml("damage: [fall(0.5)]\n")); + assertEquals(0.5, fragile.getDamageData().getModifier("FALL")); + } + @Test void defaultsAndFallbacksSupportEveryProjectileType() throws Exception { Weapon stored = new Weapon("default", new YamlConfiguration());