Xonotic
sv_pinata.qc File Reference
#include "sv_pinata.qh"
+ Include dependency graph for sv_pinata.qc:

Go to the source code of this file.

Functions

 MUTATOR_HOOKFUNCTION (pinata, PlayerDies)
 
 MUTATOR_HOOKFUNCTION (pinata, BuildMutatorsString)
 
 MUTATOR_HOOKFUNCTION (pinata, BuildMutatorsPrettyString)
 
 REGISTER_MUTATOR (pinata, expr_evaluate(autocvar_g_pinata) &&!MUTATOR_IS_ENABLED(mutator_instagib) &&!MUTATOR_IS_ENABLED(ok))
 

Variables

string autocvar_g_pinata
 
bool autocvar_g_pinata_offhand
 

Function Documentation

◆ MUTATOR_HOOKFUNCTION() [1/3]

MUTATOR_HOOKFUNCTION ( pinata  ,
PlayerDies   
)

Definition at line 7 of file sv_pinata.qc.

References autocvar_g_pinata_offhand, CENTER_OR_VIEWOFS, entity(), FOREACH, M_ARGV, MAX_WEAPONSLOTS, randomvec(), W_IsWeaponThrowable(), W_ThrowNewWeapon(), weaponentities, and WepSet_FromWeapon.

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 }
entity() spawn
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
#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
+ Here is the call graph for this function:

◆ MUTATOR_HOOKFUNCTION() [2/3]

MUTATOR_HOOKFUNCTION ( pinata  ,
BuildMutatorsString   
)

Definition at line 32 of file sv_pinata.qc.

References M_ARGV, and strcat().

33 {
34  M_ARGV(0, string) = strcat(M_ARGV(0, string), ":Pinata");
35 }
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"))
#define M_ARGV(x, type)
Definition: events.qh:17
+ Here is the call graph for this function:

◆ MUTATOR_HOOKFUNCTION() [3/3]

MUTATOR_HOOKFUNCTION ( pinata  ,
BuildMutatorsPrettyString   
)

Definition at line 37 of file sv_pinata.qc.

References M_ARGV, and strcat().

38 {
39  M_ARGV(0, string) = strcat(M_ARGV(0, string), ", PiƱata");
40 }
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"))
#define M_ARGV(x, type)
Definition: events.qh:17
+ Here is the call graph for this function:

◆ REGISTER_MUTATOR()

REGISTER_MUTATOR ( pinata  ,
expr_evaluate(autocvar_g_pinata) &&!MUTATOR_IS_ENABLED(mutator_instagib) &&!MUTATOR_IS_ENABLED(ok)   
)

Variable Documentation

◆ autocvar_g_pinata

string autocvar_g_pinata

Definition at line 3 of file sv_pinata.qc.

◆ autocvar_g_pinata_offhand

bool autocvar_g_pinata_offhand

Definition at line 4 of file sv_pinata.qc.

Referenced by MUTATOR_HOOKFUNCTION().