H9 Boathook swings don't damage players #73

Closed
opened 2026-11-12 07:42:34 +00:00 by claude · 1 comment
Owner

Depends on: B6

Tuning.HARVEST_DAMAGE's comment says players take the boathook's damage (20) instead, but Harvest.swing only tests props and built pieces. A swing that passes through another player does nothing, so a player with no weapon can't fight at all, and unarmed bots ignore opponents (M5).

Acceptance

  • A boathook swing damages the nearest player in reach along the look direction, unless terrain, a solid, a prop or a piece is hit first.
  • The hit goes through Weapons.damage_player, so armor, the kill feed and stats work.
  • Tests cover a hit, a miss out of reach, and a wall in between.
  • Unarmed bots close in and swing at an opponent within a few metres.
**Depends on:** B6 `Tuning.HARVEST_DAMAGE`'s comment says players take the boathook's `damage` (20) instead, but `Harvest.swing` only tests props and built pieces. A swing that passes through another player does nothing, so a player with no weapon can't fight at all, and unarmed bots ignore opponents (M5). **Acceptance** - A boathook swing damages the nearest player in reach along the look direction, unless terrain, a solid, a prop or a piece is hit first. - The hit goes through `Weapons.damage_player`, so armor, the kill feed and stats work. - Tests cover a hit, a miss out of reach, and a wall in between. - Unarmed bots close in and swing at an opponent within a few metres.
claude added this to the v0.9 Hardening milestone 2026-11-12 07:42:34 +00:00
claude added the type/bug label 2026-11-12 07:42:34 +00:00
eric closed this issue 2026-11-14 02:10:53 +00:00
Author
Owner

Fixed in d5c8019.

What changed

  • Harvest.swing takes the simulation and traces the swing the same way a shot is traced (Weapons.trace, lag-compensated). The nearest player in reach along the look direction takes the boathook's damage, unless terrain, a solid, a prop's grown box or a built piece comes first. The hit goes through Weapons.damage_player, with an impact event and a player_hit carrying the boathook's item code, so armor, the kill feed and stats all count it.
  • A level swing from the eye meets the head, so it takes the boathook's 1.5 headshot multiplier, as a shot would.
  • Unarmed bots now go for an opponent in view within Tuning.BOT_BRAWL_METRES (6 m) and swing once within BOT_SWING_METRES (2.3 m from the eye). Inside a hut they swing back without walking in.

Tests

  • test_harvest (+5): a hit (with attacker and item in the event), armor taken first, a miss out of reach, a wall in between, and a player standing in front of a tree taking the swing instead of the tree.
  • test_bot_brain (+2): an unarmed bot closes in and lands hits, and leaves an opponent beyond the brawl range alone.
  • test_world_replication: on seed 2 an unarmed bot now meets the scripted player early. The scripted player wins the fight, but a gunman finishes it on 20 health before it builds. The test now gives it full armor once it lands, the same way it already hands the client's player driftwood. Every assertion is unchanged.
  • make check: 627 passed. make match passes, and its replay matches.
  • make bot-matches with 5 seeds: every match had a winner and 1.7% of deaths were drownings. That's too few matches for the difficulty checks; H3's 20-match batch will judge the balance.

Follow-up for H3: brawling makes the opening fights in a match more frequent. Worth watching in the balance batches.

Fixed in d5c8019. **What changed** - `Harvest.swing` takes the simulation and traces the swing the same way a shot is traced (`Weapons.trace`, lag-compensated). The nearest player in reach along the look direction takes the boathook's `damage`, unless terrain, a solid, a prop's grown box or a built piece comes first. The hit goes through `Weapons.damage_player`, with an `impact` event and a `player_hit` carrying the boathook's item code, so armor, the kill feed and stats all count it. - A level swing from the eye meets the head, so it takes the boathook's 1.5 headshot multiplier, as a shot would. - Unarmed bots now go for an opponent in view within `Tuning.BOT_BRAWL_METRES` (6 m) and swing once within `BOT_SWING_METRES` (2.3 m from the eye). Inside a hut they swing back without walking in. **Tests** - `test_harvest` (+5): a hit (with attacker and item in the event), armor taken first, a miss out of reach, a wall in between, and a player standing in front of a tree taking the swing instead of the tree. - `test_bot_brain` (+2): an unarmed bot closes in and lands hits, and leaves an opponent beyond the brawl range alone. - `test_world_replication`: on seed 2 an unarmed bot now meets the scripted player early. The scripted player wins the fight, but a gunman finishes it on 20 health before it builds. The test now gives it full armor once it lands, the same way it already hands the client's player driftwood. Every assertion is unchanged. - `make check`: 627 passed. `make match` passes, and its replay matches. - `make bot-matches` with 5 seeds: every match had a winner and 1.7% of deaths were drownings. That's too few matches for the difficulty checks; H3's 20-match batch will judge the balance. **Follow-up for H3:** brawling makes the opening fights in a match more frequent. Worth watching in the balance batches.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: claude/tidewall#73