Skip to content

After #96: autoMining() and autoRestore(), guards on the order verbs, the card library on a branch - #97

Merged
jeany55 merged 6 commits into
mainfrom
library-names-and-guards
Nov 15, 2026
Merged

jeany55 merged 6 commits into
mainfrom
library-names-and-guards

Conversation

@jeany55

@jeany55 jeany55 commented Nov 15, 2026

Copy link
Copy Markdown
Contributor

The follow-up to #96, which was merged as it was. These are the changes the review on #88 asked for, and the ones found reading #96.

What changes

  • The libraries' calls are autoMining() and autoRestore(), not buildAutoMiningProgram() and buildAutoRestoreProgram(). The rest of the standard library names what a thing does for the map. The longer names were there to say "top of the script only"; since A function that reaches program() or trigger() is refused where a program calls it #90 the compiler says that itself, at the call. Both libraries have a test of that error.
  • u.gather(), u.cast() and u.stop() leave a burrowed or loaded unit as it is. The three write an order into the unit, past everything the game checks before it takes a command. The player has no command for a burrowed Drone or an SCV in a Dropship, so the lowering and the simulator test the unit's status first (bits 0x10 and 0x40) and write nothing. The doc comments say what is written, where they said "as a right-click does".
  • autoRestore() passes over a Medic that cannot cast: in stasis, under Maelstrom, or loaded. Nothing looked at the Medic's own state, so such a Medic could be given the cast and then hold its target, and no other Medic went. A Medic under Maelstrom is still a unit to restore.
  • A test in the game reads u.orderTarget. The lifted game's test world had the two positions and hasTarget, not the unit.
  • trigscript/card and auto-restore's right-click toggle leave main and wait on the card-right-click branch, which brings them back in one commit. The card library finds which graphics are on by sending the view to the middle of the map and back at the start of the game, and its button positions were measured on one computer. A library module's names are public from the first release that has it, so it should be played on more setups first. This also means importing trigscript/spells no longer reserves a location for the card's measurement. local.mouse.buttons, local.card.buttonSet and local.screen.width stay.
  • docs/v4-plan.md has a section for this work and its open list: what the card branch waits on, what has not been played in Remastered, the fixed worker and Medic types (a mod's worker gets nothing), cast() being Restoration only.

Testing

  • npm run typecheck is clean and npm test passes: 83 files, 1484 tests.
  • New tests: the two refusals inside program(); a burrowed Drone, a loaded SCV and a loaded Medic left alone by the three verbs, the simulator and the emitted triggers agreeing; four Medics around an ensnared Marine, of which only the one that can cast goes; orderTarget read from a stand-in game's memory.
  • Not played in Remastered. The guard for burrowed and loaded units has emitter tests only; the plan's open list says so.

After this

Tag 4.5.0, move the editor's pin, and scm-js/scm-js#233 takes the two new names and holds its card and toggle sections back.

🤖 Generated with Claude Code

https://claude.ai/code/session_01VEdp4YG8zxHxfqFjpBsycX

jeany55 and others added 6 commits November 14, 2026 19:12
buildAutoMiningProgram() and buildAutoRestoreProgram() said how they are built.
The rest of the standard library names what a thing does for the map (every,
after, choose, say), and the reason for the longer names is gone: a call inside
a program is now an error at the call, which says to move it to the top of the
file. Both libraries have a test of that error.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VEdp4YG8zxHxfqFjpBsycX
The three write an order into the unit, past everything the game checks before
it takes a command. A burrowed Drone and an SCV in a Dropship have no such
command: a right-click does nothing for either. The lowering and the simulator
now test the unit's status first (burrowed, in a transport or a Bunker) and
write nothing for such a unit.

The doc comments said "as a right-click does" and "as the Stop button does".
They now say what is written and what is not checked.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VEdp4YG8zxHxfqFjpBsycX
The card library tells Classic graphics from Remastered's by sending the
player's view to the middle of the map and back at the start of the game, and
its button positions were measured on one computer. It was played on a Mac
only. As a module of the standard library its names are public from the first
release that has it, so it leaves main until it has been played on more
setups: the module, the toggle option of autoRestore(), their ledger rows and
their tests. The `card-right-click` branch brings all of it back in one commit.

Two things this also settles for plain autoRestore(): importing
trigscript/spells no longer reserves one of the map's locations for the card's
measurement, and the program is one program again, not a copy for each player.

local.mouse.buttons, local.card.buttonSet and local.screen.width stay: they
are reads, each played.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VEdp4YG8zxHxfqFjpBsycX
Nothing in the library looked at the Medic's own state, so one in stasis,
under Maelstrom, or loaded in a transport or a Bunker could be given the cast
when its order read as idle. It could not carry the cast out, and while it
held the order its target counted as taken, so no other Medic went. Such a
Medic is no longer a candidate; the next nearest that can cast goes. A Medic
under Maelstrom is itself a unit to restore, as before.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VEdp4YG8zxHxfqFjpBsycX
The lifted game's test world read where an order is aimed and whether it has
a target, but not the target itself: `u.orderTarget` in a script's test was
nothing where the game had a unit. It is the pointer `hasTarget` reads, taken
to its slot of the unit table.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VEdp4YG8zxHxfqFjpBsycX
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