From 48a2b394003143b2a5d203165eb64f7a840c9bd1 Mon Sep 17 00:00:00 2001
From: Brandon Rodriguez <brodriguez8774@gmail.com>
Date: Thu, 4 Nov 2021 14:38:17 -0400
Subject: [PATCH] Correct occasional inconsistent trash tile initialization

---
 src/entities/system_entities.py | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/entities/system_entities.py b/src/entities/system_entities.py
index 576e13d..a366c9d 100644
--- a/src/entities/system_entities.py
+++ b/src/entities/system_entities.py
@@ -1164,7 +1164,11 @@ class TrashPile:
 
         # Default with trash on roughly 10% of all tiles.
         total_tiles = data_manager.tile_data['tile_w_count'] * data_manager.tile_data['tile_h_count']
-        if random.randint(0, (total_tiles % 10)) < 1:
+        upper_limit = total_tiles
+        if upper_limit > 100:
+            upper_limit = 100
+        upper_limit = int(upper_limit / 10)
+        if random.randint(0, upper_limit) < 1:
             self.place()
 
     def place(self):
-- 
GitLab