]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
remove debugging code
authorMartin Taibr <taibr.martin@gmail.com>
Fri, 7 Oct 2016 17:06:13 +0000 (19:06 +0200)
committerMartin Taibr <taibr.martin@gmail.com>
Fri, 7 Oct 2016 17:09:58 +0000 (19:09 +0200)
qcsrc/common/mutators/mutator/spawn_near_teammate/sv_spawn_near_teammate.qc

index 68af78af48ec55d99b2cc6014ac340947f4c6986..26a6c509b1953003342ba7107ceb369d3a116582 100644 (file)
@@ -22,8 +22,6 @@ MUTATOR_HOOKFUNCTION(spawn_near_teammate, Spawn_Score)
        entity spawn_spot = M_ARGV(1, entity);
        vector spawn_score = M_ARGV(2, vector);
 
-       //LOG_INFOF("Spawn_Score player: %s %v spawn_spot: %v spawn_score: %f\n", player.netname, player.origin, spawn_spot.origin, spawn_score);
-
        if(autocvar_g_spawn_near_teammate_ignore_spawnpoint == 1 || (autocvar_g_spawn_near_teammate_ignore_spawnpoint == 2 && player.cvar_cl_spawn_near_teammate))
                return;
 
@@ -51,19 +49,17 @@ MUTATOR_HOOKFUNCTION(spawn_near_teammate, Spawn_Score)
        else if(player.team == spawn_spot.team)
                spawn_score.x += SPAWN_PRIO_NEAR_TEAMMATE_SAMETEAM; // prefer same team, if we can't find a spawn near teammate
 
-       //LOG_INFOF("Spawn_Score ret %v", spawn_score);
        M_ARGV(2, vector) = spawn_score;
 }
 
 MUTATOR_HOOKFUNCTION(spawn_near_teammate, PlayerSpawn)
 {
-       //if(!teamplay) { return; } // TODO DEBUGGING
+       if(!teamplay) { return; }
        entity player = M_ARGV(0, entity);
        entity spawn_spot = M_ARGV(1, entity);
 
-       LOG_INFOF("PlayerSpawn for player: %s %v spawn_spot: %v\n", player.netname, player.origin, spawn_spot.origin);
+       //LOG_INFOF("PlayerSpawn for player: %s %v spawn_spot: %v\n", player.netname, player.origin, spawn_spot.origin);
 
-       /*
        int num_red = 0, num_blue = 0, num_yellow = 0, num_pink = 0;
        FOREACH_CLIENT(IS_PLAYER(it),
        {
@@ -78,7 +74,6 @@ MUTATOR_HOOKFUNCTION(spawn_near_teammate, PlayerSpawn)
 
        if(num_red == 1 || num_blue == 1 || num_yellow == 1 || num_pink == 1)
                return; // at least 1 team has only 1 player, let's not give the bigger team too much of an advantage!
-       */ // // TODO DEBUGING
 
        // Note: when entering this, fixangle is already set.
        if(autocvar_g_spawn_near_teammate_ignore_spawnpoint == 1 || (autocvar_g_spawn_near_teammate_ignore_spawnpoint == 2 && player.cvar_cl_spawn_near_teammate))
@@ -90,8 +85,8 @@ MUTATOR_HOOKFUNCTION(spawn_near_teammate, PlayerSpawn)
                vector best_pos = '0 0 0';
                float best_dist = 0;
                FOREACH_CLIENT(IS_PLAYER(it), LAMBDA(
-                       LOG_INFOF("  for client: %s %v\n", it.netname, it.origin);
-                       //if (!SAME_TEAM(player, it)) continue; // TODO DEBUGING
+                       //LOG_INFOF("  for client: %s %v\n", it.netname, it.origin);
+                       if (!SAME_TEAM(player, it)) continue;
                        if (autocvar_g_spawn_near_teammate_ignore_spawnpoint_check_health >= 0 && it.health < autocvar_g_balance_health_regenstable) continue;
                        if (IS_DEAD(it)) continue;
                        if (time < it.msnt_timer) continue;
@@ -106,7 +101,7 @@ MUTATOR_HOOKFUNCTION(spawn_near_teammate, PlayerSpawn)
                        else
                                fixedmakevectors(it.angles); // .angles is the angle of the model - usually/always 0 pitch
 
-                       // test diffrent spots close to mate - trace upwards so it works on uneven surfaces
+                       // test different spots close to mate - trace upwards so it works on uneven surfaces
                        // don't spawn in front of player or directly behind to avoid players shooting each other
                        for(int i = 0; i < 6; ++i)
                        {
@@ -133,14 +128,14 @@ MUTATOR_HOOKFUNCTION(spawn_near_teammate, PlayerSpawn)
 
                                }
                                vector horizontal_trace_endpos = trace_endpos;
-                               te_lightning1(NULL, it.origin, horizontal_trace_endpos);
+                               //te_lightning1(NULL, it.origin, horizontal_trace_endpos);
                                if(trace_fraction != 1.0) continue;
 
                                // 400 is about the height of a typical laser jump (in overkill)
-                               // not traceline because we need space for the whole payer, not just his origin
+                               // not traceline because we need space for the whole player, not just his origin
                                tracebox(horizontal_trace_endpos, STAT(PL_MIN, NULL), STAT(PL_MAX, NULL), horizontal_trace_endpos - '0 0 400', MOVE_NORMAL, it);
                                vector vectical_trace_endpos = trace_endpos;
-                               te_lightning1(NULL, horizontal_trace_endpos, vectical_trace_endpos);
+                               //te_lightning1(NULL, horizontal_trace_endpos, vectical_trace_endpos);
                                if (trace_startsolid) continue; // inside another player
                                if (trace_fraction == 1.0) continue; // above void or too high
                                if (trace_dphitq3surfaceflags & Q3SURFACEFLAG_SKY) continue;
@@ -150,7 +145,7 @@ MUTATOR_HOOKFUNCTION(spawn_near_teammate, PlayerSpawn)
                                // make sure the spawned player will have floor ahead (or at least a wall - he shouldn't fall as soon as he starts moving)
                                vector floor_test_start = vectical_trace_endpos + v_up * STAT(PL_MAX, NULL).z + v_forward * STAT(PL_MAX, NULL).x; // top front of player's bbox - highest point we know is not inside solid
                                traceline(floor_test_start, floor_test_start + v_forward * 100 - v_up * 128, MOVE_NOMONSTERS, it);
-                               te_beam(NULL, floor_test_start, trace_endpos);
+                               //te_beam(NULL, floor_test_start, trace_endpos);
                                if (trace_fraction == 1.0) continue;
 
                                if (autocvar_g_nades) {
@@ -168,22 +163,22 @@ MUTATOR_HOOKFUNCTION(spawn_near_teammate, PlayerSpawn)
                                if(autocvar_g_spawn_near_teammate_ignore_spawnpoint_closetodeath)
                                {
                                        float dist = vlen(vectical_trace_endpos - player.msnt_deathloc);
-                                       LOG_INFOF("      dist: %f, best_dist %f\n", dist, best_dist);
+                                       //LOG_INFOF("      dist: %f, best_dist %f\n", dist, best_dist);
                                        if(dist < best_dist || best_dist == 0)
                                        {
-                                               LOG_INFOF("      new best dist - pos: %v\n", vectical_trace_endpos);
+                                               //LOG_INFOF("      new best dist - pos: %v\n", vectical_trace_endpos);
                                                best_dist = dist;
                                                best_pos = vectical_trace_endpos;
                                                best_mate = it;
                                        }
                                }
-                               else // TODO random to avoid favoring players who joined early
+                               else // TODO randomize to avoid favoring players who joined early
                                {
                                        setorigin(player, vectical_trace_endpos);
                                        player.angles = it.angles;
                                        player.angles_z = 0; // never spawn tilted even if the spot says to
                                        it.msnt_timer = time + autocvar_g_spawn_near_teammate_ignore_spawnpoint_delay;
-                                       LOG_INFOF("      PlayerSpawn return %v\n", player.origin);
+                                       //LOG_INFOF("      PlayerSpawn return %v\n", player.origin);
                                        return;
                                }
                        }
@@ -209,8 +204,6 @@ MUTATOR_HOOKFUNCTION(spawn_near_teammate, PlayerSpawn)
                sprint(player, "angles: ", vtos(player.angles), "\n");
                */
        }
-
-       LOG_INFOF("PlayerSpawn end player: %s %v spawn_spot: %v\n", player.netname, player.origin, spawn_spot.origin);
 }
 
 MUTATOR_HOOKFUNCTION(spawn_near_teammate, PlayerDies)