Skip to content

Commit

Permalink
Generation of forests.
Browse files Browse the repository at this point in the history
  • Loading branch information
iwatkot committed Dec 22, 2024
1 parent eaf8134 commit 116428f
Show file tree
Hide file tree
Showing 6 changed files with 473 additions and 2 deletions.
Binary file modified data/fs25-map-template.zip
Binary file not shown.
338 changes: 338 additions & 0 deletions data/fs25-tree-schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,338 @@
[
{
"name": "americanElmRavaged",
"reference_id": 1000
},
{
"name": "americanElm_stage01",
"reference_id": 1001
},
{
"name": "americanElm_stage02",
"reference_id": 1002
},
{
"name": "americanElm_stage03",
"reference_id": 1003
},
{
"name": "americanElm_stage04",
"reference_id": 1004
},
{
"name": "americanElm_stage05",
"reference_id": 1005
},
{
"name": "apple_stage03",
"reference_id": 1006
},
{
"name": "aspen_stage01",
"reference_id": 1007
},
{
"name": "aspen_stage02",
"reference_id": 1008
},
{
"name": "aspen_stage03",
"reference_id": 1009
},
{
"name": "aspen_stage04",
"reference_id": 1010
},
{
"name": "aspen_stage05",
"reference_id": 1011
},
{
"name": "aspen_stage06_var01",
"reference_id": 1012
},
{
"name": "aspen_stage06_var02",
"reference_id": 1013
},
{
"name": "beech_stage01",
"reference_id": 1014
},
{
"name": "beech_stage02",
"reference_id": 1015
},
{
"name": "beech_stage02_var02",
"reference_id": 1016
},
{
"name": "beech_stage02_var03",
"reference_id": 1017
},
{
"name": "beech_stage03",
"reference_id": 1018
},
{
"name": "beech_stage04",
"reference_id": 1019
},
{
"name": "beech_stage05",
"reference_id": 1020
},
{
"name": "beech_stage06_var01",
"reference_id": 1021
},
{
"name": "beech_stage06_var02",
"reference_id": 1022
},
{
"name": "betulaErmanii_stage01",
"reference_id": 1023
},
{
"name": "betulaErmanii_stage02",
"reference_id": 1024
},
{
"name": "betulaErmanii_stage03",
"reference_id": 1025
},
{
"name": "betulaErmanii_stage04",
"reference_id": 1026
},
{
"name": "boxelder_stage01",
"reference_id": 1027
},
{
"name": "boxelder_stage02",
"reference_id": 1028
},
{
"name": "boxelder_stage03",
"reference_id": 1029
},
{
"name": "cherry_stage01",
"reference_id": 1030
},
{
"name": "cherry_stage02",
"reference_id": 1031
},
{
"name": "cherry_stage03",
"reference_id": 1032
},
{
"name": "cherry_stage04",
"reference_id": 1033
},
{
"name": "chineseElm_stage01",
"reference_id": 1034
},
{
"name": "chineseElm_stage02",
"reference_id": 1035
},
{
"name": "chineseElm_stage03",
"reference_id": 1036
},
{
"name": "chineseElm_stage04",
"reference_id": 1037
},
{
"name": "deadwood",
"reference_id": 1038
},
{
"name": "downyServiceBerry_stage01",
"reference_id": 1039
},
{
"name": "downyServiceBerry_stage02",
"reference_id": 1040
},
{
"name": "downyServiceBerry_stage03",
"reference_id": 1041
},
{
"name": "goldenRain_stage01",
"reference_id": 1042
},
{
"name": "goldenRain_stage02",
"reference_id": 1043
},
{
"name": "goldenRain_stage03",
"reference_id": 1044
},
{
"name": "goldenRain_stage04",
"reference_id": 1045
},
{
"name": "japaneseZelkova_stage01",
"reference_id": 1046
},
{
"name": "japaneseZelkova_stage02",
"reference_id": 1047
},
{
"name": "japaneseZelkova_stage03",
"reference_id": 1048
},
{
"name": "japaneseZelkova_stage04",
"reference_id": 1049
},
{
"name": "lodgepolePine_stage01",
"reference_id": 1050
},
{
"name": "lodgepolePine_stage02",
"reference_id": 1051
},
{
"name": "lodgepolePine_stage02Var2",
"reference_id": 1052
},
{
"name": "lodgepolePine_stage03",
"reference_id": 1053
},
{
"name": "lodgepolePine_stage03Var2",
"reference_id": 1054
},
{
"name": "northernCatalpa_stage01",
"reference_id": 1055
},
{
"name": "northernCatalpa_stage02",
"reference_id": 1056
},
{
"name": "northernCatalpa_stage03",
"reference_id": 1057
},
{
"name": "northernCatalpa_stage04",
"reference_id": 1058
},
{
"name": "oak_stage01",
"reference_id": 1059
},
{
"name": "oak_stage02",
"reference_id": 1060
},
{
"name": "oak_stage03",
"reference_id": 1061
},
{
"name": "oak_stage04",
"reference_id": 1062
},
{
"name": "oak_stage05",
"reference_id": 1063
},
{
"name": "pinusSylvestris_stage01",
"reference_id": 1064
},
{
"name": "pinusSylvestris_stage02",
"reference_id": 1065
},
{
"name": "pinusSylvestris_stage03",
"reference_id": 1066
},
{
"name": "pinusSylvestris_stage04",
"reference_id": 1067
},
{
"name": "pinusSylvestris_stage05",
"reference_id": 1068
},
{
"name": "pinusTabuliformis_stage01",
"reference_id": 1069
},
{
"name": "pinusTabuliformis_stage02",
"reference_id": 1070
},
{
"name": "pinusTabuliformis_stage03",
"reference_id": 1071
},
{
"name": "pinusTabuliformis_stage04",
"reference_id": 1072
},
{
"name": "pinusTabuliformis_stage05",
"reference_id": 1073
},
{
"name": "shagbarkHickory_stage01",
"reference_id": 1074
},
{
"name": "shagbarkHickory_stage02",
"reference_id": 1075
},
{
"name": "shagbarkHickory_stage03",
"reference_id": 1076
},
{
"name": "shagbarkHickory_stage04",
"reference_id": 1077
},
{
"name": "tiliaAmurensis_stage01",
"reference_id": 1078
},
{
"name": "tiliaAmurensis_stage02",
"reference_id": 1079
},
{
"name": "tiliaAmurensis_stage03",
"reference_id": 1080
},
{
"name": "tiliaAmurensis_stage04",
"reference_id": 1081
},
{
"name": "transportTree",
"reference_id": 1082
},
{
"name": "treesRavaged",
"reference_id": 1083
}
]
15 changes: 15 additions & 0 deletions maps4fs/generator/game.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ class Game:
_map_template_path: str | None = None
_texture_schema: str | None = None
_grle_schema: str | None = None
_tree_schema: str | None = None

# Order matters! Some components depend on others.
components = [Texture, I3d, GRLE, Background, Config]
Expand Down Expand Up @@ -109,6 +110,19 @@ def grle_schema(self) -> str:
raise ValueError("GRLE layers schema path not set.")
return self._grle_schema

@property
def tree_schema(self) -> str:
"""Returns the path to the tree layers schema file.
Raises:
ValueError: If the tree layers schema path is not set.
Returns:
str: The path to the tree layers schema file."""
if not self._tree_schema:
raise ValueError("Tree layers schema path not set.")
return self._tree_schema

def dem_file_path(self, map_directory: str) -> str:
"""Returns the path to the DEM file.
Expand Down Expand Up @@ -187,6 +201,7 @@ class FS25(Game):
_map_template_path = os.path.join(working_directory, "data", "fs25-map-template.zip")
_texture_schema = os.path.join(working_directory, "data", "fs25-texture-schema.json")
_grle_schema = os.path.join(working_directory, "data", "fs25-grle-schema.json")
_tree_schema = os.path.join(working_directory, "data", "fs25-tree-schema.json")

def dem_file_path(self, map_directory: str) -> str:
"""Returns the path to the DEM file.
Expand Down
2 changes: 2 additions & 0 deletions maps4fs/generator/grle.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,8 @@ def _add_plants(self) -> None:
grass_image_path = grass_layer.get_preview_or_path(weights_directory)
self.logger.debug("Grass image path: %s.", grass_image_path)

# TODO: Get the forest layer and combine it with the grass layer.

if not grass_image_path or not os.path.isfile(grass_image_path):
self.logger.warning("Base image not found in %s.", grass_image_path)
return
Expand Down
Loading

0 comments on commit 116428f

Please sign in to comment.