]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Loopify pinata
authorMario <mario@smbclan.net>
Wed, 23 Dec 2015 23:46:34 +0000 (09:46 +1000)
committerMario <mario@smbclan.net>
Wed, 23 Dec 2015 23:46:34 +0000 (09:46 +1000)
qcsrc/common/mutators/mutator/pinata/pinata.qc

index d5cbb7fdaeb75b5833aba3266cde6810b2ec6293..d9b7666c63301d3bebf8f24b759b4a3f544a819d 100644 (file)
@@ -3,11 +3,12 @@ REGISTER_MUTATOR(pinata, cvar("g_pinata") && !cvar("g_instagib") && !cvar("g_ove
 
 MUTATOR_HOOKFUNCTION(pinata, PlayerDies)
 {SELFPARAM();
-       for(int j = WEP_FIRST; j <= WEP_LAST; ++j)
-       if(self.weapons & WepSet_FromWeapon(Weapons_from(j)))
-       if(PS(self).m_switchweapon.m_id != j)
-       if(W_IsWeaponThrowable(j))
-               W_ThrowNewWeapon(self, j, false, self.origin + (self.mins + self.maxs) * 0.5, randomvec() * 175 + '0 0 325');
+       FOREACH(Weapons, it != WEP_Null, LAMBDA(
+               if(self.weapons & WepSet_FromWeapon(it))
+               if(PS(self).m_switchweapon != it)
+               if(W_IsWeaponThrowable(it.m_id))
+                       W_ThrowNewWeapon(self, it.m_id, false, CENTER_OR_VIEWOFS(self), randomvec() * 175 + '0 0 325');
+       ));
 
        return true;
 }