]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Port teamkill_complain, teamkill_soundtime and teamkill_soundsource to ClientState
authorMario <mario@smbclan.net>
Sat, 15 Jul 2017 20:23:34 +0000 (06:23 +1000)
committerMario <mario@smbclan.net>
Sat, 15 Jul 2017 20:23:34 +0000 (06:23 +1000)
qcsrc/common/gamemodes/gamemode/nexball/nexball.qc
qcsrc/server/client.qc
qcsrc/server/client.qh
qcsrc/server/g_damage.qc

index b917deba6a05f5d6be554cf68f04dc55d5d85ed2..ba42962692441141079d57526061e381fa17322a 100644 (file)
@@ -753,11 +753,11 @@ void W_Nexball_Touch(entity this, entity toucher)
                                LogNB("stole", attacker);
                                _sound(toucher, CH_TRIGGER, ball.noise2, VOL_BASE, ATTEN_NORM);
 
-                               if(SAME_TEAM(attacker, toucher) && time > attacker.teamkill_complain)
+                               if(SAME_TEAM(attacker, toucher) && time > CS(attacker).teamkill_complain)
                                {
-                                       attacker.teamkill_complain = time + 5;
-                                       attacker.teamkill_soundtime = time + 0.4;
-                                       attacker.teamkill_soundsource = toucher;
+                                       CS(attacker).teamkill_complain = time + 5;
+                                       CS(attacker).teamkill_soundtime = time + 0.4;
+                                       CS(attacker).teamkill_soundsource = toucher;
                                }
 
                                GiveBall(attacker, toucher.ballcarried);
index b9bec171fd951a0bfee0de882e0288b71917918b..6ce77198c0410ff52588f1d24de2fd334956962e 100644 (file)
@@ -2598,11 +2598,11 @@ void PlayerPreThink (entity this)
                SetZoomState(this, PHYS_INPUT_BUTTON_ZOOM(this) || PHYS_INPUT_BUTTON_ZOOMSCRIPT(this) || wep_zoomed);
     }
 
-       if (this.teamkill_soundtime && time > this.teamkill_soundtime)
+       if (CS(this).teamkill_soundtime && time > CS(this).teamkill_soundtime)
        {
-               this.teamkill_soundtime = 0;
+               CS(this).teamkill_soundtime = 0;
 
-               entity e = this.teamkill_soundsource;
+               entity e = CS(this).teamkill_soundsource;
                entity oldpusher = e.pusher;
                e.pusher = this;
                PlayerSound(e, playersound_teamshoot, CH_VOICE, VOL_BASEVOICE, VOICETYPE_LASTATTACKER_ONLY);
index 4178ca9e6edba768fcd9dd4145b3e73759dcc246..276f751b4564ba867daf33a46e0d3444d12b11bc 100644 (file)
@@ -76,6 +76,9 @@ CLASS(Client, Object)
     ATTRIB(Client, pressedkeys, int, this.pressedkeys);
     ATTRIB(Client, movement_old, vector, this.movement_old);
     ATTRIB(Client, buttons_old, int, this.buttons_old);
+    ATTRIB(Client, teamkill_complain, float, this.teamkill_complain);
+    ATTRIB(Client, teamkill_soundtime, float, this.teamkill_soundtime);
+    ATTRIB(Client, teamkill_soundsource, entity, this.teamkill_soundsource);
 
     METHOD(Client, m_unwind, bool(Client this));
 
index e0e6bb62d2fd12fbbfb76eabfc734e7af8769d36..a2fbaf9c37257d76f0ee3faa6396665623a05043 100644 (file)
@@ -854,18 +854,18 @@ void Damage (entity targ, entity inflictor, entity attacker, float damage, int d
                                                }
                                        }
                                }
-                               else
+                               else if(IS_PLAYER(attacker))
                                {
                                        if(deathtype != DEATH_FIRE.m_id)
                                        {
                                                attacker.typehitsound += 1;
                                        }
                                        if(complainteamdamage > 0)
-                                               if(time > attacker.teamkill_complain)
+                                               if(time > CS(attacker).teamkill_complain)
                                                {
-                                                       attacker.teamkill_complain = time + 5;
-                                                       attacker.teamkill_soundtime = time + 0.4;
-                                                       attacker.teamkill_soundsource = targ;
+                                                       CS(attacker).teamkill_complain = time + 5;
+                                                       CS(attacker).teamkill_soundtime = time + 0.4;
+                                                       CS(attacker).teamkill_soundsource = targ;
                                                }
                                }
                        }