Skip to content

Schematics with gaps in link numbers may not be built correctly #326

@cardillan

Description

@cardillan

This is actually a Mindustry bug.

When a schematic has gaps in link names (e.g., only uses switch2 and switch4) , the link numbers may get reassigned when building the schematic in game (to switch1 and swich2 in this case).

With the implementation of #284, the issue can be completely avoided by only using symbolic link names in the schematic definition and having the compiler and schematic builder assign the actual link names automatically, which prevents any gaps in link numbering.

Even if the Mindustry bug is fixed, there is still potentially an issue if the schematics are used in older versions of the game. There are several possible solutions:

  1. Display an error (demoted to a warning when the target is 8.1 if it gets fixed in Mindustry) when a gap in the link numbers is detected.
  2. Add phantom links to the schematic (i.e., links to non-existent block) to fill up gaps in link numbers.
  3. Renumber even physical links automatically to remove gaps.

I'm probably not going to do the second point, not even as an opt-in option. It would create schematics that link to blocks not originally included after being built, and figuring out the positions for the phantom blocks might be tricky. It is possible to add phantom links explicitly if need be.

The third point is a bit iffy when building schematic using mlog (and not Mindcode) code. The mlog code could use switch1 as a variable, for example, even accessing it indirectly via read or write, and forcing the renumbering of switch2 to switch1 could change the intended behavior of the program.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions