Xonotic
sv_pinata.qc
Go to the documentation of this file.
1 #include "sv_pinata.qh"
2 
6 
7 MUTATOR_HOOKFUNCTION(pinata, PlayerDies)
8 {
9  entity frag_target = M_ARGV(2, entity);
10 
11  for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot)
12  {
13  .entity weaponentity = weaponentities[slot];
14 
15  if(frag_target.(weaponentity).m_weapon == WEP_Null)
16  continue;
17 
18  if(slot > 0 && !autocvar_g_pinata_offhand)
19  break;
20 
21  FOREACH(Weapons, it != WEP_Null, {
22  if(STAT(WEAPONS, frag_target) & WepSet_FromWeapon(it))
23  if(frag_target.(weaponentity).m_weapon != it)
24  if(W_IsWeaponThrowable(frag_target, it.m_id))
25  W_ThrowNewWeapon(frag_target, it.m_id, false, CENTER_OR_VIEWOFS(frag_target), randomvec() * 175 + '0 0 325', weaponentity);
26  });
27  }
28 
29  return true;
30 }
31 
32 MUTATOR_HOOKFUNCTION(pinata, BuildMutatorsString)
33 {
34  M_ARGV(0, string) = strcat(M_ARGV(0, string), ":Pinata");
35 }
36 
37 MUTATOR_HOOKFUNCTION(pinata, BuildMutatorsPrettyString)
38 {
39  M_ARGV(0, string) = strcat(M_ARGV(0, string), ", PiƱata");
40 }
entity() spawn
REGISTER_MUTATOR(pinata, expr_evaluate(autocvar_g_pinata) &&!MUTATOR_IS_ENABLED(mutator_instagib) &&!MUTATOR_IS_ENABLED(ok))
#define MUTATOR_IS_ENABLED(this)
Definition: base.qh:176
spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 f1 s1 strcat(_("Level %s: "), "^BG%s\3\, _("^BGPress ^F2%s^BG to enter the game"))
const int MAX_WEAPONSLOTS
Definition: weapon.qh:13
float W_ThrowNewWeapon(entity own, float wpn, float doreduce, vector org, vector velo,.entity weaponentity)
Definition: throwing.qc:40
string autocvar_g_pinata
Definition: sv_pinata.qc:3
#define M_ARGV(x, type)
Definition: events.qh:17
#define CENTER_OR_VIEWOFS(ent)
Definition: utils.qh:28
bool autocvar_g_pinata_offhand
Definition: sv_pinata.qc:4
bool W_IsWeaponThrowable(entity this, int w)
Definition: throwing.qc:138
entity weaponentities[MAX_WEAPONSLOTS]
Definition: weapon.qh:14
#define WepSet_FromWeapon(it)
Definition: all.qh:38
#define FOREACH(list, cond, body)
Definition: iter.qh:19
MUTATOR_HOOKFUNCTION(pinata, PlayerDies)
Definition: sv_pinata.qc:7
ERASEABLE bool expr_evaluate(string s)
Evaluate an expression of the form: [+ | -]? [var[op]val | [op]var | val | var] ...
Definition: cvar.qh:48