X-Git-Url: http://de.git.xonotic.org/?p=xonotic%2Fxonotic-data.pk3dir.git;a=blobdiff_plain;f=qcsrc%2Fserver%2Fteamplay.qc;h=5185b2c611a639093d1f343911182e98d8009cf3;hp=a96726c5643f175174783c563ec77751deb70190;hb=04ab0ff7c3c5fcfe9780eadccfd5abd03d25b181;hpb=05963b2ef10b016eec19561282175c3c39579426 diff --git a/qcsrc/server/teamplay.qc b/qcsrc/server/teamplay.qc index a96726c564..5185b2c611 100644 --- a/qcsrc/server/teamplay.qc +++ b/qcsrc/server/teamplay.qc @@ -13,7 +13,6 @@ void TeamchangeFrags(entity e) PlayerScore_Clear(e); } -void runematch_init(); void tdm_init(); void entcs_init(); @@ -55,9 +54,9 @@ void InitGameplayMode() MapInfo_LoadMapSettings(mapname); teamplay = 0; - serverflags &~= SERVERFLAG_TEAMPLAY; + serverflags &= ~SERVERFLAG_TEAMPLAY; - if not(cvar_value_issafe(world.fog)) + if (!cvar_value_issafe(world.fog)) { print("The current map contains a potentially harmful fog setting, ignored\n"); world.fog = string_null; @@ -107,33 +106,13 @@ void InitGameplayMode() have_team_spawns = -1; // request team spawns } - if(g_runematch) - { - // ActivateTeamplay(); - fraglimit_override = autocvar_g_runematch_point_limit; - leadlimit_override = autocvar_g_runematch_point_leadlimit; - runematch_init(); - } - if(g_lms) { fraglimit_override = autocvar_g_lms_lives_override; leadlimit_override = 0; // not supported by LMS if(fraglimit_override == 0) fraglimit_override = -1; - lms_lowest_lives = 9999; - lms_next_place = 0; - ScoreRules_lms(); - } - - if(g_arena) - { - fraglimit_override = autocvar_g_arena_point_limit; - leadlimit_override = autocvar_g_arena_point_leadlimit; - maxspawned = autocvar_g_arena_maxspawned; - if(maxspawned < 2) - maxspawned = 2; - arena_roundbased = autocvar_g_arena_roundbased; + MUTATOR_ADD(gamemode_lms); } if(g_ca) @@ -141,9 +120,9 @@ void InitGameplayMode() ActivateTeamplay(); fraglimit_override = autocvar_g_ca_point_limit; leadlimit_override = autocvar_g_ca_point_leadlimit; - precache_sound("ctf/red_capture.wav"); - precache_sound("ctf/blue_capture.wav"); + MUTATOR_ADD(gamemode_ca); } + if(g_keyhunt) { ActivateTeamplay(); @@ -163,7 +142,7 @@ void InitGameplayMode() if(g_assault) { ActivateTeamplay(); - ScoreRules_assault(); + MUTATOR_ADD(gamemode_assault); have_team_spawns = -1; // request team spawns } @@ -206,7 +185,7 @@ void InitGameplayMode() have_team_spawns = -1; // request team spawns MUTATOR_ADD(gamemode_nexball); } - + if(g_keepaway) { MUTATOR_ADD(gamemode_keepaway); @@ -284,9 +263,7 @@ string getwelcomemessage(void) ret_string = ""; MUTATOR_CALLHOOK(BuildMutatorsPrettyString); modifications = ret_string; - - if(g_minstagib) - modifications = strcat(modifications, ", MinstaGib"); + if(g_weaponarena) { if(g_weaponarena_random) @@ -302,14 +279,8 @@ string getwelcomemessage(void) modifications = strcat(modifications, ", Cloaked"); if(g_grappling_hook) modifications = strcat(modifications, ", Hook"); - if(g_midair) - modifications = strcat(modifications, ", Midair"); - if(g_pinata) - modifications = strcat(modifications, ", Piñata"); if(g_weapon_stay && !g_cts) modifications = strcat(modifications, ", Weapons stay"); - if(g_bloodloss > 0) - modifications = strcat(modifications, ", Blood loss"); if(g_jetpack) modifications = strcat(modifications, ", Jet pack"); if(autocvar_g_powerups == 0) @@ -478,7 +449,7 @@ void CheckAllowedTeams (entity for_whom) if(autocvar_bot_vs_human > 0) { // bots are all blue - if(clienttype(for_whom) == CLIENTTYPE_BOT) + if(IS_BOT_CLIENT(for_whom)) c1 = c3 = c4 = -1; else c2 = -1; @@ -486,7 +457,7 @@ void CheckAllowedTeams (entity for_whom) else { // bots are all red - if(clienttype(for_whom) == CLIENTTYPE_BOT) + if(IS_BOT_CLIENT(for_whom)) c2 = c3 = c4 = -1; else c1 = -1; @@ -524,7 +495,7 @@ void GetTeamCounts(entity ignore) FOR_EACH_CLIENT(head) { float t; - if(head.classname == "player") + if(IS_PLAYER(head)) t = head.team; else if(head.team_forced > 0) t = head.team_forced; // reserve the spot @@ -533,7 +504,7 @@ void GetTeamCounts(entity ignore) if(head != ignore)// && head.netname != "") { value = PlayerValue(head); - if(clienttype(head) == CLIENTTYPE_BOT) + if(IS_BOT_CLIENT(head)) bvalue = value; else bvalue = 0; @@ -614,7 +585,7 @@ float TeamSmallerEqThanTeam(float ta, float tb, entity e) if(ta == tb) return TRUE; - if(clienttype(e) == CLIENTTYPE_REAL) + if(IS_REAL_CLIENT(e)) { if(bots_would_leave) { @@ -622,7 +593,7 @@ float TeamSmallerEqThanTeam(float ta, float tb, entity e) cb -= cbb * 0.999; } } - + // keep teams alive (teams of size 0 always count as smaller, ignoring score) if(ca < 1) if(cb >= 1) @@ -672,7 +643,7 @@ float FindSmallestTeam(entity pl, float ignore_pl) if(totalteams <= 1) { - if(autocvar_g_campaign && pl && clienttype(pl) == CLIENTTYPE_REAL) + if(autocvar_g_campaign && pl && IS_REAL_CLIENT(pl)) return 1; // special case for campaign and player joining else if(g_domination) error("Too few teams available for domination\n"); @@ -693,7 +664,7 @@ float FindSmallestTeam(entity pl, float ignore_pl) GetTeamCounts(world); RandomSelection_Init(); - + t = 1; if(TeamSmallerEqThanTeam(2, t, pl)) t = 2; @@ -855,7 +826,7 @@ void SV_ChangeTeam(float _color) // bprint("allow change teams from ", ftos(steam), " to ", ftos(dteam), "\n"); - if(self.classname == "player" && steam != dteam) + if(IS_PLAYER(self) && steam != dteam) { // reduce frags during a team change TeamchangeFrags(self); @@ -863,7 +834,7 @@ void SV_ChangeTeam(float _color) SetPlayerTeam(self, dteam, steam, FALSE); - if(self.classname == "player" && steam != dteam) + if(IS_PLAYER(self) && steam != dteam) { // kill player when changing teams if(self.deadflag == DEAD_NO)