From: Lyberta <lyberta@lyberta.net>
Date: Sun, 10 Jun 2018 07:47:41 +0000 (+0300)
Subject: Added Overkill weapons mutator.
X-Git-Tag: xonotic-v0.8.5~2085^2
X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=refs%2Fmerge-requests%2F561%2Fhead;p=xonotic%2Fxonotic-data.pk3dir.git

Added Overkill weapons mutator.
---

diff --git a/mutators.cfg b/mutators.cfg
index c997a807f..a4c8144fc 100644
--- a/mutators.cfg
+++ b/mutators.cfg
@@ -55,6 +55,7 @@ set g_instagib_friendlypush 1 "allow pushing teammates with the vaporizer primar
 //  overkill
 // ==========
 set g_overkill 0 "internal cvar, to enable overkill, use  `exec ruleset-overkill.cfg`"
+set g_overkill_weapons 0 "Whether to enable overkill weapons outside of overkill ruleset."
 
 set g_overkill_powerups_replace 1
 set g_overkill_itemwaypoints 1
diff --git a/qcsrc/common/mutators/mutator/overkill/_mod.inc b/qcsrc/common/mutators/mutator/overkill/_mod.inc
index 57fb6c246..017cc2082 100644
--- a/qcsrc/common/mutators/mutator/overkill/_mod.inc
+++ b/qcsrc/common/mutators/mutator/overkill/_mod.inc
@@ -10,3 +10,6 @@
 #include <common/mutators/mutator/overkill/oknex.qc>
 #include <common/mutators/mutator/overkill/okrpc.qc>
 #include <common/mutators/mutator/overkill/okshotgun.qc>
+#ifdef SVQC
+    #include <common/mutators/mutator/overkill/sv_weapons.qc>
+#endif
diff --git a/qcsrc/common/mutators/mutator/overkill/sv_overkill.qc b/qcsrc/common/mutators/mutator/overkill/sv_overkill.qc
index b6ff5e14d..9fa66e8b2 100644
--- a/qcsrc/common/mutators/mutator/overkill/sv_overkill.qc
+++ b/qcsrc/common/mutators/mutator/overkill/sv_overkill.qc
@@ -1,5 +1,9 @@
 #include "sv_overkill.qh"
 
+#include "okshotgun.qh"
+#include "okhmg.qh"
+#include "okrpc.qh"
+
 bool autocvar_g_overkill_powerups_replace;
 
 bool autocvar_g_overkill_itemwaypoints = true;
diff --git a/qcsrc/common/mutators/mutator/overkill/sv_overkill.qh b/qcsrc/common/mutators/mutator/overkill/sv_overkill.qh
index 4949edb1e..79e5dd3c5 100644
--- a/qcsrc/common/mutators/mutator/overkill/sv_overkill.qh
+++ b/qcsrc/common/mutators/mutator/overkill/sv_overkill.qh
@@ -1,10 +1,5 @@
 #pragma once
 
-#include "okshotgun.qh"
-#include "okmachinegun.qh"
-#include "okhmg.qh"
-#include "okrpc.qh"
-
 string autocvar_g_overkill;
 bool autocvar_g_overkill_filter_healthmega;
 bool autocvar_g_overkill_filter_armormedium;
@@ -35,13 +30,6 @@ REGISTER_MUTATOR(ok, expr_evaluate(autocvar_g_overkill) && !MUTATOR_IS_ENABLED(m
 		{
 			ITEM_ArmorMega.spawnflags |= ITEM_FLAG_MUTATORBLOCKED;
 		}
-
-		WEP_OVERKILL_RPC.spawnflags &= ~WEP_FLAG_MUTATORBLOCKED;
-		WEP_OVERKILL_HMG.spawnflags &= ~WEP_FLAG_MUTATORBLOCKED;
-
-		WEP_OVERKILL_SHOTGUN.spawnflags &= ~WEP_FLAG_MUTATORBLOCKED;
-		WEP_OVERKILL_MACHINEGUN.spawnflags &= ~WEP_FLAG_MUTATORBLOCKED;
-		WEP_OVERKILL_NEX.spawnflags &= ~WEP_FLAG_MUTATORBLOCKED;
 	}
 
 	MUTATOR_ONREMOVE
@@ -50,12 +38,5 @@ REGISTER_MUTATOR(ok, expr_evaluate(autocvar_g_overkill) && !MUTATOR_IS_ENABLED(m
 		ITEM_ArmorMedium.spawnflags &= ~ITEM_FLAG_MUTATORBLOCKED;
 		ITEM_ArmorBig.spawnflags &= ~ITEM_FLAG_MUTATORBLOCKED;
 		ITEM_ArmorMega.spawnflags &= ~ITEM_FLAG_MUTATORBLOCKED;
-
-		WEP_OVERKILL_RPC.spawnflags |= WEP_FLAG_MUTATORBLOCKED;
-		WEP_OVERKILL_HMG.spawnflags |= WEP_FLAG_MUTATORBLOCKED;
-
-		WEP_OVERKILL_SHOTGUN.spawnflags |= WEP_FLAG_MUTATORBLOCKED;
-		WEP_OVERKILL_MACHINEGUN.spawnflags |= WEP_FLAG_MUTATORBLOCKED;
-		WEP_OVERKILL_NEX.spawnflags |= WEP_FLAG_MUTATORBLOCKED;
 	}
 }
diff --git a/qcsrc/common/mutators/mutator/overkill/sv_weapons.qc b/qcsrc/common/mutators/mutator/overkill/sv_weapons.qc
new file mode 100644
index 000000000..4a131e3f0
--- /dev/null
+++ b/qcsrc/common/mutators/mutator/overkill/sv_weapons.qc
@@ -0,0 +1,22 @@
+string autocvar_g_overkill_weapons;
+
+REGISTER_MUTATOR(ok_weapons, expr_evaluate(autocvar_g_overkill_weapons) || MUTATOR_IS_ENABLED(ok))
+{
+	MUTATOR_ONADD
+	{
+		WEP_OVERKILL_SHOTGUN.spawnflags &= ~WEP_FLAG_MUTATORBLOCKED;
+		WEP_OVERKILL_MACHINEGUN.spawnflags &= ~WEP_FLAG_MUTATORBLOCKED;
+		WEP_OVERKILL_NEX.spawnflags &= ~WEP_FLAG_MUTATORBLOCKED;
+		WEP_OVERKILL_HMG.spawnflags &= ~WEP_FLAG_MUTATORBLOCKED;
+		WEP_OVERKILL_RPC.spawnflags &= ~WEP_FLAG_MUTATORBLOCKED;
+	}
+
+	MUTATOR_ONREMOVE
+	{
+		WEP_OVERKILL_SHOTGUN.spawnflags |= WEP_FLAG_MUTATORBLOCKED;
+		WEP_OVERKILL_MACHINEGUN.spawnflags |= WEP_FLAG_MUTATORBLOCKED;
+		WEP_OVERKILL_NEX.spawnflags |= WEP_FLAG_MUTATORBLOCKED;
+		WEP_OVERKILL_HMG.spawnflags |= WEP_FLAG_MUTATORBLOCKED;
+		WEP_OVERKILL_RPC.spawnflags |= WEP_FLAG_MUTATORBLOCKED;
+	}
+}
diff --git a/randomitems-xonotic.cfg b/randomitems-xonotic.cfg
index bffa2b1ac..47611a9e2 100644
--- a/randomitems-xonotic.cfg
+++ b/randomitems-xonotic.cfg
@@ -91,6 +91,11 @@ set g_random_items_weapon_hlac_probability 0 "Probability of random HLAC spawnin
 set g_random_items_weapon_rifle_probability 0 "Probability of random rifle spawning in the map."
 set g_random_items_weapon_seeker_probability 0 "Probability of random TAG seeker spawning in the map."
 set g_random_items_weapon_vaporizer_probability 0 "Probability of random vaporizer spawning in the map."
+set g_random_items_weapon_okshotgun_probability 0 "Probability of random overkill shotgun spawning in the map."
+set g_random_items_weapon_okmachinegun_probability 0 "Probability of random overkill machinegun spawning in the map."
+set g_random_items_weapon_oknex_probability 0 "Probability of random overkill nex spawning in the map."
+set g_random_items_weapon_okhmg_probability 0 "Probability of random overkill HMG spawning in the map."
+set g_random_items_weapon_okrpc_probability 0 "Probability of random overkill RPC spawning in the map."
 set g_random_items_item_strength_probability 1 "Probability of random strength spawning in the map."
 set g_random_items_item_shield_probability 1 "Probability of random shield spawning in the map."
 set g_random_items_item_fuel_regen_probability 0 "Probability of random fuel regeneration spawning in the map."
@@ -148,6 +153,11 @@ set g_random_loot_weapon_hlac_probability 0 "Probability of random HLAC spawning
 set g_random_loot_weapon_rifle_probability 0 "Probability of random rifle spawning as loot."
 set g_random_loot_weapon_seeker_probability 0 "Probability of random TAG seeker spawning as loot."
 set g_random_loot_weapon_vaporizer_probability 0 "Probability of random vaporizer spawning as loot."
+set g_random_loot_weapon_okshotgun_probability 0 "Probability of random overkill shotgun spawning as loot."
+set g_random_loot_weapon_okmachinegun_probability 0 "Probability of random overkill machinegun spawning as loot."
+set g_random_loot_weapon_oknex_probability 0 "Probability of random overkill nex spawning as loot."
+set g_random_loot_weapon_okhmg_probability 0 "Probability of random overkill HMG spawning as loot."
+set g_random_loot_weapon_okrpc_probability 0 "Probability of random overkill RPC spawning as loot."
 set g_random_loot_item_strength_probability 1 "Probability of random strength spawning as loot."
 set g_random_loot_item_shield_probability 1 "Probability of random shield spawning as loot."
 set g_random_loot_item_fuel_regen_probability 0 "Probability of random fuel regeneration spawning as loot."