]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/weapons/weapon/hlac.qc
Weapons: require explicit `Weapons_from` call
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / weapons / weapon / hlac.qc
index 9c4d8b2a66e86923de98617f0d3d6280941bd732..3f52224897196c305fd57c956f8586b575d7f692 100644 (file)
@@ -103,7 +103,7 @@ void W_HLAC_Attack(Weapon thiswep)
        //missile.angles = vectoangles(missile.velocity); // csqc
 
        missile.touch = W_HLAC_Touch;
-       missile.think = SUB_Remove;
+       missile.think = SUB_Remove_self;
 
     missile.nextthink = time + WEP_CVAR_PRI(hlac, lifetime);
 
@@ -145,7 +145,7 @@ void W_HLAC_Attack2()
        //missile.angles = vectoangles(missile.velocity); // csqc
 
        missile.touch = W_HLAC_Touch;
-       missile.think = SUB_Remove;
+       missile.think = SUB_Remove_self;
 
     missile.nextthink = time + WEP_CVAR_SEC(hlac, lifetime);
 
@@ -169,11 +169,10 @@ void W_HLAC_Attack_Frame(Weapon thiswep, entity actor, .entity weaponentity, int
 
        if(actor.BUTTON_ATCK)
        {
-               Weapon w = get_weaponinfo(actor.weapon);
-               if(!w.wr_checkammo1(w))
+               if(!thiswep.wr_checkammo1(thiswep))
                if(!(actor.items & IT_UNLIMITED_WEAPON_AMMO))
                {
-                       W_SwitchWeapon_Force(actor, w_getbestweapon(actor));
+                       W_SwitchWeapon_Force(actor, Weapons_from(w_getbestweapon(actor)));
                        w_ready(thiswep, actor, weaponentity, fire);
                        return;
                }
@@ -213,8 +212,7 @@ void W_HLAC_Attack2_Frame(Weapon thiswep)
                METHOD(HLAC, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire))
                {
                        if(autocvar_g_balance_hlac_reload_ammo && actor.clip_load < min(WEP_CVAR_PRI(hlac, ammo), WEP_CVAR_SEC(hlac, ammo))) { // forced reload
-                               Weapon w = get_weaponinfo(actor.weapon);
-                               w.wr_reload(w);
+                               thiswep.wr_reload(thiswep);
                        } else if(fire & 1)
                        {
                                if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(hlac, refire)))