vector my_center = CENTER_OR_VIEWOFS(this);
// find the closest acceptable target to pass to
- FOREACH_ENTITY_RADIUS(this.origin, this.target_range, it.monster_attack,
+ IL_EACH(g_monster_targets, it.monster_attack && vdist(it.origin - this.origin, <, this.target_range),
{
if(Monster_ValidTarget(this, it))
{
if(!teamplay) { return; }
this.team = newteam;
+ if(!this.monster_attack)
+ IL_PUSH(g_monster_targets, this);
this.monster_attack = true; // new team, activate attacking
monster_setupcolors(this);
{
if(tokenize_console(s) != 3)
{
- LOG_TRACE("Invalid sound info line: ", s);
+ //LOG_DEBUG("Invalid sound info line: ", s); // probably a comment, no need to spam warnings
continue;
}
PrecacheGlobalSound(strcat(argv(1), " ", argv(2)));
float fh = fopen(f, FILE_READ);
if(fh < 0)
{
- LOG_TRACE("Monster sound file not found: ", f);
+ //LOG_DEBUG("Monster sound file not found: ", f); // no biggie, monster has no sounds, let's not spam it
return false;
}
while((s = fgets(fh)))
|| ((trace_fraction < 1) && (trace_ent != this.enemy)))
{
this.enemy = NULL;
- this.pass_distance = 0;
+ //this.pass_distance = 0;
}
if(this.enemy)
void Monster_CalculateVelocity(entity this, vector to, vector from, float turnrate, float movespeed)
{
- float current_distance = vlen((('1 0 0' * to.x) + ('0 1 0' * to.y)) - (('1 0 0' * from.x) + ('0 1 0' * from.y))); // for the sake of this check, exclude Z axis
- float initial_height = 0; //min(50, (targ_distance * tanh(20)));
- float current_height = (initial_height * min(1, (this.pass_distance) ? (current_distance / this.pass_distance) : current_distance));
+ //float current_distance = vlen((('1 0 0' * to.x) + ('0 1 0' * to.y)) - (('1 0 0' * from.x) + ('0 1 0' * from.y))); // for the sake of this check, exclude Z axis
+ //float initial_height = 0; //min(50, (targ_distance * tanh(20)));
+ //float current_height = (initial_height * min(1, (this.pass_distance) ? (current_distance / this.pass_distance) : current_distance));
//print("current_height = ", ftos(current_height), ", initial_height = ", ftos(initial_height), ".\n");
- vector targpos;
+ vector targpos = to;
+#if 0
if(current_height) // make sure we can actually do this arcing path
{
targpos = (to + ('0 0 1' * current_height));
}
}
else { targpos = to; }
+#endif
//this.angles = normalize(('0 1 0' * to_y) - ('0 1 0' * from_y));
this.monster_moveto = '0 0 0';
this.monster_face = '0 0 0';
- this.pass_distance = vlen((('1 0 0' * this.enemy.origin_x) + ('0 1 0' * this.enemy.origin_y)) - (('1 0 0' * this.origin_x) + ('0 1 0' * this.origin_y)));
+ //this.pass_distance = vlen((('1 0 0' * this.enemy.origin_x) + ('0 1 0' * this.enemy.origin_y)) - (('1 0 0' * this.origin_x) + ('0 1 0' * this.origin_y)));
Monster_Sound(this, monstersound_sight, 0, false, CH_VOICE);
}
}
Monster_Sounds_Update(this);
if(teamplay)
+ {
+ if(!this.monster_attack)
+ IL_PUSH(g_monster_targets, this);
this.monster_attack = true; // we can have monster enemies in team games
+ }
Monster_Sound(this, monstersound_spawn, 0, false, CH_VOICE);
this.candrop = true;
this.view_ofs = '0 0 0.7' * (this.maxs_z * 0.5);
this.oldtarget2 = this.target2;
- this.pass_distance = 0;
+ //this.pass_distance = 0;
this.deadflag = DEAD_NO;
this.spawn_time = time;
this.gravity = 1;
bool autocvar_g_invasion_zombies_only;
float autocvar_g_invasion_spawn_delay;
+bool inv_warning_shown; // spammy
+
.string spawnmob;
spawnfunc(invasion_wave)
if(spawn_point == NULL)
{
- LOG_TRACE("Warning: couldn't find any invasion_spawnpoint spawnpoints, attempting to spawn monsters in random locations");
+ if(!inv_warning_shown)
+ {
+ inv_warning_shown = true;
+ LOG_TRACE("Warning: couldn't find any invasion_spawnpoint spawnpoints, attempting to spawn monsters in random locations");
+ }
entity e = spawn();
setsize(e, mon.m_mins, mon.m_maxs);
}
}
+ if(monster.monster_attack)
+ IL_REMOVE(g_monster_targets, monster);
monster.monster_attack = false; // it's the player's job to kill all the monsters
if(inv_roundcnt >= inv_maxrounds)