Skip to content

Add API 3 object visibility and block edits with shared contracts - #104

Closed
Roxas2712 wants to merge 17 commits into
UNDERdecoded:mainfrom
Roxas2712:codex/api3-world-edits
Closed

Roxas2712 wants to merge 17 commits into
UNDERdecoded:mainfrom
Roxas2712:codex/api3-world-edits

Conversation

@Roxas2712

@Roxas2712 Roxas2712 commented Oct 22, 2026 •

Copy link
Copy Markdown

Depends on #103 and its API prerequisites (#102, #90–#99), which remain open and are included as ancestors. Merge those first, then rebase before merging this PR. The implementation is isolated in 2ea78e3db7a07532c6ab08a2c0cd0e7b7edeee5d (implementation-only diff). No shader dependency is added.

Behavior

API-3 mods currently receive unsupported results for mod.world:toggleObject() and mod.world:replaceBlock() despite existing native paths. Enable both for generations 1–3 with validation and native idle-world admission. Invalid arguments, malformed target stores, missing runtime geometry/redraw services and busy world owners decline before native effects. API-3 Gen4/5 remain unavailable; API-1/2 facade behavior and the portable script vocabulary are unchanged.

Preserve native generation semantics: Gen1 visibility keys may target inactive maps; Gen2/3 resolve active-map templates and use native visibility effects, including persistent event flags and visit-scoped flagless state. Extract Gen2's existing appear/disappear effect into a shared native helper so public template resolution does not depend on cached script-object numbering. Targeted synchronization leaves unrelated live actors in place, including actors sharing a flag.

Validate zero-based block coordinates and IDs (Gen1/2: 32px blocks, IDs 0–255 present in the tileset; Gen3: 16px metatiles, IDs 0–1023). Replace through the host's native block/metatile paths, including Gen3's default collision/shut-cell reset and redraw. Emit one native-shaped public event per successful edit. Gen2Recomped retains instance patches without rewriting generated map data.

Reuse the API-3 owner lease from #103: rollback, reload and teardown retire retained mutation facades. Decline reentrant edits during an edit's own event/native callback; release the guard on both success and exceptions. Native failures after entering a mutation are not transactional rollbacks.

Reference routing, persistence, geometry and reproduction. This does not invent common map/object IDs or a shared collision table.

Validation

  • 40 cross-engine comparisons / 80 isolated LuaJIT runs, against clean pinned bryanthaboi/gen1recomp@79ea62f45fb2ea8f65d081a109431e4eb1bbdb36. The same new fixture manifest/source runs through both real loaders for Red, Blue, Yellow, Gold, Silver, Crystal, FireRed and Emerald. All previous entry, rollback, generated-starter and warp cases remain. Reports include fixture hashes and the tested clean feature head.
  • New shared cases compare argument/bounds refusals, busy-world admission, object reference routing, visibility and flag changes, native block reads/geometry and public events. Engine-specific setup stays in the driver; the mod has no engine imports or backend-specific branches. Map/render/object seams remain synthetic; this is not rendered retail-ROM equivalence.
  • 238/238 targeted object/block checks, 108/108 API-3 compatibility checks and 206/206 existing warp checks. Local tests exercise actual native Map/block redraw and OverworldState object synchronization with pooled synthetic actors: shared flags, retained positions, flagless visit reset, packed metatiles, collision clearing, malformed stores, native command numbering, reentry, native exceptions, retired owners and legacy behavior.
  • Full ROM-free run: 78/88 engine, 3/3 mod-SDK, B30 PASS. The 27 complete FAIL lines match a fresh Add validated API 3 world warps and cross-engine contracts #103 baseline byte-for-byte; no new failing suite.
  • Integration of Add configurable mod load order to launcher and mod profiles #88–Add validated API 3 world warps and cross-engine contracts #103 plus this change: 83/93 engine, 3/3 mod-SDK, B30 PASS, with the same exact 27 FAIL lines. All 40 shared comparisons pass on the combined tree too. The existing API-3 CI workflow automatically runs the new world_edits mode.
  • Changed/new Lua formatting, Python parsing and diff checks pass. The small native helper extraction preserves existing formatting. No retail-ROM scene playthrough was performed.

The ten unchanged failing engine suites are gate_fingerprint, gate_meta_coverage, quit_thread_shutdown, rebind_capture_bug510, rebind_swap_clear_bug589, soft_reset_bug563, tool_mod_hooks, update_check_tests, update_tests and wide_battle_layout.

Hosted CI: API 3 contracts and ci currently report action_required and await maintainer approval for the fork workflows. All local results above were run against the published source; no hosted green result is claimed.

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