Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,8 @@ public Weapon(String key, ConfigurationSection config) {
projectileClusterAmount = config.getInt("projectile-cluster-amount");
}
damageData = new DamageData((List<String>) config.getList("damage", new ArrayList<String>()));
// 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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down
Loading