]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/weapons/weaponsystem.qc
Add a temporary flag for weapons that penetrate walls (rifle), to avoid a direct...
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / weapons / weaponsystem.qc
index 452ac7f533badd5084b92fd41454b4b312132e53..f8949b15601919e1b863084a1e5653ab3f94d9c2 100644 (file)
@@ -393,10 +393,10 @@ void weapon_thinkf(entity actor, .entity weaponentity, WFRAME fr, float t, void(
 
        if (this)
        {
-               FOREACH_CLIENT(true, LAMBDA(
+               FOREACH_CLIENT(true, {
                        if(it == actor || (IS_SPEC(it) && it.enemy == actor))
                                wframe_send(it, this, a, restartanim);
-               ));
+               });
        }
 
        if ((fr == WFRAME_FIRE1 || fr == WFRAME_FIRE2) && t)
@@ -452,21 +452,13 @@ void W_WeaponFrame(Player actor, .entity weaponentity)
                }
        }
 
-       if (this.m_switchweapon == WEP_Null)
-       {
-               this.m_weapon = WEP_Null;
-               this.m_switchingweapon = WEP_Null;
-               this.state = WS_CLEAR;
-               this.weaponname = "";
-               return;
-       }
-
        if(autocvar_g_weaponswitch_debug == 2 && weaponslot(weaponentity) > 0)
        {
                .entity wepe1 = weaponentities[0];
                entity wep1 = actor.(wepe1);
                this.m_switchweapon = wep1.m_switchweapon;
-               if(!(this.m_switchweapon.spawnflags & WEP_FLAG_DUALWIELD))
+               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;
@@ -477,6 +469,15 @@ void W_WeaponFrame(Player actor, .entity weaponentity)
                }
        }
 
+       if (this.m_switchweapon == WEP_Null)
+       {
+               this.m_weapon = WEP_Null;
+               this.m_switchingweapon = WEP_Null;
+               this.state = WS_CLEAR;
+               this.weaponname = "";
+               return;
+       }
+
        makevectors(actor.v_angle);
        vector fo = v_forward;  // save them in case the weapon think functions change it
        vector ri = v_right;
@@ -517,7 +518,7 @@ void W_WeaponFrame(Player actor, .entity weaponentity)
                                        this.clip_load = this.clip_size = 0;
                                }
 
-                               weapon_thinkf(actor, weaponentity, WFRAME_IDLE, newwep.switchdelay_raise, w_ready);
+                               weapon_thinkf(actor, weaponentity, WFRAME_DONTCHANGE, newwep.switchdelay_raise, w_ready);
                                break;
                        }
                        case WS_DROP: