# tools/extract-gmd/data/

## action-ids.json

Lookup table for GameMaker DnD `Action_ID` → engine action descriptor. Consumed
by `src/dnd/actionLookup.ts` (cached after first load) and `src/dnd/transcompile.ts`
(per D-09 / D-10 / D-11).

**Source:** LateralGM 1.8.234 `org/lateralgm/resources/library/default/*.lgl` —
the binary library files shipped inside the LateralGM Java application that
encode the stock GameMaker 5.x DnD action set (move, main1, main2, control,
score, extra, draw — 7 files, 134 unique action IDs).

**Upstream:** https://github.com/IsmAvatar/LateralGM (tag `v1.8.234`).

**Format:** sorted-keys JSON array of `LibAction` objects:

```ts
interface LibAction {
  id: number;            // ascending; the lookup key
  name: string;          // LateralGM action name (e.g. "Move", "Code")
  description?: string;  // human-readable short description
  argCount: number;
  argKinds: number[];    // ArgType enum values (0=Expression, 1=String, ...)
  gmlTemplate?: string;  // best-effort GML; @N substituted with argValues[N]
  isCode?: boolean;      // true for the "execute a piece of code" action
}
```

The array is sorted by `id` ascending and each object's keys are sorted
alphabetically — both for stable, line-reviewable diffs (D-15 byte-determinism).

**Reproducibility:** the JSON is regenerated by
`scripts/port-action-ids.ts`, which clones LateralGM at the pinned tag, parses
each `.lgl` file using the binary layout documented in
`org/lateralgm/resources/library/LibManager.java#loadLgl`, and writes the
sorted JSON. Run with `--check` to verify the committed file is byte-identical
to a fresh re-port — CI runs this on every PR.

```sh
# Re-port (writes data/action-ids.json):
pnpm tsx tools/extract-gmd/scripts/port-action-ids.ts

# Verify byte-identity vs upstream LateralGM 1.8.234:
pnpm tsx tools/extract-gmd/scripts/port-action-ids.ts --check
```

**Re-port if:** LateralGM upstream releases a pinned-tag bump that adds or
revises stock 5.x action descriptors. Bump `LATERALGM_TAG` in the porter,
re-run, commit the new JSON + the porter diff together.

**Plan deviation note:** plan 01-03 expected ≥250 entries based on a planner
estimate; the actual stock count in 1.8.234 is **134** (the porter asserts
≥100 as a defensive floor). 250 was a guess that didn't survive contact with
upstream's actual library files.

### D-08 path (a) extension (Phase 2, plan 02-02)

Two action IDs surfaced as UNKNOWN by Phase 1 plan 01-07 in
`extracted/client-5-8/UNKNOWN-ACTIONS.md`:

| ID  | Sites | Source                                                                                                                                |
|-----|-------|---------------------------------------------------------------------------------------------------------------------------------------|
| 523 | 16 (Draw events on title/exit/connect/...) | LateralGM "Set font" — argument shape verified by inspection of `extracted/client-5-8/objects/0034-title/events/Draw.dnd.json` (8-kind argTypes `[1,0,0,3,3,3,0,0]`, 6 actual argValues `["OCRA","20","16711680","0","0","0"]`) |
| 525 | 11 (Draw events on commandob/chatob/...) | LateralGM "Set font (combined)" — argument shape verified by inspection of `extracted/client-5-8/objects/0045-commandob/events/Draw.dnd.json` (1 composite argValue `"Fixedsys,12,16777215,0,0,0,0"` = name,size,color,bold,italic,halign,valign) |

**Entry count:** 134 → 136. The two entries were added by **hand-authoring**:
the existing porter at `scripts/port-action-ids.ts` did not surface these IDs
from LateralGM 1.8.234's stock 7 default `.lgl` files (move/main1/main2/control/
score/extra/draw). They likely live in an unparsed Draw extension `.lgl` or a
filtered library file. Hand-authored signatures match the `.dnd.json` argTypes
verbatim and are exercised by 4 unit tests in
`tests/dnd/transcompile.test.ts` under the
`D-08 path (a): action IDs 523 + 525 (Phase 2 plan 02-02)` describe block.

**Naming choice:** id 526 in upstream LateralGM is already named `Set_Font`
(the older single-font/cursor action `action_font(font, transparent)`).
To avoid name collision in the lookup table, IDs 523 and 525 are named
`Draw_Set_Font` and `Draw_Set_Font_Combined` respectively — semantically
matching their direct-invocation `draw_set_font*` GML emit.

**Re-port hygiene:** if a future LateralGM tag actually ships these two IDs
in upstream `.lgl` files, the porter's `--check` mode will diff against this
hand-authored content and surface the drift; resolve by accepting upstream's
naming + template (and updating the 4 D-08 tests if the regex still matches).
