From: Mario Date: Sat, 12 Mar 2016 00:34:40 +0000 (+1000) Subject: Don't spawn behind the player in spawn near teammates mutator X-Git-Tag: xonotic-v0.8.2~1124 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=ceab6e8524589dc857f3f7de5f028650eea53693;p=xonotic%2Fxonotic-data.pk3dir.git Don't spawn behind the player in spawn near teammates mutator --- diff --git a/qcsrc/common/mutators/mutator/spawn_near_teammate/spawn_near_teammate.qc b/qcsrc/common/mutators/mutator/spawn_near_teammate/spawn_near_teammate.qc index 5d3618f9e..af42a487a 100644 --- a/qcsrc/common/mutators/mutator/spawn_near_teammate/spawn_near_teammate.qc +++ b/qcsrc/common/mutators/mutator/spawn_near_teammate/spawn_near_teammate.qc @@ -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)