Skip to content
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

Railways for FS25 #42

Merged
merged 3 commits into from
Dec 1, 2024
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: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -406,6 +406,8 @@ To create a basic map, you only need the Giants Editor. But if you want to creat
2. [Blender](https://www.blender.org/download/) - the open-source 3D modeling software that you can use to create models for the Farming Simulator.
3. [Blender Exporter Plugins](https://gdn.giants-software.com/downloads.php) - the official plugins for exporting models from Blender to i3d format (the format used in the Farming Simulator).
4. [QGIS](https://qgis.org/download/) - the open-source GIS software that you can use to obtain high-resolution satellite images for your map.
5. [CompressPngCom](https://www.compresspng.com/) - the online tool to compress the PNG images. May be useful to reduce the size of the satellite images.
6. [AnyConv](https://anyconv.com/png-to-dds-converter/) - the online tool to convert the PNG images to the DDS format. You'll need this format for the textures, icons, overview and preview images.

## Bugs and feature requests
➡️ Please, before creating an issue or asking some questions, check the [FAQ](tutorials/FAQ.md) section.<br>
Expand Down
5 changes: 4 additions & 1 deletion data/fs25-texture-schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,10 @@
},
{
"name": "rockFloorTiles",
"count": 2
"count": 2,
"tags": { "railway": true },
"width": 4,
"color": [100, 100, 100]
},
{
"name": "rockFloorTilesPattern",
Expand Down
22 changes: 22 additions & 0 deletions dev/clean_trash.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Directories to be removed
$dirs = @(".mypy_cache", ".pytest_cache", "htmlcov", "dist", "archives", "cache", "logs", "maps", "temp")

# Files to be removed
$files = @(".coverage")

# Loop through the directories
foreach ($dir in $dirs) {
Write-Host "Removing directory $dir"
Remove-Item -Recurse -Force $dir -ErrorAction SilentlyContinue
}

# Loop through the files
foreach ($file in $files) {
Write-Host "Removing file $file"
Remove-Item -Force $file -ErrorAction SilentlyContinue
}

Write-Host "Removing __pycache__ directories"
Get-ChildItem -Recurse -Directory -Filter "__pycache__" -ErrorAction SilentlyContinue | Remove-Item -Recurse -Force -ErrorAction SilentlyContinue

Write-Host "Cleanup completed."
11 changes: 8 additions & 3 deletions maps4fs/generator/background.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@
import trimesh # type: ignore

from maps4fs.generator.component import Component
from maps4fs.generator.dem import (
DEFAULT_BLUR_RADIUS,
DEFAULT_MULTIPLIER,
DEFAULT_PLATEAU,
)
from maps4fs.generator.path_steps import DEFAULT_DISTANCE, PATH_FULL_NAME, get_steps
from maps4fs.generator.tile import Tile
from maps4fs.logger import timeit
Expand Down Expand Up @@ -58,9 +63,9 @@ def preprocess(self) -> None:
logger=self.logger,
tile_code=path_step.code,
auto_process=False,
blur_radius=self.kwargs.get("blur_radius"),
multiplier=self.kwargs.get("multiplier", 1),
plateau=self.kwargs.get("plateau", 0),
blur_radius=self.kwargs.get("blur_radius", DEFAULT_BLUR_RADIUS),
multiplier=self.kwargs.get("multiplier", DEFAULT_MULTIPLIER),
plateau=self.kwargs.get("plateau", DEFAULT_PLATEAU),
)

# Update the origin for the next tile.
Expand Down
1 change: 1 addition & 0 deletions maps4fs/generator/dem.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
SRTM = "https://elevation-tiles-prod.s3.amazonaws.com/skadi/{latitude_band}/{tile_name}.hgt.gz"
DEFAULT_MULTIPLIER = 1
DEFAULT_BLUR_RADIUS = 35
DEFAULT_PLATEAU = 0


# pylint: disable=R0903, R0902
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "maps4fs"
version = "0.9.5"
version = "0.9.6"
description = "Generate map templates for Farming Simulator from real places."
authors = [{name = "iwatkot", email = "[email protected]"}]
license = {text = "MIT License"}
Expand Down
16 changes: 12 additions & 4 deletions webui/webui.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,11 @@
from PIL import Image

import maps4fs as mfs
from maps4fs.generator.dem import DEFAULT_BLUR_RADIUS, DEFAULT_MULTIPLIER
from maps4fs.generator.dem import (
DEFAULT_BLUR_RADIUS,
DEFAULT_MULTIPLIER,
DEFAULT_PLATEAU,
)

DEFAULT_LAT = 45.28571409289627
DEFAULT_LON = 20.237433441210115
Expand Down Expand Up @@ -44,7 +48,11 @@ def __init__(self):

st.set_page_config(page_title="Maps4FS", page_icon="🚜", layout="wide")
st.title("Maps4FS")
st.write("Generate map templates for Farming Simulator from real places.")
st.write(
"Generate map templates for Farming Simulator from real places. \n"
"Join our [Discord server](https://discord.gg/Sj5QKKyE42) to get help, share your "
"maps, or just chat."
)

if self.community:
st.warning(
Expand Down Expand Up @@ -237,7 +245,7 @@ def add_left_widgets(self) -> None:

self.multiplier_input = DEFAULT_MULTIPLIER
self.blur_radius_input = DEFAULT_BLUR_RADIUS
self.plateau_height_input = 0
self.plateau_height_input = DEFAULT_PLATEAU

if not self.auto_process:
self.logger.info("Auto preset is disabled.")
Expand Down Expand Up @@ -288,7 +296,7 @@ def add_left_widgets(self) -> None:
self.blur_radius_input = st.number_input(
"Blur Radius",
value=DEFAULT_BLUR_RADIUS,
min_value=1,
min_value=0,
max_value=300,
key="blur_radius",
label_visibility="collapsed",
Expand Down