From: Mario Date: Sun, 16 Jul 2017 22:00:22 +0000 (+1000) Subject: Roughly port dual_weapons to PlayerState X-Git-Tag: xonotic-v0.8.5~2588 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=fa4d1576bf19100ffafcbff988c3309b96e4f937;p=xonotic%2Fxonotic-data.pk3dir.git Roughly port dual_weapons to PlayerState --- diff --git a/qcsrc/server/client.qc b/qcsrc/server/client.qc index ec771b2d6..5ad2e2dc9 100644 --- a/qcsrc/server/client.qc +++ b/qcsrc/server/client.qc @@ -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; diff --git a/qcsrc/server/client.qh b/qcsrc/server/client.qh index bd9359cf5..74c8bb174 100644 --- a/qcsrc/server/client.qh +++ b/qcsrc/server/client.qh @@ -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); diff --git a/qcsrc/server/weapons/selection.qc b/qcsrc/server/weapons/selection.qc index 895c65ae2..17ba0dc9d 100644 --- a/qcsrc/server/weapons/selection.qc +++ b/qcsrc/server/weapons/selection.qc @@ -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)) { diff --git a/qcsrc/server/weapons/weaponsystem.qc b/qcsrc/server/weapons/weaponsystem.qc index 2e4e160b3..cbde7d360 100644 --- a/qcsrc/server/weapons/weaponsystem.qc +++ b/qcsrc/server/weapons/weaponsystem.qc @@ -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;