enemy: add max_viewport_dist attribute

Analogous to the max_viewport_dist in Projectiles
This commit is contained in:
Andrei Alexeyev 2022-11-05 22:12:28 +01:00
parent f5e8cfe65e
commit 748b92fc7f
No known key found for this signature in database
GPG key ID: 72D26128040B9690
2 changed files with 7 additions and 1 deletions

View file

@ -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 &&

View file

@ -112,6 +112,8 @@ DEFINE_ENTITY_TYPE(Enemy, {
float hit_radius;
float hurt_radius;
float max_viewport_dist;
bool moving;
IF_ENEMY_DEBUG(