Merge branch 'DefaultUser/m_itemid' into 'master'
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / mutators / mutator / melee_only / sv_melee_only.qc
1 #include "sv_melee_only.qh"
2
3 REGISTER_MUTATOR(melee_only, cvar("g_melee_only") && !cvar("g_instagib") && !cvar("g_overkill") && !g_nexball);
4
5 MUTATOR_HOOKFUNCTION(melee_only, SetStartItems, CBC_ORDER_LAST)
6 {
7         start_ammo_shells = warmup_start_ammo_shells = 0;
8         start_weapons = warmup_start_weapons = WEPSET(SHOTGUN);
9 }
10
11 MUTATOR_HOOKFUNCTION(melee_only, SetWeaponArena)
12 {
13         // turn weapon arena off
14         M_ARGV(0, string) = "off";
15 }
16
17 MUTATOR_HOOKFUNCTION(melee_only, ForbidThrowCurrentWeapon)
18 {
19         return true;
20 }
21
22 MUTATOR_HOOKFUNCTION(melee_only, FilterItem)
23 {
24         entity item = M_ARGV(0, entity);
25
26         switch (item.itemdef)
27         {
28                 case ITEM_HealthSmall:
29                 case ITEM_ArmorSmall:
30                         return false;
31         }
32
33         return true;
34 }
35
36 MUTATOR_HOOKFUNCTION(melee_only, BuildMutatorsString)
37 {
38         M_ARGV(0, string) = strcat(M_ARGV(0, string), ":MeleeOnly");
39 }
40
41 MUTATOR_HOOKFUNCTION(melee_only, BuildMutatorsPrettyString)
42 {
43         M_ARGV(0, string) = strcat(M_ARGV(0, string), ", Melee Only Arena");
44 }