Christopher Wiebe 4d3db17a89 M6.2: Step V Abilities — drag-drop assignment + roll/auto-assign
Per GODOT_PORTING_GUIDE.md §7, the highest-risk piece in the wizard.
Three reusable widgets + the orchestrating step.

Scenes/Widgets/AbilityToken.cs:
  Draggable Control with Value + Origin metadata. _GetDragData returns
  a Dictionary payload {kind, value, from, ability, idx} per guide
  §7.1. MouseFilter = Pass so clicks propagate to the parent slot
  for the click-to-return affordance (later removed; see commit body).
  Drag preview is a dimmed duplicate.

Scenes/Widgets/AbilitySlot.cs:
  PanelContainer drop target per guide §7.2. Accepts any
  ability_value payload via _CanDropData / _DropData and emits
  Dropped(payload). Each slot owns one ability id (STR/DEX/CON/INT/
  WIS/CHA).

Scenes/Widgets/AbilityPool.cs:
  HBoxContainer drop target per guide §7.3. Accepts only slot→pool
  drops (returning an assigned value to the pool); pool→pool drops
  are no-ops.

Scenes/Steps/StepStats.cs:
  Direct port of StepStats in steps.jsx per guide §7.4. Standard
  array (default) and roll-4d6-drop-lowest method tabs; Reroll
  button visible in roll mode; Auto Assign sorts the remaining pool
  descending and places the largest values into empty slots ordered
  by class.PrimaryAbility. Three drag-drop cases (pool→slot,
  slot→slot swap, slot→pool) all delegate to a single Patch call,
  then the entire token tree rebuilds from the new draft state on
  the Changed signal — handlers don't reparent anything manually.

Issues hit during development and resolved before commit:
  - Initial click-to-return on slot pre-empted drag-from-slot every
    time (the GuiInput fired on mouse-down, before Godot detected
    the drag). Removed click-to-return — drag is the canonical
    interaction; that matches the React prototype anyway.
  - Token MouseFilter = Stop blocked clicks from reaching the slot
    layer; switched to Pass which still works as a drag source.
  - Refresh() teardown + rebuild reset the parent ScrollContainer's
    scroll to 0 every drop. CallDeferred / SetDeferred / CreateTimer
    all raced because layout settles over multiple frames; the fix
    that worked was capturing scroll position pre-rebuild and
    restoring in _Process the next frame.

Wizard.cs:
  StepTypes[5] = typeof(StepStats); the Abilities step is now
  reachable. (StepTypes[1..4, 6..7] still null — coming in M6.3+.)

Verified: all three drag scenarios + click handling + auto-assign
+ method switch + reroll work; scroll position holds across drops.

Closes M6.2. Next per guide §12: M6.3 — popover system (TraitChip +
shared PopoverLayer) before adding more easy card-grid steps.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-02 20:36:19 -07:00
S
Description
No description provided
3 MiB
Languages
C# 95.4%
JavaScript 3.3%
HTML 1.3%