From: terencehill Date: Tue, 2 Mar 2021 15:25:17 +0000 (+0100) Subject: Move code that resets clip load whenever the player goes unarmed to the weaposystem X-Git-Tag: xonotic-v0.8.5~537 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=a140d84e31546812f5ccb972f04914ee53626248;p=xonotic%2Fxonotic-data.pk3dir.git Move code that resets clip load whenever the player goes unarmed to the weaposystem --- 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 {