]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/common/mutators/mutator/pinata/sv_pinata.qc
ff942db310e4fbf434c725343e091cdab24b39f9
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / mutators / mutator / pinata / sv_pinata.qc
1 #include "sv_pinata.qh"
2
3 REGISTER_MUTATOR(pinata, cvar("g_pinata") && !cvar("g_instagib") && !cvar("g_overkill"));
4
5 MUTATOR_HOOKFUNCTION(pinata, PlayerDies)
6 {
7         entity frag_target = M_ARGV(2, entity);
8
9         for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot)
10         {
11                 .entity weaponentity = weaponentities[slot];
12
13                 if(frag_target.(weaponentity).m_weapon == WEP_Null && slot != 0)
14                         continue;
15
16                 FOREACH(Weapons, it != WEP_Null, LAMBDA(
17                         if(frag_target.weapons & WepSet_FromWeapon(it))
18                         if(frag_target.(weaponentity).m_switchweapon != it)
19                         if(W_IsWeaponThrowable(frag_target, it.m_id))
20                                 W_ThrowNewWeapon(frag_target, it.m_id, false, CENTER_OR_VIEWOFS(frag_target), randomvec() * 175 + '0 0 325', weaponentity);
21                 ));
22         }
23
24         return true;
25 }
26
27 MUTATOR_HOOKFUNCTION(pinata, BuildMutatorsString)
28 {
29         M_ARGV(0, string) = strcat(M_ARGV(0, string), ":Pinata");
30 }
31
32 MUTATOR_HOOKFUNCTION(pinata, BuildMutatorsPrettyString)
33 {
34         M_ARGV(0, string) = strcat(M_ARGV(0, string), ", PiƱata");
35 }