feat(cheats): an Invincible cheat: hits pass Link by, with no damage and no knockback #3255
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!3255
Loading…
Reference in a new issue
No description provided.
Delete branch "llun/Longshot:feat/invincible-cheat"
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
A player on Discord asked for a real invincibility cheat: no damage, no knockback, no hit of any kind. The Debug tab's
Heart protection keeps Link's hearts, but the hit still lands: it only puts the old life back at the two places the
game writes it (
game_core::heart_protection), so he is still knocked back by it, and everything else a hit doesstill happens.
This adds a row, Invincible, on the Cheats page (Link section, under Damage taken), shown while Enable cheats is
on and kept for the run like the other cheat rows (key
invincible, never saved). It uses the game's owninvincibility instead of undoing a hit's damage:
OneShotLifeSetInvincible with IsNoReaction adds or takes off a name). The game takes "invincible" as that list, or
its sibling, holding any name, in Link's hit checks and in other actors' code.
location
player.lifeInvincible) at his update (player.update), on his own thread. It is put back after a mapload (a new Link) and taken out when the row, or Enable cheats, goes off: by the game's function when it is the last
name, else by hand, the game's own names kept (that function, asked to take one name out, empties the list).
game's function is called only when the name must go in or come out.
Read first:
game/crates/game-core/src/invincible.rs,layout/invincible.rs, the row ingame/mods/cheats/mod.toml,and
docs/dev/reference/actors.md#invincibility(how the lists were found, with HumanBean'sre.pyfrom #2924).Testing
Tested: Windows 11, RTX 5080, driver 621.47, this PR built over the shared base of main
7bc53f841, headlessfrom the repository save
kokiri-start. A local test mod spawned three Keese and an Octorok around a standing childLink in Kokiri Forest and logged every hit on him (
actors.damaged), his life and how far he was moved, for 30 s:and 2534 (life 12 to 8, moved 0.97 m); on again, then a teleport to Hyrule Field and a new ambush: no hit, 0.00 m.
[Longshot]; a stand-in "game" name planted beside it,[Longshot, game]; Invincible off,[game], and the whole next wave of enemies (frames 835 to about 2640) landed no hit, so the game reads the list kept by hand as invincible; the stand-in cleared and the map changed, the next wave hit twice (12 to 8).7bc379485): on, no hit; off at frame 1611, hits at 1653 and 2459 (12 to 8, moved 1.00 m); on again and a map change, no hit.Checks: L1's test (the game's names beside Longshot's when the row goes off) fails on the commit before the fix (the list's count 0: the names gone) and passes with it; all of game-core's 420 tests and sysmod-cheats' 60 pass on the head. The cheats mod's row test fails on main ("invincible" missing from the rows) and passes here; the core's three
tests (
invincible::tests, against a fake of the game's list function) pass, and fail with the add step taken out;clippy of game-core and sysmod-cheats (
--no-deps -D warnings) is clean;test_menu_ini_keysandtest_i18n_completepass (the row's texts in all 13 languages). The full suite (run_all.py --exact, every check--listgives on Windows but the ones that fail on main): 848 of 849 pass.test_lifterfails, on main's failures only: clippy at host-sys'slarge_const_arrays(settings_abi.rs:323) and api'sa_walked_reshade_folder_counts_a_change_once_two_walks_agree, both fixed in open #3248; as cargo stops there, the whole workspace's tests ran again with--no-fail-fast, skipping only those and main's other listed failures (the_menu_passes_its_tests,the_repository_s_lock_and_the_table_agree,the_repositorys_files_are_current): all pass. Not run, as they fail on main:test_present_geometry_trace,test_present_image_free,test_present_held_image,test_present_acquire_ahead,test_dlssg,test_no_map_reload,test_sync_watch_event,test_turf_budget,test_ui_renderer,test_no_game_title(none reads what this changes).Still to test:
walk on lava (Death Mountain Crater), be grabbed by a Like Like and a Wallmaster, be frozen by a Freezard and
shocked by a Biri, and fight a boss, expecting no damage and no knockback, and the game's own return from a pit
or water as without the cheat (by hand).
last its usual time (the game's own name in the list, not a planted one; by hand).
Measurements
Verdict: no cost seen. With the cheat off, this PR's frame times are within the spread of main's; with it on,
within the spread of its own runs with it off.
Setup: Windows 11, RTX 5080, driver 621.47;
dev.py ab, Hyrule Field (child, the scene's default), Render resolution67 %, 60 s measured after the warm-up, interleaved. Main against this PR with the cheat off (what every player runs):
5 runs of main, 4 of this PR (the fifth was cancelled when another session's game held the GPU for over 20 minutes).
dev.py abwould not write the section itself: it counts two per-run handle values (LONGSHOT_BUILDER_PIPES,LONGSHOT_CRASH_BLOCK) as switches that differ; the medians are worked out by hand from its run lines (below). Theruns are of
0c124e3e2; the fix for BeanBot's L1 after it changes only what turning the row off does, not the pathtaken while it stays off (one switch and one remembered address read, then a return).
7bc53f8410c124e3e2Invincible on against off, this PR's runtime both sides (
LONGSHOT_SETper side), 5 runs each:0c124e3e20c124e3e2The "on" side being faster is the "off" side's noise (one off run at 98 fps, another at 172), not a gain.
Risks
moves him. A hit the game marks to land anyway (a flag of the life component's) still lands, read from the code,
not seen. Turning the row off ends it at once.
say) takes Longshot's out by hand and keeps the game's (BeanBot's L1: the game's own function would empty the whole
list); only when Longshot's is the last name is the game's function asked, which also tells Link's other components
the list is empty. The hand edit is made on Link's own thread, at his update.
Enable cheats on turns Autosave off, as before.
player.lifeInvincible: the row then does nothing, and the log says so once.Checklist
Ready for review
main; the title is a Conventional Commit.mise run testpasses (any failure that also fails onmainis named).main, or Measurements says why there is nothing to measure.third_party/untouched; nothing GPL-incompatible.When it applies
tests/that reads changed source is updated, not weakened.mainand here, for a change that shows on screen.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
Tested in game: Windows 11, RTX 5080, driver 621.47, this PR's head over main
7bc53f841, headless from kokiri-start. Three Keese and an Octorok spawned at a standing child Link in Kokiri Forest, every hit logged for 30 s: Invincible off, 2 hits (life 12 to 8 quarter hearts) and pushed up to 0.99 m; on, no hit and 0.00 m. Toggled live through the control bridge: off at frame 1700, hits landed at 1816 and 2534; on again and a teleport to Hyrule Field with a new ambush, no hit. The Cheats page shows the row and its help.The Debug tab's Cheats page, the same spot (Windows 11, RTX 5080, Kokiri Forest, headless):
main @

7bc53f841, Damage taken focused, no Invincible row:This PR @

0c124e3e2, the new row on and focused, with its help:Possibly related, for context:
@review
Recommendation: Request changes. Turning the cheat off can also end the game’s own active invincibility, leaving Link vulnerable earlier than intended. The enemy-hit test shows the feature works in that scenario, but the remaining gameplay and Linux cases need runs.
Adds a run-only Invincible cheat that uses Link’s existing no-reaction invincibility list. It prevents the tested enemy hits and knockback, but currently removes unrelated protection when switched off.
Blocking (1): must change before merging.
game/crates/game-core/src/invincible.rs:102: Removing Longshot’s name through this function empties the entire no-reaction list, including names owned by the game. (more on the line) Do: Remove only Longshot’s contribution while preserving the game’s active names and the component notifications, and add a test with both a game name and Longshot’s name present when the cheat is turned off.Testing before merging (3) (runs on the systems it can change; it doesn't hold the recommendation)
game/crates/game-core/src/debug.rs:408: The measurements do not isolate the cost of the new update path when the cheat is off. (more on the line) Do: Compare the base and this head with the cheat off using interleaved runs in the same stable scene and settings, reporting frame times and 1% lows.@fixcan do L1.Checks: Still running: 11 checks.
More: does it help, other systems, switches, what was read
Does it help: Yes for the tested enemy encounters: on Windows, two hits reduced life from 12 to 8 quarter hearts and moved Link up to 0.99 m with the cheat off; with it on, no hit landed and he moved 0.00 m. The five-run frame-time comparison is too variable to establish its cost: off runs ranged from 98 to 172 fps, and both sides used the PR runtime rather than comparing its always-on update path with the base.
Other systems: The change calls a guest game function from Link’s update and can affect game-owned invincibility, hazards, grabs, scripted damage and enemy behavior. The supplied run covers Keese, an Octorok, toggling and a map change on Windows; it does not cover Linux or the listed hazard and story cases. It does not change rendering, saves, audio or input directly.
Switches: Adds the player-facing Invincible toggle, default off and kept only for the run; it is gated by Enable cheats. Off is an appropriate default for an optional cheat. No environment switch is added.
Reviewed:
0c124e3e21against7bc53f8413: Read the repository rules, PR template, standards, commit log, invincibility implementation and layout, and the changed settings and wiring. Reviewed the remaining diffs and relevant memory, call and update references; translations, the large unchanged portions of the cheats manifest and system mod, and recorded run claims were skimmed. The requested review checklist file is absent.; nothing run (a code review).Checked and fine:
Testing: No commands that build or run the project were executed. The author reports Windows game runs and passing targeted checks; CI is still running.
Overlaps and merge order: Not checked; the network is closed.
Automated code review by BeanBot (gpt-6.1-terra), asked for by llun. Nothing was run; a maintainer decides.
@ -391,6 +405,7 @@ pub fn player_update(g: &mut GuestCtx<'_>, actor: u64) {}crate::fixes::high_fps::note_link(components);crate::spawn::link_update(g);crate::invincible::link_update(g, components);L4 (should fix): The measurements do not isolate the cost of the new update path when the cheat is off.
When: Every Link update now calls this path even for players who never enable the cheat, while both measured sides already include it and the recorded runs have a wide spread.
Do: Compare the base and this head with the cheat off using interleaved runs in the same stable scene and settings, reporting frame times and 1% lows.
@ -0,0 +99,4 @@Step::Add => match set(g, life, true, layout::NAME) {Ok(()) => HELD.store(life, Ordering::Relaxed),Err(e) => said(&format!("cheats: Invincible could not be turned on: {e}")),},L1 (blocking): Removing Longshot’s name through this function empties the entire no-reaction list, including names owned by the game.
When: If the player turns Invincible or Enable cheats off while the game has its own no-reaction protection active, the removal clears that protection too. A subsequent hit can land before the game’s protection would normally expire.
Do: Remove only Longshot’s contribution while preserving the game’s active names and the component notifications, and add a test with both a game name and Longshot’s name present when the cheat is turned off.
Thanks, BeanBot. Answers by point, on head
7bc379485:L1 (blocking): fixed. Turning Invincible off now asks the game's function only when Longshot's name is the last one in Link's no-reaction list (it empties the list and tells his other components). With other names in it, Longshot's alone is taken out by hand, the rest kept from the same start in their order (
ceaf30937the test,b8a49e5dcthe fix).[Longshot]; a stand-in game name planted,[Longshot, game]; off,[game], and the next wave of Keese and an Octorok landed no hit, so the game reads the kept list as invincible. Cleared and the map changed: the next wave hit twice.L4: measured. main against this PR with the cheat off, 5 and 4 interleaved runs in Hyrule Field: 151.5 against 158.1 fps median, median frame time 6.45 against 6.16 ms, p99 9.24 against 9.29 ms, 1% low 108.3 against 107.8 fps: within the spread. In Measurements. The off path is one switch and one remembered address read.
L2: in Still to test as hand tests (pits, deep water, lava, grabs, freezing, shocks, a boss, a story hit, and a revival fairy's own invincibility kept when the row goes off).
L3: asked of the Test Farm below.
@Beanstalk On Linux (any GPU): load a save in play, open the Insert menu, Debug, Cheats, turn Enable cheats on, then Invincible on. Stand next to an enemy and let it attack for 30 s: expect no damage and no knockback. Then turn Invincible off: expect the next hit to take hearts and knock Link back. Change map with Invincible on and let an enemy attack again: expect no damage. Attach the game's log.
Beanstalk test farm · ⛔ can't be tested as asked
Commit
7bc3794· approved by llun (untrusted) · dashboardNot run: the farm can't test this as asked, so nothing is built or run:
⚠️ Note: The alternative does not measure the cost with Invincible on or verify preservation of the game's own invincibility.
⚠️ Note: The requested game-log attachment is not specified by the plan schema.
What it could test instead: The alternative plan compares the PR with main on Linux, with cheats off, in Kokiri Forest and Hyrule Field. It uses three starts per build and measures uncapped frame times for 30 seconds in each place after warm-up. A crash, an Invincible error in the log, or a frame-time regression over 15% fails the alternative plan. It does not test the requested enemy-hit behavior.
A member of
BigBeanscan comment@Beanstalk <new words>to ask for something else, or@Beanstalk test it anywayto run the plan regardless.WIP: feat(cheats): an Invincible cheat: hits pass Link by, with no damage and no knockbackto feat(cheats): an Invincible cheat: hits pass Link by, with no damage and no knockbackRecommendation: Approve. The code is ready: only testing is left. The fix preserves the game’s names when Invincible is turned off, and the Windows enemy tests show the cheat working. The remaining gameplay-path and Linux runs are still needed. Recommend approval; not approved on the forge.
Adds a run-only Invincible cheat that prevents ordinary enemy hits and knockback. The fix keeps the game’s own invincibility names when the cheat is disabled, at the cost of additional list handling.
Testing before merging (2) (runs on the systems it can change; it doesn't hold the recommendation)
Since the last review (on
0c124e3e21)Resolved: L1 (Removing Longshot’s name through this function empties the entire no-reaction list, includ…); L4 (The measurements do not isolate the cost of the new update path when the cheat is off.)
Still open: L2 (The tested enemy hits do not cover the other gameplay paths that the new invincibility sta…); L3 (The guest function call and update hook have only been exercised in the supplied Windows r…)
Checks: Still running: 11 checks.
More: does it help, other systems, switches, what was read
Does it help: Yes for the tested enemy hits: on Windows, two hits reduced life from 12 to 8 and moved Link up to 0.99 m with the cheat off; with it on, no hit landed and movement was 0.00 m. The reported off-path measurements show median frame times of 6.45 ms on main and 6.16 ms on the PR, with p99 of 9.24 and 9.29 ms respectively, within the reported run spread.
Other systems: The update hook and guest call also run on Linux, where a game test remains outstanding. Pits, water, lava, grabs, status effects, bosses, story damage and an actual revival fairy remain untested. The change does not alter rendering-specific code.
Switches: Adds the run-only Invincible cheat, default off and available while Enable cheats is on. The default is appropriate; the user guide and menu strings are updated.
Reviewed:
7bc379485fagainst7bc53f8413: Read AGENTS.md, CONTRIBUTING.md, the full invincible implementation and its changed lines, and the reported runs and comments. Inspected the remaining diff and cheat wiring; the large cheat configuration, translations and other changed files were only skimmed. Output for some file reads was truncated.; nothing run (a code review).Checked and fine:
Testing: No commands from the project were run. The author reports Windows game tests and game-free checks; CI is still running.
Overlaps and merge order: Not checked; network access is closed.
Automated code review by BeanBot (gpt-6.1-terra), asked for by BeanBot, as llun took it out of WIP. Nothing was run; a maintainer decides.