Skip to content

Add configurable multi-track rail generation and persistent in-game editing - #98

Open
Jasupa wants to merge 2 commits into
mainfrom
railgen-v2
Open

Add configurable multi-track rail generation and persistent in-game editing#98
Jasupa wants to merge 2 commits into
mainfrom
railgen-v2

Conversation

@Jasupa

@Jasupa Jasupa commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Rail Generator v2 replaces the fixed rail preset with saved rail types. Builders can generate one to eight aligned tracks with individual gaps, sleepers, and optional overhead poles, supports and wires, then manage their presets in-game.

Implementation

  • Separate configuration, generation and menu code. Store custom types in versioned rail-types.yml, with validation and transactional save/delete behavior so failed writes do not change active types.
  • Add selection, search, pagination, creation, editing and deletion menus, including individual track gaps and overhead settings.
  • Validate path overlap, the terrain preparation envelope and the complete placement count before queuing blocks. Abort with a clear error if terrain preparation cannot read the region.
  • Preserve every ballast entry, its order and repetitions when editing or copying a type. The current picker selects one block: explicitly choosing a block replaces the mix, as explained in the editor. Saving unrelated changes preserves the entire mix.
  • Use the shared permission helper and existing denial-message logic. Reloading types requires btt.generator.rail.edit (the rail type edit permission); menu access alone does not allow reload.
  • Remove the incomplete early block estimate. Prepared-region limits and the exact generated block count cover sleepers and overhead infrastructure.
  • Create the track-spacing +/- items directly; the center item opens the individual-gap editor.

The track-switch setting stores a preference for future support; it does not generate switches. Dependency and Shadow relocation settings remain unchanged from main.

Commit batches

  1. feat(rail): add persistent multi-track railway generation and editor — consolidates the previous implementation, excluding the unrelated build changes.
  2. fix(rail): preserve ballast mixes and enforce generation safeguards — addresses the review findings and adds ballast regression tests.

Both batches are based on main at a60f67293681dda3aed4085634038a3342571942.

Validation

  • Gradle build passed, including tests and Shadow packaging with the original build configuration.
  • Regression tests cover unrelated edits, copying a type and explicitly replacing ballast, including repeated materials.
  • git diff --check passed.

Requirements

Rail Generator v2 requirements

@github-actions

github-actions Bot commented Jul 7, 2026

Copy link
Copy Markdown

Qodana for JVM

It seems all right 👌

No new problems were found according to the checks applied

💡 Qodana analysis was run in the pull request mode: only the changed files were checked
☁️ View the detailed Qodana report

Contact Qodana team

Contact us at qodana-support@jetbrains.com

@Jasupa
Jasupa force-pushed the railgen-v2 branch 7 times, most recently from ccc8e63 to 3d6c46b Compare July 11, 2026 20:29
@Jasupa
Jasupa requested a review from Zoriot July 11, 2026 20:36

@Zoriot Zoriot left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Solid Rail Generator v2 overall: clear package split, transactional save/delete, overlap checks before placement, and a usable in-game type editor.

Main concerns: data loss when editing multi-block ballast, missing permission on reload, underestimated pre-check for block count, and missing null-guard after terrain prep.

In game testing is pending - will be done till Sunday night, review partly done by Cursor

Please rebase. Going forward please explain changes which may not be clear in the commit so it's easier to follow and review.

Comment thread build.gradle.kts Outdated
Replace the fixed rail preset with configurable rail types stored in rail-types.yml. Split configuration, generation and menus so persistence, geometry and player interaction can be reviewed independently.

Generate one to eight aligned tracks with individual gaps, sleepers, optional overhead poles, supports and wires. Validate overlapping paths, the terrain preparation envelope and the complete placement set before queuing blocks. Keep preparation progress and cancellation tied to the active generation.

Provide in-game selection, search, pagination, creation, editing and deletion. Version the configuration and make save/delete transactional so failed writes do not change the active types. Add permissions for rail actions and multiple tracks. The track-switch setting is only a stored option for future generation support.

Consolidate the previous implementation commits on the current main branch. Retain the existing dependency and Shadow packaging configuration; the unrelated relocation changes are excluded.
Preserve the complete ordered ballast list, including repeated materials, when editing or copying a type. The single-block picker replaces that list only after an explicit selection, and its description explains this behavior. Persist the complete draft list and cover editing, copying and replacement with regression tests.

Replace the rail-specific permission guard with Utils.checkPermission(CommandSender, String), reusing the existing denial-message logic. Require the rail type edit permission before reloading configuration from disk.

Abort with a player-facing error when terrain preparation returns null. Remove the incomplete five-block-per-track estimate: prepared-region limits and the exact final placement count remain authoritative, including sleepers and overhead structures.

Build the track-spacing minus and plus items directly because the center item opens the individual-gap editor. This avoids constructing an item that is immediately overwritten.

Validation: Gradle build, including the test suite and Shadow packaging, passed with the original build configuration. In-game behavior still requires server testing.
@Jasupa Jasupa changed the title Implements the second version of the rail generator. Add configurable multi-track rail generation and persistent in-game editing Sep 5, 2026
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.

2 participants