X-Git-Url: https://de.git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fserver%2Fspawnpoints.qc;h=09d914a3c86751b7f0d6bbc97e49c8277575e560;hb=2e4b6fcb1aec544934a31bd49bba5eeecaffbf86;hp=b86da6b54ee9f0823dec8d72f2a34d11de7f40b0;hpb=924ba9b521119651b5667c0280868df9f95ca488;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/server/spawnpoints.qc b/qcsrc/server/spawnpoints.qc index b86da6b54..09d914a3c 100644 --- a/qcsrc/server/spawnpoints.qc +++ b/qcsrc/server/spawnpoints.qc @@ -9,7 +9,7 @@ #include "../common/util.qh" #include "../warpzonelib/util_server.qh" -float SpawnPoint_Send(entity to, int sf) +bool SpawnPoint_Send(entity this, entity to, int sf) { WriteByte(MSG_ENTITY, ENT_CLIENT_SPAWNPOINT); @@ -21,7 +21,7 @@ float SpawnPoint_Send(entity to, int sf) return true; } -float SpawnEvent_Send(entity to, int sf) +bool SpawnEvent_Send(entity this, entity to, int sf) { float send; @@ -46,18 +46,18 @@ float SpawnEvent_Send(entity to, int sf) } void spawnpoint_use() -{ +{SELFPARAM(); if(teamplay) if(have_team_spawns > 0) { self.team = activator.team; some_spawn_has_been_used = 1; } - print("spawnpoint was used!\n"); + //LOG_INFO("spawnpoint was used!\n"); } void relocate_spawnpoint() -{ +{SELFPARAM(); // nudge off the floor setorigin(self, self.origin + '0 0 1'); @@ -70,14 +70,14 @@ void relocate_spawnpoint() self.maxs = PL_MAX_CONST; if (!move_out_of_solid(self)) objerror("could not get out of solid at all!"); - print("^1NOTE: this map needs FIXING. Spawnpoint at ", vtos(o - '0 0 1')); - print(" needs to be moved out of solid, e.g. by '", ftos(self.origin.x - o.x)); - print(" ", ftos(self.origin.y - o.y)); - print(" ", ftos(self.origin.z - o.z), "'\n"); + LOG_INFO("^1NOTE: this map needs FIXING. Spawnpoint at ", vtos(o - '0 0 1')); + LOG_INFO(" needs to be moved out of solid, e.g. by '", ftos(self.origin.x - o.x)); + LOG_INFO(" ", ftos(self.origin.y - o.y)); + LOG_INFO(" ", ftos(self.origin.z - o.z), "'\n"); if (autocvar_g_spawnpoints_auto_move_out_of_solid) { if (!spawnpoint_nag) - print("\{1}^1NOTE: this map needs FIXING (it contains spawnpoints in solid, see server log)\n"); + LOG_INFO("\{1}^1NOTE: this map needs FIXING (it contains spawnpoints in solid, see server log)\n"); spawnpoint_nag = 1; } else @@ -141,27 +141,73 @@ void relocate_spawnpoint() { Net_LinkEntity(self, false, 0, SpawnPoint_Send); } } -void spawnfunc_info_player_survivor (void) +spawnfunc(info_player_survivor) { - spawnfunc_info_player_deathmatch(); + spawnfunc_info_player_deathmatch(this); } -void spawnfunc_info_player_start (void) +spawnfunc(info_player_start) { - spawnfunc_info_player_deathmatch(); + spawnfunc_info_player_deathmatch(this); } -void spawnfunc_info_player_deathmatch (void) +spawnfunc(info_player_deathmatch) { self.classname = "info_player_deathmatch"; relocate_spawnpoint(); } +/*QUAKED spawnfunc_info_player_team1 (1 0 0) (-16 -16 -24) (16 16 24) +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); +} + + +/*QUAKED spawnfunc_info_player_team2 (1 0 0) (-16 -16 -24) (16 16 24) +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); +} + +/*QUAKED spawnfunc_info_player_team3 (1 0 0) (-16 -16 -24) (16 16 24) +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); +} + + +/*QUAKED spawnfunc_info_player_team4 (1 0 0) (-16 -16 -24) (16 16 24) +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); +} + // Returns: // _x: prio (-1 if unusable) // _y: weight vector Spawn_Score(entity spot, float mindist, float teamcheck) -{ +{SELFPARAM(); float shortest, thisdist; float prio; entity player; @@ -212,10 +258,9 @@ vector Spawn_Score(entity spot, float mindist, float teamcheck) ++found; if(ent.spawn_evalfunc) { - entity oldself = self; - self = ent; - spawn_score = ent.spawn_evalfunc(oldself, spot, spawn_score); - self = oldself; + WITH(entity, self, ent, { + spawn_score = ent.spawn_evalfunc(this, spot, spawn_score); + }); if(spawn_score.x < 0) return spawn_score; } @@ -223,12 +268,12 @@ vector Spawn_Score(entity spot, float mindist, float teamcheck) if(!found) { - dprint("WARNING: spawnpoint at ", vtos(spot.origin), " could not find its target ", spot.target, "\n"); + LOG_TRACE("WARNING: spawnpoint at ", vtos(spot.origin), " could not find its target ", spot.target, "\n"); return '-1 0 0'; } } - MUTATOR_CALLHOOK(Spawn_Score); + MUTATOR_CALLHOOK(Spawn_Score, self, spawn_spot, spawn_score); return spawn_score; } @@ -286,7 +331,7 @@ Finds a point to respawn ============= */ entity SelectSpawnPoint (float anypoint) -{ +{SELFPARAM(); float teamcheck; entity spot, firstspot;