Skip to content

Fix AI shooting by adding Action button bindings#2

Merged
yava-code merged 5 commits into
mainfrom
jules-14484808672928127370-4b6e9bf6
May 16, 2026
Merged

Fix AI shooting by adding Action button bindings#2
yava-code merged 5 commits into
mainfrom
jules-14484808672928127370-4b6e9bf6

Conversation

@yava-code

@yava-code yava-code commented May 16, 2026

Copy link
Copy Markdown
Owner

The AI bot was unable to shoot because the engine relies on the mButtonDownAction and mButtonFrameAction fields to trigger wand usage. This fix ensures that when do_fire is active, the corresponding Action button fields in the ControlsComponent are accurately updated.


PR created automatically by Jules for task 14484808672928127370 started by @yava-code

Summary by CodeRabbit

  • Bug Fixes

    • Synchronized firing input states and frame markers for reliable firing behavior.
    • Prevent training hangs by dismissing in-game error dialogs on timeout in headless/non-Windows setups.
  • Tests

    • Updated default entropy coefficient expectation.
    • Stubbed an additional platform-dependent module to avoid import failures.
    • Aligned tests with an internal window-detection rename.
  • Chores

    • Cleaned and augmented dependency list with development tooling; added a helper for screenshot/window handling.

Review Change Stack

@google-labs-jules

Copy link
Copy Markdown

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@coderabbitai

coderabbitai Bot commented May 16, 2026

Copy link
Copy Markdown

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: d02f6022-57ab-44eb-a401-06bb7559e846

📥 Commits

Reviewing files that changed from the base of the PR and between 7b01bd0 and 3096dfa.

📒 Files selected for processing (3)
  • noita_env.py
  • patch_req.py
  • requirements.txt

📝 Walkthrough

Walkthrough

Adds action-button wiring in apply_action to set mButtonDownAction/mButtonFrameAction; adds guarded Win32 imports and a _dismiss_error_dialog helper invoked on frame-timeout; updates tests (ent_coef, win32gui stub, renamed window helper); appends development deps and a patch script for requirements.txt.

Changes

Input, environment, and dependency updates

Layer / File(s) Summary
Action button control input and tests
init.lua, tests/test_config.py, tests/test_obs.py, tests/test_video_recorder.py
apply_action now sets mButtonDownAction and mButtonFrameAction alongside existing fire/left-click flags when do_fire is active; tests updated for default ent_coef (0.03), added win32gui stub in make_env(), and updated the tested method to _find_noita_hwnd().
NoitaEnv Windows imports and dialog dismissal
noita_env.py
Adds guarded imports for win32gui/win32process, implements _dismiss_error_dialog(target_pid) to locate Noita error dialogs and post a click to an “Always Ignore” button, and calls it when _wait_for_new_frame times out.
Requirements and patch helper
patch_req.py, requirements.txt
Adds a development-tools block to requirements.txt (black, flake8, mypy, pytest, pytest-cov, pygetwindow) and a patch_req.py script that cleans merge-conflict markers and appends the development block to requirements.txt.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

I nibble at keys through midnight air,
Press action once, the frames prepare.
I hop through dialogs, click away,
Dev deps added for brighter day. 🐇✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 25.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately reflects the main change in the pull request, which is fixing AI shooting by adding Action button bindings to the ControlsComponent.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch jules-14484808672928127370-4b6e9bf6

Tip

💬 Introducing Slack Agent: The best way for teams to turn conversations into code.

Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.

  • Generate code and open pull requests
  • Plan features and break down work
  • Investigate incidents and troubleshoot customer tickets together
  • Automate recurring tasks and respond to alerts with triggers
  • Summarize progress and report instantly

Built for teams:

  • Shared memory across your entire org—no repeating context
  • Per-thread sandboxes to safely plan and execute work
  • Governance built-in—scoped access, auditability, and budget controls

One agent for your entire SDLC. Right inside Slack.

👉 Get started


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates the control logic in init.lua to bind the mButtonDownAction and mButtonFrameAction inputs to the firing command. Feedback suggests that this change may cause unintended side effects, such as the agent accidentally interacting with environmental objects or portals during combat, and recommends exploring ways to separate combat actions from environmental interactions.

Comment thread init.lua
-- Fire: Fix "eternal first frame" bug by using local agent_was_firing
cset(ctrl, "mButtonDownFire", do_fire)
cset(ctrl, "mButtonDownLeftClick", do_fire)
cset(ctrl, "mButtonDownAction", do_fire)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Binding mButtonDownAction to the fire command will cause the agent to trigger environmental interactions (such as picking up items, swapping wands, or entering portals) every time it attempts to shoot. While this may be a necessary workaround if the engine requires it for wand usage in this context, it introduces a significant side effect where the agent might unintentionally teleport or replace its equipment during combat. Consider if this binding can be restricted to specific item types or if a dedicated interaction action should be added to the action space to separate combat from interaction.

@yava-code

Copy link
Copy Markdown
Owner Author

@copilot resolve the merge conflicts in this pull request

Co-authored-by: yava-code <185186582+yava-code@users.noreply.github.com>

Copilot AI commented May 16, 2026

Copy link
Copy Markdown
Contributor

@copilot resolve the merge conflicts in this pull request

Resolved and pushed in commit 7b01bd0. I merged origin/main into this PR branch and fixed the requirements.txt conflict so the PR is conflict-free now.

@google-labs-jules

Copy link
Copy Markdown

@copilot resolve the merge conflicts in this pull request

I've resolved the merge conflicts with main. The tests are passing correctly.

@yava-code yava-code merged commit 6f2d3a9 into main May 16, 2026
2 of 3 checks passed
@yava-code yava-code deleted the jules-14484808672928127370-4b6e9bf6 branch May 16, 2026 20:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants