]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Fixed random items check in new toys. 559/head
authorLyberta <lyberta@lyberta.net>
Wed, 6 Jun 2018 02:00:11 +0000 (05:00 +0300)
committerLyberta <lyberta@lyberta.net>
Wed, 6 Jun 2018 02:00:11 +0000 (05:00 +0300)
qcsrc/common/mutators/mutator/new_toys/sv_new_toys.qc
qcsrc/common/mutators/mutator/random_items/sv_random_items.qc
qcsrc/common/mutators/mutator/random_items/sv_random_items.qh

index 1c38588ace59e62fe7ff24c47d4c7bf90d3f8c2b..540edc69d9c6578c7ef4277a9f35b1a2f37cfb4b 100644 (file)
@@ -195,7 +195,7 @@ MUTATOR_HOOKFUNCTION(nt, SetStartItems)
 
 MUTATOR_HOOKFUNCTION(nt, SetWeaponreplace)
 {
-       if (autocvar_g_random_items)
+       if (MUTATOR_IS_ENABLED(random_items))
        {
                // Do not replace weapons when random items are enabled.
                return;
index 2829e3ae2b8a70534134eefaeb6738f47123df4a..251e57b8749cad4a70dbfe747daa8303d08bf3aa 100644 (file)
@@ -24,8 +24,6 @@
 
 // Loot
 
-bool autocvar_g_random_loot; ///< Whether to enable random loot.
-
 float autocvar_g_random_loot_min; ///< Minimum amount of loot items.
 float autocvar_g_random_loot_max; ///< Maximum amount of loot items.
 float autocvar_g_random_loot_time; ///< Amount of time the loot will stay.
@@ -392,9 +390,6 @@ void RandomItems_SpawnLootItem(vector position)
 
 //============================= Hooks ========================================
 
-REGISTER_MUTATOR(random_items, (autocvar_g_random_items ||
-       autocvar_g_random_loot));
-
 MUTATOR_HOOKFUNCTION(random_items, BuildMutatorsString)
 {
        M_ARGV(0, string) = strcat(M_ARGV(0, string), ":random_items");
index 9ac738ca68ede11020c348c1a681d0b65a0eb7ca..d49e3effa83fed685b08f5144fad4d8cfb19f6d0 100644 (file)
@@ -6,6 +6,7 @@
 /// \copyright GNU GPLv2 or any later version.
 
 bool autocvar_g_random_items; ///< Whether to enable random items.
+bool autocvar_g_random_loot; ///< Whether to enable random loot.
 
 enum
 {
@@ -41,3 +42,6 @@ string RandomItems_GetRandomInstagibItemClassName(string prefix);
 /// \param[in] prefix Prefix of the cvars that hold probabilities.
 /// \return Random classname of the overkill item.
 string RandomItems_GetRandomOverkillItemClassName(string prefix);
+
+REGISTER_MUTATOR(random_items, (autocvar_g_random_items ||
+       autocvar_g_random_loot));