X-Git-Url: https://de.git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fserver%2Fteamplay.qc;h=d8bf72cd6b2a87bc27cc3700053716840c3bd8b3;hb=c4168ca06080bc9797a09680875ead840dfc4afe;hp=f429628b01a05d1d82541292fbeeb14aa2989cf5;hpb=06ac66a5edaa645e19ed9a6482409e8656a65b1d;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/server/teamplay.qc b/qcsrc/server/teamplay.qc index f429628b0..d8bf72cd6 100644 --- a/qcsrc/server/teamplay.qc +++ b/qcsrc/server/teamplay.qc @@ -52,6 +52,11 @@ void InitGameplayMode() get_mi_min_max(1); world.mins = mi_min; world.maxs = mi_max; + // currently, NetRadiant's limit is 131072 qu for each side + // distance from one corner of a 131072qu cube to the opposite corner is approx. 227023 qu + // set the distance according to map size but don't go over the limit to avoid issues with float precision + // in case somebody makes extremely large maps + max_shot_distance = min(230000, vlen(world.maxs - world.mins)); MapInfo_LoadMapSettings(mapname); serverflags &= ~SERVERFLAG_TEAMPLAY; @@ -82,25 +87,23 @@ void InitGameplayMode() string GetClientVersionMessage(entity this) { - string versionmsg; if (this.version_mismatch) { if(this.version < autocvar_gameversion) { - versionmsg = "^3Your client version is outdated.\n\n\n### YOU WON'T BE ABLE TO PLAY ON THIS SERVER ###\n\n\nPlease update!!!^8"; + return strcat("This is Xonotic ", autocvar_g_xonoticversion, + "\n^3Your client version is outdated.\n\n\n### YOU WON'T BE ABLE TO PLAY ON THIS SERVER ###\n\n\nPlease update!!!^8"); } else { - versionmsg = "^3This server is using an outdated Xonotic version.\n\n\n ### THIS SERVER IS INCOMPATIBLE AND THUS YOU CANNOT JOIN ###.^8"; + return strcat("This is Xonotic ", autocvar_g_xonoticversion, + "\n^3This server is using an outdated Xonotic version.\n\n\n ### THIS SERVER IS INCOMPATIBLE AND THUS YOU CANNOT JOIN ###.^8"); } } else { - versionmsg = "^2client version and server version are compatible.^8"; + return strcat("Welcome to Xonotic ", autocvar_g_xonoticversion); } - return versionmsg; } string getwelcomemessage(entity this) { - string s, modifications, motd; - MUTATOR_CALLHOOK(BuildMutatorsPrettyString, ""); - modifications = M_ARGV(0, string); + string modifications = M_ARGV(0, string); if(g_weaponarena) { @@ -109,7 +112,7 @@ string getwelcomemessage(entity this) else modifications = strcat(modifications, ", ", g_weaponarena_list, " Arena"); } - else if(cvar("g_balance_blaster_weaponstart") == 0) + else if(cvar("g_balance_blaster_weaponstartoverride") == 0) modifications = strcat(modifications, ", No start weapons"); if(cvar("sv_gravity") < stof(cvar_defstring("sv_gravity"))) modifications = strcat(modifications, ", Low gravity"); @@ -124,9 +127,7 @@ string getwelcomemessage(entity this) modifications = substring(modifications, 2, strlen(modifications) - 2); string versionmessage = GetClientVersionMessage(this); - - s = strcat("This is Xonotic ", autocvar_g_xonoticversion, "\n", versionmessage); - s = strcat(s, "^8\n\nmatch type is ^1", gamemode_name, "^8\n"); + string s = strcat(versionmessage, "^8\n^8\nmatch type is ^1", gamemode_name, "^8\n"); if(modifications != "") s = strcat(s, "^8\nactive modifications: ^3", modifications, "^8\n"); @@ -151,13 +152,23 @@ string getwelcomemessage(entity this) s = strcat(s, mutator_msg); // trust that the mutator will do proper formatting - motd = autocvar_sv_motd; + string motd = autocvar_sv_motd; if (motd != "") { s = strcat(s, "\n\n^8MOTD: ^7", strreplace("\\n", "\n", motd)); } return s; } +void setcolor(entity this, int clr) +{ +#if 0 + this.clientcolors = clr; + this.team = (clr & 15) + 1; +#else + builtin_setcolor(this, clr); +#endif +} + void SetPlayerColors(entity pl, float _color) { /*string s; @@ -198,7 +209,7 @@ void SetPlayerTeam(entity pl, float t, float s, float noprint) LogTeamchange(pl.playerid, pl.team, 3); // log manual team join if(!noprint) - bprint(pl.netname, "^7 has changed from ", Team_NumberToColoredFullName(s), "^7 to ", Team_NumberToColoredFullName(t), "\n"); + bprint(playername(pl, false), "^7 has changed from ", Team_NumberToColoredFullName(s), "^7 to ", Team_NumberToColoredFullName(t), "\n"); } } @@ -206,23 +217,23 @@ void SetPlayerTeam(entity pl, float t, float s, float noprint) // set c1...c4 to show what teams are allowed void CheckAllowedTeams (entity for_whom) { - int dm = 0; + int teams_mask = 0; c1 = c2 = c3 = c4 = -1; cb1 = cb2 = cb3 = cb4 = 0; string teament_name = string_null; - bool mutator_returnvalue = MUTATOR_CALLHOOK(GetTeamCount, dm, teament_name); - dm = M_ARGV(0, float); + bool mutator_returnvalue = MUTATOR_CALLHOOK(CheckAllowedTeams, teams_mask, teament_name, for_whom); + teams_mask = M_ARGV(0, float); teament_name = M_ARGV(1, string); if(!mutator_returnvalue) { - if(dm & BIT(0)) c1 = 0; - if(dm & BIT(1)) c2 = 0; - if(dm & BIT(2)) c3 = 0; - if(dm & BIT(3)) c4 = 0; + if(teams_mask & BIT(0)) c1 = 0; + if(teams_mask & BIT(1)) c2 = 0; + if(teams_mask & BIT(2)) c3 = 0; + if(teams_mask & BIT(3)) c4 = 0; } // find out what teams are allowed if necessary @@ -498,13 +509,13 @@ float FindSmallestTeam(entity pl, float ignore_pl) // now t is the minimum, or A minimum! if(t == 1 || TeamSmallerEqThanTeam(1, t, pl)) - RandomSelection_Add(NULL, 1, string_null, 1, 1); + RandomSelection_AddFloat(1, 1, 1); if(t == 2 || TeamSmallerEqThanTeam(2, t, pl)) - RandomSelection_Add(NULL, 2, string_null, 1, 1); + RandomSelection_AddFloat(2, 1, 1); if(t == 3 || TeamSmallerEqThanTeam(3, t, pl)) - RandomSelection_Add(NULL, 3, string_null, 1, 1); + RandomSelection_AddFloat(3, 1, 1); if(t == 4 || TeamSmallerEqThanTeam(4, t, pl)) - RandomSelection_Add(NULL, 4, string_null, 1, 1); + RandomSelection_AddFloat(4, 1, 1); return RandomSelection_chosen_float; }