Merge branch 'master' into Mario/vaporizer_damage
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / mutators / mutator_melee_only.qc
1 #include "../_all.qh"
2
3 #include "mutator.qh"
4
5 MUTATOR_HOOKFUNCTION(melee_SetStartItems)
6 {
7         start_ammo_shells = warmup_start_ammo_shells = 0;
8         start_weapons = warmup_start_weapons = WEPSET_SHOTGUN;
9
10         return false;
11 }
12
13 MUTATOR_HOOKFUNCTION(melee_ForbidThrowing)
14 {
15         return true;
16 }
17
18 MUTATOR_HOOKFUNCTION(melee_FilterItem)
19 {
20         switch (self.items)
21         {
22                 case ITEM_HealthSmall.m_itemid:
23                 case ITEM_ArmorSmall.m_itemid:
24                         return false;
25         }
26
27         return true;
28 }
29
30 MUTATOR_HOOKFUNCTION(melee_BuildMutatorsString)
31 {
32         ret_string = strcat(ret_string, ":MeleeOnly");
33         return false;
34 }
35
36 MUTATOR_HOOKFUNCTION(melee_BuildMutatorsPrettyString)
37 {
38         ret_string = strcat(ret_string, ", Melee Only Arena");
39         return false;
40 }
41
42 MUTATOR_DEFINITION(mutator_melee_only)
43 {
44         MUTATOR_HOOK(SetStartItems, melee_SetStartItems, CBC_ORDER_ANY);
45         MUTATOR_HOOK(ForbidThrowCurrentWeapon, melee_ForbidThrowing, CBC_ORDER_ANY);
46         MUTATOR_HOOK(FilterItem, melee_FilterItem, CBC_ORDER_ANY);
47         MUTATOR_HOOK(BuildMutatorsString, melee_BuildMutatorsString, CBC_ORDER_ANY);
48         MUTATOR_HOOK(BuildMutatorsPrettyString, melee_BuildMutatorsPrettyString, CBC_ORDER_ANY);
49
50         return false;
51 }