Repository navigation
Show the rail network on a Rail tab in the staff panel #110
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 1 commit
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| # Rail network | ||
|
|
||
| The staff panel's Rail tab draws the Minecraft server's rail network on the | ||
| live map: every VehicleFramework track, its junctions and ends, broken or | ||
| damaged stretches, and the stops along it. `GET /admin/rail?map=<id>` serves | ||
| it to admins and the owner (`view_rail`). Track positions are not personal | ||
| data, so views are not audited. | ||
|
|
||
| VehicleFramework saves one JSON file per track in | ||
| `plugins/VehicleFramework/data/tracks/<world>/`, with switches in | ||
| `junctions/` beside them. A track holds a sample about every block and one | ||
| segment per pair of samples; a segment can be broken or damaged. The backend | ||
| reads the files on request and keeps the result until any file, the map's | ||
| `map_markers.json` or its `province_id_runs.bin.gz` changes. A file caught | ||
| mid-save is skipped and counted, so the page can say so. | ||
|
|
||
| - **Stops** are the settlements whose provinces a track crosses. Each sits | ||
| where the track comes closest to the settlement inside its provinces. | ||
| - **Lines** are tracks joined by junctions. A line is named after its first and | ||
| last stop along its longest track; one with no stops is an "Unnamed line". | ||
| - Tracks are simplified (Douglas-Peucker, 0.35 blocks) before they are sent. | ||
|
|
||
| ## Settings | ||
|
|
||
| | Variable | Meaning | | ||
| | --- | --- | | ||
| | `RAIL_TRACKS_DIR` | VehicleFramework's `data/tracks` folder inside the backend container. Unset: the tab says the site is not set up to read the network. | | ||
| | `RAIL_WORLD` | The world folder to read: the server's `level-name`. Defaults to `COREPROTECT_MAP_WORLD`, then `TFMC_Map`. | | ||
|
|
||
| Mount the folder read-only in the host's `docker-compose.override.yml`, like | ||
| CoreProtect's: | ||
|
|
||
| ```yaml | ||
| services: | ||
| backend: | ||
| volumes: | ||
| - /home/amp/.ampdata/instances/TFMCMain01/Minecraft/plugins/VehicleFramework/data/tracks:/vehicleframework-tracks:ro | ||
| environment: | ||
| - RAIL_TRACKS_DIR=/vehicleframework-tracks | ||
| ``` |
Empty file.
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| import sys | ||
| from pathlib import Path | ||
| import pytest | ||
|
|
||
| BACKEND = Path(__file__).resolve().parents[2] | ||
| if str(BACKEND) not in sys.path: | ||
| sys.path.insert(0, str(BACKEND)) | ||
|
|
||
|
|
||
| @pytest.fixture | ||
| def database(tmp_path, monkeypatch): | ||
| from src.skins import db | ||
| monkeypatch.setattr(db, "DB_PATH", tmp_path / "province.db") | ||
| monkeypatch.setattr(db, "DATA_DIR", tmp_path) | ||
| for name in ("SKINS_DIR", "WARDROBE_DIR", "DRINKS_DIR"): | ||
| monkeypatch.setattr(db, name, tmp_path / name.lower()) | ||
| db.migrate() | ||
| return db |
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.