]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Port muted to ClientState and don't call formatmessage if there was no sender (potent...
authorMario <mario@smbclan.net>
Sat, 15 Jul 2017 15:52:28 +0000 (01:52 +1000)
committerMario <mario@smbclan.net>
Sat, 15 Jul 2017 15:52:28 +0000 (01:52 +1000)
qcsrc/server/client.qh
qcsrc/server/command/banning.qc
qcsrc/server/player.qc
qcsrc/server/player.qh

index c63d26190489ed084b4cd1397f5f7649c42b18ac..eebb7d969824fed6cf6ba03a73e56de81c42f1f9 100644 (file)
@@ -34,6 +34,7 @@ CLASS(Client, Object)
     ATTRIB(Client, playerid, int, this.playerid);
 
     ATTRIB(Client, parm_idlesince, int, this.parm_idlesince);
+    ATTRIB(Client, muted, int, this.muted);
 
     METHOD(Client, m_unwind, bool(Client this));
 
index 8a35bec2925c2f89658dfe7145308e56dabb0c2a..446c69de40f9d1da5732fd4863a362469062f39f 100644 (file)
@@ -131,7 +131,7 @@ void BanCommand_mute(float request, float argc, string command)  // TODO: Add a
 
                                if (accepted > 0)
                                {
-                                       client.muted = true;
+                                       CS(client).muted = true;
                                        return;
                                }
                                else
@@ -212,7 +212,7 @@ void BanCommand_unmute(float request, float argc)
 
                                if (accepted > 0)
                                {
-                                       client.muted = false;
+                                       CS(client).muted = false;
                                        return;
                                }
                                else
index 0ca9cb8491d3084d309b3a5d92be39303c8448f8..70e972da88f50af29fa3a2246b693e58b7373c51 100644 (file)
@@ -744,7 +744,8 @@ int Say(entity source, int teamsay, entity privatesay, string msgin, bool floodc
        if (!teamsay && !privatesay && substring(msgin, 0, 1) == " ")
         msgin = substring(msgin, 1, -1); // work around DP say bug (say_team does not have this!)
 
-       msgin = formatmessage(source, msgin);
+    if(source)
+               msgin = formatmessage(source, msgin);
 
     string colorstr;
        if (!IS_PLAYER(source))
@@ -944,7 +945,7 @@ int Say(entity source, int teamsay, entity privatesay, string msgin, bool floodc
                sourcemsgstr = strcat(privatemsgprefix, substring(sourcemsgstr, privatemsgprefixlen, -1));
 
     int ret;
-       if(source.muted)
+       if(source && CS(source).muted)
        {
                // always fake the message
                ret = -1;
index b9a5fa928835208119144e2d7749149c7685af4e..1834bb865ffbb668801e525eb40b7e90f5afa341 100644 (file)
@@ -73,6 +73,4 @@ void MoveToTeam(entity client, float team_colour, float type);
 
 void PlayerDamage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force);
 
-/** to be used by `prvm_edictset server playernumber muted 1` */
-.float muted;
 int Say(entity source, float teamsay, entity privatesay, string msgin, float floodcontrol);