return;
}
- if(self.classname != STR_PLAYER) { sprint(self, "You can't spawn monsters while spectating.\n"); }
+ if(!IS_PLAYER(self)) { sprint(self, "You can't spawn monsters while spectating.\n"); }
else if not(autocvar_g_monsters) { sprint(self, "Monsters aren't enabled.\n"); }
+ else if(self.vehicle) { sprint(self, "You can't spawn monsters while driving a vehicle.\n"); }
else if(g_td) { sprint(self, "You can't spawn monsters in Tower Defense mode.\n"); }
else if(self.deadflag) { sprint(self, "You can't spawn monsters while dead.\n"); }
else if(self.monstercount >= autocvar_g_monsters_max_perplayer) { sprint(self, "You have spawned too many monsters, kill some before trying to spawn any more.\n"); }
if(!targ || !ent)
return FALSE; // this check should fix a crash
- if(targ.vehicle_flags & VHF_ISVEHICLE)
- targ = targ.vehicle;
-
if(time < game_starttime)
return FALSE; // monsters do nothing before the match has started
- traceline(ent.origin, targ.origin, FALSE, ent);
+ WarpZone_TraceLine(ent.origin, targ.origin, MOVE_NORMAL, ent);
if(vlen(targ.origin - ent.origin) >= ent.target_range)
return FALSE; // enemy is too far away
-
+
+ if not(targ.vehicle_flags & VHF_ISVEHICLE)
if(trace_ent != targ)
return FALSE; // we can't see the enemy
if(IS_SPEC(targ) || IS_OBSERVER(targ))
return FALSE; // enemy is a spectator
+ if not(targ.vehicle_flags & VHF_ISVEHICLE) // vehicles dont count as alive?
if(targ.deadflag != DEAD_NO || ent.deadflag != DEAD_NO || targ.health <= 0 || ent.health <= 0)
return FALSE; // enemy/self is dead
if(targ.monster_owner == ent || ent.monster_owner == targ)
return FALSE; // enemy owns us, or we own them
+ if not(targ.vehicle_flags & VHF_ISVEHICLE)
if(targ.flags & FL_NOTARGET)
return FALSE; // enemy can't be targetted
self.tur_head.owner = self;
self.takedamage = DAMAGE_AIM;
self.bot_attack = TRUE;
+ self.monster_attack = TRUE;
self.iscreature = TRUE;
self.teleportable = FALSE; // no teleporting for vehicles, too buggy
self.damagedbycontents = TRUE;