]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/weapons/throwing.qc
Weapons: pass weaponentity field instead of slot
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / weapons / throwing.qc
index 900b45018db2b5b45edc0334c1c145f0874f3908..5ddecef59bf9606736ec95df31bd5cc99da33ca2 100644 (file)
@@ -34,7 +34,8 @@ string W_ThrowNewWeapon(entity own, float wpn, float doreduce, vector org, vecto
 {SELFPARAM();
        float thisammo, i;
        string s;
-       var .int ammotype = (get_weaponinfo(wpn)).ammo_field;
+       Weapon info = get_weaponinfo(wpn);
+       var .int ammotype = info.ammo_field;
 
        entity wep = spawn();
 
@@ -75,7 +76,7 @@ string W_ThrowNewWeapon(entity own, float wpn, float doreduce, vector org, vecto
                }
        }
 
-       WITH(entity, self, wep, weapon_defaultspawnfunc(wpn));
+       weapon_defaultspawnfunc(wep, info);
        if(startitem_failed)
                return string_null;
        wep.glowmod = own.weaponentity_glowmod;
@@ -171,8 +172,8 @@ void W_ThrowWeapon(vector velo, vector delta, float doreduce)
                return;
        if(!autocvar_g_weapon_throwable)
                return;
-       int slot = 0; // TODO: unhardcode
-       if(self.weaponentity[slot].state != WS_READY)
+       .entity weaponentity = weaponentities[0]; // TODO: unhardcode
+       if(self.(weaponentity).state != WS_READY)
                return;
        if(!W_IsWeaponThrowable(w))
                return;