]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/mutators/mutator/pinata/sv_pinata.qc
Merge branch 'master' into martin-t/damagetext
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / mutators / mutator / pinata / sv_pinata.qc
index 387c1c359fd1c563a66651a7f7c609efcedfa05c..ff44cc8bd0a89facf0ab00abd49f4c861488f498 100644 (file)
@@ -6,14 +6,20 @@ MUTATOR_HOOKFUNCTION(pinata, PlayerDies)
 {
        entity frag_target = M_ARGV(2, entity);
 
-       .entity weaponentity = weaponentities[0]; // TODO: unhardcode
-
-       FOREACH(Weapons, it != WEP_Null, LAMBDA(
-               if(frag_target.weapons & WepSet_FromWeapon(it))
-               if(frag_target.(weaponentity).m_switchweapon != it)
-               if(W_IsWeaponThrowable(frag_target, it.m_id))
-                       W_ThrowNewWeapon(frag_target, it.m_id, false, CENTER_OR_VIEWOFS(frag_target), randomvec() * 175 + '0 0 325', weaponentity);
-       ));
+       for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot)
+       {
+               .entity weaponentity = weaponentities[slot];
+
+               if(frag_target.(weaponentity).m_weapon == WEP_Null)
+                       continue;
+
+               FOREACH(Weapons, it != WEP_Null, LAMBDA(
+                       if(frag_target.weapons & WepSet_FromWeapon(it))
+                       if(frag_target.(weaponentity).m_weapon != it)
+                       if(W_IsWeaponThrowable(frag_target, it.m_id))
+                               W_ThrowNewWeapon(frag_target, it.m_id, false, CENTER_OR_VIEWOFS(frag_target), randomvec() * 175 + '0 0 325', weaponentity);
+               ));
+       }
 
        return true;
 }