]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Move code that resets clip load whenever the player goes unarmed to the weaposystem
authorterencehill <piuntn@gmail.com>
Tue, 2 Mar 2021 15:25:17 +0000 (16:25 +0100)
committerterencehill <piuntn@gmail.com>
Tue, 2 Mar 2021 15:25:17 +0000 (16:25 +0100)
qcsrc/server/client.qc
qcsrc/server/weapons/weaponsystem.qc

index 1a25149a2601b72fd5a36c1295253aa29b3e50ff..4e04373bd6f4ecfa0d1afb62137a4e3dd55a7536 100644 (file)
@@ -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)
index 79f692590cb6ae2204a8072d2512d6418b7800e6..9a4392ae3ec7fe668479b9d546b2e9bc3a229632 100644 (file)
@@ -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
                        {