]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/common/mutators/mutator/pinata/sv_pinata.qc
Add a networked entity to hold weapon state
[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         .entity weaponentity = weaponentities[0]; // TODO: unhardcode
10
11         FOREACH(Weapons, it != WEP_Null, LAMBDA(
12                 if(frag_target.weapons & WepSet_FromWeapon(it))
13                 if(frag_target.(weaponentity).m_switchweapon != it)
14                 if(W_IsWeaponThrowable(frag_target, it.m_id))
15                         W_ThrowNewWeapon(frag_target, it.m_id, false, CENTER_OR_VIEWOFS(frag_target), randomvec() * 175 + '0 0 325', weaponentity);
16         ));
17
18         return true;
19 }
20
21 MUTATOR_HOOKFUNCTION(pinata, BuildMutatorsString)
22 {
23         M_ARGV(0, string) = strcat(M_ARGV(0, string), ":Pinata");
24 }
25
26 MUTATOR_HOOKFUNCTION(pinata, BuildMutatorsPrettyString)
27 {
28         M_ARGV(0, string) = strcat(M_ARGV(0, string), ", PiƱata");
29 }