From: Dr. Jaska Date: Tue, 23 May 2023 14:13:19 +0000 (+0000) Subject: Fix crylink and vaporizer being able to fire with empty magazines X-Git-Tag: xonotic-v0.8.6~84^2 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=bd30fb6eec40c60f86f04cb26705c0872e1a89a4;p=xonotic%2Fxonotic-data.pk3dir.git Fix crylink and vaporizer being able to fire with empty magazines --- diff --git a/qcsrc/common/weapons/weapon/crylink.qc b/qcsrc/common/weapons/weapon/crylink.qc index ae1eae284..61820528f 100644 --- a/qcsrc/common/weapons/weapon/crylink.qc +++ b/qcsrc/common/weapons/weapon/crylink.qc @@ -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))) diff --git a/qcsrc/common/weapons/weapon/vaporizer.qc b/qcsrc/common/weapons/weapon/vaporizer.qc index 71bc39a7c..4be54b6b2 100644 --- a/qcsrc/common/weapons/weapon/vaporizer.qc +++ b/qcsrc/common/weapons/weapon/vaporizer.qc @@ -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)) { diff --git a/qcsrc/common/weapons/weapon/vaporizer.qh b/qcsrc/common/weapons/weapon/vaporizer.qh index 87249f736..83a1660cc 100644 --- a/qcsrc/common/weapons/weapon/vaporizer.qh +++ b/qcsrc/common/weapons/weapon/vaporizer.qh @@ -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