Skip to content

feat(merge): remap switch and variable ids the mods share - #8

Merged
Zorkats merged 1 commit into
mainfrom
merge-engine
Nov 18, 2026
Merged

Zorkats merged 1 commit into
mainfrom
merge-engine

Conversation

@Zorkats

@Zorkats Zorkats commented Nov 17, 2026

Copy link
Copy Markdown
Owner

Slice 2r step 3 of the merge engine: switch and variable ids.

What it does

  • Vanilla scan. VanillaStateIds.Scan reads every vanilla data file once and lists the switch and variable ids vanilla names or uses. Lane A caches it per vanilla version (seam R-12). Without it, nothing is shared and recorded entries still apply.
  • Shared ids. An id two enabled mods use and vanilla does not is a StateIdOverlap on its name in System.json. It is a warning that defaults to Accept, since mods may share an id on purpose. A move is only offered, as one run of consecutive free ids for every range it takes along (GR-R14).
  • Names. Different names the sharing mods give the id fold into the overlap; a staying mod's name is kept. "" padding no longer clashes with another mod's name.
  • Own targets. A mod's new id that lands on its own recorded entry's target moves on as a new entry. When it cannot move, the plan warns and the name in the mod's file stays. When a plugin the mod ships names it, the move is only offered (GR-R11), on an overlap of that mod alone if no other mod uses the id.
  • Rewrites. Every command row, page condition, range and name that holds a moved id is rewritten. A range moves whole or not at all.
  • Operands. By-variable rows hold for any designation but 0, as the engine reads them; 203 and 301 keep 1.

Review first

  1. RPGModder.Core/Merge/IdRemapPlanner.States.cs: shared ids, runs, offers, own targets.
  2. RPGModder.Core/Merge/Composer.cs: StateOverlap, FoldSharedNames, padding.
  3. RPGModder.Core/Merge/IdRemapper.cs: name slots and KeepOwnNames.

Out of scope

Command tree and sequence merge (slice 2b) is the next PR.

Checks

  • Full suite on Windows: 1119 passed, 1 skipped
  • dotnet format --verify-no-changes clean, LF only
  • A test interpreter (RPGModder.Tests/Support/TestInterpreter.cs) loads padded database files for all twelve kinds on MZ and MV
  • Mutations over every new branch fail tests

Plan switch and variable ids against vanilla's System.json scan, rewrite every
command row that names one, and report an id two mods use as a StateIdOverlap
with a move offer. Names the sharing mods give fold into that overlap; a mod's
new id on its own recorded target moves on as a new entry, or warns.

Operand rows hold for any designation but 0, as the engine reads them; 203 and
301 keep 1. A test interpreter checks a padded database file loads.
@Zorkats
Zorkats merged commit cacb259 into main Nov 18, 2026
4 checks passed
@Zorkats
Zorkats deleted the merge-engine branch November 18, 2026 23:23
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