Xonotic
sv_melee_only.qc
Go to the documentation of this file.
1 #include "sv_melee_only.qh"
2 
3 #include "../overkill/sv_overkill.qh"
4 
7 
8 MUTATOR_HOOKFUNCTION(melee_only, SetStartItems, CBC_ORDER_LAST)
9 {
12 }
13 
14 MUTATOR_HOOKFUNCTION(melee_only, SetWeaponArena)
15 {
16  // turn weapon arena off
17  M_ARGV(0, string) = "off";
18 }
19 
20 MUTATOR_HOOKFUNCTION(melee_only, ForbidRandomStartWeapons)
21 {
22  return true;
23 }
24 
25 MUTATOR_HOOKFUNCTION(melee_only, ForbidThrowCurrentWeapon)
26 {
27  return true;
28 }
29 
30 MUTATOR_HOOKFUNCTION(melee_only, FilterItemDefinition)
31 {
32  entity definition = M_ARGV(0, entity);
33 
34  switch (definition)
35  {
36  case ITEM_HealthSmall:
37  case ITEM_ArmorSmall:
38  return false;
39  }
40 
41  return true;
42 }
43 
44 MUTATOR_HOOKFUNCTION(melee_only, BuildMutatorsString)
45 {
46  M_ARGV(0, string) = strcat(M_ARGV(0, string), ":MeleeOnly");
47 }
48 
49 MUTATOR_HOOKFUNCTION(melee_only, BuildMutatorsPrettyString)
50 {
51  M_ARGV(0, string) = strcat(M_ARGV(0, string), ", Melee Only Arena");
52 }
#define WEPSET(id)
Definition: all.qh:37
float warmup_start_ammo_shells
Definition: world.qh:104
WepSet warmup_start_weapons
Definition: world.qh:100
WepSet start_weapons
Definition: world.qh:81
entity() spawn
Gametype MapInfo_LoadedGametype
Definition: mapinfo.qh:193
float start_ammo_shells
Definition: world.qh:85
REGISTER_MUTATOR(melee_only, expr_evaluate(autocvar_g_melee_only) &&!MUTATOR_IS_ENABLED(mutator_instagib) &&!MUTATOR_IS_ENABLED(ok) &&!MapInfo_LoadedGametype.m_weaponarena)
#define MUTATOR_IS_ENABLED(this)
Definition: base.qh:176
const int CBC_ORDER_LAST
Definition: base.qh:8
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
bool m_weaponarena
does this gametype enforce its own weapon arena?
Definition: mapinfo.qh:46
string autocvar_g_melee_only
Definition: sv_melee_only.qc:5
MUTATOR_HOOKFUNCTION(melee_only, SetStartItems, CBC_ORDER_LAST)
Definition: sv_melee_only.qc:8
ERASEABLE bool expr_evaluate(string s)
Evaluate an expression of the form: [+ | -]? [var[op]val | [op]var | val | var] ...
Definition: cvar.qh:48