From: Mario Date: Fri, 28 Apr 2017 04:52:29 +0000 (+1000) Subject: Add a field to handle dual wielding status of a player's weapons X-Git-Tag: xonotic-v0.8.5~2826 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=30cba785cd27f19eeff00581212eba997c43f21d;p=xonotic%2Fxonotic-data.pk3dir.git Add a field to handle dual wielding status of a player's weapons --- diff --git a/qcsrc/server/client.qc b/qcsrc/server/client.qc index 168ca8496..72ee5a7cd 100644 --- a/qcsrc/server/client.qc +++ b/qcsrc/server/client.qc @@ -338,6 +338,7 @@ void PutObserverInServer(entity this) this.items = 0; this.weapons = '0 0 0'; + this.dual_weapons = '0 0 0'; this.drawonlytoclient = this; this.weaponmodel = ""; @@ -1694,6 +1695,7 @@ 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/defs.qh b/qcsrc/server/defs.qh index ccb361ea6..e210151dc 100644 --- a/qcsrc/server/defs.qh +++ b/qcsrc/server/defs.qh @@ -418,6 +418,8 @@ const int MIF_GUIDED_CONFUSABLE = MIF_GUIDED_HEAT | MIF_GUIDED_AI; .void(entity this, entity player) init_for_player; +.WepSet dual_weapons; + IntrusiveList g_monsters; STATIC_INIT(g_monsters) { g_monsters = IL_NEW(); } diff --git a/qcsrc/server/weapons/selection.qc b/qcsrc/server/weapons/selection.qc index e8b8d9a4b..895c65ae2 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)) + if (autocvar_g_weaponswitch_debug == 2 && weaponslot(weaponentity) > 0 && !(wpn.spawnflags & WEP_FLAG_DUALWIELD) && !(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 1605db39d..2e4e160b3 100644 --- a/qcsrc/server/weapons/weaponsystem.qc +++ b/qcsrc/server/weapons/weaponsystem.qc @@ -457,7 +457,7 @@ 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)) + if(!(this.m_switchweapon.spawnflags & WEP_FLAG_DUALWIELD) && !(actor.dual_weapons & wep1.m_switchweapon.m_wepset)) { this.m_weapon = WEP_Null; this.m_switchingweapon = WEP_Null;