Skip to content

[FEATURE] Add subways and tunnels #418

@GMart

Description

@GMart

Idea
Right now the code skips tunnels and subways.
I don't know Rust very well. I think this can be added:
If the tag includes tunnel or subway, and terrain is turned on and fill ground is turned on, then
respect the layer tag, and render the rails underground. Include one block of air above the rail.
Any rail stations can be rendered as grey terracotta or concrete next to the rail line.

Code idea
I attempted to add the idea by adding these lines of code, among others. It sometimes works for underground tunnels, but not for overhead flyover lines.
Line 44 of railways.rs:

    let mut ground_level = ground.level(XZPoint::new(bx, bz));
        if let Some(level_str) = element.tags.get("layer") {
            if let Ok(level) = level_str.parse::<i32>() {
                ground_level += level * 2;
            }
        }

Then I also added at line 66:

 if ground_level<0 {
                    editor.set_block(AIR, bx, ground_level + 2, bz, None, None);
                }

So that there was an air block above the rails.

Metadata

Metadata

Assignees

No one assigned

    Labels

    featureFeature request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions