From a140d84e31546812f5ccb972f04914ee53626248 Mon Sep 17 00:00:00 2001 From: terencehill Date: Tue, 2 Mar 2021 16:25:17 +0100 Subject: [PATCH] Move code that resets clip load whenever the player goes unarmed to the weaposystem --- qcsrc/server/client.qc | 9 --------- qcsrc/server/weapons/weaponsystem.qc | 8 +++++--- 2 files changed, 5 insertions(+), 12 deletions(-) diff --git a/qcsrc/server/client.qc b/qcsrc/server/client.qc index 1a25149a2..4e04373bd 100644 --- a/qcsrc/server/client.qc +++ b/qcsrc/server/client.qc @@ -2633,15 +2633,6 @@ void PlayerPreThink (entity this) } target_voicescript_next(this); - - // WEAPONTODO: Move into weaponsystem somehow - // if a player goes unarmed after holding a loaded weapon, empty his clip size and remove the crosshair ammo ring - for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot) - { - .entity weaponentity = weaponentities[slot]; - if(this.(weaponentity).m_weapon == WEP_Null) - this.(weaponentity).clip_load = this.(weaponentity).clip_size = 0; - } } void DrownPlayer(entity this) diff --git a/qcsrc/server/weapons/weaponsystem.qc b/qcsrc/server/weapons/weaponsystem.qc index 79f692590..9a4392ae3 100644 --- a/qcsrc/server/weapons/weaponsystem.qc +++ b/qcsrc/server/weapons/weaponsystem.qc @@ -509,6 +509,7 @@ void W_WeaponFrame(Player actor, .entity weaponentity) this.m_switchweapon = WEP_Null; this.state = WS_CLEAR; this.weaponname = ""; + this.clip_load = this.clip_size = this.old_clip_load = 0; return; } } @@ -521,6 +522,7 @@ void W_WeaponFrame(Player actor, .entity weaponentity) this.m_switchingweapon = WEP_Null; this.state = WS_CLEAR; this.weaponname = ""; + this.clip_load = this.clip_size = this.old_clip_load = 0; return; } @@ -602,7 +604,8 @@ void W_WeaponFrame(Player actor, .entity weaponentity) { if (w != WEP_Null && !(STAT(WEAPONS, actor) & WepSet_FromWeapon(w))) { - if (this.m_weapon == this.m_switchweapon) W_SwitchWeapon_Force(actor, w_getbestweapon(actor, weaponentity), weaponentity); + if (this.m_weapon == this.m_switchweapon) + W_SwitchWeapon_Force(actor, w_getbestweapon(actor, weaponentity), weaponentity); w = WEP_Null; } @@ -658,8 +661,7 @@ void W_WeaponFrame(Player actor, .entity weaponentity) v_right = ri; v_up = up; Weapon wpn = this.m_weapon; - this.weapon_think(wpn, actor, weaponentity, - button_atck | (button_atck2 << 1)); + this.weapon_think(wpn, actor, weaponentity, button_atck | (button_atck2 << 1)); } else { -- 2.39.2