From: Mario Date: Mon, 13 Jul 2020 10:20:51 +0000 (+1000) Subject: Add a mutator hook to allow forcing team radar icons to display regardless of their... X-Git-Tag: xonotic-v0.8.5~855^2~5 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=36b46a9876477ce9cd78336a6551d940b5b64bbf;p=xonotic%2Fxonotic-data.pk3dir.git Add a mutator hook to allow forcing team radar icons to display regardless of their team (will be useful in Race to display all racers) --- diff --git a/qcsrc/client/hud/panel/radar.qc b/qcsrc/client/hud/panel/radar.qc index 14cdb4f68..a2776b662 100644 --- a/qcsrc/client/hud/panel/radar.qc +++ b/qcsrc/client/hud/panel/radar.qc @@ -353,10 +353,12 @@ void HUD_Radar() IL_EACH(g_radarlinks, true, draw_teamradar_link(it.origin, it.velocity, it.team)); + bool mutator_returnvalue = MUTATOR_CALLHOOK(TeamRadar_Draw); // TODO: allow players to show on the radar as well! + IL_EACH(g_radaricons, it.teamradar_icon, { if ( hud_panel_radar_mouse ) if ( GetResource(it, RES_HEALTH) >= 0 ) - if ( it.team == myteam + 1 || ISGAMETYPE(RACE) || !teamplay ) + if ( it.team == myteam + 1 || mutator_returnvalue || !teamplay ) { vector coord = teamradar_texcoord_to_2dcoord(teamradar_3dcoord_to_texcoord(it.origin)); if(vdist((mousepos - coord), <, 8)) diff --git a/qcsrc/client/mutators/events.qh b/qcsrc/client/mutators/events.qh index 258ad9e11..c324732b2 100644 --- a/qcsrc/client/mutators/events.qh +++ b/qcsrc/client/mutators/events.qh @@ -228,3 +228,6 @@ MUTATOR_HOOKABLE(ShowNames_Draw, EV_ShowNames_Draw); /** Return true to display the race timer HUD panel */ MUTATOR_HOOKABLE(ShowRaceTimer, EV_NO_ARGS); + +/** Return true to force team radar to display entities regardless of their team */ +MUTATOR_HOOKABLE(TeamRadar_Draw, EV_NO_ARGS); diff --git a/qcsrc/common/gamemodes/gamemode/race/cl_race.qc b/qcsrc/common/gamemodes/gamemode/race/cl_race.qc index 01a6e83b2..c2346a4f2 100644 --- a/qcsrc/common/gamemodes/gamemode/race/cl_race.qc +++ b/qcsrc/common/gamemodes/gamemode/race/cl_race.qc @@ -176,3 +176,8 @@ MUTATOR_HOOKFUNCTION(cl_race, ShowRaceTimer) { return ISGAMETYPE(RACE); // show the race timer panel } + +MUTATOR_HOOKFUNCTION(cl_race, TeamRadar_Draw) +{ + return ISGAMETYPE(RACE); // show all competitors in a race +}