Skip to content

Take a circle or cone off an agent without deleting the agent - #473

Merged
SunkenInTime merged 2 commits into
mainfrom
t3/detach-from-agent
Nov 2, 2026
Merged

SunkenInTime merged 2 commits into
mainfrom
t3/detach-from-agent

Conversation

@SunkenInTime

@SunkenInTime SunkenInTime commented Nov 2, 2026 •

Copy link
Copy Markdown
Owner

Before and after

Detaching a circle and a cone in a running build

Drop a circle or a cone on an agent and the two become one item. A cone could be taken off ("Remove View Cone"), but a circle couldn't: the only way to get rid of it was to delete the agent. LeonTM asked for this on Sep 9: "now you have to delete agents once stuff is attached and you want to remove it", with a right-click menu to detach.

The agent menu now has:

  • Detach circle and Remove circle on an agent with a circle
  • Detach view cone next to Remove View Cone on an agent with a cone

Detaching is attaching run backwards (_convertFreeUtilityToComposite). The agent goes back to a plain PlacedAgent with the same id, caption, weapon and team, and a free customCircle or view cone utility is added with the same diameter, colour and opacity, or the same preset, rotation, length and eye height. It's one transaction, so it's one undo step. The free item's saved position is the top-left that puts its anchor on the agent's middle (detach_from_agent.dart). Remove circle mirrors convertViewConeAgentToPlain.

No saved-format change: both kinds already exist and every build draws them.

Seen in a running build

Driver build of this branch, Ascent (tool/drive/scripts/detach-from-agent.json, clean run):

  • A circle dropped on Sova, then Detach circle. The circle's middle is at (559.5, 599.5) on screen before and after, measured from its outline. Dragging Sova away leaves the circle where it was.
  • Ctrl+Z twice undoes the move and then the detach, back to one item with no free circle.
  • Remove circle leaves only Sova.
  • A 103° cone dropped on Cypher, then Detach view cone. The screen is pixel-identical before and after (0 pixels differ). Dragging Cypher away leaves the cone and its eye where they were.

Test

test/detach_from_agent_test.dart:

  • A detached circle and cone are drawn with their middle on the agent's middle, on attack and defense, on Ascent, Bind and Lotus (three map scales), at two marker sizes other than the saved ones. It measures through the canvas's drawing path (screenPositionForWidget), not the formula detach uses, and fails by 1168 px if detach skips the placement step.
  • What carries over to the two pieces (id, caption, team, diameter, colour, opacity, preset, rotation, length, eye height), undo and redo as one step each, and nothing for a plain agent.

Not covered

  • "Detach view cone" is sentence case next to the older "Remove View Cone". I left the old label alone.
  • Web and cloud weren't run. Detach sends an agent edit and a utility add, the same ops attaching sends in reverse.

ci: analyze test

RetriggerView in GreptileConfidence Score: 5/5

The PR appears safe to merge once CI confirms the added placement test passes.

Summary

The PR lets users detach circles and view cones without deleting their agents. It also adds circle removal.

  • Agents can now split their circles and cones into separate map items.
  • Circle agents can lose their circle without losing the agent.

Reviews (2) · Last reviewed commit: "Test that a detached item is drawn on it..." · Reviewed by Greptile

An agent with a circle now has Detach circle and Remove circle in its
right-click menu, and one with a cone gains Detach view cone beside Remove
View Cone. Detaching is the reverse of dropping one on an agent: the agent
goes back to a plain agent with the same id, and a free circle or cone is
added drawn on the same spot, in one undo step. Both are kinds every build
already saves.
@coderabbitai

coderabbitai Bot commented Nov 2, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

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

Next included review available in 47 minutes.

Check out review usage here.

View limit details

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

Learn how review limits work.

Review configuration:

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: f8c9a261-15c3-418d-b6a6-73cf54c5a351
Commits

Reviewing files that changed from the base of the PR and between 912cc37 and 14a346d.

Files selected for processing: 5
  • lib/providers/agent_provider.dart
  • lib/widgets/draggable_widgets/agents/agent_widget.dart
  • lib/widgets/draggable_widgets/agents/detach_from_agent.dart
  • test/detach_from_agent_test.dart
  • tool/drive/scripts/detach-from-agent.json
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

@SunkenInTime
SunkenInTime merged commit a29d078 into main Nov 2, 2026
15 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