From 5411fb1dfd2985088bf64f583373d6a2294104da Mon Sep 17 00:00:00 2001 From: Mario Date: Sun, 16 Jul 2017 06:23:34 +1000 Subject: [PATCH] Port teamkill_complain, teamkill_soundtime and teamkill_soundsource to ClientState --- qcsrc/common/gamemodes/gamemode/nexball/nexball.qc | 8 ++++---- qcsrc/server/client.qc | 6 +++--- qcsrc/server/client.qh | 3 +++ qcsrc/server/g_damage.qc | 10 +++++----- 4 files changed, 15 insertions(+), 12 deletions(-) diff --git a/qcsrc/common/gamemodes/gamemode/nexball/nexball.qc b/qcsrc/common/gamemodes/gamemode/nexball/nexball.qc index b917deba6..ba4296269 100644 --- a/qcsrc/common/gamemodes/gamemode/nexball/nexball.qc +++ b/qcsrc/common/gamemodes/gamemode/nexball/nexball.qc @@ -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); diff --git a/qcsrc/server/client.qc b/qcsrc/server/client.qc index b9bec171f..6ce77198c 100644 --- a/qcsrc/server/client.qc +++ b/qcsrc/server/client.qc @@ -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); diff --git a/qcsrc/server/client.qh b/qcsrc/server/client.qh index 4178ca9e6..276f751b4 100644 --- a/qcsrc/server/client.qh +++ b/qcsrc/server/client.qh @@ -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)); diff --git a/qcsrc/server/g_damage.qc b/qcsrc/server/g_damage.qc index e0e6bb62d..a2fbaf9c3 100644 --- a/qcsrc/server/g_damage.qc +++ b/qcsrc/server/g_damage.qc @@ -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; } } } -- 2.39.2