]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Fix monsters not targeting vehicles
authorMario <mario.mario@y7mail.com>
Thu, 11 Apr 2013 01:16:31 +0000 (11:16 +1000)
committerMario <mario.mario@y7mail.com>
Thu, 11 Apr 2013 01:16:31 +0000 (11:16 +1000)
qcsrc/server/command/cmd.qc
qcsrc/server/monsters/lib/monsters.qc
qcsrc/server/monsters/lib/spawn.qc
qcsrc/server/vehicles/vehicles.qc

index fb447f056358a942092aa2605a35216364e0549b..6f22c5083058bcabae917e3b89824f92b4014b7b 100644 (file)
@@ -276,8 +276,9 @@ void ClientCommand_mobspawn(float request, float argc)
                                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"); }
index f7d01af62613811d8ab4d99643aabb6a1983f289..889aeb4fc8ecfe1be91fe123bcdf8101e86a8aa0 100644 (file)
@@ -84,17 +84,15 @@ float monster_isvalidtarget (entity targ, entity ent)
        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
                
@@ -107,12 +105,14 @@ float monster_isvalidtarget (entity targ, entity ent)
        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
        
index 2b5fed48100d06532abcaa8cd68ebeecc2d62a49..87704d80f2524ff202d07031d7286ff308299b29 100644 (file)
@@ -18,9 +18,6 @@ entity spawnmonster (string monster, entity spawnedby, entity own, vector orig,
                return world;
        }
        
-       if(spawnedby.vehicle) // no vehicle player spawning...
-               return world;
-       
        if(!spawncode_first_load)
        {
                initialize_field_db();
index dd1ed6523c96a51c1bb793062837872577f6c987..bad37d30f4ecd7759e842b2b2a2db793304c95fe 100644 (file)
@@ -1258,6 +1258,7 @@ float vehicle_initialize(string  net_name,
     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;