M_ARGV(2, vector) = spawn_score;
}
+vector snt_ofs[6];
MUTATOR_HOOKFUNCTION(spawn_near_teammate, PlayerSpawn)
{
if (!teamplay) return;
// 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
// test the potential spots in pairs (first pair is better than second and so on) but don't prefer one side
+ snt_ofs[0] = up * 64 + right * 128 - forward * 64;
+ snt_ofs[1] = up * 64 - right * 128 - forward * 64;
+ snt_ofs[2] = up * 64 + right * 192;
+ snt_ofs[3] = up * 64 - right * 192;
+ snt_ofs[4] = up * 64 + right * 64 - forward * 128;
+ snt_ofs[5] = up * 64 - right * 64 - forward * 128;
RandomSelection_Init();
for(int i = 0; i < 6; ++i)
{
- switch(i)
- {
- case 0:
- tracebox(it.origin, STAT(PL_MIN, player), STAT(PL_MAX, player), it.origin - forward * 64 + right * 128 + up * 64, MOVE_NOMONSTERS, it);
- break;
- case 1:
- tracebox(it.origin, STAT(PL_MIN, player), STAT(PL_MAX, player), it.origin - forward * 64 - right * 128 + up * 64, MOVE_NOMONSTERS, it);
- break;
- case 2:
- tracebox(it.origin, STAT(PL_MIN, player), STAT(PL_MAX, player), it.origin + right * 192 + up * 64, MOVE_NOMONSTERS, it);
- break;
- case 3:
- tracebox(it.origin, STAT(PL_MIN, player), STAT(PL_MAX, player), it.origin - right * 192 + up * 64, MOVE_NOMONSTERS, it);
- break;
- case 4:
- tracebox(it.origin, STAT(PL_MIN, player), STAT(PL_MAX, player), it.origin - forward * 128 + right * 64 + up * 64, MOVE_NOMONSTERS, it);
- break;
- case 5:
- tracebox(it.origin, STAT(PL_MIN, player), STAT(PL_MAX, player), it.origin - forward * 128 - right * 64 + up * 64, MOVE_NOMONSTERS, it);
- break;
- }
+ tracebox(it.origin, STAT(PL_MIN, player), STAT(PL_MAX, player), it.origin + snt_ofs[i], MOVE_NOMONSTERS, it);
vector horizontal_trace_endpos = trace_endpos;
//te_lightning1(NULL, it.origin, horizontal_trace_endpos);
RandomSelection_Add(it, 0, string_null, vectical_trace_endpos, 1, 1);
//te_lightning1(NULL, vectical_trace_endpos, vectical_trace_endpos + forward * 10);
-LABEL(skip)
+ LABEL(skip)
if (i % 2 == 1 && RandomSelection_chosen_ent)
{
if (autocvar_g_spawn_near_teammate_ignore_spawnpoint_closetodeath)