Draw explosions and gas inside tunnel cells

Remove the is_hidden_in_tunnel() checks from Explosion.draw() and
Gas.draw() so explosions and gas clouds remain visible when their center
falls inside a tunnel cell. Logic already spawned them in tunnel cells,
but they were rendered invisible because the draw path returned early.
This commit is contained in:
2026-06-16 21:56:22 +02:00
parent 5afdf3705b
commit 62a65f599d
2 changed files with 2 additions and 7 deletions
-3
View File
@@ -169,9 +169,6 @@ class Explosion(Bomb):
x_pos = self.position_before[0] * self.game.cell_size + (self.game.cell_size - image_size[0]) // 2 + partial_x x_pos = self.position_before[0] * self.game.cell_size + (self.game.cell_size - image_size[0]) // 2 + partial_x
y_pos = self.position_before[1] * self.game.cell_size + (self.game.cell_size - image_size[1]) // 2 + partial_y y_pos = self.position_before[1] * self.game.cell_size + (self.game.cell_size - image_size[1]) // 2 + partial_y
if self.is_hidden_in_tunnel(image_size):
return
self.game.render_engine.draw_image(x_pos, y_pos, image, anchor="nw", tag="unit") self.game.render_engine.draw_image(x_pos, y_pos, image, anchor="nw", tag="unit")
+2 -4
View File
@@ -75,10 +75,8 @@ class Gas(Unit):
x_pos = self.position_before[0] * self.game.cell_size + (self.game.cell_size - image_size[0]) // 2 + partial_x x_pos = self.position_before[0] * self.game.cell_size + (self.game.cell_size - image_size[0]) // 2 + partial_x
y_pos = self.position_before[1] * self.game.cell_size + (self.game.cell_size - image_size[1]) // 2 + partial_y y_pos = self.position_before[1] * self.game.cell_size + (self.game.cell_size - image_size[1]) // 2 + partial_y
if not self.is_hidden_in_tunnel(image_size): self.game.render_engine.draw_image(x_pos, y_pos, image, anchor="nw", tag="unit")
self.game.render_engine.draw_image(x_pos, y_pos, image, anchor="nw", tag="unit")
for cell in self.spreading_cells: for cell in self.spreading_cells:
x_pos = cell[0] * self.game.cell_size + (self.game.cell_size - image_size[0]) // 2 + partial_x x_pos = cell[0] * self.game.cell_size + (self.game.cell_size - image_size[0]) // 2 + partial_x
y_pos = cell[1] * self.game.cell_size + (self.game.cell_size - image_size[1]) // 2 + partial_y y_pos = cell[1] * self.game.cell_size + (self.game.cell_size - image_size[1]) // 2 + partial_y
if not self.is_hidden_in_tunnel(image_size, position=cell): self.game.render_engine.draw_image(x_pos, y_pos, image, anchor="nw", tag="unit")
self.game.render_engine.draw_image(x_pos, y_pos, image, anchor="nw", tag="unit")