X-Git-Url: https://de.git.xonotic.org/?p=xonotic%2Fxonotic-data.pk3dir.git;a=blobdiff_plain;f=qcsrc%2Fserver%2Fteamplay.qc;h=5a9d2ee3b999f5989482d0375fad17c4c8ca8502;hp=b50c49eb5a0eb21ea00220485eb5b9f8060f90e8;hb=437d67dbc7631d6c49e922990d96461d3ff4b7b2;hpb=8d10ea819c27736320d03e75134af341f8127199 diff --git a/qcsrc/server/teamplay.qc b/qcsrc/server/teamplay.qc index b50c49eb5..5a9d2ee3b 100644 --- a/qcsrc/server/teamplay.qc +++ b/qcsrc/server/teamplay.qc @@ -1,5 +1,4 @@ #include "teamplay.qh" -#include "_all.qh" #include "cl_client.qh" #include "race.qh" @@ -12,7 +11,8 @@ #include "mutators/mutators_include.qh" -#include "../common/deathtypes.qh" +#include "../common/deathtypes/all.qh" +#include "../common/gamemodes/all.qh" #include "../common/teams.qh" void TeamchangeFrags(entity e) @@ -64,7 +64,7 @@ void InitGameplayMode() if (!cvar_value_issafe(world.fog)) { - print("The current map contains a potentially harmful fog setting, ignored\n"); + LOG_INFO("The current map contains a potentially harmful fog setting, ignored\n"); world.fog = string_null; } if(MapInfo_Map_fog != "") @@ -84,6 +84,7 @@ void InitGameplayMode() if(g_dm) { + MUTATOR_ADD(gamemode_deathmatch); } if(g_tdm) @@ -140,6 +141,8 @@ void InitGameplayMode() ActivateTeamplay(); fraglimit_override = autocvar_g_keyhunt_point_limit; leadlimit_override = autocvar_g_keyhunt_point_leadlimit; + if(autocvar_g_keyhunt_team_spawns) + have_team_spawns = -1; // request team spawns MUTATOR_ADD(gamemode_keyhunt); } @@ -244,9 +247,6 @@ void InitGameplayMode() MUTATOR_ADD(gamemode_invasion); } - if(teamplay) - entcs_init(); - cache_mutatormsg = strzone(""); cache_lastmutatormsg = strzone(""); @@ -266,7 +266,8 @@ void InitGameplayMode() InitializeEntity(world, default_delayedinit, INITPRIO_GAMETYPE_FALLBACK); } -string GetClientVersionMessage() { +string GetClientVersionMessage() +{SELFPARAM(); string versionmsg; if (self.version_mismatch) { if(self.version < autocvar_gameversion) { @@ -294,14 +295,12 @@ string getwelcomemessage(void) else modifications = strcat(modifications, ", ", g_weaponarena_list, " Arena"); } - if(cvar("g_balance_blaster_weaponstart") == 0) + else if(cvar("g_balance_blaster_weaponstart") == 0) modifications = strcat(modifications, ", No start weapons"); if(cvar("sv_gravity") < stof(cvar_defstring("sv_gravity"))) modifications = strcat(modifications, ", Low gravity"); if(g_cloaked && !g_cts) modifications = strcat(modifications, ", Cloaked"); - if(g_grappling_hook) - modifications = strcat(modifications, ", Hook"); if(g_weapon_stay && !g_cts) modifications = strcat(modifications, ", Weapons stay"); if(g_jetpack) @@ -321,9 +320,6 @@ string getwelcomemessage(void) if(modifications != "") s = strcat(s, "^8\nactive modifications: ^3", modifications, "^8\n"); - if (g_grappling_hook) - s = strcat(s, "\n\n^3grappling hook^8 is enabled, press 'e' to use it\n"); - if (cvar("g_nades")) s = strcat(s, "\n\n^3nades^8 are enabled, press 'g' to use them\n"); @@ -341,6 +337,12 @@ string getwelcomemessage(void) s = strcat(s, "\n\n^8special gameplay tips: ^7", cache_mutatormsg); } + string mutator_msg = ""; + MUTATOR_CALLHOOK(BuildGameplayTipsString, mutator_msg); + mutator_msg = ret_string; + + s = strcat(s, mutator_msg); // trust that the mutator will do proper formatting + motd = autocvar_sv_motd; if (motd != "") { s = strcat(s, "\n\n^8MOTD: ^7", strreplace("\\n", "\n", motd)); @@ -395,7 +397,7 @@ void SetPlayerTeam(entity pl, float t, float s, float noprint) // set c1...c4 to show what teams are allowed void CheckAllowedTeams (entity for_whom) -{ +{SELFPARAM(); float dm; entity head; string teament_name; @@ -701,7 +703,7 @@ float FindSmallestTeam(entity pl, float ignore_pl) } float JoinBestTeam(entity pl, float only_return_best, float forcebestteam) -{ +{SELFPARAM(); float smallest, selectedteam; // don't join a team if we're not playing a team game @@ -770,7 +772,7 @@ float JoinBestTeam(entity pl, float only_return_best, float forcebestteam) LogTeamchange(pl.playerid, pl.team, 2); // log auto join if(pl.deadflag == DEAD_NO) - Damage(pl, pl, pl, 100000, DEATH_TEAMCHANGE, pl.origin, '0 0 0'); + Damage(pl, pl, pl, 100000, DEATH_TEAMCHANGE.m_id, pl.origin, '0 0 0'); } return smallest; @@ -778,7 +780,7 @@ float JoinBestTeam(entity pl, float only_return_best, float forcebestteam) //void() ctf_playerchanged; void SV_ChangeTeam(float _color) -{ +{SELFPARAM(); float scolor, dcolor, steam, dteam; //, dbotcount, scount, dcount; // in normal deathmatch we can just apply the color and we're done @@ -846,13 +848,17 @@ void SV_ChangeTeam(float _color) TeamchangeFrags(self); } - SetPlayerTeam(self, dteam, steam, false); + // since this is an engine function, and gamecode doesn't have any calls earlier than this, do the connecting message here + if(!IS_CLIENT(self)) + Send_Notification(NOTIF_ONE, self, MSG_INFO, INFO_CONNECTING, self.netname); + + SetPlayerTeam(self, dteam, steam, !IS_CLIENT(self)); if(IS_PLAYER(self) && steam != dteam) { // kill player when changing teams if(self.deadflag == DEAD_NO) - Damage(self, self, self, 100000, DEATH_TEAMCHANGE, self.origin, '0 0 0'); + Damage(self, self, self, 100000, DEATH_TEAMCHANGE.m_id, self.origin, '0 0 0'); } } @@ -993,6 +999,6 @@ void ShufflePlayerOutOfTeam (float source_team) SetPlayerTeam(selected, smallestteam, source_team, false); if(selected.deadflag == DEAD_NO) - Damage(selected, selected, selected, 100000, DEATH_AUTOTEAMCHANGE, selected.origin, '0 0 0'); + Damage(selected, selected, selected, 100000, DEATH_AUTOTEAMCHANGE.m_id, selected.origin, '0 0 0'); Send_Notification(NOTIF_ONE, selected, MSG_CENTER, CENTER_DEATH_SELF_AUTOTEAMCHANGE, selected.team); }