DA Mod Editor: reference slots (chambered/magwell/opening), editor metadata file, slide simulation #38
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Context
The DA Mod Editor (tracking issue #35) staging scene lets modders place markers and rails visually, but they position fields (the magwell rail, colliders) by numbers, blind. To line everything up correctly, the author needs to see the items that occupy those positions — a mag in the magwell, a bullet in the chamber, a bullet at the mag's opening — rendered in the staging scene as references.
Reference slots
Named sockets where a reference item renders as a ghost (visible, not editable). The slots follow the item's structure:
chambered(a bullet in the chamber) andmagwell(a mag).opening(a bullet at the opening — the first-out bullet).Each slot has an editor-only dropdown to pick the item to render. The dropdown is tag-gated by a simple "does the item have X tag" check, reusing the existing dot-prefix tag system:
mag-tagged items.ammo-tagged items.The dropdown defaults to the accepted item (the gun's accepted mag, the mag's accepted bullet), but any item with the right tag can be picked — so cross-fits (a rifle mag in a pistol magwell) render as visible misfits, while nonsense (a gun in a magwell) is excluded by the tag gate.
Cascading
A slot rendering an item surfaces that item's own slot options: a mag in the magwell shows its opening-bullet dropdown. The reference tree is assembled by walking metadata files; each item's slot choices live in that item's own metadata file. Tag-gating bounds the nesting (a gun cannot go in a magwell, so no cycles).
Editor metadata file
<item>.modtool_meta.jsonalongside<item>.json. It stores editor-only state (which item is in each reference slot). The editor auto-detects and loads it when the item is loaded; defaults apply when absent. It is committed with the mod, so the references are already set up for everyone who opens the item. It is never read by the game, and it must never be written into the item JSON.Chamber position
The chamber has no position in the JSON today, so this needs a new
gun_chambermarker (placed by the modder where the breech is), with a sensible default pulled back along +Z from the muzzle. Like other markers, its position saves to the item JSON when moved.Slide simulation
A dock slider (0–1) drives the actual slide node along its axis in the staging scene (0 to the travel length, 0.05 m default), plus a fire/rack control that plays the slide cycle (back to max travel, return to forward). Uses the existing slide identification (gun_slide role or by name) and travel (rail / slide_travel field else 0.05 m default). The slide gizmo (forward/back wireframes + travel line) stays as-is.
Pose agreement
Reference items must sit where the game puts them — the insert pose. The editor and the game must agree, or the editor lies. This connects to the held-off "render the real mag GLB" change (same pose problem, same definition); that change is NOT authorized by this issue.
Scope
No build is authorized by filing alone — this issue tracks the feature. The build follows in the same work as this filing.
Closing: built and merged in PR #41 (merge commit
a5838000d4) — reference slots (chambered / magwell / opening), editor metadata files, slide simulation, plus the magwell coupling fix. All on main.