Skip to content

Update leisure and highway element processing #425

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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 14 commits into from
May 3, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/block_definitions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ impl Block {
}

pub fn namespace(&self) -> &str {
"mincraft"
"minecraft"
}

pub fn name(&self) -> &str {
Expand Down
16 changes: 16 additions & 0 deletions src/element_processing/highways.rs
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,22 @@ pub fn generate_highways(editor: &mut WorldEditor, element: &ProcessedElement, a
block_type = GRAY_CONCRETE;
block_range = 2;
}
"secondary_link" | "tertiary_link" => {
//Exit ramps, sliproads
block_type = BLACK_CONCRETE;
block_range = 1;
}
"escape" => {
// Sand trap for vehicles on mountainous roads
block_type = SAND;
block_range = 1;
}
"steps" => {
//TODO: Add correct stairs respecting height, step_count, etc.
block_type = GRAY_CONCRETE;
block_range = 1;
}

_ => {
if let Some(lanes) = element.tags().get("lanes") {
if lanes == "2" {
Expand Down
18 changes: 13 additions & 5 deletions src/element_processing/leisure.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,29 @@ pub fn generate_leisure(editor: &mut WorldEditor, element: &ProcessedWay, args:

// Determine block type based on leisure type
let block_type: Block = match leisure_type.as_str() {
"park" => GRASS_BLOCK,
"playground" | "recreation_ground" | "pitch" => {
"park" | "nature_reserve" | "garden" | "disc_golf_course" | "golf_course" => {
GRASS_BLOCK
}
"playground" | "recreation_ground" | "pitch" | "beach_resort" | "dog_park" => {
if let Some(surface) = element.tags.get("surface") {
match surface.as_str() {
"clay" => TERRACOTTA,
"sand" => SAND,
"tartan" => RED_TERRACOTTA,
"grass" => GRASS_BLOCK,
"dirt" => DIRT,
"pebblestone" | "cobblestone" | "unhewn_cobblestone" => COBBLESTONE,
_ => GREEN_STAINED_HARDENED_CLAY,
}
} else {
GREEN_STAINED_HARDENED_CLAY
}
}
"garden" => GRASS_BLOCK,
"swimming_pool" => WATER,
"swimming_pool" | "swimming_area" => WATER, //Swimming area: Area in a larger body of water for swimming
"bathing_place" => SMOOTH_SANDSTONE, // Could be sand or concrete
"outdoor_seating" => SMOOTH_STONE, //Usually stone or stone bricks
"water_park" | "slipway" => LIGHT_GRAY_CONCRETE, // Water park area, not the pool. Usually is concrete
"ice_rink" => PACKED_ICE, // TODO: Ice for Ice Rink, needs building defined
_ => GRASS_BLOCK,
};

Expand Down Expand Up @@ -79,7 +87,7 @@ pub fn generate_leisure(editor: &mut WorldEditor, element: &ProcessedWay, args:
editor.set_block(block_type, x, 0, z, Some(&[GRASS_BLOCK]), None);

// Add decorative elements for parks and gardens
if matches!(leisure_type.as_str(), "park" | "garden")
if matches!(leisure_type.as_str(), "park" | "garden" | "nature_reserve")
&& editor.check_for_block(x, 0, z, Some(&[GRASS_BLOCK]))
{
let mut rng: rand::prelude::ThreadRng = rand::thread_rng();
Expand Down