X-Git-Url: http://git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fserver%2Fspawnpoints.qc;h=0692d90886521cabe42d84eb1477b32aff438cc6;hb=6f4c7132e635c0150e3894f2f9958b361ce0c238;hp=a1abfa58fc2f02e926d6e0de50c264b8aa4fa08c;hpb=9077dc21021e33f85cf06f30fbe303614786f2e0;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/server/spawnpoints.qc b/qcsrc/server/spawnpoints.qc index a1abfa58f..0692d9088 100644 --- a/qcsrc/server/spawnpoints.qc +++ b/qcsrc/server/spawnpoints.qc @@ -12,12 +12,12 @@ 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); - WriteShort(MSG_ENTITY, self.origin.y); - WriteShort(MSG_ENTITY, self.origin.z); + WriteCoord(MSG_ENTITY, self.origin.x); + WriteCoord(MSG_ENTITY, self.origin.y); + WriteCoord(MSG_ENTITY, self.origin.z); return true; } @@ -26,14 +26,14 @@ 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)); - WriteShort(MSG_ENTITY, self.owner.origin.x); - WriteShort(MSG_ENTITY, self.owner.origin.y); - WriteShort(MSG_ENTITY, self.owner.origin.z); + WriteByte(MSG_ENTITY, etof(self.owner)); + WriteCoord(MSG_ENTITY, self.owner.origin.x); + WriteCoord(MSG_ENTITY, self.owner.origin.y); + WriteCoord(MSG_ENTITY, self.owner.origin.z); send = true; } else if((to == self.owner) || (IS_SPEC(to) && (to.enemy == self.owner)) ) @@ -117,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; @@ -216,7 +214,6 @@ vector Spawn_Score(entity spot, float mindist, float teamcheck) {SELFPARAM(); float shortest, thisdist; float prio; - entity player; prio = 0; @@ -241,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;