X-Git-Url: http://de.git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fserver%2Fspawnpoints.qc;h=022e27608f34016794153f3dc1dbee12f0167b90;hb=06d3f628c5e91ba1dec8016ef082f664e59d2eb6;hp=6980a9e9439d59a0c6a53b72d94065e2244c0ee1;hpb=21307f327df5609b82d90496c1c6156d636d1c8d;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/server/spawnpoints.qc b/qcsrc/server/spawnpoints.qc index 6980a9e94..022e27608 100644 --- a/qcsrc/server/spawnpoints.qc +++ b/qcsrc/server/spawnpoints.qc @@ -1,6 +1,6 @@ #include "spawnpoints.qh" -#include "mutators/mutators_include.qh" +#include "mutators/all.qh" #include "g_world.qh" #include "race.qh" #include "../common/constants.qh" @@ -12,7 +12,7 @@ bool SpawnPoint_Send(entity this, entity to, int sf) { - WriteByte(MSG_ENTITY, ENT_CLIENT_SPAWNPOINT); + WriteHeader(MSG_ENTITY, ENT_CLIENT_SPAWNPOINT); WriteByte(MSG_ENTITY, self.team); WriteShort(MSG_ENTITY, self.origin.x); @@ -26,11 +26,11 @@ bool SpawnEvent_Send(entity this, entity to, int sf) { float send; - WriteByte(MSG_ENTITY, ENT_CLIENT_SPAWNEVENT); + WriteHeader(MSG_ENTITY, ENT_CLIENT_SPAWNEVENT); if(autocvar_g_spawn_alloweffects) { - WriteByte(MSG_ENTITY, num_for_edict(self.owner)); + WriteByte(MSG_ENTITY, etof(self.owner)); WriteShort(MSG_ENTITY, self.owner.origin.x); WriteShort(MSG_ENTITY, self.owner.origin.y); WriteShort(MSG_ENTITY, self.owner.origin.z); @@ -46,6 +46,17 @@ bool SpawnEvent_Send(entity this, entity to, int sf) return send; } +.vector spawnpoint_prevorigin; +void spawnpoint_think() +{ + self.nextthink = time + 0.1; + if(self.origin != self.spawnpoint_prevorigin) + { + self.spawnpoint_prevorigin = self.origin; + self.SendFlags |= 1; + } +} + void spawnpoint_use() {SELFPARAM(); if(teamplay) @@ -91,6 +102,8 @@ void relocate_spawnpoint() } self.use = spawnpoint_use; + self.think = spawnpoint_think; + self.nextthink = time + 0.5 + random() * 2; // shouldn't need it for a little second self.team_saved = self.team; if (!self.cnt) self.cnt = 1; @@ -104,9 +117,7 @@ void relocate_spawnpoint() { // show where spawnpoints point at too makevectors(self.angles); - entity e; - e = spawn(); - e.classname = "info_player_foo"; + entity e = new(info_player_foo); setorigin(e, self.origin + v_forward * 24); setsize(e, '-8 -8 -8', '8 8 8'); e.solid = SOLID_TRIGGER; @@ -163,8 +174,6 @@ Starting point for a player in team one (Red). Keys: "angle" viewing angle when spawning. */ spawnfunc(info_player_team1) { - if(g_assault) { remove(this); return; } - this.team = NUM_TEAM_1; // red spawnfunc_info_player_deathmatch(this); } @@ -175,8 +184,6 @@ Starting point for a player in team two (Blue). Keys: "angle" viewing angle when spawning. */ spawnfunc(info_player_team2) { - if(g_assault) { remove(this); return; } - this.team = NUM_TEAM_2; // blue spawnfunc_info_player_deathmatch(this); } @@ -186,8 +193,6 @@ Starting point for a player in team three (Yellow). Keys: "angle" viewing angle when spawning. */ spawnfunc(info_player_team3) { - if(g_assault) { remove(this); return; } - this.team = NUM_TEAM_3; // yellow spawnfunc_info_player_deathmatch(this); } @@ -198,8 +203,6 @@ Starting point for a player in team four (Purple). Keys: "angle" viewing angle when spawning. */ spawnfunc(info_player_team4) { - if(g_assault) { remove(this); return; } - this.team = NUM_TEAM_4; // purple spawnfunc_info_player_deathmatch(this); } @@ -211,7 +214,6 @@ vector Spawn_Score(entity spot, float mindist, float teamcheck) {SELFPARAM(); float shortest, thisdist; float prio; - entity player; prio = 0; @@ -236,12 +238,11 @@ vector Spawn_Score(entity spot, float mindist, float teamcheck) } shortest = vlen(world.maxs - world.mins); - FOR_EACH_PLAYER(player) if (player != self) - { - thisdist = vlen(player.origin - spot.origin); + FOREACH_CLIENT(IS_PLAYER(it) && it != self, LAMBDA( + thisdist = vlen(it.origin - spot.origin); if (thisdist < shortest) shortest = thisdist; - } + )); if(shortest > mindist) prio += SPAWN_PRIO_GOOD_DISTANCE;