X-Git-Url: http://de.git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fcommon%2Fmutators%2Fmutator%2Frandom_items%2Fsv_random_items.qh;h=c94375ceaeeb98d7648179ed6845bfff251dacd1;hb=45d8904a100765555e622598a39967963733df1d;hp=c9b4dbb9011ca91cd905d0c7221e3f089f4745b0;hpb=b945d959784e5b249c66aea4f3326d8ae048f1cd;p=xonotic%2Fxonotic-data.pk3dir.git 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 c9b4dbb90..c94375cea 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,17 @@ /// \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 +{ + RANDOM_ITEM_TYPE_HEALTH = BIT(0), + RANDOM_ITEM_TYPE_ARMOR = BIT(1), + RANDOM_ITEM_TYPE_RESOURCE = BIT(2), + RANDOM_ITEM_TYPE_WEAPON = BIT(3), + RANDOM_ITEM_TYPE_POWERUP = BIT(4), + RANDOM_ITEM_TYPE_ALL = BITS(5) +}; /// \brief Returns a random classname of the item. /// \param[in] prefix Prefix of the cvars that hold probabilities. @@ -16,17 +27,19 @@ string RandomItems_GetRandomItemClassName(string prefix); /// \brief Returns a random classname of the vanilla item. /// \param[in] prefix Prefix of the cvars that hold probabilities. +/// \param[in] types Bitmask of the types. See RANDOM_ITEM_TYPE constants. /// \return Random classname of the vanilla item. /// \note This includes mutator items that don't change gameplay a lot such as /// jetpack and new toys. -string RandomItems_GetRandomVanillaItemClassName(string prefix); +string RandomItems_GetRandomVanillaItemClassName(string prefix, int types); -/// \brief Returns a random classname of the instagib item. -/// \param[in] prefix Prefix of the cvars that hold probabilities. -/// \return Random classname of the instagib item. -string RandomItems_GetRandomInstagibItemClassName(string prefix); +/// \brief Called when random item classname is requested. +#define EV_RandomItems_GetRandomItemClassName(i, o) \ + /** prefix */ i(string, MUTATOR_ARGV_0_string) \ + /** classname */ o(string, MUTATOR_ARGV_1_string) \ + /**/ +MUTATOR_HOOKABLE(RandomItems_GetRandomItemClassName, + EV_RandomItems_GetRandomItemClassName); -/// \brief Returns a random classname of the overkill item. -/// \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));