Repository navigation
Step 14: the build in the editor — TrigScript builds the map itself - #60
Merged
Merged
Conversation
The map of our own is what Save, Test Map and an export write: the plugin's own build step (buildOwn, compiler/backend/build.ts in the compile worker) lays the programs out into the scenario the host hands it, on its bytes alone (chk.ts), with eudplib's fixes to the map (fixes.ts) and the script's settings; a refusal is a warning on the line while the script is typed (CompileResult.ownRefusal) and goes into the manifest, which decides the changeover: TrigScript's step where it takes the script, the eudplib contribution elsewhere and where Magenta shares the map. build-own.mts builds through the same function; the step-13 probe prints the same lines either way in the lifted game, and the editor was driven headlessly. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01En4SHqafb1QFJ4xgbUkAe5
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
TrigScript 4, step 14 of the way off eudplib: the map of our own is what Save, Test Map and an export write, from the editor — no eudplib, no Python, no download.
The build step (
service.tsbuildOwn,compiler/backend/build.ts, run in the compile worker). Registered with the host'sdocument.buildSteps.addbeside thebeforestep that applies the script. It works on the scenario's bytes alone: the host hands it the map as Save would write it, it reads the CHK out withsections.chkOf(plugin-api 1.61.0), lays the programs out after the strings and the start-up into TRIG, and hands a bare scenario back — the editor lays the file out with the user's save options and the map's members as they were, so the plugin writes no archive.chk.tsreads and writes the sections touched (chunks, STR read on as STRx, DIM/OWNR/FORC, UNIT, UPRP/UPUS);fixes.tsdoes what eudplib does to a map before writing it (UNIT flags, UNIx/UPGx/TECx rows at the defaults, VER 206, null tiles), each said in Output. The map's own triggers come out of the input's TRIG — hand triggers and the script's block as the apply ordered them. The script's settings (heap cells, stack depth) reach the emitter.A refusal while the script is typed.
compileScripttakesown(who plays, the map's size) and answersownRefusal—emitOwnon a copy of the IR, the first part it never takes with its line, and the file when it is not the entry file. The editor shows it as a warning on the line (Problems, "build" column; Monaco), and the apply writes it into the manifest.The changeover, as the audit proposed: TrigScript builds wherever the emitter takes the whole script, eudplib elsewhere — both decided off the manifest, so a save asks for free. The own step applies when the script has programs, the manifest holds no refusal and Magenta's member is not in the map; the eudplib contribution applies when the step does not. The status bar reads built by TrigScript, or eudplib's state with why underneath; Output gets the build's lines through the same events as the library's builds.
Checked.
scripts/build-own.mtsnow calls the samebuildOwnMap: the step-13 probe built with the old script and the new prints the same ten lines at the same frames in the lifted game, and its sections differ only by the fixes. Headless in the editor (plugin served from the worktree, dist override): a program typed, Apply, Ctrl+S — built by TrigScript, the Output lines, "Built 290 KB", the downloaded file VER 206 with 65 start-up triggers and the build manifest namingtrigscript/build, the source inside at VER 205 with its 3 triggers.Tests:
tests/own-build.test.ts(8),tests/service.test.ts(+3, the eudplib tests moved onto a refused program); the suite 1,362 green, the ledger unchanged.Docs: README (the intro, the status bar, saving, troubleshooting, the source table),
docs/v4-plan.md("The build in the editor (2026-10-23)", step 14 ✓, the Open list's leftovers: Magenta on the own layout, protection, the fixes' lines, a refusal found at build only),plugin.json. The editor's own guide (scm-js/docs/trigscript.md) follows in scm-js.🤖 Generated with Claude Code
https://claude.ai/code/session_01En4SHqafb1QFJ4xgbUkAe5