From: Juhu <5894800-Juhu_@users.noreply.gitlab.com> Date: Sun, 30 Jan 2022 02:02:57 +0000 (+0100) Subject: make team waypoints and team chat work in battle royale X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=45d930bbe86d00a7f7806991206c797186d58e58;p=xonotic%2Fxonotic-data.pk3dir.git make team waypoints and team chat work in battle royale --- diff --git a/qcsrc/common/gamemodes/gamemode/br/sv_br.qc b/qcsrc/common/gamemodes/gamemode/br/sv_br.qc index 0a27f3e04..0baad0f1b 100644 --- a/qcsrc/common/gamemodes/gamemode/br/sv_br.qc +++ b/qcsrc/common/gamemodes/gamemode/br/sv_br.qc @@ -6,7 +6,9 @@ #include #include -#define BR_KILLS_INSTANTLY(pl, dt) (!IN_SQUAD((pl)) || (br_SquadFindLastAlive((pl).br_squad, true) == (pl)) || ((dt) == DEATH_HURTTRIGGER.m_id) || ((dt) == DEATH_KILL.m_id) || ((dt) == DEATH_TEAMCHANGE.m_id) || ((dt) == DEATH_AUTOTEAMCHANGE.m_id)) +#define BR_KILLS_INSTANTLY(pl, dt) \ + (!IN_SQUAD((pl)) || (br_SquadFindLastAlive((pl).br_squad, true) == (pl)) || ((dt) == DEATH_HURTTRIGGER.m_id) \ + || ((dt) == DEATH_KILL.m_id) || ((dt) == DEATH_TEAMCHANGE.m_id) || ((dt) == DEATH_AUTOTEAMCHANGE.m_id)) float br_CalculatePlayerDropAngle(entity this); void br_LastPlayerForSquad_Notify(entity squad); @@ -734,7 +736,7 @@ MUTATOR_HOOKFUNCTION(br, PlayerDies, CBC_ORDER_FIRST) } STAT(WEAPONS, frag_target) = '0 0 0'; - WaypointSprite_Spawn(WP_BRBleeding, 0, 0, frag_target, '0 0 64', NULL, 0, frag_target, waypointsprite_attached, true, RADARICON_WAYPOINT).br_squad = frag_target.br_squad; + WaypointSprite_Spawn(WP_BRBleeding, 0, 0, frag_target, '0 0 64', NULL, 0, frag_target, waypointsprite_attached, true, RADARICON_WAYPOINT); if(frag_attacker == frag_target || !frag_attacker || ITEM_DAMAGE_NEEDKILL(frag_deathtype)) { @@ -896,10 +898,13 @@ MUTATOR_HOOKFUNCTION(br, CustomizeWaypoint) entity wp = M_ARGV(0, entity); entity player = M_ARGV(1, entity); + if(wp.owner == NULL) + return false; + if((wp == wp.owner.br_allywaypoint) && (vdist(wp.owner.origin - player.origin, <, autocvar_g_br_squad_waypoint_distance) || STAT(BLEEDING, wp.owner))) return true; - if(!IS_PLAYER(player) || DIFF_SQUAD(wp, player)) + if(!IS_PLAYER(player) || DIFF_SQUAD(wp.owner, player)) return true; } @@ -1115,7 +1120,7 @@ void br_Start(){ it.br_drop_launch = 0; UNSET_ONGROUND(it); // otherwise this isn't unset if the player drops in the same frame - WaypointSprite_Spawn(WP_BRAlly, 0, 0, it, '0 0 64', NULL, 0, it, br_allywaypoint, true, RADARICON_WAYPOINT).br_squad = it.br_squad; + WaypointSprite_Spawn(WP_BRAlly, 0, 0, it, '0 0 64', NULL, 0, it, br_allywaypoint, true, RADARICON_WAYPOINT); }); squads_colored = autocvar_g_br_squad_colors; diff --git a/qcsrc/server/chat.qc b/qcsrc/server/chat.qc index 204ed1341..da75146ba 100644 --- a/qcsrc/server/chat.qc +++ b/qcsrc/server/chat.qc @@ -31,10 +31,12 @@ int Say(entity source, int teamsay, entity privatesay, string msgin, bool floodc msgin = formatmessage(source, msgin); string colorstr; - if (!(IS_PLAYER(source) || source.caplayer)) + if (!(IS_PLAYER(source) || source.caplayer || IN_SQUAD(source))) colorstr = "^0"; // black for spectators else if(teamplay) colorstr = Team_ColorCode(source.team); + else if(IN_SQUAD(source)) + colorstr = "^7"; else { colorstr = ""; @@ -224,7 +226,7 @@ int Say(entity source, int teamsay, entity privatesay, string msgin, bool floodc sourcecmsgstr = cmsgstr; } - if (!privatesay && source && !(IS_PLAYER(source) || source.caplayer) && !game_stopped + if (!privatesay && source && !(IS_PLAYER(source) || source.caplayer || IN_SQUAD(source)) && !game_stopped && (teamsay || CHAT_NOSPECTATORS())) { teamsay = -1; // spectators @@ -258,8 +260,8 @@ int Say(entity source, int teamsay, entity privatesay, string msgin, bool floodc ret = 1; } - if (privatesay && source && !(IS_PLAYER(source) || source.caplayer) && !game_stopped - && (IS_PLAYER(privatesay) || privatesay.caplayer) && CHAT_NOSPECTATORS()) + if (privatesay && source && !(IS_PLAYER(source) || source.caplayer || IN_SQUAD(source)) && !game_stopped + && (IS_PLAYER(privatesay) || privatesay.caplayer || IN_SQUAD(privatesay)) && CHAT_NOSPECTATORS()) { ret = -1; // just hide the message completely } @@ -304,7 +306,7 @@ int Say(entity source, int teamsay, entity privatesay, string msgin, bool floodc dedicated_print(msgstr); // send to server console too if(sourcecmsgstr != "") centerprint(source, sourcecmsgstr); - FOREACH_CLIENT((IS_PLAYER(it) || it.caplayer) && IS_REAL_CLIENT(it) && it != source && it.team == source.team && !MUTATOR_CALLHOOK(ChatMessageTo, it, source), { + FOREACH_CLIENT((IS_PLAYER(it) || it.caplayer || IN_SQUAD(it)) && IS_REAL_CLIENT(it) && it != source && (((it.team == source.team) && !IN_SQUAD(source)) || SAME_SQUAD(it, source)) && !MUTATOR_CALLHOOK(ChatMessageTo, it, source), { sprint(it, msgstr); if(cmsgstr != "") centerprint(it, cmsgstr); @@ -315,7 +317,7 @@ int Say(entity source, int teamsay, entity privatesay, string msgin, bool floodc { sprint(source, sourcemsgstr); dedicated_print(msgstr); // send to server console too - FOREACH_CLIENT(!(IS_PLAYER(it) || it.caplayer) && IS_REAL_CLIENT(it) && it != source && !MUTATOR_CALLHOOK(ChatMessageTo, it, source), { + FOREACH_CLIENT(!(IS_PLAYER(it) || it.caplayer || IN_SQUAD(it)) && IS_REAL_CLIENT(it) && it != source && !MUTATOR_CALLHOOK(ChatMessageTo, it, source), { sprint(it, msgstr); }); event_log_msg = sprintf(":chat_spec:%d:%s", source.playerid, strreplace("\n", " ", msgin));