forked from tas/major_tom
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:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user