}
}
- if(gameover || time < game_starttime || (autocvar_g_campaign && !campaign_bots_may_start) || time < self.spawn_time || player_count - currentbots < 1)
+ targ = self.goalentity;
+
+ monster_target = targ;
+ monster_speed_run = runspeed;
+ monster_speed_walk = walkspeed;
+
+ if(MUTATOR_CALLHOOK(MonsterMove) || gameover || time < game_starttime || (autocvar_g_campaign && !campaign_bots_may_start) || time < self.spawn_time)
{
runspeed = walkspeed = 0;
if(time >= self.spawn_time)
return;
}
- targ = self.goalentity;
-
- monster_target = targ;
- monster_speed_run = runspeed;
- monster_speed_walk = walkspeed;
- MUTATOR_CALLHOOK(MonsterMove);
targ = monster_target;
runspeed = monster_speed_run;
walkspeed = monster_speed_walk;
MUTATOR_HOOKABLE(MonsterMove);
// called when a monster moves
+ // returning TRUE makes the monster stop
// INPUT:
float monster_speed_run;
float monster_speed_walk;
MUTATOR_HOOKFUNCTION(td_MonsterMove)
{
+ entity head;
+ float n_players = 0;
+
+ FOR_EACH_PLAYER(head) { ++n_players; }
+ if(n_players < 1) return TRUE;
+
if not(self.enemy) // don't change targets while attacking
if((vlen(monster_target.origin - self.origin) <= 100 && monster_target.classname == "td_waypoint") || (vlen(monster_target.origin - self.origin) <= 200 && (self.flags & FL_FLY) && monster_target.classname == "td_waypoint"))
{