Skip to content

fix: stop melee from wrecking vehicle weapons - #82

Merged
XxFran10xX merged 1 commit into
mainfrom
fix/weapon-melee-damage
Oct 27, 2026
Merged

XxFran10xX merged 1 commit into
mainfrom
fix/weapon-melee-damage

Conversation

@XxFran10xX

Copy link
Copy Markdown
Contributor

Problem

Players reported that Behemoth and Cloudskimmer weapons drop to 0 after landing. Landing isn't the cause: a Dev bot test (51-block climb, then a controlled landing on VF 2.16.4) left every weapon and component at 0 damage, because FALL has been 0 for weapons since #74.

What does wreck them is melee. ActiveVehicle.damage passes each hit to every weapon in full. Weapons had no ENTITY_ATTACK modifier, but every armour template gives the hull, balloon and engine entity_attack: 0.1. In the same Dev test, 5 fist punches from an unmounted player took 5% off each of the Behemoth's 7 weapons and 0.5% off the hull and balloon. Main's data matches: a Behemoth that landed between 10-21 and 10-22 took 41.07 on every weapon and 4.107 on the hull.

Change

  • Weapons now default ENTITY_ATTACK to 0.1, the same as the hull, unless their own damage: list sets it (e.g. entity_attack(1.0) keeps the old behaviour).
  • Bullets, shells, bombs, explosions and GunsAndGadgets guns (PROJECTILE/ROCKET) are unchanged.

Tests

  • New unit test meleeHitsWeaponsLikeTheHullUnlessConfigured.
  • mvn verify locally: 1758 tests, 0 failures. Locally the coverage gate fails only on untouched classes whose tests skip on Windows (9 skipped); Weapon is fully covered.
  • Dev bot test (~/landing-dura-test/test.js): Behemoth and Cloudskimmer landing, then 5 punches from an unmounted player. Results are in the comments.

🤖 Generated with Claude Code

Every weapon takes each hit on the vehicle in full and weapons had no
melee modifier, so punches and sword hits on a parked airship wore every
gun down ten times faster than the hull, which the armour templates give
entity_attack 0.1. Weapons now default ENTITY_ATTACK to 0.1 unless their
own damage list sets it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Oct 27, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: d5ed7b28-3b7d-44c4-af0e-a20ecc60bf99
Commits

Reviewing files that changed from the base of the PR and between e5efc1e and c66aa7c.

Files selected for processing: 2
  • src/main/java/net/tfminecraft/vehicleframework/weapons/Weapon.java
  • src/test/java/net/tfminecraft/vehicleframework/weapons/WeaponsCoverageTest.java

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

📝 Summary

Summary by CodeRabbit

  • Bug Fixes
    • Melee attacks now apply a default damage modifier to weapons, matching the hull’s damage handling. Existing custom melee damage settings remain unchanged.
    • Kept the existing default handling for fall damage unchanged.

The weapon constructor now adds an ENTITY_ATTACK modifier of 0.1 when none is configured. A test covers default damage handling and an explicitly configured modifier.

Changes: Weapon damage modifiers

Layer / File(s) Summary
Default modifier and test
src/main/java/net/tfminecraft/vehicleframework/weapons/Weapon.java, src/test/java/net/tfminecraft/vehicleframework/weapons/WeaponsCoverageTest.java
Weapon defines MELEE_MODIFIER as 0.1 and applies it when no ENTITY_ATTACK modifier is configured. The test checks default damage handling and the value of an explicit entity_attack(1.0) modifier.

Priority: Normal

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Suggested reviewers: ryanbarlow97

Merge Risk: Minimal · up to c66aa

The change addresses default melee damage handling without an identified merge-blocking risk.

- [ ] Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@XxFran10xX

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@github-actions github-actions Bot added the size:XS 0-9 effective changed lines (tests excluded in mixed PRs). label Oct 27, 2026
@coderabbitai

coderabbitai Bot commented Oct 27, 2026 •

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@XxFran10xX
XxFran10xX merged commit a0ef138 into main Oct 27, 2026
3 checks passed
@XxFran10xX
XxFran10xX deleted the fix/weapon-melee-damage branch October 27, 2026 15:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XS 0-9 effective changed lines (tests excluded in mixed PRs).

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant