mirror of
https://github.com/louis-e/arnis.git
synced 2025-12-31 10:18:02 -05:00
Compare commits
29 Commits
v2.1.3
...
dev-build-
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ef25c669c1 | ||
|
|
df09afe868 | ||
|
|
e9a2329e38 | ||
|
|
9cb919eeae | ||
|
|
e2c9b07e91 | ||
|
|
3efb8460c1 | ||
|
|
0efa681bb9 | ||
|
|
a92c5bb01f | ||
|
|
408e182be2 | ||
|
|
ea3cf80472 | ||
|
|
28ecbb58e7 | ||
|
|
7b7ff6b534 | ||
|
|
5e6eb0969b | ||
|
|
9d6c528438 | ||
|
|
920725d21f | ||
|
|
3689bfbf6d | ||
|
|
8ed864210f | ||
|
|
a0d242716d | ||
|
|
a604e546a7 | ||
|
|
3c5f5eff24 | ||
|
|
c750b90719 | ||
|
|
553dce3c3b | ||
|
|
24d7a7e3eb | ||
|
|
b34a9c851c | ||
|
|
1274781223 | ||
|
|
9470bbf87f | ||
|
|
c4e27b6059 | ||
|
|
c26cb933dc | ||
|
|
83be3c7c64 |
92
.github/workflows/prerelease.yml
vendored
Normal file
92
.github/workflows/prerelease.yml
vendored
Normal file
@@ -0,0 +1,92 @@
|
||||
name: Pre-release Dev Build
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
|
||||
jobs:
|
||||
build:
|
||||
strategy:
|
||||
matrix:
|
||||
include:
|
||||
- os: windows-latest
|
||||
target: x86_64-pc-windows-msvc
|
||||
binary_name: arnis.exe
|
||||
asset_name: arnis-windows-x64.exe
|
||||
- os: ubuntu-latest
|
||||
target: x86_64-unknown-linux-gnu
|
||||
binary_name: arnis
|
||||
asset_name: arnis-linux-x64
|
||||
|
||||
runs-on: ${{ matrix.os }}
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Set up Rust
|
||||
uses: dtolnay/rust-toolchain@v1
|
||||
with:
|
||||
toolchain: stable
|
||||
targets: ${{ matrix.target }}
|
||||
|
||||
- name: Install Linux dependencies
|
||||
if: matrix.os == 'ubuntu-latest'
|
||||
run: |
|
||||
sudo apt update
|
||||
sudo apt install -y software-properties-common
|
||||
sudo add-apt-repository universe
|
||||
echo "deb http://archive.ubuntu.com/ubuntu $(lsb_release -sc)-backports main restricted universe multiverse" | sudo tee -a /etc/apt/sources.list
|
||||
sudo apt update
|
||||
sudo apt install -y libgtk-3-dev build-essential pkg-config libglib2.0-dev libsoup-3.0-dev libwebkit2gtk-4.1-dev
|
||||
echo "PKG_CONFIG_PATH=/usr/lib/x86_64-linux-gnu/pkgconfig" >> $GITHUB_ENV
|
||||
|
||||
- name: Install dependencies
|
||||
run: cargo fetch --locked
|
||||
|
||||
- name: Build
|
||||
run: cargo build --frozen --release
|
||||
|
||||
- name: Upload artifact
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: ${{ matrix.os }}-build
|
||||
path: target/release/${{ matrix.binary_name }}
|
||||
|
||||
prerelease:
|
||||
needs: build
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Download Windows build artifact
|
||||
uses: actions/download-artifact@v3
|
||||
with:
|
||||
name: windows-latest-build
|
||||
path: ./builds/windows
|
||||
|
||||
- name: Download Linux build artifact
|
||||
uses: actions/download-artifact@v3
|
||||
with:
|
||||
name: ubuntu-latest-build
|
||||
path: ./builds/linux
|
||||
|
||||
- name: Make Linux binary executable
|
||||
run: chmod +x ./builds/linux/arnis
|
||||
|
||||
- name: Create Pre-release on GitHub
|
||||
uses: ncipollo/release-action@v1
|
||||
with:
|
||||
tag: "dev-build-${{ github.run_number }}"
|
||||
name: "Dev Build #${{ github.run_number }}"
|
||||
body: "Automated pre-release for testing purposes. This build may contain experimental features. For the latest official version, please download the latest stable release."
|
||||
draft: false
|
||||
prerelease: true
|
||||
makeLatest: false
|
||||
files: |
|
||||
builds/windows/arnis.exe
|
||||
builds/linux/arnis
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
2
Cargo.lock
generated
2
Cargo.lock
generated
@@ -168,7 +168,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "arnis"
|
||||
version = "2.1.2"
|
||||
version = "2.1.3"
|
||||
dependencies = [
|
||||
"clap",
|
||||
"colored",
|
||||
|
||||
28
README.md
28
README.md
@@ -1,5 +1,5 @@
|
||||
<p align="center">
|
||||
<img width="456" height="125" src="https://github.com/louis-e/arnis/blob/main/gitassets/logo.png?raw=true">
|
||||
<img width="456" height="125" src="https://github.com/louis-e/arnis/blob/main/gui-src/images/logo.png?raw=true">
|
||||
</p>
|
||||
|
||||
# Arnis [](https://github.com/louis-e/arnis/actions) [<img alt="GitHub Release" src="https://img.shields.io/github/v/release/louis-e/arnis" />](https://github.com/louis-e/arnis/releases) [<img alt="GitHub Downloads (all assets, all releases" src="https://img.shields.io/github/downloads/louis-e/arnis/total" />](https://github.com/louis-e/arnis/releases)
|
||||
@@ -56,6 +56,12 @@ If you're on Windows, please install the [Evergreen Bootstrapper from Microsoft]
|
||||
Please use Minecraft version 1.21.4 for the best results. Minecraft version 1.16.5 and below is currently not supported, but we are working on it!
|
||||
- *The generation did finish, but there's nothing in the world!*<br>
|
||||
Make sure to teleport to the generation starting point (/tp 0 0 0). If there is still nothing, you might need to travel a bit further into the positive X and positive Z direction.
|
||||
- *What features are in the world generation settings?*<br>
|
||||
**Winter Mode:** This setting changes the generation style to a snowy theme and adds snow layers to the ground.<br>
|
||||
**Scale Factor:** The scale factor determines the size of the generated world.<br>
|
||||
**Custom BBOX Input:** This setting allows you to manually input the bounding box coordinates for the area you want to generate.<br>
|
||||
**Floodfill-Timeout (Sec):** This setting determines the maximum time the floodfill algorithm is allowed to run before being terminated. Increasing this value may improve the generation of large water areas but may also increase processing time.<br>
|
||||
**Ground Height:** This setting determines the base height of the generated world and can be adjusted to create different terrain types.
|
||||
|
||||
## :memo: ToDo and Known Bugs
|
||||
Feel free to choose an item from the To-Do or Known Bugs list, or bring your own idea to the table. Bug reports shall be raised as a Github issue. Contributions are highly welcome and appreciated!
|
||||
@@ -111,11 +117,25 @@ After your pull request was merged, I will take care of regularly creating updat
|
||||
</a>
|
||||
|
||||
## :copyright: License Information
|
||||
This project is licensed under the Apache 2.0 License.[^3]
|
||||
This GitHub repository is the only official source for the Arnis project. Websites or distributions that claim to be official sources or use the Arnis name, logo, or branding without explicit permission are not allowed and violate the terms of the Apache 2.0 License.
|
||||
|
||||
Copyright (c) 2022-2025 Louis Erbkamm (louis-e)
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.[^3]
|
||||
|
||||
Download Arnis only from the official source (https://github.com/louis-e/arnis/). Every other website providing a download and claiming to be affiliated with the project is unofficial and may be malicious.
|
||||
|
||||
The logo was made by @nxfx21.
|
||||
|
||||
|
||||
[^1]: https://en.wikipedia.org/wiki/OpenStreetMap
|
||||
|
||||
[^2]: https://en.wikipedia.org/wiki/Arnis,_Germany
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 19 KiB |
21
gui-src/css/styles.css
vendored
21
gui-src/css/styles.css
vendored
@@ -356,3 +356,24 @@ button:hover {
|
||||
content: "⚙️";
|
||||
font-size: 18px;
|
||||
}
|
||||
|
||||
/* Logo Animation */
|
||||
#arnis-logo {
|
||||
width: 35%;
|
||||
height: auto;
|
||||
opacity: 0;
|
||||
transform: scale(0);
|
||||
animation: zoomInLogo 1s ease-out forwards;
|
||||
}
|
||||
|
||||
/* Keyframe Animation */
|
||||
@keyframes zoomInLogo {
|
||||
0% {
|
||||
transform: scale(0);
|
||||
opacity: 0;
|
||||
}
|
||||
100% {
|
||||
transform: scale(1);
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
|
||||
BIN
gui-src/images/logo.png
vendored
BIN
gui-src/images/logo.png
vendored
Binary file not shown.
|
Before Width: | Height: | Size: 19 KiB After Width: | Height: | Size: 231 KiB |
17
gui-src/index.html
vendored
17
gui-src/index.html
vendored
@@ -7,13 +7,14 @@
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>Arnis</title>
|
||||
<script type="module" src="./js/main.js" defer></script>
|
||||
<script type="module" src="./js/license.js" defer></script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<main class="container">
|
||||
<div class="row">
|
||||
<a href="https://github.com/louis-e/arnis" target="_blank">
|
||||
<img src="./images/logo.png" class="logo arnis" alt="Arnis Logo" />
|
||||
<img src="./images/logo.png" id="arnis-logo" class="logo arnis" alt="Arnis Logo" style="width: 35%; height: auto;" />
|
||||
</a>
|
||||
</div>
|
||||
|
||||
@@ -118,6 +119,20 @@
|
||||
<label for="ground-level" data-localize="ground_level">Ground Level:</label>
|
||||
<input type="number" id="ground-level" name="ground-level" min="-64" max="290" value="-62" style="width: 100px;" placeholder="Ground Level">
|
||||
</div>
|
||||
|
||||
<!-- License and Credits Button -->
|
||||
<button type="button" id="license-button" class="license-button" onclick="openLicense()" data-localize="license_and_credits">License and Credits</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- License Modal -->
|
||||
<div id="license-modal" class="modal" style="display: none;">
|
||||
<div class="modal-content">
|
||||
<span class="close-button" onclick="closeLicense()">×</span>
|
||||
<h2 data-localize="license_and_credits">License and Credits</h2>
|
||||
<div id="license-content" style="overflow-y: auto; max-height: 300px; font-size: 0.85em; line-height: 1.3; padding: 10px; border: 1px solid #ccc; border-radius: 4px;">
|
||||
Loading...
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
81
gui-src/js/license.js
vendored
Normal file
81
gui-src/js/license.js
vendored
Normal file
@@ -0,0 +1,81 @@
|
||||
export const licenseText = `
|
||||
<p><b>Contributors:</b></p>
|
||||
louis-e (Louis Erbkamm)<br>
|
||||
scd31<br>
|
||||
amir16yp<br>
|
||||
vfosnar<br>
|
||||
TheComputerGuy96<br>
|
||||
zer0-dev<br>
|
||||
RedAuburn<br>
|
||||
daniil2327<br>
|
||||
benjamin051000<br>
|
||||
|
||||
<p>For a full list of contributors, please refer to the <a href="https://github.com/louis-e/arnis" style="color: inherit;" target="_blank">Github page</a>. Logo made by nxfx21.</p>
|
||||
|
||||
<p style="color: #ff7070;"><b>Download Arnis only from the official source:</b> <a href="https://github.com/louis-e/arnis" style="color: inherit;" target="_blank">https://github.com/louis-e/arnis/</a>. Every other website providing a download and claiming to be affiliated with the project is unofficial and may be malicious.</p>
|
||||
|
||||
<p><b>License:</b></p>
|
||||
<pre style="white-space: pre-wrap; font-family: inherit;">
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized bythe copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and allother entities that control, are controlled by, or are under commoncontrol with that entity. For the purposes of this definition,"control" means (i) the power, direct or indirect, to cause thedirection or management of such entity, whether by contract orotherwise, or (ii) ownership of fifty percent (50%) or more of theoutstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entityexercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,including but not limited to software source code, documentationsource, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanicaltransformation or translation of a Source form, including butnot limited to compiled object code, generated documentation,and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source orObject form, made available under the License, as indicated by acopyright notice that is included in or attached to the work(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Objectform, that is based on (or derived from) the Work and for which theeditorial revisions, annotations, elaborations, or other modificationsrepresent, as a whole, an original work of authorship. For the purposesof this License, Derivative Works shall not include works that remainseparable from, or merely link (or bind by name) to the interfaces of,the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, includingthe original version of the Work and any modifications or additionsto that Work or Derivative Works thereof, that is intentionallysubmitted to Licensor for inclusion in the Work by the copyright owneror by an individual or Legal Entity authorized to submit on behalf ofthe copyright owner. For the purposes of this definition, "submitted"means any form of electronic, verbal, or written communication sentto the Licensor or its representatives, including but not limited tocommunication on electronic mailing lists, source code control systems,and issue tracking systems that are managed by, or on behalf of, theLicensor for the purpose of discussing and improving the Work, butexcluding communication that is conspicuously marked or otherwisedesignated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entityon behalf of whom a Contribution has been received by Licensor andsubsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions ofthis License, each Contributor hereby grants to You a perpetual,worldwide, non-exclusive, no-charge, royalty-free, irrevocablecopyright license to reproduce, prepare Derivative Works of,publicly display, publicly perform, sublicense, and distribute theWork and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions ofthis License, each Contributor hereby grants to You a perpetual,worldwide, non-exclusive, no-charge, royalty-free, irrevocable(except as stated in this section) patent license to make, have made,use, offer to sell, sell, import, and otherwise transfer the Work,where such license applies only to those patent claims licensableby such Contributor that are necessarily infringed by theirContribution(s) alone or by combination of their Contribution(s)with the Work to which such Contribution(s) was submitted. If Youinstitute patent litigation against any entity (including across-claim or counterclaim in a lawsuit) alleging that the Workor a Contribution incorporated within the Work constitutes director contributory patent infringement, then any patent licensesgranted to You under this License for that Work shall terminateas of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of theWork or Derivative Works thereof in any medium, with or withoutmodifications, and in Source or Object form, provided that Youmeet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications andmay provide additional or different license terms and conditionsfor use, reproduction, or distribution of Your modifications, orfor any such Derivative Works as a whole, provided Your use,reproduction, and distribution of the Work otherwise complies withthe conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,any Contribution intentionally submitted for inclusion in the Workby You to the Licensor shall be under the terms and conditions ofthis License, without any additional terms or conditions.Notwithstanding the above, nothing herein shall supersede or modifythe terms of any separate license agreement you may have executedwith Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the tradenames, trademarks, service marks, or product names of the Licensor,except as required for reasonable and customary use in describing theorigin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law oragreed to in writing, Licensor provides the Work (and eachContributor provides its Contributions) on an "AS IS" BASIS,WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express orimplied, including, without limitation, any warranties or conditionsof TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR APARTICULAR PURPOSE. You are solely responsible for determining theappropriateness of using or redistributing the Work and assume anyrisks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,whether in tort (including negligence), contract, or otherwise,unless required by applicable law (such as deliberate and grosslynegligent acts) or agreed to in writing, shall any Contributor beliable to You for damages, including any direct, indirect, special,incidental, or consequential damages of any character arising as aresult of this License or out of the use or inability to use theWork (including but not limited to damages for loss of goodwill,work stoppage, computer failure or malfunction, or any and allother commercial damages or losses), even if such Contributorhas been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributingthe Work or Derivative Works thereof, You may choose to offer,and charge a fee for, acceptance of support, warranty, indemnity,or other liability obligations and/or rights consistent with thisLicense. However, in accepting such obligations, You may act onlyon Your own behalf and on Your sole responsibility, not on behalfof any other Contributor, and only if You agree to indemnify,defend, and hold each Contributor harmless for any liabilityincurred by, or claims asserted against, such Contributor by reasonof your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
Copyright 2025 Louis Erbkamm
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License athttp://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS,WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions andlimitations under the License.
|
||||
</pre>
|
||||
`;
|
||||
30
gui-src/js/main.js
vendored
30
gui-src/js/main.js
vendored
@@ -1,3 +1,5 @@
|
||||
import { licenseText } from './license.js';
|
||||
|
||||
const { invoke } = window.__TAURI__.core;
|
||||
|
||||
// Initialize elements and start the demo progress
|
||||
@@ -247,6 +249,29 @@ function initSettings() {
|
||||
slider.addEventListener("input", () => {
|
||||
sliderValue.textContent = parseFloat(slider.value).toFixed(2);
|
||||
});
|
||||
|
||||
|
||||
/// License and Credits
|
||||
function openLicense() {
|
||||
const licenseModal = document.getElementById("license-modal");
|
||||
const licenseContent = document.getElementById("license-content");
|
||||
|
||||
// Render the license text as HTML
|
||||
licenseContent.innerHTML = licenseText;
|
||||
|
||||
// Show the modal
|
||||
licenseModal.style.display = "flex";
|
||||
licenseModal.style.justifyContent = "center";
|
||||
licenseModal.style.alignItems = "center";
|
||||
}
|
||||
|
||||
function closeLicense() {
|
||||
const licenseModal = document.getElementById("license-modal");
|
||||
licenseModal.style.display = "none";
|
||||
}
|
||||
|
||||
window.openLicense = openLicense;
|
||||
window.closeLicense = closeLicense;
|
||||
}
|
||||
|
||||
function initWorldPicker() {
|
||||
@@ -307,6 +332,11 @@ function handleBboxInput() {
|
||||
const bboxText = `${lat1} ${lng1} ${lat2} ${lng2}`;
|
||||
window.dispatchEvent(new MessageEvent('message', { data: { bboxText } }));
|
||||
|
||||
// Show custom bbox on the map
|
||||
let map_container = document.querySelector('.map-container');
|
||||
map_container.setAttribute('src', `maps.html#${lat1},${lng1},${lat2},${lng2}`);
|
||||
map_container.contentWindow.location.reload();
|
||||
|
||||
// Update the info text
|
||||
bboxInfo.textContent = window.localization.custom_selection_confirmed;
|
||||
bboxInfo.style.color = "#7bd864";
|
||||
|
||||
2
gui-src/locales/ru.json
vendored
2
gui-src/locales/ru.json
vendored
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"select_location": "Выбрать местоположение",
|
||||
"zoom_in_and_choose": "Приблизьте и выберите область с помощью инструмента прямоугольника",
|
||||
"zoom_in_and_choose": "Приблизьте и выберите область",
|
||||
"select_world": "Выбрать мир",
|
||||
"choose_world": "Выбрать мир",
|
||||
"no_world_selected": "Мир не выбран",
|
||||
|
||||
@@ -43,6 +43,7 @@ pub fn generate_world(
|
||||
let progress_increment_prcs: f64 = 50.0 / elements_count as f64;
|
||||
let mut current_progress_prcs: f64 = 10.0;
|
||||
let mut last_emitted_progress: f64 = current_progress_prcs;
|
||||
|
||||
for element in &elements {
|
||||
process_pb.inc(1);
|
||||
current_progress_prcs += progress_increment_prcs;
|
||||
|
||||
@@ -17,6 +17,9 @@ pub fn generate_barriers(editor: &mut WorldEditor, element: &ProcessedElement, g
|
||||
);
|
||||
// Place bollard
|
||||
}
|
||||
} else if barrier_type == "kerb" {
|
||||
// Ignore kerbs
|
||||
return;
|
||||
} else if let ProcessedElement::Way(way) = element {
|
||||
// Determine wall height
|
||||
let wall_height: i32 = element
|
||||
|
||||
@@ -17,15 +17,12 @@ pub fn generate_buildings(
|
||||
relation_levels: Option<i32>,
|
||||
) {
|
||||
// Adjust starting height based on building:min_level
|
||||
let start_level = if let Some(min_level_str) = element.tags.get("building:min_level") {
|
||||
if let Ok(min_level) = min_level_str.parse::<i32>() {
|
||||
ground_level + (min_level * 4) // Each level is 4 blocks high
|
||||
} else {
|
||||
ground_level
|
||||
}
|
||||
let min_level = if let Some(min_level_str) = element.tags.get("building:min_level") {
|
||||
min_level_str.parse::<i32>().unwrap_or(0)
|
||||
} else {
|
||||
ground_level
|
||||
0
|
||||
};
|
||||
let start_level = ground_level + (min_level * 4);
|
||||
|
||||
let mut previous_node: Option<(i32, i32)> = None;
|
||||
let mut corner_addup: (i32, i32, i32) = (0, 0, 0);
|
||||
@@ -57,7 +54,23 @@ pub fn generate_buildings(
|
||||
})
|
||||
})
|
||||
.flatten()
|
||||
.unwrap_or_else(|| building_floor_variations()[variation_index_floor]);
|
||||
.unwrap_or_else(|| {
|
||||
if let Some(building_type) = element
|
||||
.tags
|
||||
.get("building")
|
||||
.or_else(|| element.tags.get("building:part"))
|
||||
{
|
||||
//Random roof color only for single houses
|
||||
match building_type.as_str() {
|
||||
"yes" | "house" | "detached" | "static_caravan" | "semidetached_house"
|
||||
| "bungalow" | "manor" | "villa" => {
|
||||
return building_floor_variations()[variation_index_floor];
|
||||
}
|
||||
_ => return LIGHT_GRAY_CONCRETE,
|
||||
}
|
||||
}
|
||||
LIGHT_GRAY_CONCRETE
|
||||
});
|
||||
let window_block: Block = WHITE_STAINED_GLASS;
|
||||
|
||||
// Set to store processed flood fill points
|
||||
@@ -81,8 +94,10 @@ pub fn generate_buildings(
|
||||
// Determine building height from tags
|
||||
if let Some(levels_str) = element.tags.get("building:levels") {
|
||||
if let Ok(levels) = levels_str.parse::<i32>() {
|
||||
if levels >= 1 {
|
||||
building_height = ((levels * 4 + 2) as f64 * scale_factor) as i32;
|
||||
let lev = levels - min_level;
|
||||
|
||||
if lev >= 1 {
|
||||
building_height = ((lev * 4 + 2) as f64 * scale_factor) as i32;
|
||||
building_height = building_height.max(3);
|
||||
}
|
||||
}
|
||||
@@ -180,7 +195,7 @@ pub fn generate_buildings(
|
||||
|| element
|
||||
.tags
|
||||
.get("parking")
|
||||
.map_or(false, |p| p == "multi-storey")
|
||||
.is_some_and(|p| p == "multi-storey")
|
||||
{
|
||||
// Parking building structure
|
||||
|
||||
|
||||
@@ -58,7 +58,7 @@ pub fn generate_highways(
|
||||
} else if element
|
||||
.tags()
|
||||
.get("area")
|
||||
.map_or(false, |v: &String| v == "yes")
|
||||
.is_some_and(|v: &String| v == "yes")
|
||||
{
|
||||
let ProcessedElement::Way(way) = element else {
|
||||
return;
|
||||
|
||||
@@ -344,13 +344,25 @@ pub fn generate_landuse(
|
||||
}
|
||||
"grass" => {
|
||||
if rng.gen_range(1..=7) != 1
|
||||
&& !editor.check_for_block(x, ground_level, z, None, Some(&[WATER]))
|
||||
&& editor.check_for_block(
|
||||
x,
|
||||
ground_level,
|
||||
z,
|
||||
Some(&[GRASS_BLOCK, SNOW_BLOCK]),
|
||||
None,
|
||||
)
|
||||
{
|
||||
editor.set_block(GRASS, x, ground_level + 1, z, None, None);
|
||||
}
|
||||
}
|
||||
"meadow" => {
|
||||
if !editor.check_for_block(x, ground_level, z, None, Some(&[WATER])) {
|
||||
if editor.check_for_block(
|
||||
x,
|
||||
ground_level,
|
||||
z,
|
||||
Some(&[GRASS_BLOCK, SNOW_BLOCK]),
|
||||
None,
|
||||
) {
|
||||
let random_choice: i32 = rng.gen_range(0..1001);
|
||||
if random_choice < 5 {
|
||||
create_tree(
|
||||
|
||||
27
src/main.rs
27
src/main.rs
@@ -18,7 +18,6 @@ use clap::Parser;
|
||||
use colored::*;
|
||||
use fastnbt::Value;
|
||||
use flate2::read::GzDecoder;
|
||||
use fs2::FileExt;
|
||||
use log::{error, LevelFilter};
|
||||
use rfd::FileDialog;
|
||||
use std::{
|
||||
@@ -175,7 +174,14 @@ fn gui_select_world(generate_new: bool) -> Result<String, i32> {
|
||||
.join("saves")
|
||||
})
|
||||
} else if cfg!(target_os = "linux") {
|
||||
dirs::home_dir().map(|home: PathBuf| home.join(".minecraft").join("saves"))
|
||||
dirs::home_dir().map(|home| {
|
||||
let flatpak_path = home.join(".var/app/com.mojang.Minecraft/.minecraft/saves");
|
||||
if flatpak_path.exists() {
|
||||
flatpak_path
|
||||
} else {
|
||||
home.join(".minecraft/saves")
|
||||
}
|
||||
})
|
||||
} else {
|
||||
None
|
||||
};
|
||||
@@ -210,11 +216,11 @@ fn gui_select_world(generate_new: bool) -> Result<String, i32> {
|
||||
if session_lock_path.exists() {
|
||||
// Try to acquire a lock on the session.lock file
|
||||
if let Ok(file) = File::open(&session_lock_path) {
|
||||
if file.try_lock_shared().is_err() {
|
||||
if fs2::FileExt::try_lock_shared(&file).is_err() {
|
||||
return Err(2); // Error code 2: The selected world is currently in use
|
||||
} else {
|
||||
// Release the lock immediately
|
||||
let _ = file.unlock();
|
||||
let _ = fs2::FileExt::unlock(&file);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -369,8 +375,17 @@ fn gui_start_generation(
|
||||
Ok(raw_data) => {
|
||||
let (mut parsed_elements, scale_factor_x, scale_factor_z) =
|
||||
osm_parser::parse_osm_data(&raw_data, reordered_bbox, &args);
|
||||
parsed_elements.sort_by_key(|element: &osm_parser::ProcessedElement| {
|
||||
osm_parser::get_priority(element)
|
||||
parsed_elements.sort_by(|el1, el2| {
|
||||
let (el1_priority, el2_priority) =
|
||||
(osm_parser::get_priority(el1), osm_parser::get_priority(el2));
|
||||
match (
|
||||
el1.tags().contains_key("landuse"),
|
||||
el2.tags().contains_key("landuse"),
|
||||
) {
|
||||
(true, false) => std::cmp::Ordering::Greater,
|
||||
(false, true) => std::cmp::Ordering::Less,
|
||||
_ => el1_priority.cmp(&el2_priority),
|
||||
}
|
||||
});
|
||||
|
||||
let _ = data_processing::generate_world(
|
||||
|
||||
Reference in New Issue
Block a user