enemy: add max_viewport_dist attribute
Analogous to the max_viewport_dist in Projectiles
This commit is contained in:
parent
f5e8cfe65e
commit
748b92fc7f
2 changed files with 7 additions and 1 deletions
|
@ -287,7 +287,11 @@ bool enemy_is_targetable(Enemy *enemy) {
|
|||
}
|
||||
|
||||
bool enemy_in_viewport(Enemy *enemy) {
|
||||
double s = 60; // TODO: make this adjustable
|
||||
// FIXME: Ideally this is supposed to be the size of the visual, as in with projectiles, but
|
||||
// we don't have access to this information here.
|
||||
real base = 60;
|
||||
|
||||
real s = base + enemy->max_viewport_dist;
|
||||
|
||||
return
|
||||
creal(enemy->pos) >= -s &&
|
||||
|
|
|
@ -112,6 +112,8 @@ DEFINE_ENTITY_TYPE(Enemy, {
|
|||
float hit_radius;
|
||||
float hurt_radius;
|
||||
|
||||
float max_viewport_dist;
|
||||
|
||||
bool moving;
|
||||
|
||||
IF_ENEMY_DEBUG(
|
||||
|
|
Loading…
Reference in a new issue