X-Git-Url: https://git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fserver%2Fspawnpoints.qc;h=ab0d2bea43f1122610e555bd5eca1d8136eb2e57;hb=f0f1d3c4da1c02c2dd7bdfee5afb1c0b0f0fa6af;hp=616824bbcbb78b4c0ebe2f2a67cd1ca65d54fc90;hpb=f7673c11a5261668cc3e3896391fafd546168994;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/server/spawnpoints.qc b/qcsrc/server/spawnpoints.qc index 616824bbc..ab0d2bea4 100644 --- a/qcsrc/server/spawnpoints.qc +++ b/qcsrc/server/spawnpoints.qc @@ -1,19 +1,23 @@ #include "spawnpoints.qh" -#include -#include "g_world.qh" -#include "race.qh" -#include "defs.qh" -#include "../common/constants.qh" +#include +#include +#include +#include +#include #include -#include "../common/teams.qh" -#include -#include "../common/mapobjects/subs.qh" -#include "../common/mapobjects/target/spawnpoint.qh" -#include "../common/util.qh" -#include "../lib/warpzone/common.qh" -#include "../lib/warpzone/util_server.qh" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #include +#include bool SpawnPoint_Send(entity this, entity to, int sf) { @@ -75,6 +79,17 @@ void spawnpoint_reset(entity this) this.SendFlags |= 1; // update team since it was restored during reset } +void link_spawnpoint(entity this) +{ + bool anypoint = (autocvar_g_spawn_useallspawns || (teamplay && have_team_spawns <= 0)); // TODO: check if available teams is equal to spawnpoints available + + // Don't show team spawns in non-team matches, + // and don't show non-team spawns in team matches. + // (Unless useallspawns is activated) + if(anypoint || !((teamplay && !Team_IsValidTeam(this.team)) || (!teamplay && Team_IsValidTeam(this.team)))) + Net_LinkEntity(this, false, 0, SpawnPoint_Send); +} + void relocate_spawnpoint(entity this) { // nudge off the floor @@ -134,34 +149,8 @@ void relocate_spawnpoint(entity this) e.solid = SOLID_TRIGGER; } - // Don't show team spawns in non-team matches, - // and don't show non-team spawns in team matches. - // (Unless useallspawns is activated) - if( - !( - ( // if this passes, there is a DM spawn on a team match - teamplay - && (this.team != NUM_TEAM_1) - && (this.team != NUM_TEAM_2) - && (this.team != NUM_TEAM_3) - && (this.team != NUM_TEAM_4) - ) - || - ( // if this passes, there is a team spawn on a DM match - !teamplay - && - ( - (this.team == NUM_TEAM_1) - || (this.team == NUM_TEAM_2) - || (this.team == NUM_TEAM_3) - || (this.team == NUM_TEAM_4) - ) - ) - ) - || - autocvar_g_spawn_useallspawns - ) - { Net_LinkEntity(this, false, 0, SpawnPoint_Send); } + // network it after all spawnpoints are setup, so that we can check if team spawnpoints are used + InitializeEntity(this, link_spawnpoint, INITPRIO_FINDTARGET); } spawnfunc(info_player_survivor) @@ -176,7 +165,6 @@ spawnfunc(info_player_start) spawnfunc(info_player_deathmatch) { - this.classname = "info_player_deathmatch"; IL_PUSH(g_spawnpoints, this); relocate_spawnpoint(this); } @@ -246,7 +234,7 @@ vector Spawn_Score(entity this, entity spot, float mindist, float teamcheck, boo float prio = 0; float shortest = vlen(world.maxs - world.mins); - FOREACH_CLIENT(IS_PLAYER(it) && it != this, { + FOREACH_CLIENT(IS_PLAYER(it) && !IS_DEAD(it) && it != this, { float thisdist = vlen(it.origin - spot.origin); if (thisdist < shortest) shortest = thisdist;