Fix line of sight checks to use collision rectangle for prop interactions; as it caused the enemy to be able to softlock itself around a prop by thinking it was inside one the whole time;
This commit is contained in:
+4
-4
@@ -25,10 +25,10 @@ class EnemyAI
|
|||||||
|
|
||||||
if player_tile == enemy_tile
|
if player_tile == enemy_tile
|
||||||
los_blocked = !prop_in_tile.nil? && !(
|
los_blocked = !prop_in_tile.nil? && !(
|
||||||
line_of_sight?(@enemy.x - @enemy.w / 2, @enemy.y - @enemy.h / 2, player_x, player_y, prop_in_tile.rect) &&
|
line_of_sight?(@enemy.x - @enemy.w / 2, @enemy.y - @enemy.h / 2, player_x, player_y, prop_in_tile.collision_rect) &&
|
||||||
line_of_sight?(@enemy.x + @enemy.w / 2, @enemy.y + @enemy.h / 2, player_x, player_y, prop_in_tile.rect) &&
|
line_of_sight?(@enemy.x + @enemy.w / 2, @enemy.y + @enemy.h / 2, player_x, player_y, prop_in_tile.collision_rect) &&
|
||||||
line_of_sight?(@enemy.x - @enemy.w / 2, @enemy.y + @enemy.h / 2, player_x, player_y, prop_in_tile.rect) &&
|
line_of_sight?(@enemy.x - @enemy.w / 2, @enemy.y + @enemy.h / 2, player_x, player_y, prop_in_tile.collision_rect) &&
|
||||||
line_of_sight?(@enemy.x + @enemy.w / 2, @enemy.y - @enemy.h / 2, player_x, player_y, prop_in_tile.rect)
|
line_of_sight?(@enemy.x + @enemy.w / 2, @enemy.y - @enemy.h / 2, player_x, player_y, prop_in_tile.collision_rect)
|
||||||
)
|
)
|
||||||
|
|
||||||
if los_blocked
|
if los_blocked
|
||||||
|
|||||||
Reference in New Issue
Block a user