maps4fs 1.1.0__tar.gz → 1.2.3__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {maps4fs-1.1.0 → maps4fs-1.2.3}/PKG-INFO +34 -11
- {maps4fs-1.1.0 → maps4fs-1.2.3}/README.md +33 -10
- {maps4fs-1.1.0 → maps4fs-1.2.3}/maps4fs/generator/background.py +4 -1
- {maps4fs-1.1.0 → maps4fs-1.2.3}/maps4fs/generator/component.py +10 -1
- {maps4fs-1.1.0 → maps4fs-1.2.3}/maps4fs/generator/game.py +16 -1
- maps4fs-1.2.3/maps4fs/generator/grle.py +397 -0
- {maps4fs-1.1.0 → maps4fs-1.2.3}/maps4fs/generator/i3d.py +174 -1
- {maps4fs-1.1.0 → maps4fs-1.2.3}/maps4fs/generator/map.py +16 -1
- {maps4fs-1.1.0 → maps4fs-1.2.3}/maps4fs/generator/texture.py +28 -8
- {maps4fs-1.1.0 → maps4fs-1.2.3}/maps4fs.egg-info/PKG-INFO +34 -11
- {maps4fs-1.1.0 → maps4fs-1.2.3}/pyproject.toml +1 -1
- maps4fs-1.1.0/maps4fs/generator/grle.py +0 -175
- {maps4fs-1.1.0 → maps4fs-1.2.3}/LICENSE.md +0 -0
- {maps4fs-1.1.0 → maps4fs-1.2.3}/maps4fs/__init__.py +0 -0
- {maps4fs-1.1.0 → maps4fs-1.2.3}/maps4fs/generator/__init__.py +0 -0
- {maps4fs-1.1.0 → maps4fs-1.2.3}/maps4fs/generator/config.py +0 -0
- {maps4fs-1.1.0 → maps4fs-1.2.3}/maps4fs/generator/dem.py +0 -0
- {maps4fs-1.1.0 → maps4fs-1.2.3}/maps4fs/generator/qgis.py +0 -0
- {maps4fs-1.1.0 → maps4fs-1.2.3}/maps4fs/logger.py +0 -0
- {maps4fs-1.1.0 → maps4fs-1.2.3}/maps4fs/toolbox/__init__.py +0 -0
- {maps4fs-1.1.0 → maps4fs-1.2.3}/maps4fs/toolbox/background.py +0 -0
- {maps4fs-1.1.0 → maps4fs-1.2.3}/maps4fs/toolbox/dem.py +0 -0
- {maps4fs-1.1.0 → maps4fs-1.2.3}/maps4fs.egg-info/SOURCES.txt +0 -0
- {maps4fs-1.1.0 → maps4fs-1.2.3}/maps4fs.egg-info/dependency_links.txt +0 -0
- {maps4fs-1.1.0 → maps4fs-1.2.3}/maps4fs.egg-info/requires.txt +0 -0
- {maps4fs-1.1.0 → maps4fs-1.2.3}/maps4fs.egg-info/top_level.txt +0 -0
- {maps4fs-1.1.0 → maps4fs-1.2.3}/setup.cfg +0 -0
- {maps4fs-1.1.0 → maps4fs-1.2.3}/tests/test_generator.py +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: maps4fs
|
3
|
-
Version: 1.
|
3
|
+
Version: 1.2.3
|
4
4
|
Summary: Generate map templates for Farming Simulator from real places.
|
5
5
|
Author-email: iwatkot <iwatkot@gmail.com>
|
6
6
|
License: MIT License
|
@@ -35,6 +35,7 @@ Requires-Dist: pympler
|
|
35
35
|
<a href="#How-To-Run">How-To-Run</a><br>
|
36
36
|
<a href="docs/FAQ.md">FAQ</a> •
|
37
37
|
<a href="docs/map_structure.md">Map Structure</a> •
|
38
|
+
<a href="docs/tips_and_hints.md">Tips and Hints</a> •
|
38
39
|
<a href="#Modder-Toolbox">Modder Toolbox</a><br>
|
39
40
|
<a href="#Supported-objects">Supported objects</a> •
|
40
41
|
<a href="#Generation-info">Generation info</a> •
|
@@ -42,9 +43,10 @@ Requires-Dist: pympler
|
|
42
43
|
<a href="#Background-terrain">Background terrain</a> •
|
43
44
|
<a href="#Overview-image">Overview image</a><br>
|
44
45
|
<a href="#DDS-conversion">DDS conversion</a> •
|
45
|
-
<a href="#
|
46
|
+
<a href="#Advanced-settings">Advanced settings</a> •
|
46
47
|
<a href="#Resources">Resources</a> •
|
47
|
-
<a href="#Bugs-and-feature-requests">Bugs and feature requests</a>
|
48
|
+
<a href="#Bugs-and-feature-requests">Bugs and feature requests</a><br>
|
49
|
+
<a href="#Special-thanks">Special thanks</a>
|
48
50
|
</p>
|
49
51
|
|
50
52
|
|
@@ -66,6 +68,8 @@ Requires-Dist: pympler
|
|
66
68
|
🔄 Support map rotation 🆕<br>
|
67
69
|
🌾 Automatically generates fields 🆕<br>
|
68
70
|
🌽 Automatically generates farmlands 🆕<br>
|
71
|
+
🌿 Automatically generates decorative foliage 🆕<br>
|
72
|
+
🌲 Automatically generates forests 🆕<br>
|
69
73
|
🌍 Based on real-world data from OpenStreetMap<br>
|
70
74
|
🏞️ Generates height map using SRTM dataset<br>
|
71
75
|
📦 Provides a ready-to-use map template for the Giants Editor<br>
|
@@ -78,17 +82,20 @@ Requires-Dist: pympler
|
|
78
82
|
<p align="center">
|
79
83
|
<img src="https://github.com/user-attachments/assets/cf8f5752-9c69-4018-bead-290f59ba6976"><br>
|
80
84
|
🌎 Detailed terrain based on real-world data.<br><br>
|
81
|
-
<img src="https://github.com/user-attachments/assets/
|
82
|
-
🛰️ Realistic background terrain
|
85
|
+
<img src="https://github.com/user-attachments/assets/dc40d0bb-c20b-411c-8833-9925d0389452"><br>
|
86
|
+
🛰️ Realistic background terrain with satellite images.<br><br>
|
87
|
+
<img src="https://github.com/user-attachments/assets/6e3c0e99-2cce-46ac-82db-5cb60bba7a30"><br>
|
88
|
+
📐 Perfectly aligned background terrain.<br><br>
|
89
|
+
<img src="https://github.com/user-attachments/assets/5764b2ec-e626-426f-9f5d-beb12ba95133"><br>
|
90
|
+
🌿 Automatically generates decorative foliage.<br><br>
|
91
|
+
<img src="https://github.com/user-attachments/assets/27a5e541-a9f5-4504-b8d2-64aae9fb3e52"><br>
|
92
|
+
🌲 Automatically generates forests.<br><br>
|
83
93
|
<img src="https://github.com/user-attachments/assets/80e5923c-22c7-4dc0-8906-680902511f3a"><br>
|
84
94
|
🗒️ True-to-life blueprints for fast and precise modding.<br><br>
|
85
95
|
<img width="480" src="https://github.com/user-attachments/assets/1a8802d2-6a3b-4bfa-af2b-7c09478e199b"><br>
|
86
96
|
🌾 Field generation with one click.<br><br>
|
87
97
|
<img width="480" src="https://github.com/user-attachments/assets/4d1fa879-5d60-438b-a84e-16883bcef0ec"><br>
|
88
98
|
🌽 Automatic farmlands generation based on the fields.<br><br>
|
89
|
-
<img src="https://github.com/user-attachments/assets/cce45575-c917-4a1b-bdc0-6368e32ccdff"><br>
|
90
|
-
📏 Almost any possible map sizes.
|
91
|
-
</p>
|
92
99
|
|
93
100
|
📹 A complete step-by-step video tutorial is here!
|
94
101
|
<a href="https://www.youtube.com/watch?v=Nl_aqXJ5nAk" target="_blank"><img src="https://github.com/user-attachments/assets/4845e030-0e73-47ab-a5a3-430308913060"/></a>
|
@@ -111,7 +118,7 @@ So, jump to [Docker version](#option-2-docker-version) to launch the tool with o
|
|
111
118
|
### 😎 For advanced users
|
112
119
|
**Option 2:** Run the Docker version in your browser. Launch the following command in your terminal:
|
113
120
|
```bash
|
114
|
-
docker run -d -p 8501:8501 iwatkot/maps4fs
|
121
|
+
docker run -d -p 8501:8501 --name maps4fs iwatkot/maps4fs
|
115
122
|
```
|
116
123
|
And open [http://localhost:8501](http://localhost:8501) in your browser.<br>
|
117
124
|
If you don't know how to use Docker, navigate to the [Docker version](#option-2-docker-version), it's really simple.<br>
|
@@ -174,7 +181,7 @@ You can launch the project with minimalistic UI in your browser using Docker. Fo
|
|
174
181
|
1. Install [Docker](https://docs.docker.com/get-docker/) for your OS.
|
175
182
|
2. Run the following command in your terminal:
|
176
183
|
```bash
|
177
|
-
docker run -d -p 8501:8501 iwatkot/maps4fs
|
184
|
+
docker run -d -p 8501:8501 --name maps4fs iwatkot/maps4fs
|
178
185
|
```
|
179
186
|
3. Open your browser and go to [http://localhost:8501](http://localhost:8501).
|
180
187
|
4. Fill in the required fields and click on the `Generate` button.
|
@@ -452,7 +459,7 @@ List of the important DDS files:
|
|
452
459
|
- `preview.dds` - 2048x2048 pixels, the preview image of the map on the loading screen,
|
453
460
|
- `mapsUS/overview.dds` - 4096x4096 pixels, the overview image of the map (in-game map)
|
454
461
|
|
455
|
-
##
|
462
|
+
## Advanced settings
|
456
463
|
The tool supports the custom size of the map. To use this feature select `Custom` in the `Map size` dropdown and enter the desired size. The tool will generate a map with the size you entered.<br>
|
457
464
|
|
458
465
|
⛔️ Do not use this feature, if you don't know what you're doing. In most cases, the Giants Editor will just crash on opening the file, because you need to enter specific values for the map size.<br><br>
|
@@ -477,6 +484,12 @@ You can also apply some advanced settings to the map generation process. Note th
|
|
477
484
|
|
478
485
|
- Farmlands margin - this value (in meters) will be applied to each farmland, making it bigger. You can use the value to adjust how much the farmland should be bigger than the actual field. By default, it's set to 3.
|
479
486
|
|
487
|
+
### Vegetation Advanced settings
|
488
|
+
|
489
|
+
- Forest density - the density of the forest in meters. The lower the value, the lower the distance between the trees, which makes the forest denser. Note, that low values will lead to enormous number of trees, which may cause the Giants Editor to crash or lead to performance issues. By default, it's set to 10.
|
490
|
+
|
491
|
+
- Random plants - when adding decorative foliage, enabling this option will add different species of plants to the map. If unchecked only basic grass (smallDenseMix) will be added. Defaults to True.
|
492
|
+
|
480
493
|
## Resources
|
481
494
|
In this section, you'll find a list of the resources that you need to create a map for the Farming Simulator.<br>
|
482
495
|
To create a basic map, you only need the Giants Editor. But if you want to create a background terrain - the world around the map, so it won't look like it's floating in the void - you also need Blender and the Blender Exporter Plugins. To create realistic textures for the background terrain, the QGIS is required to obtain high-resolution satellite images.<br>
|
@@ -491,3 +504,13 @@ To create a basic map, you only need the Giants Editor. But if you want to creat
|
|
491
504
|
## Bugs and feature requests
|
492
505
|
➡️ Please, before creating an issue or asking some questions, check the [FAQ](docs/FAQ.md) section.<br>
|
493
506
|
If you find a bug or have an idea for a new feature, please create an issue [here](https://github.com/iwatkot/maps4fs/issues) or contact me directly on [Telegram](https://t.me/iwatkot) or on Discord: `iwatkot`.
|
507
|
+
|
508
|
+
## Special thanks
|
509
|
+
|
510
|
+
Of course, first of all, thanks to the direct [contributors](https://github.com/iwatkot/maps4fs/graphs/contributors) of the project.
|
511
|
+
|
512
|
+
But also, I want to thank the people who helped me with the project in some way, even if they didn't contribute directly. Here's the list of them:
|
513
|
+
|
514
|
+
- [Ka5tis](https://github.com/Ka5tis) - for investigating the issue with a "spiky terrain" and finding a solution - changing the `DisplacementLayer` size to a higher value.
|
515
|
+
- [Kalderone](https://www.youtube.com/@Kalderone_FS22) - for useful feedback, suggestions, expert advice on the map-making process and highlihting some important settings in the Giants Editor.
|
516
|
+
- [OneSunnySunday](https://www.artstation.com/onesunnysunday) - for expert advice on Blender, help in processing background terrain, and compiling detailed tutorials on how to prepare the OBJ files for use in Giants Editor.
|
@@ -10,6 +10,7 @@
|
|
10
10
|
<a href="#How-To-Run">How-To-Run</a><br>
|
11
11
|
<a href="docs/FAQ.md">FAQ</a> •
|
12
12
|
<a href="docs/map_structure.md">Map Structure</a> •
|
13
|
+
<a href="docs/tips_and_hints.md">Tips and Hints</a> •
|
13
14
|
<a href="#Modder-Toolbox">Modder Toolbox</a><br>
|
14
15
|
<a href="#Supported-objects">Supported objects</a> •
|
15
16
|
<a href="#Generation-info">Generation info</a> •
|
@@ -17,9 +18,10 @@
|
|
17
18
|
<a href="#Background-terrain">Background terrain</a> •
|
18
19
|
<a href="#Overview-image">Overview image</a><br>
|
19
20
|
<a href="#DDS-conversion">DDS conversion</a> •
|
20
|
-
<a href="#
|
21
|
+
<a href="#Advanced-settings">Advanced settings</a> •
|
21
22
|
<a href="#Resources">Resources</a> •
|
22
|
-
<a href="#Bugs-and-feature-requests">Bugs and feature requests</a>
|
23
|
+
<a href="#Bugs-and-feature-requests">Bugs and feature requests</a><br>
|
24
|
+
<a href="#Special-thanks">Special thanks</a>
|
23
25
|
</p>
|
24
26
|
|
25
27
|
|
@@ -41,6 +43,8 @@
|
|
41
43
|
🔄 Support map rotation 🆕<br>
|
42
44
|
🌾 Automatically generates fields 🆕<br>
|
43
45
|
🌽 Automatically generates farmlands 🆕<br>
|
46
|
+
🌿 Automatically generates decorative foliage 🆕<br>
|
47
|
+
🌲 Automatically generates forests 🆕<br>
|
44
48
|
🌍 Based on real-world data from OpenStreetMap<br>
|
45
49
|
🏞️ Generates height map using SRTM dataset<br>
|
46
50
|
📦 Provides a ready-to-use map template for the Giants Editor<br>
|
@@ -53,17 +57,20 @@
|
|
53
57
|
<p align="center">
|
54
58
|
<img src="https://github.com/user-attachments/assets/cf8f5752-9c69-4018-bead-290f59ba6976"><br>
|
55
59
|
🌎 Detailed terrain based on real-world data.<br><br>
|
56
|
-
<img src="https://github.com/user-attachments/assets/
|
57
|
-
🛰️ Realistic background terrain
|
60
|
+
<img src="https://github.com/user-attachments/assets/dc40d0bb-c20b-411c-8833-9925d0389452"><br>
|
61
|
+
🛰️ Realistic background terrain with satellite images.<br><br>
|
62
|
+
<img src="https://github.com/user-attachments/assets/6e3c0e99-2cce-46ac-82db-5cb60bba7a30"><br>
|
63
|
+
📐 Perfectly aligned background terrain.<br><br>
|
64
|
+
<img src="https://github.com/user-attachments/assets/5764b2ec-e626-426f-9f5d-beb12ba95133"><br>
|
65
|
+
🌿 Automatically generates decorative foliage.<br><br>
|
66
|
+
<img src="https://github.com/user-attachments/assets/27a5e541-a9f5-4504-b8d2-64aae9fb3e52"><br>
|
67
|
+
🌲 Automatically generates forests.<br><br>
|
58
68
|
<img src="https://github.com/user-attachments/assets/80e5923c-22c7-4dc0-8906-680902511f3a"><br>
|
59
69
|
🗒️ True-to-life blueprints for fast and precise modding.<br><br>
|
60
70
|
<img width="480" src="https://github.com/user-attachments/assets/1a8802d2-6a3b-4bfa-af2b-7c09478e199b"><br>
|
61
71
|
🌾 Field generation with one click.<br><br>
|
62
72
|
<img width="480" src="https://github.com/user-attachments/assets/4d1fa879-5d60-438b-a84e-16883bcef0ec"><br>
|
63
73
|
🌽 Automatic farmlands generation based on the fields.<br><br>
|
64
|
-
<img src="https://github.com/user-attachments/assets/cce45575-c917-4a1b-bdc0-6368e32ccdff"><br>
|
65
|
-
📏 Almost any possible map sizes.
|
66
|
-
</p>
|
67
74
|
|
68
75
|
📹 A complete step-by-step video tutorial is here!
|
69
76
|
<a href="https://www.youtube.com/watch?v=Nl_aqXJ5nAk" target="_blank"><img src="https://github.com/user-attachments/assets/4845e030-0e73-47ab-a5a3-430308913060"/></a>
|
@@ -86,7 +93,7 @@ So, jump to [Docker version](#option-2-docker-version) to launch the tool with o
|
|
86
93
|
### 😎 For advanced users
|
87
94
|
**Option 2:** Run the Docker version in your browser. Launch the following command in your terminal:
|
88
95
|
```bash
|
89
|
-
docker run -d -p 8501:8501 iwatkot/maps4fs
|
96
|
+
docker run -d -p 8501:8501 --name maps4fs iwatkot/maps4fs
|
90
97
|
```
|
91
98
|
And open [http://localhost:8501](http://localhost:8501) in your browser.<br>
|
92
99
|
If you don't know how to use Docker, navigate to the [Docker version](#option-2-docker-version), it's really simple.<br>
|
@@ -149,7 +156,7 @@ You can launch the project with minimalistic UI in your browser using Docker. Fo
|
|
149
156
|
1. Install [Docker](https://docs.docker.com/get-docker/) for your OS.
|
150
157
|
2. Run the following command in your terminal:
|
151
158
|
```bash
|
152
|
-
docker run -d -p 8501:8501 iwatkot/maps4fs
|
159
|
+
docker run -d -p 8501:8501 --name maps4fs iwatkot/maps4fs
|
153
160
|
```
|
154
161
|
3. Open your browser and go to [http://localhost:8501](http://localhost:8501).
|
155
162
|
4. Fill in the required fields and click on the `Generate` button.
|
@@ -427,7 +434,7 @@ List of the important DDS files:
|
|
427
434
|
- `preview.dds` - 2048x2048 pixels, the preview image of the map on the loading screen,
|
428
435
|
- `mapsUS/overview.dds` - 4096x4096 pixels, the overview image of the map (in-game map)
|
429
436
|
|
430
|
-
##
|
437
|
+
## Advanced settings
|
431
438
|
The tool supports the custom size of the map. To use this feature select `Custom` in the `Map size` dropdown and enter the desired size. The tool will generate a map with the size you entered.<br>
|
432
439
|
|
433
440
|
⛔️ Do not use this feature, if you don't know what you're doing. In most cases, the Giants Editor will just crash on opening the file, because you need to enter specific values for the map size.<br><br>
|
@@ -452,6 +459,12 @@ You can also apply some advanced settings to the map generation process. Note th
|
|
452
459
|
|
453
460
|
- Farmlands margin - this value (in meters) will be applied to each farmland, making it bigger. You can use the value to adjust how much the farmland should be bigger than the actual field. By default, it's set to 3.
|
454
461
|
|
462
|
+
### Vegetation Advanced settings
|
463
|
+
|
464
|
+
- Forest density - the density of the forest in meters. The lower the value, the lower the distance between the trees, which makes the forest denser. Note, that low values will lead to enormous number of trees, which may cause the Giants Editor to crash or lead to performance issues. By default, it's set to 10.
|
465
|
+
|
466
|
+
- Random plants - when adding decorative foliage, enabling this option will add different species of plants to the map. If unchecked only basic grass (smallDenseMix) will be added. Defaults to True.
|
467
|
+
|
455
468
|
## Resources
|
456
469
|
In this section, you'll find a list of the resources that you need to create a map for the Farming Simulator.<br>
|
457
470
|
To create a basic map, you only need the Giants Editor. But if you want to create a background terrain - the world around the map, so it won't look like it's floating in the void - you also need Blender and the Blender Exporter Plugins. To create realistic textures for the background terrain, the QGIS is required to obtain high-resolution satellite images.<br>
|
@@ -466,3 +479,13 @@ To create a basic map, you only need the Giants Editor. But if you want to creat
|
|
466
479
|
## Bugs and feature requests
|
467
480
|
➡️ Please, before creating an issue or asking some questions, check the [FAQ](docs/FAQ.md) section.<br>
|
468
481
|
If you find a bug or have an idea for a new feature, please create an issue [here](https://github.com/iwatkot/maps4fs/issues) or contact me directly on [Telegram](https://t.me/iwatkot) or on Discord: `iwatkot`.
|
482
|
+
|
483
|
+
## Special thanks
|
484
|
+
|
485
|
+
Of course, first of all, thanks to the direct [contributors](https://github.com/iwatkot/maps4fs/graphs/contributors) of the project.
|
486
|
+
|
487
|
+
But also, I want to thank the people who helped me with the project in some way, even if they didn't contribute directly. Here's the list of them:
|
488
|
+
|
489
|
+
- [Ka5tis](https://github.com/Ka5tis) - for investigating the issue with a "spiky terrain" and finding a solution - changing the `DisplacementLayer` size to a higher value.
|
490
|
+
- [Kalderone](https://www.youtube.com/@Kalderone_FS22) - for useful feedback, suggestions, expert advice on the map-making process and highlihting some important settings in the Giants Editor.
|
491
|
+
- [OneSunnySunday](https://www.artstation.com/onesunnysunday) - for expert advice on Blender, help in processing background terrain, and compiling detailed tutorials on how to prepare the OBJ files for use in Giants Editor.
|
@@ -43,6 +43,7 @@ class Background(Component):
|
|
43
43
|
def preprocess(self) -> None:
|
44
44
|
"""Registers the DEMs for the background terrain."""
|
45
45
|
self.light_version = self.kwargs.get("light_version", False)
|
46
|
+
self.stl_preview_path: str | None = None
|
46
47
|
|
47
48
|
if self.rotation:
|
48
49
|
self.logger.debug("Rotation is enabled: %s.", self.rotation)
|
@@ -62,6 +63,7 @@ class Background(Component):
|
|
62
63
|
for name, autoprocess in zip(ELEMENTS, autoprocesses):
|
63
64
|
dem = DEM(
|
64
65
|
self.game,
|
66
|
+
self.map,
|
65
67
|
self.coordinates,
|
66
68
|
background_size,
|
67
69
|
rotated_size,
|
@@ -335,7 +337,8 @@ class Background(Component):
|
|
335
337
|
cv2.imwrite(background_dem_preview_path, background_dem_preview_image)
|
336
338
|
preview_paths.append(background_dem_preview_path)
|
337
339
|
|
338
|
-
|
340
|
+
if self.stl_preview_path:
|
341
|
+
preview_paths.append(self.stl_preview_path)
|
339
342
|
|
340
343
|
return preview_paths
|
341
344
|
|
@@ -17,6 +17,7 @@ from maps4fs.generator.qgis import save_scripts
|
|
17
17
|
|
18
18
|
if TYPE_CHECKING:
|
19
19
|
from maps4fs.generator.game import Game
|
20
|
+
from maps4fs.generator.map import Map
|
20
21
|
|
21
22
|
|
22
23
|
# pylint: disable=R0801, R0903, R0902, R0904
|
@@ -25,6 +26,7 @@ class Component:
|
|
25
26
|
|
26
27
|
Arguments:
|
27
28
|
game (Game): The game instance for which the map is generated.
|
29
|
+
map (Map): The map instance for which the component is generated.
|
28
30
|
coordinates (tuple[float, float]): The latitude and longitude of the center of the map.
|
29
31
|
map_size (int): The size of the map in pixels.
|
30
32
|
map_rotated_size (int): The size of the map in pixels after rotation.
|
@@ -37,6 +39,7 @@ class Component:
|
|
37
39
|
def __init__(
|
38
40
|
self,
|
39
41
|
game: Game,
|
42
|
+
map: Map, # pylint: disable=W0622
|
40
43
|
coordinates: tuple[float, float],
|
41
44
|
map_size: int,
|
42
45
|
map_rotated_size: int,
|
@@ -46,6 +49,7 @@ class Component:
|
|
46
49
|
**kwargs, # pylint: disable=W0613, R0913, R0917
|
47
50
|
):
|
48
51
|
self.game = game
|
52
|
+
self.map = map
|
49
53
|
self.coordinates = coordinates
|
50
54
|
self.map_size = map_size
|
51
55
|
self.map_rotated_size = map_rotated_size
|
@@ -356,6 +360,7 @@ class Component:
|
|
356
360
|
offset = (self.map_size / 2) - (self.map_rotated_size / 2)
|
357
361
|
self.logger.debug("Translating the polygon by %s", offset)
|
358
362
|
polygon = translate(polygon, xoff=offset, yoff=offset)
|
363
|
+
self.logger.debug("Rotated and translated polygon.")
|
359
364
|
|
360
365
|
if margin:
|
361
366
|
polygon = polygon.buffer(margin, join_style="mitre")
|
@@ -367,12 +372,16 @@ class Component:
|
|
367
372
|
|
368
373
|
# Intersect the polygon with the bounds to fit it within the map
|
369
374
|
fitted_polygon = polygon.intersection(bounds)
|
375
|
+
self.logger.debug("Fitted the polygon into the bounds: %s", bounds)
|
370
376
|
|
371
377
|
if not isinstance(fitted_polygon, Polygon):
|
372
378
|
raise ValueError("The fitted polygon is not a valid polygon.")
|
373
379
|
|
374
380
|
# Return the fitted polygon points
|
375
|
-
|
381
|
+
as_list = list(fitted_polygon.exterior.coords)
|
382
|
+
if not as_list:
|
383
|
+
raise ValueError("The fitted polygon has no points.")
|
384
|
+
return as_list
|
376
385
|
|
377
386
|
def get_infolayer_path(self, layer_name: str) -> str | None:
|
378
387
|
"""Returns the path to the info layer file.
|
@@ -31,11 +31,12 @@ class Game:
|
|
31
31
|
"""
|
32
32
|
|
33
33
|
code: str | None = None
|
34
|
-
dem_multipliyer: int =
|
34
|
+
dem_multipliyer: int = 2
|
35
35
|
_additional_dem_name: str | None = None
|
36
36
|
_map_template_path: str | None = None
|
37
37
|
_texture_schema: str | None = None
|
38
38
|
_grle_schema: str | None = None
|
39
|
+
_tree_schema: str | None = None
|
39
40
|
|
40
41
|
# Order matters! Some components depend on others.
|
41
42
|
components = [Texture, I3d, GRLE, Background, Config]
|
@@ -109,6 +110,19 @@ class Game:
|
|
109
110
|
raise ValueError("GRLE layers schema path not set.")
|
110
111
|
return self._grle_schema
|
111
112
|
|
113
|
+
@property
|
114
|
+
def tree_schema(self) -> str:
|
115
|
+
"""Returns the path to the tree layers schema file.
|
116
|
+
|
117
|
+
Raises:
|
118
|
+
ValueError: If the tree layers schema path is not set.
|
119
|
+
|
120
|
+
Returns:
|
121
|
+
str: The path to the tree layers schema file."""
|
122
|
+
if not self._tree_schema:
|
123
|
+
raise ValueError("Tree layers schema path not set.")
|
124
|
+
return self._tree_schema
|
125
|
+
|
112
126
|
def dem_file_path(self, map_directory: str) -> str:
|
113
127
|
"""Returns the path to the DEM file.
|
114
128
|
|
@@ -187,6 +201,7 @@ class FS25(Game):
|
|
187
201
|
_map_template_path = os.path.join(working_directory, "data", "fs25-map-template.zip")
|
188
202
|
_texture_schema = os.path.join(working_directory, "data", "fs25-texture-schema.json")
|
189
203
|
_grle_schema = os.path.join(working_directory, "data", "fs25-grle-schema.json")
|
204
|
+
_tree_schema = os.path.join(working_directory, "data", "fs25-tree-schema.json")
|
190
205
|
|
191
206
|
def dem_file_path(self, map_directory: str) -> str:
|
192
207
|
"""Returns the path to the DEM file.
|