]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Don't spawn behind the player in spawn near teammates mutator
authorMario <mario@smbclan.net>
Sat, 12 Mar 2016 00:34:40 +0000 (10:34 +1000)
committerMario <mario@smbclan.net>
Sat, 12 Mar 2016 00:34:40 +0000 (10:34 +1000)
qcsrc/common/mutators/mutator/spawn_near_teammate/spawn_near_teammate.qc

index 5d3618f9e75f29a0d043d10c34485aa519ead138..af42a487ad093a0f409741e61fc80be6de3b0528 100644 (file)
@@ -28,10 +28,9 @@ MUTATOR_HOOKFUNCTION(spawn_near_teammate, Spawn_Score)
 
        RandomSelection_Init();
        FOREACH_CLIENT(IS_PLAYER(it) && it != self && SAME_TEAM(it, self) && !IS_DEAD(it), LAMBDA(
-               float l = vlen(spawn_spot.origin - it.origin);
-               if(l > autocvar_g_spawn_near_teammate_distance)
+               if(vdist(spawn_spot.origin - it.origin, >, autocvar_g_spawn_near_teammate_distance))
                        continue;
-               if(l < 48)
+               if(vdist(spawn_spot.origin - it.origin, <, 48))
                        continue;
                if(!checkpvs(spawn_spot.origin, it))
                        continue;
@@ -70,7 +69,7 @@ MUTATOR_HOOKFUNCTION(spawn_near_teammate, PlayerSpawn)
                        if(STAT(FROZEN, it) == 0)
                        if(it != self)
                        {
-                               tracebox(it.origin, STAT(PL_MIN, NULL), STAT(PL_MAX, NULL), it.origin - '0 0 100', MOVE_WORLDONLY, it);
+                               tracebox(it.origin, STAT(PL_MIN, NULL), STAT(PL_MAX, NULL), it.origin - '0 0 100', MOVE_NOMONSTERS, it);
                                if(trace_fraction != 1.0)
                                if(!(trace_dphitq3surfaceflags & Q3SURFACEFLAG_SKY))
                                {
@@ -82,30 +81,30 @@ MUTATOR_HOOKFUNCTION(spawn_near_teammate, PlayerSpawn)
                                                else
                                                        fixedmakevectors(it.angles);
 
-                                               for(pc = 0; pc < 5; ++pc) // test 5 diffrent spots close to mate
+                                               for(pc = 0; pc < 4; ++pc) // test 4 diffrent spots close to mate
                                                {
                                                        switch(pc)
                                                        {
                                                                case 0:
-                                                                       tracebox(it.origin , STAT(PL_MIN, NULL), STAT(PL_MAX, NULL), it.origin + v_right * 128, MOVE_NORMAL, it);
+                                                                       tracebox(it.origin , STAT(PL_MIN, NULL), STAT(PL_MAX, NULL), it.origin + v_right * 128, MOVE_NOMONSTERS, it);
                                                                        break;
                                                                case 1:
-                                                                       tracebox(it.origin , STAT(PL_MIN, NULL), STAT(PL_MAX, NULL), it.origin - v_right * 128 , MOVE_NORMAL, it);
+                                                                       tracebox(it.origin , STAT(PL_MIN, NULL), STAT(PL_MAX, NULL), it.origin - v_right * 128 , MOVE_NOMONSTERS, it);
                                                                        break;
                                                                case 2:
-                                                                       tracebox(it.origin , STAT(PL_MIN, NULL), STAT(PL_MAX, NULL), it.origin + v_right * 64 - v_forward * 64, MOVE_NORMAL, it);
+                                                                       tracebox(it.origin , STAT(PL_MIN, NULL), STAT(PL_MAX, NULL), it.origin + v_right * 64 - v_forward * 64, MOVE_NOMONSTERS, it);
                                                                        break;
                                                                case 3:
-                                                                       tracebox(it.origin , STAT(PL_MIN, NULL), STAT(PL_MAX, NULL), it.origin - v_right * 64 - v_forward * 64, MOVE_NORMAL, it);
-                                                                       break;
-                                                               case 4:
-                                                                       tracebox(it.origin , STAT(PL_MIN, NULL), STAT(PL_MAX, NULL), it.origin - v_forward * 128, MOVE_NORMAL, it);
+                                                                       tracebox(it.origin , STAT(PL_MIN, NULL), STAT(PL_MAX, NULL), it.origin - v_right * 64 - v_forward * 64, MOVE_NOMONSTERS, it);
                                                                        break;
+                                                               //case 4:
+                                                                       //tracebox(it.origin , STAT(PL_MIN, NULL), STAT(PL_MAX, NULL), it.origin - v_forward * 128, MOVE_NOMONSTERS, it);
+                                                                       //break;
                                                        }
 
                                                        if(trace_fraction == 1.0)
                                                        {
-                                                               traceline(trace_endpos + '0 0 4', trace_endpos - '0 0 100', MOVE_NORMAL, it);
+                                                               traceline(trace_endpos + '0 0 4', trace_endpos - '0 0 100', MOVE_NOMONSTERS, it);
                                                                if(trace_fraction != 1.0)
                                                                {
                                                                        if(autocvar_g_spawn_near_teammate_ignore_spawnpoint_closetodeath)