]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Roughly port dual_weapons to PlayerState
authorMario <mario@smbclan.net>
Sun, 16 Jul 2017 22:00:22 +0000 (08:00 +1000)
committerMario <mario@smbclan.net>
Sun, 16 Jul 2017 22:00:22 +0000 (08:00 +1000)
qcsrc/server/client.qc
qcsrc/server/client.qh
qcsrc/server/weapons/selection.qc
qcsrc/server/weapons/weaponsystem.qc

index ec771b2d6232c8367f34d3babb852d3e178544c2..5ad2e2dc909846074da2db7dc6f27dcadbfaa1f1 100644 (file)
@@ -334,7 +334,7 @@ void PutObserverInServer(entity this)
 
        this.items = 0;
        this.weapons = '0 0 0';
-       this.dual_weapons = '0 0 0';
+       PS(this).dual_weapons = '0 0 0';
        this.drawonlytoclient = this;
 
        this.weaponmodel = "";
@@ -547,7 +547,7 @@ void PutPlayerInServer(entity this)
        }
        SetSpectatee_status(this, 0);
 
-       this.dual_weapons = '0 0 0';
+       PS(this).dual_weapons = '0 0 0';
 
        this.superweapons_finished = (this.weapons & WEPSET_SUPERWEAPONS) ? time + autocvar_g_balance_superweapons_time : 0;
 
@@ -1718,7 +1718,6 @@ void SpectateCopy(entity this, entity spectatee)
        this.superweapons_finished = spectatee.superweapons_finished;
        STAT(PRESSED_KEYS, this) = STAT(PRESSED_KEYS, spectatee);
        this.weapons = spectatee.weapons;
-       this.dual_weapons = spectatee.dual_weapons;
        this.vortex_charge = spectatee.vortex_charge;
        this.vortex_chargepool_ammo = spectatee.vortex_chargepool_ammo;
        this.hagar_load = spectatee.hagar_load;
index bd9359cf5b61604f93bb26d4e907ed59b37e23b0..74c8bb174a53356b3db43ef821e9658a09cd2f7d 100644 (file)
@@ -135,6 +135,11 @@ CLASS(Spectator, Client)
 ENDCLASS(Spectator)
 
 CLASS(Player, Client)
+    
+    // custom
+
+    ATTRIB(Player, dual_weapons, vector, this.dual_weapons); // TODO: actually WepSet!
+
     INIT(Player) {
         this.classname = STR_PLAYER;
         IL_PUSH(g_players, this);
index 895c65ae29b0ab7def236c753c9fce930c3288b4..17ba0dc9dfafb4f1063e0f20f14b292f11856b56 100644 (file)
@@ -61,7 +61,7 @@ bool client_hasweapon(entity this, Weapon wpn, .entity weaponentity, float andam
                        sprint(this, "Invalid weapon\n");
                return false;
        }
-       if (autocvar_g_weaponswitch_debug == 2 && weaponslot(weaponentity) > 0 && !(wpn.spawnflags & WEP_FLAG_DUALWIELD) && !(this.dual_weapons & wpn.m_wepset))
+       if (autocvar_g_weaponswitch_debug == 2 && weaponslot(weaponentity) > 0 && !(wpn.spawnflags & WEP_FLAG_DUALWIELD) && !(PS(this).dual_weapons & wpn.m_wepset))
                return false; // no complaints needed
        if (this.weapons & WepSet_FromWeapon(wpn))
        {
index 2e4e160b3e16f1727a810cf3418a8d41b1a81b1e..cbde7d360c61544c8ea3b4d48596c11ac2330435 100644 (file)
@@ -457,7 +457,8 @@ void W_WeaponFrame(Player actor, .entity weaponentity)
                .entity wepe1 = weaponentities[0];
                entity wep1 = actor.(wepe1);
                this.m_switchweapon = wep1.m_switchweapon;
-               if(!(this.m_switchweapon.spawnflags & WEP_FLAG_DUALWIELD) && !(actor.dual_weapons & wep1.m_switchweapon.m_wepset))
+               entity store = IS_PLAYER(actor) ? PS(actor) : actor;
+               if(!(this.m_switchweapon.spawnflags & WEP_FLAG_DUALWIELD) && !(store.dual_weapons & wep1.m_switchweapon.m_wepset))
                {
                        this.m_weapon = WEP_Null;
                        this.m_switchingweapon = WEP_Null;