fix(mod-api): a hit names whose it is and what dealt it #3231

Merged
HumanBean merged 2 commits from glinesbdev/Longshot:fix/mod-api-hit-source into main 2026-12-05 17:17:21 +00:00
Contributor

Summary
actors.damaged's sourceKind said who dealt a hit from one mark alone: the flag the game sets on its internal hits when they are Link's. The game sets it only on its own scripted damage, so Link's sword, charged sword and slingshot all read other. A mod could not tell its player's blows from an enemy's, and nothing said what a hit was dealt with (a sword, an arrow, a bomb).

To see it on main: log actors.damaged from a mod (e.sourceKind), hit an Octorok with the sword or the slingshot. Each hit reads other.

This reads a hit in its parts, as the game sums them at the life write:

Who dealt it. A hit is Link's when its internal part is marked his, or its external part (a blow or a shot) has Link (Player) as its owner. Otherwise an external hit is another's when its source and owner can be read, and unknown when they cannot; a hit with no external part is another's unless its internal part is marked Link's. The source (what hit, who threw or shot it) is read only when the hit has an external part, since the game keeps its last attacker after the hit, and a fall right after a blow would otherwise read the blow's attacker.
What it was dealt with. The external part's damage kinds, by the game's own list of them (body, smallWeapon, largeWeapon, arrow, bomb, fire, hammer, durability and the rest): a new DamageType enum, ActorDamage.damageType (the first of the hit's kinds), and where.damageType on a damage rule, which matches any of them.
Read first: game-core/src/rules.rs (hit_parts, source_kind, the damage_types match in applies) and game-core/src/layout/rules.rs (the four new fields, with what each is). Then api/src/services/actors.rs and rules.rs for the names, and docs/dev/reference/actors.md for what the game does and what a run showed.

Testing
Tested: Windows 10, Radeon RDNA3 (driver ), a test build of this branch with a mod logging every actors.damaged (its kind, source, owner and damageType), over two runs. None read unknown.

Hit sourceKind source / owner damageType
Link's sword, the Master Sword, a charged sword player Player / Player smallWeapon
A Deku stick (twice a sword's damage), the Biggoron's Sword (4 a blow, 8 a jump attack) player Player / Player largeWeapon
The slingshot (no seed actor: the source is Link) player Player / Player slingshotBullet
An arrow, a fire arrow, a light arrow (2, 2, 14) player Player / Player arrow
A bomb on a Peahat; a bombchu on a ReDead player Item_Bomb / Item_Bombchu, owner Player bomb
Link's own bomb's blast on him player Player or Item_Bomb / Player bomb
The Megaton Hammer player Player / Player hammer
Din's Fire player Player / Player fire
An Octorok's rock on Link, a Peahat's blows other the enemy / the enemy body
The Octorok's rock sent back at it by Link's shield (it killed itself) other Enemy_Octorok / itself body
A Deku stick breaking other none durability
A fall, fire on the ground, a ReDead's bite other none none

Magic arrows carry arrow alone: in the second run the mod also added two damage rules, fire ×3 and beam ×5. Din's Fire went from 6 to 18, and the arrows stayed at 2 and 14. The boomerang and the hookshot only stunned the enemies they hit, which deals no damage and so no actors.damaged.

Checks, on this branch rebased on main @ 3a0f7d8f7:

cargo test --lib: game-core 410 passed. api 591 passed, 1 failed: watch::tests::a_walked_reshade_folder_counts_a_change_once_two_walks_agree, which fails on main too. modtool 252 passed, 1 failed: testing_game::tests::the_menu_passes_its_tests, its frame-time check (the search step's worst frame 3.0 to 3.4 ms against a limit of 2 ms times the CPU scale). Run alone, it failed on main too (1 run of 3, worst frame 3.0 ms) and failed in each of 3 runs alone here. Nothing in this change runs in the menu's frames; it reads as a timing test that a debug build on this PC is near the edge of.
cargo clippy -p api -p game-core -p modtool --all-targets -- -D warnings (no errors; one unused-import warning in build-core, not touched here), cargo fmt --all --check and schema-gen --check: clean.
New tests: a_hit_is_links_when_the_game_marks_its_internal_part_or_its_owner_is_link (game-core; fails on main, where a blow owned by Link reads other) and a_hits_kind_of_damage_and_whether_link_dealt_it (modtool's fake game: a slingshotBullet rule doubles a seed and leaves a blow; the event names each kind and whose it is). Removing the damageType match from applies fails the second.
Still to test:

Linux: log actors.damaged and hit an enemy with the sword and the slingshot, expecting player and smallWeapon / slingshotBullet (@Beanstalk or by hand).
Any: a mod's scripted hit (actors.damage on an enemy), expecting player with no source and no damageType (it is an internal hit, marked Link's) (by hand).
Any: a boomerang or hookshot hit that deals damage (an enemy it hurts rather than stuns), expecting player and boomerang / hookshot (by hand).
Measurements
Nothing to measure: the hit's parts are read only when a damage rule asks for its source or kind, or a mod watches actors.damaged, and then it is four more reads of the life component per hit.

Risks
sourceKind changes for mods that read it: Link's blows and shots now read player where they read other. That is the fix, but a mod that worked around it will see the difference.
Link's own bomb hurting him reads player, as its owner is Link, so a rule on Link's side with sourceKind: "player" catches it too. A shot he sends back with his shield stays its first owner's.
damageType is only the first of a hit's kinds; a rule's where.damageType matches any of them. No hit in the runs had more than one.
A revert is enough. Nothing changes in saves or settings.

Checklist

Ready for review

  • One topic, on current main; the title is a Conventional Commit.
  • 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).
  • 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.
  • Host code builds on Windows (llvm-mingw) and Linux, with UTF-8 paths.
  • Docs updated.
  • 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.
Summary actors.damaged's sourceKind said who dealt a hit from one mark alone: the flag the game sets on its internal hits when they are Link's. The game sets it only on its own scripted damage, so Link's sword, charged sword and slingshot all read other. A mod could not tell its player's blows from an enemy's, and nothing said what a hit was dealt with (a sword, an arrow, a bomb). To see it on main: log actors.damaged from a mod (e.sourceKind), hit an Octorok with the sword or the slingshot. Each hit reads other. This reads a hit in its parts, as the game sums them at the life write: Who dealt it. A hit is Link's when its internal part is marked his, or its external part (a blow or a shot) has Link (Player) as its owner. Otherwise an external hit is another's when its source and owner can be read, and unknown when they cannot; a hit with no external part is another's unless its internal part is marked Link's. The source (what hit, who threw or shot it) is read only when the hit has an external part, since the game keeps its last attacker after the hit, and a fall right after a blow would otherwise read the blow's attacker. What it was dealt with. The external part's damage kinds, by the game's own list of them (body, smallWeapon, largeWeapon, arrow, bomb, fire, hammer, durability and the rest): a new DamageType enum, ActorDamage.damageType (the first of the hit's kinds), and where.damageType on a damage rule, which matches any of them. Read first: game-core/src/rules.rs (hit_parts, source_kind, the damage_types match in applies) and game-core/src/layout/rules.rs (the four new fields, with what each is). Then api/src/services/actors.rs and rules.rs for the names, and docs/dev/reference/actors.md for what the game does and what a run showed. Testing Tested: Windows 10, Radeon RDNA3 (driver ), a test build of this branch with a mod logging every actors.damaged (its kind, source, owner and damageType), over two runs. None read unknown. |Hit| sourceKind |source / owner |damageType| |------|--------|---------------|------------------| |Link's sword, the Master Sword, a charged sword |player |Player / Player |smallWeapon |A Deku stick (twice a sword's damage), the Biggoron's Sword (4 a blow, 8 a jump attack) |player| Player / Player |largeWeapon |The slingshot (no seed actor: the source is Link)| player| Player / Player |slingshotBullet| |An arrow, a fire arrow, a light arrow (2, 2, 14) |player |Player / Player |arrow| |A bomb on a Peahat; a bombchu on a ReDead |player |Item_Bomb / Item_Bombchu, owner Player| bomb| |Link's own bomb's blast on him |player |Player or Item_Bomb / Player |bomb| |The Megaton Hammer |player |Player / Player |hammer| |Din's Fire |player |Player / Player |fire| |An Octorok's rock on Link, a Peahat's blows |other |the enemy / the enemy |body| |The Octorok's rock sent back at it by Link's shield (it killed itself) |other |Enemy_Octorok / itself |body| |A Deku stick breaking |other |none |durability| |A fall, fire on the ground, a ReDead's bite |other |none |none| Magic arrows carry arrow alone: in the second run the mod also added two damage rules, fire ×3 and beam ×5. Din's Fire went from 6 to 18, and the arrows stayed at 2 and 14. The boomerang and the hookshot only stunned the enemies they hit, which deals no damage and so no actors.damaged. Checks, on this branch rebased on main @ 3a0f7d8f7: cargo test --lib: game-core 410 passed. api 591 passed, 1 failed: watch::tests::a_walked_reshade_folder_counts_a_change_once_two_walks_agree, which fails on main too. modtool 252 passed, 1 failed: testing_game::tests::the_menu_passes_its_tests, its frame-time check (the search step's worst frame 3.0 to 3.4 ms against a limit of 2 ms times the CPU scale). Run alone, it failed on main too (1 run of 3, worst frame 3.0 ms) and failed in each of 3 runs alone here. Nothing in this change runs in the menu's frames; it reads as a timing test that a debug build on this PC is near the edge of. cargo clippy -p api -p game-core -p modtool --all-targets -- -D warnings (no errors; one unused-import warning in build-core, not touched here), cargo fmt --all --check and schema-gen --check: clean. New tests: a_hit_is_links_when_the_game_marks_its_internal_part_or_its_owner_is_link (game-core; fails on main, where a blow owned by Link reads other) and a_hits_kind_of_damage_and_whether_link_dealt_it (modtool's fake game: a slingshotBullet rule doubles a seed and leaves a blow; the event names each kind and whose it is). Removing the damageType match from applies fails the second. Still to test: Linux: log actors.damaged and hit an enemy with the sword and the slingshot, expecting player and smallWeapon / slingshotBullet (@Beanstalk or by hand). Any: a mod's scripted hit (actors.damage on an enemy), expecting player with no source and no damageType (it is an internal hit, marked Link's) (by hand). Any: a boomerang or hookshot hit that deals damage (an enemy it hurts rather than stuns), expecting player and boomerang / hookshot (by hand). Measurements Nothing to measure: the hit's parts are read only when a damage rule asks for its source or kind, or a mod watches actors.damaged, and then it is four more reads of the life component per hit. Risks sourceKind changes for mods that read it: Link's blows and shots now read player where they read other. That is the fix, but a mod that worked around it will see the difference. Link's own bomb hurting him reads player, as its owner is Link, so a rule on Link's side with sourceKind: "player" catches it too. A shot he sends back with his shield stays its first owner's. damageType is only the first of a hit's kinds; a rule's where.damageType matches any of them. No hit in the runs had more than one. A revert is enough. Nothing changes in saves or settings. ## Checklist ### Ready for review - [x] One topic, on current `main`; the title is a Conventional Commit. - [x] 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). - [x] 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 - [x] A fix: a game-free test that fails on `main` and passes here. - [ ] Host code builds on Windows (llvm-mingw) and Linux, with UTF-8 paths. - [x] Docs updated. - [ ] 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.
fix(mod-api): a hit names whose it is and what dealt it
Some checks failed
PR description / Title and description (pull_request_target) Failing after 7s
CI / What the change needs (pull_request) Has been cancelled
CI / Lint (pre-commit, ShellCheck, actionlint) (pull_request) Has been cancelled
CI / Third-party parts and guide screenshots (pull_request) Has been cancelled
CI / Rust (rustfmt, clippy, cargo test, end to end) (pull_request) Has been cancelled
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Has been cancelled
CI / Renderer build check (Windows, compile --only renderer, without and with FSR 4) (pull_request) Has been cancelled
CI / Renderer build check (Linux, compile --only renderer, without and with FSR 4) (pull_request) Has been cancelled
CI / Game-free checks (run_all.py, part 1/2) (pull_request) Has been cancelled
CI / Game-free checks (run_all.py, part 2/2) (pull_request) Has been cancelled
CI / Website build and checks (pull_request) Has been cancelled
1b46e53817
`actors.damaged` read `sourceKind` from the game's mark on its internal hits alone, which only the game's own scripted damage sets. Link's sword, charged sword and slingshot read `other`, and nothing said what a hit was dealt with.

A hit is now read in its parts. Its internal part is Link's when the game marks it so; its external part (a blow or a shot) is Link's when its owner is Link, and the source is read only when the hit has an external part, since the game keeps the last attacker after the hit. The external part's damage kinds (the game's own list: body, smallWeapon, largeWeapon, arrow, bomb, fire, hammer and the rest) are now `ActorDamage.damageType`, and a damage rule can match them with `where.damageType`.

Runs on Windows confirmed the sword, the Master Sword, the charged sword, a Deku stick, the Biggoron's Sword, the slingshot, arrows (fire and light arrows read `arrow`), bombs and bombchus, the hammer, Din's Fire, an enemy's blows and shots (one sent back by the shield stays the enemy's), Link's own bomb on him (`player`), and a fall, fire on the ground and a ReDead's bite (internal: no source, no kind).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Member

Possibly related, for context:

  • PR #3143 feat(mod-api): player.kill() defeats Link through the game's own hit — Earlier mod API work using native damage hits
Possibly related, for context: - PR #3143 feat(mod-api): player.kill() defeats Link through the game's own hit — Earlier mod API work using native damage hits
Member
@review
BeanBot left a comment

Recommendation: Request changes. An external hit whose attacker cannot be read is reported as another actor’s hit, so mods can apply the wrong damage rule. The new testing helper can also panic on an invalid Unicode damage type.

The change identifies Link’s blows and projectiles and exposes damage types to mods. The reported Windows runs demonstrate the common cases, but unreadable attackers are misclassified and several stated cases remain untested.

Blocking (1): must change before merging.

  1. L1 game/crates/game-core/src/rules.rs:888: An external hit with an unreadable attacker is classified as other instead of unknown. (more on the line) Do: Return None when an external hit’s source or owner cannot be read, and test the unreadable attacker case.

Should fix (2): not blocking, but worth doing before merging.

  • L2 game/crates/modtool/src/testing_game/hooks.rs:1141: The testing helper slices a caller-supplied string at a byte boundary that may split a UTF-8 character. (more on the line) Do: Validate or look up the supplied API name without slicing at an unchecked byte boundary, and cover an invalid Unicode name.
  • L3: The pull request description omits the checklist required by the template. When: The description gives testing and risks but has no Ready for review, When it applies, or Ready to merge checklist, so the applicable repository checks are not recorded there. Do: Add the applicable template checklist and record each box’s status.

Testing before merging (1) (the change behaves the same on every system: one run of the change itself is enough; it doesn't hold the recommendation)

  • L4: The remaining damage paths listed in the pull request have not been exercised in the game. When: A scripted hit or a damaging boomerang or hookshot hit may be classified differently from the documented result; the reported runs did not exercise those cases. Do: Run the listed scripted and damaging boomerang or hookshot cases, including the stated Linux sword and slingshot check, and record the results.

@fix can do L1, L2 and L3.

Checks: Still running: 11 checks.

More: does it help, other systems, switches, what was read

Does it help: Yes for the reported cases: two Windows runs identified Link’s sword and slingshot hits as player and their respective damage types. This is not a performance change; no before-and-after performance numbers were provided.

Other systems: Damage rules and actors.damaged share the new source classification; an incorrect classification can change gameplay as well as event data. Linux, scripted hits and damaging boomerang or hookshot hits remain untested. The change does not alter rendering, saves or settings.

Switches: None.

Reviewed: 1b46e53817 against 3a0f7d8f7f: Read the repository rules, standards, PR template, commit, diff, changed layout file and the surrounding hit-source, rule and fake-game paths. Skimmed the generated documentation and schema changes; did not read the larger changed API and modtool files in full. The adjacent Tooling checkout and docs/review-checklist.md were unavailable.; nothing run (a code review).

Checked and fine:

  • The commit records AI assistance with a Co-Authored-By trailer.
  • No switches, renderer interface versions, shaders or third-party files are changed.
  • The damage type match checks membership in the mask, and the new fake-game test exercises a matching and a nonmatching type.
  • The added damage-type ring field uses atomic storage alongside the existing note fields.

Testing: No code, tests, builds or project scripts were run, as requested. The pull request reports Windows game runs and game-free tests; CI was still running.

Overlaps and merge order: Unknown; the network is closed.


Automated code review by BeanBot (gpt-6.1-terra), asked for by llun. Nothing was run; a maintainer decides.

**Recommendation: Request changes.** An external hit whose attacker cannot be read is reported as another actor’s hit, so mods can apply the wrong damage rule. The new testing helper can also panic on an invalid Unicode damage type. The change identifies Link’s blows and projectiles and exposes damage types to mods. The reported Windows runs demonstrate the common cases, but unreadable attackers are misclassified and several stated cases remain untested. **Blocking (1)**: must change before merging. 1. **L1** `game/crates/game-core/src/rules.rs:888`: An external hit with an unreadable attacker is classified as other instead of unknown. (more on the line) **Do:** Return None when an external hit’s source or owner cannot be read, and test the unreadable attacker case. **Should fix (2)**: not blocking, but worth doing before merging. - **L2** `game/crates/modtool/src/testing_game/hooks.rs:1141`: The testing helper slices a caller-supplied string at a byte boundary that may split a UTF-8 character. (more on the line) **Do:** Validate or look up the supplied API name without slicing at an unchecked byte boundary, and cover an invalid Unicode name. - **L3**: The pull request description omits the checklist required by the template. *When:* The description gives testing and risks but has no Ready for review, When it applies, or Ready to merge checklist, so the applicable repository checks are not recorded there. **Do:** Add the applicable template checklist and record each box’s status. **Testing before merging (1)** (the change behaves the same on every system: one run of the change itself is enough; it doesn't hold the recommendation) - **L4**: The remaining damage paths listed in the pull request have not been exercised in the game. *When:* A scripted hit or a damaging boomerang or hookshot hit may be classified differently from the documented result; the reported runs did not exercise those cases. **Do:** Run the listed scripted and damaging boomerang or hookshot cases, including the stated Linux sword and slingshot check, and record the results. `@fix` can do L1, L2 and L3. **Checks:** Still running: 11 checks. <details> <summary>More: does it help, other systems, switches, what was read</summary> **Does it help:** Yes for the reported cases: two Windows runs identified Link’s sword and slingshot hits as player and their respective damage types. This is not a performance change; no before-and-after performance numbers were provided. **Other systems:** Damage rules and actors.damaged share the new source classification; an incorrect classification can change gameplay as well as event data. Linux, scripted hits and damaging boomerang or hookshot hits remain untested. The change does not alter rendering, saves or settings. **Switches:** None. **Reviewed:** 1b46e5381797 against 3a0f7d8f7f34: Read the repository rules, standards, PR template, commit, diff, changed layout file and the surrounding hit-source, rule and fake-game paths. Skimmed the generated documentation and schema changes; did not read the larger changed API and modtool files in full. The adjacent Tooling checkout and docs/review-checklist.md were unavailable.; nothing run (a code review). **Checked and fine:** - The commit records AI assistance with a Co-Authored-By trailer. - No switches, renderer interface versions, shaders or third-party files are changed. - The damage type match checks membership in the mask, and the new fake-game test exercises a matching and a nonmatching type. - The added damage-type ring field uses atomic storage alongside the existing note fields. **Testing:** No code, tests, builds or project scripts were run, as requested. The pull request reports Windows game runs and game-free tests; CI was still running. **Overlaps and merge order:** Unknown; the network is closed. </details> --- <sub>Automated code review by BeanBot (gpt-6.1-terra), asked for by llun. Nothing was run; a maintainer decides.</sub>
@ -807,0 +885,4 @@
return Some(SourceKind::Player);
}
if parts.external > 0 && source.source != 0 {
return match source.owner_type {
Member

L1 (blocking): An external hit with an unreadable attacker is classified as other instead of unknown.

When: When the external part is nonzero but its attacker link is stale or unreadable, hit_source returns a default source. This branch falls through to Other, so an other-only damage rule applies even if Link dealt the hit, and actors.damaged reports other instead of null.

Do: Return None when an external hit’s source or owner cannot be read, and test the unreadable attacker case.

**L1** (blocking): An external hit with an unreadable attacker is classified as other instead of unknown. *When:* When the external part is nonzero but its attacker link is stale or unreadable, hit_source returns a default source. This branch falls through to Other, so an other-only damage rule applies even if Link dealt the hit, and actors.damaged reports other instead of null. **Do:** Return None when an external hit’s source or owner cannot be read, and test the unreadable attacker case.
@ -1138,0 +1138,4 @@
// (what it was dealt with: one of the API's DamageType names, the game's with its first letter lowered)
let kind = a.get("damageType").and_then(J::as_str);
let mask = match kind {
Some(k) if !k.is_empty() => game_core::rules::damage_type_bit(&(k[..1].to_uppercase() + &k[1..]))
Member

L2 (should fix): The testing helper slices a caller-supplied string at a byte boundary that may split a UTF-8 character.

When: A mod test calling game.damage with damageType set to a non-ASCII string such as "é" reaches k[..1] and panics instead of returning the intended invalid-kind error.

Do: Validate or look up the supplied API name without slicing at an unchecked byte boundary, and cover an invalid Unicode name.

**L2** (should fix): The testing helper slices a caller-supplied string at a byte boundary that may split a UTF-8 character. *When:* A mod test calling game.damage with damageType set to a non-ASCII string such as "é" reaches k[..1] and panics instead of returning the intended invalid-kind error. **Do:** Validate or look up the supplied API name without slicing at an unchecked byte boundary, and cover an invalid Unicode name.
Owner
@fix
BeanBot force-pushed fix/mod-api-hit-source from 1b46e53817
Some checks failed
PR description / Title and description (pull_request_target) Failing after 7s
CI / What the change needs (pull_request) Has been cancelled
CI / Lint (pre-commit, ShellCheck, actionlint) (pull_request) Has been cancelled
CI / Third-party parts and guide screenshots (pull_request) Has been cancelled
CI / Rust (rustfmt, clippy, cargo test, end to end) (pull_request) Has been cancelled
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Has been cancelled
CI / Renderer build check (Windows, compile --only renderer, without and with FSR 4) (pull_request) Has been cancelled
CI / Renderer build check (Linux, compile --only renderer, without and with FSR 4) (pull_request) Has been cancelled
CI / Game-free checks (run_all.py, part 1/2) (pull_request) Has been cancelled
CI / Game-free checks (run_all.py, part 2/2) (pull_request) Has been cancelled
CI / Website build and checks (pull_request) Has been cancelled
to f115dad32b
Some checks failed
PR description / Title and description (pull_request_target) Failing after 6s
CI / What the change needs (pull_request) Successful in 8s
CI / Website build and checks (pull_request) Waiting to run
CI / Third-party parts and guide screenshots (pull_request) Successful in 12s
CI / Lint (pre-commit, ShellCheck, actionlint) (pull_request) Successful in 17s
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Failing after 1m24s
CI / Rust (rustfmt, clippy, cargo test, end to end) (pull_request) Failing after 13m18s
CI / Renderer build check (Linux, compile --only renderer, without and with FSR 4) (pull_request) Has started running
CI / Game-free checks (run_all.py, part 1/2) (pull_request) Has started running
CI / Renderer build check (Windows, compile --only renderer, without and with FSR 4) (pull_request) Successful in 10m49s
CI / Game-free checks (run_all.py, part 2/2) (pull_request) Has started running
2026-12-05 17:16:39 +00:00
Compare
BeanBot left a comment

Recommendation: Approve. The code is ready: only testing is left. The Windows game runs show the corrected hit attribution and damage types, but the listed Linux, scripted-hit, and damaging boomerang or hookshot cases remain untested. Recommend approval; not approved on the forge.

What @fix changed
I changed this pull request: the new head is f115dad32b. I rebased it onto main (b6330a5b0b).

Conflicts resolved

  • docs/modding/reference.md: Updated the combined schema hash, keeping both sides’ documentation.
  • docs/modding/permissions.md: Updated the combined schema hash.
  • docs/modding/scripting.md: Updated the shortened combined schema hash. I edited its description to match the change.

Changed

  • Unreadable attacker classification: Updated game/crates/game-core/src/rules.rs:882 to return unknown for an unreadable external attacker or owner, with coverage for classification and rule matching.
  • Unicode damage type validation: Updated game/crates/modtool/src/testing_game/hooks.rs:1141 to check the UTF-8 boundary and added an invalid Unicode name test in game/crates/modtool/src/testing_game/tests.rs:1383.

Nothing was built or run: the checks run again on the new head.

Mods can distinguish Link’s hits from other damage and inspect or match the kind of damage. The change adds bounded reads when a rule or watcher needs that information.

Testing before merging (1) (runs on the systems it can change; it doesn't hold the recommendation)

  • L4: The remaining damage paths listed in the pull request have not been exercised in the game. When: A scripted hit or a damaging boomerang or hookshot hit may be classified differently from the documented result; the reported runs did not exercise those cases. Do: Run the listed scripted and damaging boomerang or hookshot cases, including the stated Linux sword and slingshot check, and record the results.

Checks: they run again on this head (PR description / Title and description (pull_request_target) failed on the last one); a failure shows on the pull request.

Also noticed (1; not asked for, not blocking)
  • hit_source falls back to the attacker when a creator link cannot be read, so an unreadable projectile owner may be classified as the projectile.
More: does it help, other systems, switches, what was read

Does it help: Yes: the reported Windows runs classified sword and slingshot hits as player and identified their damage types; damage rules also changed Din’s Fire damage from 6 to 18. The remaining listed paths have not been exercised.

Other systems: The changed life hook serves damage rules and actors.damaged on Windows and Linux. The reported Windows run covers several player and enemy hits; Linux and the remaining damage paths are still untested.

Switches: None.

Reviewed: f115dad32b against b6330a5b0b: Read AGENTS.md, CONTRIBUTING.md, the pull request template, the fix diff, the changed sections of game-core rules and modtool hooks, and game-core’s rules layout in full. Skimmed the original feature diff and reported runs; the other changed files were not read in full.; nothing run (a code review).

Checked and fine:

  • An external hit with a missing source or owner now classifies as unknown, while a marked internal player hit still takes precedence.
  • The Unicode damage-type check rejects a non-ASCII first character without slicing through its UTF-8 encoding.

Testing: No commands that run the project or its tests were executed. The description reports Windows game runs and game-free tests; CI has not run on this head.

Overlaps and merge order: Not checked; network access is closed.


Automated code review by BeanBot (gpt-6.1-terra), asked for by BeanBot, after its fix. Nothing was run; a maintainer decides.

**Recommendation: Approve.** The code is ready: only testing is left. The Windows game runs show the corrected hit attribution and damage types, but the listed Linux, scripted-hit, and damaging boomerang or hookshot cases remain untested. Recommend approval; not approved on the forge. **What `@fix` changed** I changed this pull request: the new head is f115dad32b4f. I rebased it onto `main` (b6330a5b0b0e). **Conflicts resolved** - docs/modding/reference.md: Updated the combined schema hash, keeping both sides’ documentation. - docs/modding/permissions.md: Updated the combined schema hash. - docs/modding/scripting.md: Updated the shortened combined schema hash. I edited its description to match the change. **Changed** - **Unreadable attacker classification**: Updated game/crates/game-core/src/rules.rs:882 to return unknown for an unreadable external attacker or owner, with coverage for classification and rule matching. - **Unicode damage type validation**: Updated game/crates/modtool/src/testing_game/hooks.rs:1141 to check the UTF-8 boundary and added an invalid Unicode name test in game/crates/modtool/src/testing_game/tests.rs:1383. Nothing was built or run: the checks run again on the new head. Mods can distinguish Link’s hits from other damage and inspect or match the kind of damage. The change adds bounded reads when a rule or watcher needs that information. **Testing before merging (1)** (runs on the systems it can change; it doesn't hold the recommendation) - **L4**: The remaining damage paths listed in the pull request have not been exercised in the game. *When:* A scripted hit or a damaging boomerang or hookshot hit may be classified differently from the documented result; the reported runs did not exercise those cases. **Do:** Run the listed scripted and damaging boomerang or hookshot cases, including the stated Linux sword and slingshot check, and record the results. **Checks:** they run again on this head (`PR description / Title and description (pull_request_target)` failed on the last one); a failure shows on the pull request. <details> <summary>Also noticed (1; not asked for, not blocking)</summary> - hit_source falls back to the attacker when a creator link cannot be read, so an unreadable projectile owner may be classified as the projectile. </details> <details> <summary>More: does it help, other systems, switches, what was read</summary> **Does it help:** Yes: the reported Windows runs classified sword and slingshot hits as player and identified their damage types; damage rules also changed Din’s Fire damage from 6 to 18. The remaining listed paths have not been exercised. **Other systems:** The changed life hook serves damage rules and actors.damaged on Windows and Linux. The reported Windows run covers several player and enemy hits; Linux and the remaining damage paths are still untested. **Switches:** None. **Reviewed:** f115dad32b4f against b6330a5b0b0e: Read AGENTS.md, CONTRIBUTING.md, the pull request template, the fix diff, the changed sections of game-core rules and modtool hooks, and game-core’s rules layout in full. Skimmed the original feature diff and reported runs; the other changed files were not read in full.; nothing run (a code review). **Checked and fine:** - An external hit with a missing source or owner now classifies as unknown, while a marked internal player hit still takes precedence. - The Unicode damage-type check rejects a non-ASCII first character without slicing through its UTF-8 encoding. **Testing:** No commands that run the project or its tests were executed. The description reports Windows game runs and game-free tests; CI has not run on this head. **Overlaps and merge order:** Not checked; network access is closed. </details> --- <sub>Automated code review by BeanBot (gpt-6.1-terra), asked for by BeanBot, after its fix. Nothing was run; a maintainer decides.</sub>
HumanBean deleted branch fix/mod-api-hit-source 2026-12-05 17:17:21 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
4 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!3231
No description provided.