X-Git-Url: https://de.git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fserver%2Fmutators%2Fmutator%2Fgamemode_tdm.qc;h=d0bde8c4f949b8218e650391a92a49a200e95068;hb=ee7a78f942624de2ab30112a798e3f663cf9cc2f;hp=42415a495e7140dbab08c4e9a47c925f51be4022;hpb=e9f30b97435c6afe3d6911f21e1f4fd1b97e93da;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/server/mutators/mutator/gamemode_tdm.qc b/qcsrc/server/mutators/mutator/gamemode_tdm.qc index 42415a495..d0bde8c4f 100644 --- a/qcsrc/server/mutators/mutator/gamemode_tdm.qc +++ b/qcsrc/server/mutators/mutator/gamemode_tdm.qc @@ -1,10 +1,11 @@ +#include "gamemode_tdm.qh" #ifndef GAMEMODE_TDM_H #define GAMEMODE_TDM_H int autocvar_g_tdm_point_limit; int autocvar_g_tdm_point_leadlimit; bool autocvar_g_tdm_team_spawns; -void tdm_DelayedInit(); +void tdm_DelayedInit(entity this); REGISTER_MUTATOR(tdm, false) { @@ -12,10 +13,10 @@ REGISTER_MUTATOR(tdm, false) { if (time > 1) // game loads at time 1 error("This is a game type and it cannot be added at runtime."); - InitializeEntity(world, tdm_DelayedInit, INITPRIO_GAMETYPE); + InitializeEntity(NULL, tdm_DelayedInit, INITPRIO_GAMETYPE); ActivateTeamplay(); - SetLimits(autocvar_g_tdm_point_limit, autocvar_g_tdm_point_leadlimit, -1, -1); + SetLimits(autocvar_g_tdm_point_limit, autocvar_g_tdm_point_leadlimit, autocvar_timelimit_override, -1); if (autocvar_g_tdm_team_spawns) have_team_spawns = -1; // request team spawns } @@ -50,43 +51,52 @@ Keys: "cnt" Scoreboard color of the team (for example 4 is red and 13 is blue)... */ spawnfunc(tdm_team) { - if(!g_tdm || !self.cnt) { remove(self); return; } + if(!g_tdm || !this.cnt) { remove(this); return; } - self.classname = "tdm_team"; - self.team = self.cnt + 1; + this.classname = "tdm_team"; + this.team = this.cnt + 1; } // code from here on is just to support maps that don't have team entities void tdm_SpawnTeam (string teamname, float teamcolor) { - entity this = new(tdm_team); + entity this = new_pure(tdm_team); this.netname = teamname; this.cnt = teamcolor; + this.team = this.cnt + 1; this.spawnfunc_checked = true; - WITH(entity, self, this, spawnfunc_tdm_team(this)); + //spawnfunc_tdm_team(this); } -void tdm_DelayedInit() +void tdm_DelayedInit(entity this) { // if no teams are found, spawn defaults - if(find(world, classname, "tdm_team") == world) + if(find(NULL, classname, "tdm_team") == NULL) { - LOG_INFO("No ""tdm_team"" entities found on this map, creating them anyway.\n"); + LOG_TRACE("No \"tdm_team\" entities found on this map, creating them anyway.\n"); int numteams = min(4, autocvar_g_tdm_teams_override); if(numteams < 2) { numteams = autocvar_g_tdm_teams; } numteams = bound(2, numteams, 4); + int teams = 0; + if(numteams >= 1) teams |= BIT(0); + if(numteams >= 2) teams |= BIT(1); + if(numteams >= 3) teams |= BIT(2); + if(numteams >= 4) teams |= BIT(3); + + //numteams = teams; // now set it? + float i; - for(i = 1; i <= numteams; ++i) + for(i = 1; i <= numteams && (teams & BIT(numteams)); ++i) tdm_SpawnTeam(Team_ColorName(Team_NumberToTeam(i)), Team_NumberToTeam(i) - 1); } } MUTATOR_HOOKFUNCTION(tdm, GetTeamCount, CBC_ORDER_EXCLUSIVE) { - ret_string = "tdm_team"; + M_ARGV(1, string) = "tdm_team"; return true; }