fix(travel): an unlocked Fairy Bow or Fairy Slingshot comes with its smallest bag, so the arrows or seeds picked up after count (#2416) #3033

Merged
HumanBean merged 2 commits from cuecuemoar/Longshot:fix/weapon-ammo-bag-modapi into main 2026-12-03 07:07:14 +00:00
Contributor

Summary

For mod-api. #2416, what's left of it: unlocking the Fairy Bow or the Fairy Slingshot (Debug > Cheats, the Inventory rows) gave no Quiver or Bullet Bag. So every arrow or seed picked up afterwards stayed at 0, because the game clamps ammunition to the bag held.

How to see it on mod-api:

  1. Load a save with no bow and no Quiver (the repository save kokiri-start has neither), and turn on Debug tools.
  2. Open Debug > Cheats, choose Items > Fairy Bow, and set Amount to 1.
  3. The Bow arrives, but Upgrades > Quiver stays at 0, and arrows picked up stay at 0.

Why it happens: pouch_add in game/crates/game-core/src/travel.rs already gives the smallest bag first when ammunition is added with no bag held, as the game's chest does. But it looks the bag up by the ammunition's own name (AMMO_BAGS), so the weapon that shoots it got none.

What this changes:

  • WEAPON_AMMO names what each weapon shoots: the Fairy Bow, arrows; the Fairy Slingshot, Deku Seeds.
  • bags_of gives a weapon its ammunition's bags, so bag_needed and pouch_add give the smallest Quiver or Bullet Bag first when none is held.
  • A removal or relock takes only the weapon, and a bag already held means none is given.

Read first: WEAPON_AMMO, bags_of, bag_needed and pouch_add in travel.rs.

This was part of #2990 (main's Debug Inventory fix, closed for its mod-api port). On #3030, the port of the rest, BeanBot asked for it to be its own PR. The two merge cleanly in either order.

See #2416
See #3030

Testing

Tested: Windows 10, RTX 4090, driver 617.42, headless, through the PC's job queue, with a runtime built from this branch alone.

The run used the repository save kokiri-start (Kokiri Forest, child, no bow and no Quiver) with the Debug tools on. Under the game's pause screen and the Insert menu (Debug > Cheats), the Fairy Bow was the last edit made and set to 1; the pause screen then closed.

  • After (82407cd1, this PR):
    cheats: Weapon_Range_Bow needs a bag: gave Item_Quiver_Small first (event status 2)
    cheats: inventory Weapon_Range_Bow +1 (had 0, now 0, event status 2)
    
    The Amount row with Upgrades > Quiver chosen read 1 at the end of the run.
  • Before (mod-api 582b6a1ab, the same steps; the current mod-api changes none of these files): only cheats: inventory Weapon_Range_Bow +1, with no bag.
  • (Without #3030 only the last edit made under the pause screen arrives, so the Bow was put last.)

The checks:

  • The test: travel.rs's bag test now also asks for the Bow's and the Slingshot's bag. With only the test commit, on mod-api, it fails: bag_needed("Weapon_Range_Bow", ...) gives None, not Some("Item_Quiver_Small"). Here it passes. Undoing the weapon lookup in bags_of makes it fail again.
  • The test commit only moves the lookup that bag_needed and pouch_add both did into bags_of, unchanged.
  • Linux, WSL: cargo test -p game-core passes here (386), game-core's clippy is clean with -D warnings, and cargo fmt --check is clean. tests/run_all.py --strict gives the same 782 passed, 77 failed, 12 skipped as mod-api b9bf697bb, with the same files.

Still to test:

  • By hand: on a save with no bow and no Quiver, unlock the Fairy Bow in Debug > Cheats, then pick up arrows (from grass or a pot). Expect the arrow count to rise, up to the small Quiver's 30. The headless run doesn't script the pick-up.

Measurements

Nothing to measure: a change to the Debug tools' Inventory rows. It adds one table lookup to a pouch add. Rendering and presenting are untouched.

Risks

  • What could break: only a Debug tools unlock of the Fairy Bow or the Fairy Slingshot, which now also gives the smallest bag when none is held.
  • Turning it off: there is no switch; a revert is enough.
  • For players: nothing changes in saves, the settings or the caches. Debug tools are off by default.

Checklist

Ready for review

  • One topic, on current main; the title is a Conventional Commit. (On current mod-api, its base.)
  • Tested on my own PC, in the game for a change the game runs, as Testing says.
  • mise run test passes (any failure that also fails on main is named). (tests/run_all.py --strict: 782 passed, 77 failed, 12 skipped here and on mod-api b9bf697bb, the same files: this PC's setup, or failing on mod-api as it is.)
  • Measured against main, or Measurements says why there is nothing to measure.
  • No game files, build output or hand-edited generated files; third_party/ untouched; nothing GPL-incompatible.

When it applies

  • A fix: a game-free test that fails on main and passes here. (Fails on mod-api.)
  • Host code builds on Windows (llvm-mingw) and Linux, with UTF-8 paths.
  • AI assistance recorded with Assisted-by: / Co-Authored-By: trailers.

Ready to merge

  • Everything in Still to test has run, its results in Tested.
  • Tier 1 hardware it can affect is tested (docs/dev/standards.md, "Hardware tiers").
  • Approved in review, every comment answered.
  • CI passes on the head; on current main, measured again or a comment says why the numbers still hold.

🤖 Generated with Claude Code

https://claude.ai/code/session_01VxeaZk9YYKvW5r88gQGguW

## Summary **For `mod-api`. #2416, what's left of it:** unlocking the Fairy Bow or the Fairy Slingshot (Debug > Cheats, the Inventory rows) gave no Quiver or Bullet Bag. So every arrow or seed picked up afterwards stayed at 0, because the game clamps ammunition to the bag held. **How to see it on `mod-api`:** 1. Load a save with no bow and no Quiver (the repository save `kokiri-start` has neither), and turn on Debug tools. 2. Open Debug > Cheats, choose Items > Fairy Bow, and set Amount to 1. 3. The Bow arrives, but Upgrades > Quiver stays at 0, and arrows picked up stay at 0. **Why it happens:** `pouch_add` in `game/crates/game-core/src/travel.rs` already gives the smallest bag first when ammunition is added with no bag held, as the game's chest does. But it looks the bag up by the ammunition's own name (`AMMO_BAGS`), so the weapon that shoots it got none. **What this changes:** - `WEAPON_AMMO` names what each weapon shoots: the Fairy Bow, arrows; the Fairy Slingshot, Deku Seeds. - `bags_of` gives a weapon its ammunition's bags, so `bag_needed` and `pouch_add` give the smallest Quiver or Bullet Bag first when none is held. - A removal or relock takes only the weapon, and a bag already held means none is given. **Read first:** `WEAPON_AMMO`, `bags_of`, `bag_needed` and `pouch_add` in `travel.rs`. This was part of #2990 (`main`'s Debug Inventory fix, closed for its `mod-api` port). On #3030, the port of the rest, BeanBot asked for it to be its own PR. The two merge cleanly in either order. See #2416 See #3030 ## Testing **Tested:** Windows 10, RTX 4090, driver 617.42, headless, through the PC's job queue, with a runtime built from this branch alone. The run used the repository save `kokiri-start` (Kokiri Forest, child, no bow and no Quiver) with the Debug tools on. Under the game's pause screen and the Insert menu (Debug > Cheats), the Fairy Bow was the last edit made and set to 1; the pause screen then closed. - **After** (`82407cd1`, this PR): ``` cheats: Weapon_Range_Bow needs a bag: gave Item_Quiver_Small first (event status 2) cheats: inventory Weapon_Range_Bow +1 (had 0, now 0, event status 2) ``` The Amount row with Upgrades > Quiver chosen read 1 at the end of the run. - **Before** (`mod-api` `582b6a1ab`, the same steps; the current `mod-api` changes none of these files): only `cheats: inventory Weapon_Range_Bow +1`, with no bag. - (Without #3030 only the last edit made under the pause screen arrives, so the Bow was put last.) The checks: - **The test:** `travel.rs`'s bag test now also asks for the Bow's and the Slingshot's bag. With only the test commit, on `mod-api`, it fails: `bag_needed("Weapon_Range_Bow", ...)` gives `None`, not `Some("Item_Quiver_Small")`. Here it passes. Undoing the weapon lookup in `bags_of` makes it fail again. - The test commit only moves the lookup that `bag_needed` and `pouch_add` both did into `bags_of`, unchanged. - **Linux, WSL:** `cargo test -p game-core` passes here (386), `game-core`'s clippy is clean with `-D warnings`, and `cargo fmt --check` is clean. `tests/run_all.py --strict` gives the same 782 passed, 77 failed, 12 skipped as `mod-api` `b9bf697bb`, with the same files. **Still to test:** - By hand: on a save with no bow and no Quiver, unlock the Fairy Bow in Debug > Cheats, then pick up arrows (from grass or a pot). Expect the arrow count to rise, up to the small Quiver's 30. The headless run doesn't script the pick-up. ## Measurements Nothing to measure: a change to the Debug tools' Inventory rows. It adds one table lookup to a pouch add. Rendering and presenting are untouched. ## Risks - **What could break:** only a Debug tools unlock of the Fairy Bow or the Fairy Slingshot, which now also gives the smallest bag when none is held. - **Turning it off:** there is no switch; a revert is enough. - **For players:** nothing changes in saves, the settings or the caches. Debug tools are off by default. ## Checklist ### Ready for review - [x] One topic, on current `main`; the title is a Conventional Commit. (On current `mod-api`, its base.) - [x] Tested on my own PC, in the game for a change the game runs, as Testing says. - [x] `mise run test` passes (any failure that also fails on `main` is named). (`tests/run_all.py --strict`: 782 passed, 77 failed, 12 skipped here and on `mod-api` `b9bf697bb`, the same files: this PC's setup, or failing on `mod-api` as it is.) - [x] Measured against `main`, or Measurements says why there is nothing to measure. - [x] No game files, build output or hand-edited generated files; `third_party/` untouched; nothing GPL-incompatible. ### When it applies - [x] A fix: a game-free test that fails on `main` and passes here. (Fails on `mod-api`.) - [x] Host code builds on Windows (llvm-mingw) and Linux, with UTF-8 paths. - [x] AI assistance recorded with `Assisted-by:` / `Co-Authored-By:` trailers. ### Ready to merge - [ ] Everything in Still to test has run, its results in Tested. - [ ] Tier 1 hardware it can affect is tested (docs/dev/standards.md, "Hardware tiers"). - [ ] Approved in review, every comment answered. - [ ] CI passes on the head; on current `main`, measured again or a comment says why the numbers still hold. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01VxeaZk9YYKvW5r88gQGguW
Unlocking the Fairy Bow or the Fairy Slingshot from the Debug tools' Inventory rows gave no Quiver or Bullet Bag, so
every arrow or seed picked up after stayed 0: travel.rs's pouch_add gives the smallest bag first only for an add of the
ammunition itself (AMMO_BAGS is keyed by it), not for the weapon that shoots it.

The lookup bag_needed and pouch_add both did becomes bags_of, doing what it did. travel.rs's bag test now also asks for
the Bow's and the Slingshot's: with no bag held, bag_needed gives none here (None, not Item_Quiver_Small).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01VxeaZk9YYKvW5r88gQGguW
fix(travel): an unlocked Fairy Bow or Fairy Slingshot comes with its smallest bag, so the arrows or seeds picked up after count (#2416)
All checks were successful
PR description / Title and description (pull_request_target) Successful in 7s
82407cd1a2
Unlocking the Fairy Bow or the Fairy Slingshot with none of its bags held gave no Quiver or Bullet Bag, and every arrow
or seed picked up after stayed 0. WEAPON_AMMO names the ammunition each one shoots, and bags_of gives a weapon its
ammunition's bags, so pouch_add gives the smallest bag first, as the game's chest does. A removal or relock takes only
the weapon, and a bag already held means none is given.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01VxeaZk9YYKvW5r88gQGguW
Author
Contributor

Tested in game: Windows 10, RTX 4090, driver 617.42, headless through the job queue, repository save kokiri-start (no bow, no Quiver), Debug tools on. On 82407cd1 (runtime from the commit alone): the Fairy Bow set to 1 in Debug > Cheats logged 'Weapon_Range_Bow needs a bag: gave Item_Quiver_Small first' then 'inventory Weapon_Range_Bow +1', and the Quiver's Amount read 1 after. Before, on mod-api 582b6a1ab: only the Bow, no bag.

Tested in game: Windows 10, RTX 4090, driver 617.42, headless through the job queue, repository save kokiri-start (no bow, no Quiver), Debug tools on. On 82407cd1 (runtime from the commit alone): the Fairy Bow set to 1 in Debug > Cheats logged 'Weapon_Range_Bow needs a bag: gave Item_Quiver_Small first' then 'inventory Weapon_Range_Bow +1', and the Quiver's Amount read 1 after. Before, on mod-api 582b6a1ab: only the Bow, no bag.
Member

Possibly related, for context:

  • PR #2779 fix(debug): the Debug tab's ammunition amounts give the bag they need, and a removal takes what is held — Merged ammo bag handling that this extends for bow and slingshot unlocks.
Possibly related, for context: - PR #2779 fix(debug): the Debug tab's ammunition amounts give the bag they need, and a removal takes what is held — Merged ammo bag handling that this extends for bow and slingshot unlocks.
cuecuemoar changed title from WIP: fix(travel): an unlocked Fairy Bow or Fairy Slingshot comes with its smallest bag, so the arrows or seeds picked up after count (#2416) to fix(travel): an unlocked Fairy Bow or Fairy Slingshot comes with its smallest bag, so the arrows or seeds picked up after count (#2416) 2026-12-02 20:58:53 +00:00
HumanBean changed target branch from mod-api to main 2026-12-03 05:48:53 +00:00
HumanBean force-pushed fix/weapon-ammo-bag-modapi from 82407cd1a2
All checks were successful
PR description / Title and description (pull_request_target) Successful in 7s
to 3b5736e08d
Some checks failed
PR description / Title and description (pull_request_target) Successful in 6s
CI / What the change needs (pull_request) Successful in 5s
CI / Third-party parts and guide screenshots (pull_request) Successful in 9s
CI / Lint (pre-commit, ShellCheck, actionlint) (pull_request) Successful in 18s
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Failing after 1m28s
CI / Renderer build check (Windows, compile --only renderer, without and with FSR 4) (pull_request) Successful in 11m19s
CI / Website build and checks (pull_request) Failing after 35s
CI / Renderer build check (Linux, compile --only renderer, without and with FSR 4) (pull_request) Successful in 9m33s
CI / Rust (rustfmt, clippy, cargo test, end to end) (pull_request) Failing after 40m5s
CI / Game-free checks (run_all.py, part 2/2) (pull_request) Failing after 43m5s
CI / Game-free checks (run_all.py, part 1/2) (pull_request) Failing after 1h0m8s
2026-12-03 07:04:40 +00:00
Compare
HumanBean deleted branch fix/weapon-ammo-bag-modapi 2026-12-03 07:07:14 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
3 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
MagicBeanDev/Longshot!3033
No description provided.