Skip to content

Add firearm selection to placed agents - #165

Merged
SunkenInTime merged 4 commits into
mainfrom
feature/agent-firearms
Sep 13, 2026
Merged

Add firearm selection to placed agents#165
SunkenInTime merged 4 commits into
mainfrom
feature/agent-firearms

Conversation

@SunkenInTime

@SunkenInTime SunkenInTime commented Sep 13, 2026

Copy link
Copy Markdown
Owner

Right-click a placed agent to choose or remove a firearm through category submenus. The 19 bundled Valorant silhouettes paint at the portrait's bottom-right without changing its size, position, drag anchor, or hit area.

Supports plain, circle, view-cone, and lineup agents, undo/redo, duplication, lineup drafts, and page/video transitions. Firearms persist through Hive, .ica export/import, and library backups. Older data defaults to no firearm through the version 100 migration; adapters were regenerated from source.

Validation:

  • flutter test: 493 passed, 1 existing skip.
  • flutter test integration_test/agent_weapon_test.dart -d windows: 11 passed in an isolated in-memory native test app, including menus, dragging at different sizes/zooms, hit testing, lineup draft isolation, and transition rendering.
  • Inspected Windows screenshots of every firearm and category menus.
  • flutter analyze: no errors or warnings, 3 existing informational findings in unchanged files.
  • git diff --check: clean.

Weapon asset sources are recorded in assets/weapons/README.md.

Summary by CodeRabbit

  • New Features

    • Added weapon selection for agents, with categorized weapon menus and visible weapon icons.
    • Weapon choices are preserved for placed agents, lineups, exports, and imports.
    • Added undo/redo support for weapon changes.
    • Weapon icons now animate smoothly during agent movement transitions.
  • Bug Fixes

    • Improved icon sizing so transparent image margins do not affect weapon appearance.
  • Tests

    • Added coverage for weapon selection, persistence, migration, rendering, dragging, transitions, and undo/redo.

@coderabbitai

coderabbitai Bot commented Sep 13, 2026

Copy link
Copy Markdown

Review Change StackReview Change Stack

Warning

Review limit reached

Next included review available in 43 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: a2937951-56b0-4534-8f54-7157d00faec2

📥 Commits

Reviewing files that changed from the base of the PR and between 9a1c96d and 388ad5e.

⛔ Files ignored due to path filters (2)
  • docs/verification/agent-firearms/all-firearms.png is excluded by !**/*.png
  • docs/verification/agent-firearms/sidearms-menu.png is excluded by !**/*.png
📒 Files selected for processing (3)
  • docs/verification/agent-firearms/README.md
  • docs/verification/agent-firearms/windows-test-output.txt
  • test/agent_weapon_widgets_test.dart

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: c01d747b-61fc-49e4-a697-d97776f49bef

📥 Commits

Reviewing files that changed from the base of the PR and between fc4baf8 and 9a1c96d.

⛔ Files ignored due to path filters (19)
  • assets/weapons/ares.png is excluded by !**/*.png
  • assets/weapons/bandit.png is excluded by !**/*.png
  • assets/weapons/bucky.png is excluded by !**/*.png
  • assets/weapons/bulldog.png is excluded by !**/*.png
  • assets/weapons/classic.png is excluded by !**/*.png
  • assets/weapons/frenzy.png is excluded by !**/*.png
  • assets/weapons/ghost.png is excluded by !**/*.png
  • assets/weapons/guardian.png is excluded by !**/*.png
  • assets/weapons/judge.png is excluded by !**/*.png
  • assets/weapons/marshal.png is excluded by !**/*.png
  • assets/weapons/odin.png is excluded by !**/*.png
  • assets/weapons/operator.png is excluded by !**/*.png
  • assets/weapons/outlaw.png is excluded by !**/*.png
  • assets/weapons/phantom.png is excluded by !**/*.png
  • assets/weapons/sheriff.png is excluded by !**/*.png
  • assets/weapons/shorty.png is excluded by !**/*.png
  • assets/weapons/spectre.png is excluded by !**/*.png
  • assets/weapons/stinger.png is excluded by !**/*.png
  • assets/weapons/vandal.png is excluded by !**/*.png
📒 Files selected for processing (30)
  • assets/weapons/README.md
  • integration_test/agent_weapon_test.dart
  • lib/const/line_provider.dart
  • lib/const/placed_classes.dart
  • lib/const/placed_classes.g.dart
  • lib/const/settings.dart
  • lib/const/transition_data.dart
  • lib/const/weapons.dart
  • lib/hive/hive_adapters.dart
  • lib/hive/hive_adapters.g.dart
  • lib/hive/hive_adapters.g.yaml
  • lib/hive/hive_registrar.g.dart
  • lib/migrations/agent_weapon_migration.dart
  • lib/providers/action_provider.dart
  • lib/providers/agent_provider.dart
  • lib/providers/strategy_provider.dart
  • lib/widgets/draggable_widgets/agents/agent_weapon_badge.dart
  • lib/widgets/draggable_widgets/agents/agent_weapon_menu.dart
  • lib/widgets/draggable_widgets/agents/agent_widget.dart
  • lib/widgets/draggable_widgets/agents/placed_circle_agent_widget.dart
  • lib/widgets/draggable_widgets/agents/placed_lineup_agent_widget.dart
  • lib/widgets/draggable_widgets/agents/placed_view_cone_agent_widget.dart
  • lib/widgets/draggable_widgets/agents/weapon_icon.dart
  • lib/widgets/draggable_widgets/placed_widget_builder.dart
  • lib/widgets/line_up_widget.dart
  • lib/widgets/page_transition_overlay.dart
  • pubspec.yaml
  • test/agent_weapon_test.dart
  • test/agent_weapon_widgets_test.dart
  • test/view_cone_agent_drag_feedback_test.dart

Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

Changes

Agent weapon support

Layer / File(s) Summary
Weapon contract and persistence
lib/const/weapons.dart, lib/const/placed_classes.dart, lib/const/placed_classes.g.dart, lib/hive/*
Adds weapon enums and stores weapon values in JSON and Hive data. Legacy records default to WeaponType.none.
Weapon state and migration
lib/providers/*, lib/const/line_provider.dart, lib/migrations/*, lib/const/settings.dart
Adds weapon selection, lineup editing, undo/redo actions, conversion preservation, and version 100 migration handling.
Weapon selection and rendering
lib/widgets/draggable_widgets/agents/*, lib/widgets/draggable_widgets/placed_widget_builder.dart, lib/widgets/line_up_widget.dart, pubspec.yaml, assets/weapons/README.md
Adds categorized weapon menus, cropped weapon icons, agent badges, asset registration, and weapon propagation through agent widgets.
Weapon transition wiring
lib/const/transition_data.dart, lib/widgets/page_transition_overlay.dart
Includes weapon changes in visual transition comparisons and crossfades weapon icons during move transitions.
Weapon validation and integration coverage
test/agent_weapon_test.dart, test/agent_weapon_widgets_test.dart, test/view_cone_agent_drag_feedback_test.dart, integration_test/agent_weapon_test.dart
Adds persistence, migration, editing, rendering, transition, asset, and desktop integration tests.

Priority: ⬇️ Low

Estimated code review effort: 4 (Complex) | ~45 minutes

Change: Feature

Sequence Diagram(s)

sequenceDiagram
  participant User
  participant AgentWidget
  participant AgentProvider
  participant PlacedAgent
  participant AgentWeaponBadge
  User->>AgentWidget: Select weapon from context menu
  AgentWidget->>AgentProvider: setWeapon(id, weapon)
  AgentProvider->>PlacedAgent: Store updated weapon
  AgentWidget->>AgentWeaponBadge: Render selected weapon
  AgentWeaponBadge-->>User: Display weapon badge
Loading

Merge Risk: ⚪ Minimal · up to 9a1c9

Weapon assets, rendering, persistence, migration, and transition wiring have no identified merge-blocking issue.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: adding firearm selection to placed agents.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 0…
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.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/agent-firearms

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.

@greptile-apps

greptile-apps Bot commented Sep 13, 2026

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 5/5

The verified firearm selection, persistence, interaction, and transition behavior is safe to merge.

What we checked:

  • Legacy strategy firearm compatibility: Absent JSON firearm values deserialize as WeaponType.none. Focused tests also restore frozen pre-firearm Hive field layouts and confirm their expected agent geometry remains unchanged. T-Rex
  • Firearm state lost during agent transformations: Conversion constructors explicitly pass the existing firearm into replacement agents, while duplication calls the subtype's copyWith. Focused runtime assertions confirm firearm preservation for duplication and all investigated conversion paths. T-Rex
  • Weapon badge intercepts agent interaction: The weapon badge is wrapped in IgnorePointer and placed as an overflowing visual child. Rendered widget checks confirm right-clicking the exposed badge area does not open the agent menu and portrait drag anchoring remains correct. T-Rex
  • Firearm changes omitted from page transitions: Weapon values participate in tweened visual-property comparison. Focused runtime checks confirm a same-ID Classic-to-Vandal change becomes a move transition for plain, view-cone, and circle agents and stages both weapon states across transition progress. T-Rex
  • T-Rex ran the requested verification, but its local artifact references were not uploaded. T-Rex
  • T-Rex verified that an equipped firearm remains selected when plain, view-cone, and circle agents are duplicated, and confirmed that plain-to-view-cone, view-cone-to-plain, and plain-to-circle conversions retain the selected firearm. T-Rex
  • T-Rex validated pointer isolation, hover and right-click behavior over portrait areas, ensured the equipped-agent drag preserves its anchor across portrait sizes and zoom levels, and rendered the production firearm menu and selected-weapon badge. T-Rex

Summary

  • This change lets players select a firearm for placed agents and lineup agents, shows its silhouette beside the portrait, preserves it in saved strategies, and crossfades it during page transitions. Focused Flutter checks confirmed that older saves still load, firearm selections survive agent conversion and duplication, the badge does not alter pointer or drag behavior, and firearm-only page changes animate correctly.

Reviews (3) · Last reviewed commit: "Wait for firearm image decoding in isola..."

Copy link
Copy Markdown
Owner Author

The visual check requested in the 4/5 review is complete. Native Windows screenshots and the passing test output are now committed under docs/verification/agent-firearms.

The existing gun overhang paints outside the portrait and has no hit target test passed on both native Windows and Windows CI. It unconditionally counts actual white pixels outside the portrait after checking hover and right-click behavior. All 19 firearm silhouettes are visible in the native capture, with unchanged portrait dimensions. The added evidence documents the same application code already reviewed; no runtime behavior changed.

@greptileai please re-review with this rendering evidence and the passing Windows pixel test.

Copy link
Copy Markdown
Owner Author

I reproduced the review's pixel failure by running only the overhang test with a cold image cache. It was a test timing dependency: earlier menu tests had already decoded the Classic image in the full suite.

The test now explicitly awaits precacheImage before capturing pixels. The isolated test changed from failure to pass; all 11 weapon widget scenarios pass, and the isolated native Windows scenario also passes. Runtime code is unchanged. The exact reproduction command is in docs/verification/agent-firearms/README.md.

@greptileai please review the latest commit, including this cold-cache test fix.

@SunkenInTime
SunkenInTime merged commit 5f8f12b into main Sep 13, 2026
3 checks passed
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.

1 participant