]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Fix crylink and vaporizer being able to fire with empty magazines
authorDr. Jaska <drjaska83@gmail.com>
Tue, 23 May 2023 14:13:19 +0000 (14:13 +0000)
committerterencehill <piuntn@gmail.com>
Tue, 23 May 2023 14:13:19 +0000 (14:13 +0000)
qcsrc/common/weapons/weapon/crylink.qc
qcsrc/common/weapons/weapon/vaporizer.qc
qcsrc/common/weapons/weapon/vaporizer.qh

index ae1eae28459adfb50c468fc37571feb1000e9a69..61820528fe1e14bcab89fd9a9f740f4b685c07bb 100644 (file)
@@ -532,7 +532,7 @@ METHOD(Crylink, wr_think, void(entity thiswep, entity actor, .entity weaponentit
         thiswep.wr_reload(thiswep, actor, weaponentity);
     }
 
-    if(fire & 1)
+    else if(fire & 1)
     {
         if(actor.(weaponentity).crylink_waitrelease != 1)
         if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(crylink, refire)))
@@ -542,7 +542,7 @@ METHOD(Crylink, wr_think, void(entity thiswep, entity actor, .entity weaponentit
         }
     }
 
-    if((fire & 2) && autocvar_g_balance_crylink_secondary)
+    else if((fire & 2) && autocvar_g_balance_crylink_secondary)
     {
         if(actor.(weaponentity).crylink_waitrelease != 2)
         if(weapon_prepareattack(thiswep, actor, weaponentity, true, WEP_CVAR_SEC(crylink, refire)))
index 71bc39a7c7e16c8cee309c7b776afd8a2aed3b66..4be54b6b220378c28746b2f864cc1bc730681e46 100644 (file)
@@ -255,8 +255,12 @@ METHOD(Vaporizer, wr_think, void(entity thiswep, entity actor, .entity weaponent
     // if the laser uses load, we also consider its ammo for reloading
     if(WEP_CVAR(vaporizer, reload_ammo) && WEP_CVAR_SEC(vaporizer, ammo) && actor.(weaponentity).clip_load < min(vaporizer_ammo, WEP_CVAR_SEC(vaporizer, ammo))) { // forced reload
         thiswep.wr_reload(thiswep, actor, weaponentity);
+        actor.(weaponentity).hagar_load = false; // rocket minsta exclusive var
+        return;
     } else if(WEP_CVAR(vaporizer, reload_ammo) && actor.(weaponentity).clip_load < vaporizer_ammo) { // forced reload
         thiswep.wr_reload(thiswep, actor, weaponentity);
+        actor.(weaponentity).hagar_load = false; // rocket minsta exclusive var
+        return;
     }
     if((fire & 1) && (GetResource(actor, RES_CELLS) || !autocvar_g_rm) && !weaponLocked(actor))
     {
@@ -271,16 +275,17 @@ METHOD(Vaporizer, wr_think, void(entity thiswep, entity actor, .entity weaponent
         if((autocvar_g_rm && autocvar_g_rm_laser) || autocvar_g_rm_laser == 2)
         {
             bool rapid = autocvar_g_rm_laser_rapid;
-            if(actor.(weaponentity).jump_interval <= time && !actor.(weaponentity).held_down)
+            //hagar_load was previously named held_down
+            if(actor.(weaponentity).jump_interval <= time && !actor.(weaponentity).hagar_load)
             {
                 if(rapid)
-                    actor.(weaponentity).held_down = true;
+                    actor.(weaponentity).hagar_load = true;
                 actor.(weaponentity).jump_interval = time + autocvar_g_rm_laser_refire;
                 actor.(weaponentity).jump_interval2 = time + autocvar_g_rm_laser_rapid_delay;
                 impressive_hits = 0;
                 W_RocketMinsta_Attack(actor, weaponentity, 0);
             }
-            else if(rapid && actor.(weaponentity).jump_interval2 <= time && actor.(weaponentity).held_down)
+            else if(rapid && actor.(weaponentity).jump_interval2 <= time && actor.(weaponentity).hagar_load)
             {
                 actor.(weaponentity).jump_interval2 = time + autocvar_g_rm_laser_rapid_refire;
                 impressive_hits = 0;
@@ -305,7 +310,7 @@ METHOD(Vaporizer, wr_think, void(entity thiswep, entity actor, .entity weaponent
         }
     }
     else
-        actor.(weaponentity).held_down = false;
+        actor.(weaponentity).hagar_load = false;
 }
 METHOD(Vaporizer, wr_setup, void(entity thiswep, entity actor, .entity weaponentity))
 {
index 87249f7364b9b6525e9ac74153d4d3902cecd1dd..83a1660ccc6eb15fe091727b6bd991f3f45d6da2 100644 (file)
@@ -63,6 +63,5 @@ SPAWNFUNC_WEAPON(weapon_minstanex, WEP_VAPORIZER)
 .float vaporizer_lasthit;
 .float jump_interval;
 .float jump_interval2;
-.bool held_down;
 .int rm_laser_count;
 #endif