From: Lyberta Date: Tue, 24 Oct 2017 21:27:32 +0000 (+0300) Subject: Disable new toys weapon replacement when random items are enabled. X-Git-Tag: xonotic-v0.8.5~2426^2~13 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=c05834ed15898e5a2cdc8b9bf490858401ce0290;p=xonotic%2Fxonotic-data.pk3dir.git Disable new toys weapon replacement when random items are enabled. --- 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 af364995a..ec2593215 100644 --- a/qcsrc/common/mutators/mutator/new_toys/sv_new_toys.qc +++ b/qcsrc/common/mutators/mutator/new_toys/sv_new_toys.qc @@ -1,5 +1,7 @@ #include "sv_new_toys.qh" +#include "../random_items/sv_random_items.qh" + /* CORE laser vortex lg rl cry gl elec hagar fireb hook @@ -193,6 +195,11 @@ MUTATOR_HOOKFUNCTION(nt, SetStartItems) MUTATOR_HOOKFUNCTION(nt, SetWeaponreplace) { + if (autocvar_g_random_items) + { + // Do not replace weapons when random items are enabled. + return; + } entity wep = M_ARGV(0, entity); entity wepinfo = M_ARGV(1, entity); string ret_string = M_ARGV(2, string); 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 b0c49d64d..3330bfedd 100644 --- a/qcsrc/common/mutators/mutator/random_items/sv_random_items.qc +++ b/qcsrc/common/mutators/mutator/random_items/sv_random_items.qc @@ -1,4 +1,5 @@ #include "sv_random_items.qh" + /// \file /// \brief Source file that contains implementation of the random items mutator. /// \author Lyberta @@ -17,8 +18,6 @@ enum //======================= Global variables ==================================== -bool autocvar_g_random_items; ///< Whether to enable random items. - // Replace cvars /// \brief Classnames to replace %s with. 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 6f70f09be..a0cc25baf 100644 --- a/qcsrc/common/mutators/mutator/random_items/sv_random_items.qh +++ b/qcsrc/common/mutators/mutator/random_items/sv_random_items.qh @@ -1 +1,3 @@ #pragma once + +bool autocvar_g_random_items; ///< Whether to enable random items.