Fix laser beam blocked by own tile, consolidate enemy-type checks

Beam raycast now skips the tile the turret is mounted on, so
wall-embedded laser turrets can shoot outward.

Extract entity_is_enemy() into engine/entity.c as single source
of truth for enemy-type checks. Replaces triplicated type lists
in level.c, drone.c, and projectile.c that caused the collision
bug when new enemy types were added.
This commit is contained in:
Thomas
2026-03-02 20:56:45 +00:00
parent 196b4f35b9
commit af0a9904c2
6 changed files with 33 additions and 19 deletions

View File

@@ -251,9 +251,7 @@ static void projectile_update(Entity *self, float dt, const Tilemap *map) {
/* Player bullets target enemies, enemy bullets target player */
if (is_player_proj) {
if (e->type != ENT_ENEMY_GRUNT && e->type != ENT_ENEMY_FLYER &&
e->type != ENT_TURRET && e->type != ENT_ENEMY_CHARGER &&
e->type != ENT_SPAWNER && e->type != ENT_LASER_TURRET) continue;
if (!entity_is_enemy(e)) continue;
} else {
if (e->type != ENT_PLAYER) continue;
}