From c454c03ba79a15fa15b35095c73e39e4b55804ea Mon Sep 17 00:00:00 2001 From: Stan Soldatov Date: Sun, 22 Dec 2024 22:48:24 +0100 Subject: [PATCH] Add frame for deco foliage. --- maps4fs/generator/grle.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/maps4fs/generator/grle.py b/maps4fs/generator/grle.py index b3c11b6..4b2656e 100644 --- a/maps4fs/generator/grle.py +++ b/maps4fs/generator/grle.py @@ -41,6 +41,7 @@ def preprocess(self) -> None: attribute. If the game does not support I3D files, the attribute is set to None.""" self.farmland_margin = self.kwargs.get("farmland_margin", 0) + self.randomize_plants = self.kwargs.get("randomize_plants", True) try: grle_schema_path = self.game.grle_schema @@ -357,7 +358,8 @@ def get_rounded_polygon( # Add islands of plants to the base image. island_count = self.map_size self.logger.info("Adding %s islands of plants to the base image.", island_count) - grass_image_copy = create_island_of_plants(grass_image_copy, island_count) + if self.randomize_plants: + grass_image_copy = create_island_of_plants(grass_image_copy, island_count) self.logger.debug("Islands of plants added to the base image.") # Sligtly reduce the size of the grass_image, that we'll use as mask. @@ -368,6 +370,12 @@ def get_rounded_polygon( grass_image_copy[grass_image == 0] = 0 self.logger.debug("Removed the values where the base image has zeros.") + # Set zeros on all sides of the image + grass_image_copy[0, :] = 0 # Top side + grass_image_copy[-1, :] = 0 # Bottom side + grass_image_copy[:, 0] = 0 # Left side + grass_image_copy[:, -1] = 0 # Right side + # Value of 33 represents the base grass plant. # After painting it with base grass, we'll create multiple islands of different plants. # On the final step, we'll remove all the values which in pixels