Skip to content

Commit

Permalink
Add frame for deco foliage.
Browse files Browse the repository at this point in the history
  • Loading branch information
iwatkot committed Dec 22, 2024
1 parent cf997ed commit c454c03
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion maps4fs/generator/grle.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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.
Expand All @@ -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
Expand Down

0 comments on commit c454c03

Please sign in to comment.