]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/mutators/mutator/melee_only/sv_melee_only.qc
Merge branch 'master' into Lyberta/StandaloneOverkillWeapons
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / mutators / mutator / melee_only / sv_melee_only.qc
index f418395590ed0bae36e0953d64ae48cb709bc739..5603dd4901c0601cc8940320acbc1f87b6ab1f3e 100644 (file)
@@ -1,26 +1,38 @@
 #include "sv_melee_only.qh"
 
-REGISTER_MUTATOR(melee_only, cvar("g_melee_only") && !cvar("g_instagib") && !cvar("g_overkill") && !g_nexball);
+string autocvar_g_melee_only;
+REGISTER_MUTATOR(melee_only, expr_evaluate(autocvar_g_melee_only) && !cvar("g_instagib") && !cvar("g_overkill") && !g_nexball);
 
-MUTATOR_HOOKFUNCTION(melee_only, SetStartItems)
+MUTATOR_HOOKFUNCTION(melee_only, SetStartItems, CBC_ORDER_LAST)
 {
        start_ammo_shells = warmup_start_ammo_shells = 0;
        start_weapons = warmup_start_weapons = WEPSET(SHOTGUN);
 }
 
+MUTATOR_HOOKFUNCTION(melee_only, SetWeaponArena)
+{
+       // turn weapon arena off
+       M_ARGV(0, string) = "off";
+}
+
+MUTATOR_HOOKFUNCTION(melee_only, ForbidRandomStartWeapons)
+{
+       return true;
+}
+
 MUTATOR_HOOKFUNCTION(melee_only, ForbidThrowCurrentWeapon)
 {
        return true;
 }
 
-MUTATOR_HOOKFUNCTION(melee_only, FilterItem)
+MUTATOR_HOOKFUNCTION(melee_only, FilterItemDefinition)
 {
-       entity item = M_ARGV(0, entity);
+       entity definition = M_ARGV(0, entity);
 
-       switch (item.items)
+       switch (definition)
        {
-               case ITEM_HealthSmall.m_itemid:
-               case ITEM_ArmorSmall.m_itemid:
+               case ITEM_HealthSmall:
+               case ITEM_ArmorSmall:
                        return false;
        }