Skip to content

Commit a255267

Browse files
committed
frame: clear target on the target verb when unit is "none"
Retail's SecureActionButton target action treats a "none" unit as "clear target". Match it: the `target` verb calls ClearTarget() when the resolved `unit` is "none" (case-insensitive), before the normal cursor/spell precedence. Mouseover already handles "none" implicitly (it resolves to GUID 0 = no unit). Docs' target-verb row updated.
1 parent aca964d commit a255267

2 files changed

Lines changed: 6 additions & 1 deletion

File tree

docs/API.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3874,7 +3874,7 @@ modifier/button-qualified, same precedence as `type`):
38743874

38753875
| Verb | Extra attributes | Action |
38763876
|------|------------------|--------|
3877-
| `target` | — | Targets the `unit`. Respects the engine's default-interaction precedence: with a spell on the cursor it casts on the unit, with an item on the cursor it drops it on the unit, instead of switching target. |
3877+
| `target` | — | Targets the `unit` (or clears the target if `unit` is `"none"`). Respects the engine's default-interaction precedence: with a spell on the cursor it casts on the unit, with an item on the cursor it drops it on the unit, instead of switching target. |
38783878
| `assist` | — | Targets the `unit`'s target. |
38793879
| `focus` | — | Sets the ClassicAPI focus to the `unit`. |
38803880
| `spell` | `spell` | Casts the `spell` on the `unit` via [`C_Spell.CastAtUnit`](#c_spellcastatunitspellidorname-unit) — the unit's GUID goes straight to the cast dispatcher (no target juggling), and ground-target spells land at the unit's feet. |

src/frame/Attributes.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -553,6 +553,11 @@ bool DispatchVerb(void *L, int fi, const char *prefix, const char *suffix,
553553
const char *verb, const char *unit) {
554554
if (EqI(verb, "target")) {
555555
if (!unit) return false;
556+
// `unit="none"` clears the target (retail's SecureActionButton behavior).
557+
if (EqI(unit, "none")) {
558+
CallGlobal(L, "ClearTarget");
559+
return true;
560+
}
556561
// Cursor / pending-spell take precedence, matching the engine's default
557562
// unit interaction — cast the pending spell / drop the item on the unit
558563
// instead of switching target. The two predicates are ours (direct C++);

0 commit comments

Comments
 (0)