]> 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 terencehill/welcome_dialog_translatable
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / mutators / mutator / melee_only / sv_melee_only.qc
index 5bd896ea279fc3178b1f5c3a7c1cdbda94441bbe..ec031730e5ee60e1b94e642bec059657f53644db 100644 (file)
@@ -1,6 +1,9 @@
 #include "sv_melee_only.qh"
 
-REGISTER_MUTATOR(melee_only, cvar("g_melee_only") && !cvar("g_instagib") && !cvar("g_overkill") && !g_nexball);
+#include "../overkill/sv_overkill.qh"
+
+string autocvar_g_melee_only;
+REGISTER_MUTATOR(melee_only, expr_evaluate(autocvar_g_melee_only) && !MUTATOR_IS_ENABLED(mutator_instagib) && !MUTATOR_IS_ENABLED(ok) && !MapInfo_LoadedGametype.m_weaponarena);
 
 MUTATOR_HOOKFUNCTION(melee_only, SetStartItems, CBC_ORDER_LAST)
 {
@@ -14,19 +17,24 @@ MUTATOR_HOOKFUNCTION(melee_only, SetWeaponArena)
        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;
        }
 
@@ -40,5 +48,5 @@ MUTATOR_HOOKFUNCTION(melee_only, BuildMutatorsString)
 
 MUTATOR_HOOKFUNCTION(melee_only, BuildMutatorsPrettyString)
 {
-       M_ARGV(0, string) = strcat(M_ARGV(0, string), ", Melee Only Arena");
+       M_ARGV(0, string) = strcat(M_ARGV(0, string), ", Melee only Arena");
 }