From: Mario Date: Mon, 6 Mar 2017 07:38:08 +0000 (+1000) Subject: Add a mutator hook to hide the team nagger (clears out 3 gamemode specific checks) X-Git-Tag: xonotic-v0.8.2~129 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=4b4387fc80f82b6871ba4dbce1cd05a9ff725c1a;p=xonotic%2Fxonotic-data.pk3dir.git Add a mutator hook to hide the team nagger (clears out 3 gamemode specific checks) --- diff --git a/qcsrc/client/hud/panel/infomessages.qc b/qcsrc/client/hud/panel/infomessages.qc index 2d6c952fc..49739a42d 100644 --- a/qcsrc/client/hud/panel/infomessages.qc +++ b/qcsrc/client/hud/panel/infomessages.qc @@ -176,7 +176,7 @@ void HUD_InfoMessages() InfoMessage(s); } - if(teamplay && !spectatee_status && gametype != MAPINFO_TYPE_CA && teamnagger) + if(teamplay && !spectatee_status && teamnagger) { float ts_min = 0, ts_max = 0; entity tm = teams.sort_next; diff --git a/qcsrc/server/client.qc b/qcsrc/server/client.qc index f6e4c8391..5506a9d0f 100644 --- a/qcsrc/server/client.qc +++ b/qcsrc/server/client.qc @@ -1214,7 +1214,7 @@ void ClientConnect(entity this) stuffcmd(this, strcat("\nfog ", world.fog, "\nr_fog_exp2 0\nr_drawfog 1\n")); if (autocvar_sv_teamnagger && !(autocvar_bot_vs_human && AvailableTeams() == 2)) - if (!g_ca && !g_cts && !g_race) // teamnagger is currently bad for ca, race & cts + if(!MUTATOR_CALLHOOK(HideTeamNagger, this)) send_CSQC_teamnagger(); CSQCMODEL_AUTOINIT(this); diff --git a/qcsrc/server/mutators/events.qh b/qcsrc/server/mutators/events.qh index 9550daadc..729106057 100644 --- a/qcsrc/server/mutators/events.qh +++ b/qcsrc/server/mutators/events.qh @@ -941,3 +941,9 @@ enum { MUT_FUSREAC_TARG_VALID, // return this flag to make the function return true (valid target) MUT_FUSREAC_TARG_INVALID // return this flag to make the function return false (invalid target) }; + +/** return true to hide the 'teamnumbers are imbalanced' message */ +#define EV_HideTeamNagger(i, o) \ + /** player */ i(entity, MUTATOR_ARGV_0_entity) \ + /**/ +MUTATOR_HOOKABLE(HideTeamNagger, EV_HideTeamNagger); diff --git a/qcsrc/server/mutators/mutator/gamemode_ca.qc b/qcsrc/server/mutators/mutator/gamemode_ca.qc index e8dcdfea5..fc06e50e2 100644 --- a/qcsrc/server/mutators/mutator/gamemode_ca.qc +++ b/qcsrc/server/mutators/mutator/gamemode_ca.qc @@ -458,6 +458,11 @@ MUTATOR_HOOKFUNCTION(ca, WantWeapon) M_ARGV(2, bool) = true; // all weapons } +MUTATOR_HOOKFUNCTION(ca, HideTeamNagger) +{ + return true; // doesn't work well with the whole spectator as player thing +} + MUTATOR_HOOKFUNCTION(ca, GetPlayerStatus) { entity player = M_ARGV(0, entity); diff --git a/qcsrc/server/mutators/mutator/gamemode_cts.qc b/qcsrc/server/mutators/mutator/gamemode_cts.qc index daec722f4..aeae1e1b9 100644 --- a/qcsrc/server/mutators/mutator/gamemode_cts.qc +++ b/qcsrc/server/mutators/mutator/gamemode_cts.qc @@ -387,6 +387,11 @@ MUTATOR_HOOKFUNCTION(cts, Race_FinalCheckpoint) CTS_ClientKill(player); } +MUTATOR_HOOKFUNCTION(cts, HideTeamNagger) +{ + return true; // doesn't work so well (but isn't cts a teamless mode?) +} + MUTATOR_HOOKFUNCTION(cts, FixClientCvars) { entity player = M_ARGV(0, entity); diff --git a/qcsrc/server/mutators/mutator/gamemode_race.qc b/qcsrc/server/mutators/mutator/gamemode_race.qc index 2945aff6e..c41586c04 100644 --- a/qcsrc/server/mutators/mutator/gamemode_race.qc +++ b/qcsrc/server/mutators/mutator/gamemode_race.qc @@ -385,6 +385,11 @@ MUTATOR_HOOKFUNCTION(rc, GetRecords) M_ARGV(1, string) = ret_string; } +MUTATOR_HOOKFUNCTION(rc, HideTeamNagger) +{ + return true; // doesn't work so well +} + MUTATOR_HOOKFUNCTION(rc, FixClientCvars) { entity player = M_ARGV(0, entity);