]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
impulse 911: check if the destination location is "somewhat close" to a spawnpoint
authorRudolf Polzer <divverent@alientrap.org>
Wed, 24 Aug 2011 14:14:21 +0000 (16:14 +0200)
committerRudolf Polzer <divverent@alientrap.org>
Wed, 24 Aug 2011 14:14:21 +0000 (16:14 +0200)
qcsrc/server/miscfunctions.qc

index 0dca3ab282030c4bc98969ddcbda261b16b2a90b..61df00dd0b1bf173262628d6666f9fd31e1ca7f4 100644 (file)
@@ -2476,6 +2476,7 @@ float MoveToRandomMapLocation(entity e, float goodcontents, float badcontents, f
 {
     float m, i;
     vector start, org, delta, end, enddown, mstart;
+    entity sp;
 
     m = e.dphitcontentsmask;
     e.dphitcontentsmask = goodcontents | badcontents;
@@ -2528,6 +2529,13 @@ float MoveToRandomMapLocation(entity e, float goodcontents, float badcontents, f
         if (trace_fraction >= 1)
             continue;
 
+       // rule 4: we must "see" some spawnpoint
+       for(sp = world; (sp = find(sp, classname, "info_player_deathmatch")); )
+               if(checkpvs(mstart, sp))
+                       break;
+       if(!sp)
+               continue;
+
         // find a random vector to "look at"
         end_x = org_x + random() * delta_x;
         end_y = org_y + random() * delta_y;