From: Lyberta Date: Wed, 6 Jun 2018 02:00:11 +0000 (+0300) Subject: Fixed random items check in new toys. X-Git-Tag: xonotic-v0.8.5~2108^2 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=5cf4ce46c7cbc6c2c9a1d22b3f095fdfc81d32ab;p=xonotic%2Fxonotic-data.pk3dir.git Fixed random items check in new toys. --- diff --git a/qcsrc/common/mutators/mutator/new_toys/sv_new_toys.qc b/qcsrc/common/mutators/mutator/new_toys/sv_new_toys.qc index 1c38588ac..540edc69d 100644 --- a/qcsrc/common/mutators/mutator/new_toys/sv_new_toys.qc +++ b/qcsrc/common/mutators/mutator/new_toys/sv_new_toys.qc @@ -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; diff --git a/qcsrc/common/mutators/mutator/random_items/sv_random_items.qc b/qcsrc/common/mutators/mutator/random_items/sv_random_items.qc index 2829e3ae2..251e57b87 100644 --- a/qcsrc/common/mutators/mutator/random_items/sv_random_items.qc +++ b/qcsrc/common/mutators/mutator/random_items/sv_random_items.qc @@ -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"); diff --git a/qcsrc/common/mutators/mutator/random_items/sv_random_items.qh b/qcsrc/common/mutators/mutator/random_items/sv_random_items.qh index 9ac738ca6..d49e3effa 100644 --- a/qcsrc/common/mutators/mutator/random_items/sv_random_items.qh +++ b/qcsrc/common/mutators/mutator/random_items/sv_random_items.qh @@ -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));