-
-
Notifications
You must be signed in to change notification settings - Fork 357
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
Added ores generation in quarries #337
Open
Oleg4260
wants to merge
11
commits into
louis-e:main
Choose a base branch
from
Oleg4260:main
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+65
−11
Open
Changes from 4 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
cc1e28b
Added ores generation in quarries
Oleg4260 6b52785
cargo fmt
Oleg4260 622edaf
Added feature to fill ground with stone
Oleg4260 cde0042
Trying to fix compilation error
Oleg4260 ce0bce9
Added feature to fill ground with stone
Oleg4260 3b1425c
Merge branch 'main' of https://github.com/Oleg4260/arnis
Oleg4260 0e28d34
Use editor.fill_blocks() instead of loop
Oleg4260 0c9c8e1
Merge branch 'main' of https://github.com/Oleg4260/arnis
Oleg4260 3d0a1c3
cargo fmt
Oleg4260 211ac4e
Merge branch 'main' of https://github.com/Oleg4260/arnis
Oleg4260 c578a43
Replace light concrete with dirt path for highway:path
Oleg4260 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 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 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 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 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 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 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 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 |
---|---|---|
@@ -1,6 +1,7 @@ | ||
use crate::args::Args; | ||
use crate::block_definitions::*; | ||
use crate::cartesian::XZPoint; | ||
use crate::data_processing::MIN_Y; | ||
use crate::element_processing::tree::create_tree; | ||
use crate::floodfill::flood_fill_area; | ||
use crate::ground::Ground; | ||
|
@@ -45,15 +46,15 @@ pub fn generate_landuse( | |
"military" => GRAY_CONCRETE, | ||
"railway" => GRAVEL, | ||
"landfill" => { | ||
// Gravel if man_made = spoil_heap, coarse dirt else | ||
let manmade = element.tags.get("man_made").unwrap_or(&binding); | ||
if manmade == "spoil_heap" { | ||
// Gravel if man_made = spoil_heap or heap, coarse dirt else | ||
let manmade_tag = element.tags.get("man_made").unwrap_or(&binding); | ||
if manmade_tag == "spoil_heap" || manmade_tag == "heap" { | ||
GRAVEL | ||
} else { | ||
COARSE_DIRT | ||
} | ||
} | ||
"quarry" => STONE, // TODO: add ores | ||
"quarry" => STONE, | ||
_ => { | ||
if args.winter { | ||
SNOW_BLOCK | ||
|
@@ -349,6 +350,28 @@ pub fn generate_landuse( | |
} | ||
} | ||
} | ||
"quarry" => { | ||
if let Some(resource) = element.tags.get("resource") { | ||
let ore_block = match resource.as_str() { | ||
"iron_ore" => IRON_ORE, | ||
"coal" => COAL_ORE, | ||
"copper" => COPPER_ORE, | ||
"gold" => GOLD_ORE, | ||
"clay" | "kaolinite" => CLAY, | ||
_ => STONE, | ||
}; | ||
let random_choice: i32 = rng.gen_range(0..100 + ground_level); // with more depth there's more resources | ||
if random_choice < 5 { | ||
editor.set_block(ore_block, x, ground_level, z, Some(&[STONE]), None); | ||
} | ||
// Fill everything with stone so dirt won't be there | ||
if args.fillground { | ||
for y in MIN_Y + 1..ground_level { | ||
editor.set_block(STONE, x, y, z, None, None); | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
} | ||
} | ||
} | ||
_ => {} | ||
} | ||
} | ||
|
This file contains 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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use
editor.fill_blocks()
instead.