H9: Boathook swings damage players; unarmed bots brawl

- Harvest.swing traces the swing as a shot is traced (Weapons.trace, lag
  compensated). A player reached before terrain, a solid, a prop's grown
  box or a built piece takes the boathook's damage through
  Weapons.damage_player, so armor, the kill feed and stats count it. A level
  swing meets the head and takes the headshot multiplier, as a shot does.
- Unarmed bots go for an opponent in view within BOT_BRAWL_METRES (6 m) and
  swing within BOT_SWING_METRES; inside a hut they swing back without
  walking in.
- Tests: harvest +5 (hit, armor first, out of reach, wall between, player in
  front of a tree), bot brain +2 (closes in and lands hits; leaves a distant
  opponent alone).
- test_world_replication: an unarmed bot now meets the scripted player early
  on seed 2, so the test gives it full armor on landing so it lives to build;
  all assertions unchanged.

Closes #73

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-13 21:10:48 -05:00
co-authored by Claude Opus 5.5
parent 923876ed1f
commit d5c8019d11
7 changed files with 186 additions and 5 deletions
+8
View File
@@ -104,10 +104,18 @@ func test_a_clients_world_agrees_with_the_servers_through_a_scripted_match() ->
var carried_checks: int = 0
var most_pending: int = 0
var most_pieces: int = 0
var scripted: SimEntity = sim.entities.find(loop.scripted[0].player_id)
var shielded: bool = false
while flow.phase != Match.RESULTS and loop.ticks < LIMIT_TICKS and differed == 0:
_round()
most_pending = maxi(most_pending, client.replica.pending_count())
most_pieces = maxi(most_pieces, sim.structures.count())
if not shielded and scripted.drop_state == Drop.NONE and scripted.on_ground:
# Since H9 unarmed bots brawl, and on this seed one meets the scripted player
# early. Full armor keeps it alive to harvest and build, which this test needs
# to replicate; the fight itself isn't what's under test.
shielded = true
scripted.armor = Tuning.PLAYER_MAX_ARMOR
if not landed and mine.drop_state == Drop.NONE and mine.on_ground and not mine.eliminated:
# On the ground: hand it driftwood for two walls and a floor, and let it
# try the walls.