]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/weapons/weapon/minelayer.qc
Merge branch 'master' into TimePath/items
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / weapons / weapon / minelayer.qc
index ad96ab56c00c3339e9574fc89e676d0c6ba7dfd3..ba255fbe2d329b016c61a0705456d8b5ae2e5cb3 100644 (file)
@@ -129,7 +129,8 @@ void W_MineLayer_Explode(void)
                if(!w.wr_checkammo1(w))
                {
                        self.cnt = WEP_MINE_LAYER.m_id;
-                       ATTACK_FINISHED(self) = time;
+                       int slot = 0; // TODO: unhardcode
+                       ATTACK_FINISHED(self, slot) = time;
                        self.switchweapon = w_getbestweapon(self);
                }
                setself(this);
@@ -155,7 +156,8 @@ void W_MineLayer_DoRemoteExplode(void)
                if(!w.wr_checkammo1(w))
                {
                        self.cnt = WEP_MINE_LAYER.m_id;
-                       ATTACK_FINISHED(self) = time;
+                       int slot = 0; // TODO: unhardcode
+                       ATTACK_FINISHED(self, slot) = time;
                        self.switchweapon = w_getbestweapon(self);
                }
                setself(this);
@@ -499,7 +501,7 @@ float W_MineLayer_PlacedMines(float detonate)
                                if(self.BUTTON_ATCK2 == true) self.BUTTON_ATCK = false;
                        }
                }
-               METHOD(MineLayer, wr_think, void(entity thiswep, entity actor, bool fire1, bool fire2))
+               METHOD(MineLayer, wr_think, void(entity thiswep, entity actor, int slot, int fire))
                {
                        if(autocvar_g_balance_minelayer_reload_ammo && actor.clip_load < WEP_CVAR(minelayer, ammo)) // forced reload
                        {
@@ -509,16 +511,16 @@ float W_MineLayer_PlacedMines(float detonate)
                                        w.wr_reload(w);
                                }
                        }
-                       else if(fire1)
+                       else if(fire & 1)
                        {
-                               if(weapon_prepareattack(thiswep, actor, false, WEP_CVAR(minelayer, refire)))
+                               if(weapon_prepareattack(thiswep, actor, slot, false, WEP_CVAR(minelayer, refire)))
                                {
                                        W_MineLayer_Attack(thiswep);
-                                       weapon_thinkf(actor, WFRAME_FIRE1, WEP_CVAR(minelayer, animtime), w_ready);
+                                       weapon_thinkf(actor, slot, WFRAME_FIRE1, WEP_CVAR(minelayer, animtime), w_ready);
                                }
                        }
 
-                       if(fire2)
+                       if(fire & 2)
                        {
                                if(W_MineLayer_PlacedMines(true))
                                        sound(actor, CH_WEAPON_B, SND_MINE_DET, VOL_BASE, ATTN_NORM);
@@ -530,8 +532,9 @@ float W_MineLayer_PlacedMines(float detonate)
                }
                METHOD(MineLayer, wr_checkammo1, bool(entity thiswep))
                {
+                       int slot = 0; // TODO: unhardcode
                        // don't switch while placing a mine
-                       if(ATTACK_FINISHED(self) <= time || self.weapon != WEP_MINE_LAYER.m_id)
+                       if(ATTACK_FINISHED(self, slot) <= time || self.weapon != WEP_MINE_LAYER.m_id)
                        {
                                float ammo_amount = self.WEP_AMMO(MINE_LAYER) >= WEP_CVAR(minelayer, ammo);
                                ammo_amount += self.(weapon_load[WEP_MINE_LAYER.m_id]) >= WEP_CVAR(minelayer, ammo);