]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
make team waypoints and team chat work in battle royale
authorJuhu <5894800-Juhu_@users.noreply.gitlab.com>
Sun, 30 Jan 2022 02:02:57 +0000 (03:02 +0100)
committerJuhu <5894800-Juhu_@users.noreply.gitlab.com>
Sun, 30 Jan 2022 02:02:57 +0000 (03:02 +0100)
qcsrc/common/gamemodes/gamemode/br/sv_br.qc
qcsrc/server/chat.qc

index 0a27f3e049e3f53235d88418a7cea548963fbade..0baad0f1bf4fdd756a7b12896e15c7d57ea8c4b9 100644 (file)
@@ -6,7 +6,9 @@
 #include <server/resources.qh>
 #include <common/mutators/base.qh>
 
-#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;
index 204ed13410defe587a59a540b5bc207a8787e295..da75146bacff6934f446b9a07e31763bc1d80d32 100644 (file)
@@ -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));