fix(mod-api): a hit the game names no attacker for is another's, not unknown #3267
No reviewers
Labels
No labels
area/accessibility
area/audio
area/input
area/install
area/menu
area/mods
area/renderer
area/saves
area/tooling
area/upscaling
beanstalk: approved
beanstalk: failed
beanstalk: needs approval
beanstalk: running
beanstalk: tested
ci: approved
good first issue
gpu/amd
gpu/igpu
gpu/intel
gpu/nvidia
help wanted
kind
bug
kind
chore
kind
docs
kind
feature
kind
performance
kind
question
needs measurements
platform/linux
platform/macos
platform/steam-deck
platform/windows
preview
priority
critical
priority
high
priority
low
regression
risk
high
risk
low
risk
medium
status
blocked
status
confirmed
status
duplicate
status
invalid
status
needs-info
status
wontfix
ci: approved
No milestone
No project
No assignees
3 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
MagicBeanDev/Longshot!3267
Loading…
Reference in a new issue
No description provided.
Delete branch "glinesbdev/Longshot:fix/mod-api-hit-no-attacker"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Since #3231,
actors.damagedreadssourceKindas unknown (null) for every blow or shot whose source can't be read. That lumps together two cases: an attacker link that is set but stale, being deleted or unreadable, and an attacker link the game left empty because nothing attacked. A Deku stick breaking is the second case. It reads null onmain, whiledocs/dev/reference/actors.mdand the runs in #3231 sayother.To see it on
main: logactors.damagedfrom a mod (e.sourceKind,e.damageType), hit something with a Deku stick until it breaks. TheItem_DekuStickhit readssourceKindnull,damageTypedurability.This notes in the hit's parts whether the attacker link is empty (its id all ones, the game's own empty link). Such a hit reads
other, as the docs say. A link set but stale, being deleted or unreadable, or an owner that can't be read, still reads unknown, as #3231's review asked.Read first:
game-core/src/rules.rs:HitParts::no_attacker, read inhit_parts, and thesource.source == 0branch ofsource_kind. ThesourceKinddoc intypes.tomlanddocs/dev/reference/actors.mdsay the same, with the runs below.See #3231.
Testing
Tested: Windows 10, Radeon RX 7800 XT (RDNA3), AMD driver 26.11.2, a test build of this change on
426130974(#3231's branch with this fix, before it merged), with a mod logging everyactors.damaged. This branch is the same change on currentmain:source_kindanswers the same for every hit in both. The only difference,main's unreadable-owner check, can't trigger once a source is read, since the owner falls back to the source itself. Nothing else onmainsince then touches the hit path.sourceKinddamageTypeotherdurabilityactors.damage(1, link.actor)on an Octorok)playerplayerPlayer/PlayerslingshotBullet,largeWeaponotherEnemy_Octorok/Enemy_OctorokbodyAn earlier run on #3231's first head also had the boomerang and the hookshot each kill an Octorok:
player,Player/Player,boomerangandhookshot. Those hits name their attacker, so this change doesn't touch them; the reference doc now records them, and the scripted hit, as run.Checks, on
main@4007f6eae:cargo test -p game-core --lib: 439 passed.a_hit_is_links_when_the_game_marks_its_internal_part_or_its_owner_is_linknow also covers an empty attacker link (other) and a hit marked Link's with no attacker (player). Withmain's rule (Nonefor any hit with no source) it fails on "the game names no attacker"; here it passes.cargo clippy -p game-core --lib --tests --no-deps -- -D warningsandschema-gen --check: clean.rustfmt --checkonrules.rs: clean.cargo fmt --all --checkfails onmaintoo, in files this doesn't touch (build-core/src/gamecube.rs,api/src/services/flag_exps.rsand others).Still to test:
actors.damaged, break a Deku stick and hit an enemy with the sword, expectingother/durabilityfor the stick andplayer/smallWeaponfor the sword (@Beanstalk or by hand).Measurements
Nothing to measure: one more bounded read (the attacker link's id) per hit, only when a damage rule names a source or a mod watches
actors.damaged.Risks
otherwhere it reads null onmain, so a damage rule namingsourceKind: "other"now applies to it (a Deku stick breaking). That is what the docs said #3231 does.Checklist
Ready for review
main; the title is a Conventional Commit.mise run testpasses (any failure that also fails onmainis named). Not run: mise isn't installed on this PC. The cargo checks under Testing ran instead.main, or Measurements says why there is nothing to measure.third_party/untouched; nothing GPL-incompatible.When it applies
mainand passes here.Assisted-by:/Co-Authored-By:trailers.Ready to merge
main, measured again or a comment says why the numbers still hold.🤖 Generated with Claude Code
WIP: fix(mod-api): a hit the game names no attacker for is another's, not unknownto fix(mod-api): a hit the game names no attacker for is another's, not unknown@review
Recommendation: Approve. The reported game run shows the intended stick-break result. Nothing blocking is left. Recommend approval; not approved on the forge.
The change classifies an external hit with an empty attacker link as
other, so matching damage rules andactors.damagedconsumers see the documented result. It keeps stale or unreadable links unknown and adds one bounded read when source information is needed.Should fix (1): not blocking, but worth doing before merging.
docs/dev/reference/actors.md:368: The newly recorded boomerang, hookshot and scripted-hit results conflict with this page's remaining list of runs still to confirm. (more on the line) Do: Remove the completed cases from the final 'What a game run has to confirm' list, leaving Linux and any genuinely untested cases.@fixcan do L1.Questions (1) (not confirmed from the code; they don't hold the recommendation)
game/crates/game-core/src/rules.rs:1423: Is there an input at HEAD for which hit_parts reads the attacker link incorrectly?Checks: Still running: 11 checks.
More: does it help, other systems, switches, what was read
Does it help: Yes: the reported Windows run observed
otheranddurabilityfor a breaking Deku stick, versus null on main. The run used the same fix on an earlier branch; Linux remains untested.Other systems: The classification also controls source-kind damage rules, not just events. The logic is shared across GPUs and operating systems; the reported run covers Windows, and the PR lists a Linux run as still needed. No renderer, save, audio, or input path is changed.
Switches: None.
Reviewed:
f6b1e2c59eagainst4007f6eae4: Read the repository rules, standards, PR template, diff, commit and changed Rust path with its callers and memory helpers. Skimmed the schema and generated modding documents, recorded runs, and surrounding actor reference. Tooling's AGENTS.md was unavailable locally. No comments or reviews were supplied.; nothing run (a code review).Checked and fine:
Testing: No commands from the project or tests were run, as requested. The PR reports 439 game-core tests passing and a Windows game run; its Linux run and CI checks remain pending.
Overlaps and merge order: None found in the supplied context; network access was unavailable.
Automated code review by BeanBot (gpt-6.1-terra), asked for by llun. Nothing was run; a maintainer decides.
@ -365,1 +366,3 @@Linux.the enemies they hit: no damage, so no `actors.damaged`.A third and a fourth run (the same PC, 2026-12-05): the boomerang and the hookshot each killed an Octorok, `player`L1 (should fix): The newly recorded boomerang, hookshot and scripted-hit results conflict with this page's remaining list of runs still to confirm.
When: A reader reaches the final checklist and is told those same hits have not been run, despite the results recorded here.
Do: Remove the completed cases from the final 'What a game run has to confirm' list, leaving Linux and any genuinely untested cases.
Thanks.
d1c2b8814answers L1: the to-confirm list in actors.md now keeps only Linux for sourceKind and damageType.On the question (can hit_parts read the attacker link wrongly?): it reads one thing, the link's id at +0x238 + 0x10, and calls the link empty only when that read succeeds and gives all ones. That is the same test link_actor makes first for an empty link, at the same offset (layout::LINK_ID), and what the game writes into a link with no actor. Each other case falls to unknown, as before:
The id can't be read (the component unreadable): is_some_and is false, so not empty. With no source read, the hit is unknown.
A link set but stale or being deleted (an id that isn't all ones, its handle's id different, or its actor being deleted): not empty, and hit_source reads no source, so unknown.
A zeroed link (id 0, no handle): not empty, and link_actor reads no handle, so unknown.
A live link: hit_source reads a source, and no_attacker isn't consulted at all; the owner's type decides, as on main.
So no_attacker only changes a hit where hit_source already found nothing and the game's own empty mark is there. The fake game writes an empty link the same way (world.rs, link_to(.., None)), and the stick run on Windows read other / durability through that path.
One thing this doesn't settle, as on main since #3231: if the game kept an earlier blow's attacker in the link for a later external hit that names none, hit_source would read that earlier attacker. No run has shown it (the stick's link was empty), and this change doesn't alter it.
@review
Recommendation: Approve. The reference now removes the runs already completed, and the reported Windows run shows the intended source classification for a breaking Deku stick. Recommend approval; not approved on the forge.
Hits the game names no attacker for are reported as
other, while unreadable attackers remain unknown. The change adds one bounded read per relevant hit.Since the last review (on
f6b1e2c59e)Resolved: L1 (The newly recorded boomerang, hookshot and scripted-hit results conflict with this page's…)
Checks: Still running: 11 checks.
Also noticed (2; not asked for, not blocking)
More: does it help, other systems, switches, what was read
Does it help: Yes: the reported Windows run changed a breaking stick from null on main to
otherwithdurability; the game-free test also covers the classification. Linux remains untested.Other systems: Damage rules and
actors.damagedconsume the classification. Windows was tested in game; the same logic is used on Linux, but its in-game result remains to be confirmed.Switches: None.
Reviewed:
d1c2b88145against4007f6eae4: Read AGENTS.md, CONTRIBUTING.md, the full diff, commit list and the change since the ledger. Read the changed portions of rules.rs, the schema and actor reference; the large file output was truncated, so those files were not all read in full. Skimmed generated documentation and recorded runs. The pull request template and standards were not read.; nothing run (a code review).Checked and fine:
Testing: No commands that execute project code or tests were run. The author reports a Windows in-game run and passing game-core tests; CI is still running.
Overlaps and merge order: Not checked; network is closed.
Automated code review by BeanBot (gpt-6.1-terra), asked for by llun. Nothing was run; a maintainer decides.