B1 Harvesting and materials #15

Closed
opened 2026-11-09 05:26:54 +00:00 by claude · 1 comment
Owner

Depends on: W5

Harvest driftwood, stone and scrap with a melee tool. Carry limits per material, shown through the simulation state.

Acceptance

  • Server-validated range and swing rate.
  • Yields and caps come from the tunable table.
  • Tests cover harvesting, caps and prop destruction.
**Depends on:** W5 Harvest driftwood, stone and scrap with a melee tool. Carry limits per material, shown through the simulation state. **Acceptance** - Server-validated range and swing rate. - Yields and caps come from the tunable table. - Tests cover harvesting, caps and prop destruction.
claude added this to the v0.3 Building and Combat milestone 2026-11-09 05:26:54 +00:00
claude added the priority/hightype/feature labels 2026-11-09 05:26:54 +00:00
claude added this to the Tidewall v1.0 project 2026-11-09 15:00:05 +00:00
eric referenced this issue from a commit 2026-11-11 19:11:18 +00:00
eric closed this issue 2026-11-11 19:11:18 +00:00
Author
Owner

Done in b847ba9.

What changed

  • Materials (src/sim/materials.gd): driftwood, stone and salvage iron codes, with add/spend helpers. A player's stock is SimEntity.materials, capped at MATERIAL_CAP each and included in the state hash, so it's visible through the simulation state.
  • Harvest (src/sim/harvest.gd): holding fire with the boathook (selection 0, outside build mode) swings once every ceil(30 / fire_rate) = 20 ticks. The server casts the swing from its own copy of the player's eye and look, reaching the boathook's range_max plus HARVEST_REACH_SLACK. It hits the nearest standing prop within HARVEST_AIM_SLACK of the ray unless terrain or another solid is in the way. Each hit does HARVEST_DAMAGE (50) and gives HARVEST_PER_HIT (15) of the prop's material. A capped player still damages props.
  • The simulation now has a per-tick events list (harvest, prop_destroyed) and a shared action_cooldown that B2 placement and B6 weapons will reuse.

Tests: test/sim/test_harvest.gd, 12 tests: yields per prop kind, swing-rate enforcement while fire is held, reach limits, a wall blocking the swing, nearest prop, cap behaviour, destruction clearing collision (the player then walks through), no swinging in build mode, in other slots, swimming or falling, and determinism on a real island. make check passed: 163 tests, self-check, and smoke at p95 0.53 ms per tick.

Follow-ups: the boathook will be folded into B6's weapon framework, and B5 decides how selection maps to inventory slots. Hit feedback (sound, particles) belongs to v0.6.

Done in b847ba9. **What changed** - `Materials` (`src/sim/materials.gd`): driftwood, stone and salvage iron codes, with add/spend helpers. A player's stock is `SimEntity.materials`, capped at `MATERIAL_CAP` each and included in the state hash, so it's visible through the simulation state. - `Harvest` (`src/sim/harvest.gd`): holding fire with the boathook (selection 0, outside build mode) swings once every `ceil(30 / fire_rate)` = 20 ticks. The server casts the swing from its own copy of the player's eye and look, reaching the boathook's `range_max` plus `HARVEST_REACH_SLACK`. It hits the nearest standing prop within `HARVEST_AIM_SLACK` of the ray unless terrain or another solid is in the way. Each hit does `HARVEST_DAMAGE` (50) and gives `HARVEST_PER_HIT` (15) of the prop's material. A capped player still damages props. - The simulation now has a per-tick `events` list (`harvest`, `prop_destroyed`) and a shared `action_cooldown` that B2 placement and B6 weapons will reuse. **Tests:** `test/sim/test_harvest.gd`, 12 tests: yields per prop kind, swing-rate enforcement while fire is held, reach limits, a wall blocking the swing, nearest prop, cap behaviour, destruction clearing collision (the player then walks through), no swinging in build mode, in other slots, swimming or falling, and determinism on a real island. `make check` passed: 163 tests, self-check, and smoke at p95 0.53 ms per tick. **Follow-ups:** the boathook will be folded into B6's weapon framework, and B5 decides how selection maps to inventory slots. Hit feedback (sound, particles) belongs to v0.6.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: claude/tidewall#15