Fix gas poisoning, explosion hit detection and render order
- Move gas poisoning from Gas.move() to Gas.collisions() so all rats are registered in the collision system before the poison query runs. - Shrink gas and explosion bboxes so rats must be well inside the tile to be poisoned/killed. - Use AABB overlap instead of partial_move threshold for gas poisoning. - Draw mobile units first, then top-layer effects (gas, mines, bombs, explosions) so rats appear under the gas. - Add draw_on_top hint to Unit base class and top-layer units.
This commit is contained in:
@@ -516,7 +516,21 @@ class MiceMaze:
|
||||
# Pass 2: RESOLVE and DRAW
|
||||
for unit in sorted_units:
|
||||
unit.collisions()
|
||||
unit.draw()
|
||||
|
||||
# Draw mobile units first so ground effects appear on top
|
||||
for unit in sorted_units:
|
||||
if not getattr(unit, "draw_on_top", False):
|
||||
unit.draw()
|
||||
|
||||
# Draw top-layer effects on top of mobile units
|
||||
for unit in sorted_units:
|
||||
if getattr(unit, "draw_on_top", False) and not getattr(unit, "draw_last", False):
|
||||
unit.draw()
|
||||
|
||||
# Draw foreground/last-layer units (points) on top of everything
|
||||
for unit in sorted_units:
|
||||
if getattr(unit, "draw_last", False):
|
||||
unit.draw()
|
||||
|
||||
self.graphics.draw_cave_foreground()
|
||||
self.render_engine.draw_pointer(self.pointer[0] * self.cell_size, self.pointer[1] * self.cell_size)
|
||||
|
||||
Reference in New Issue
Block a user