4 /// \brief Header file that describes the random items mutator.
6 /// \copyright GNU GPLv2 or any later version.
8 bool autocvar_g_random_items; ///< Whether to enable random items.
9 bool autocvar_g_random_loot; ///< Whether to enable random loot.
13 RANDOM_ITEM_TYPE_HEALTH = BIT(0),
14 RANDOM_ITEM_TYPE_ARMOR = BIT(1),
15 RANDOM_ITEM_TYPE_RESOURCE = BIT(2),
16 RANDOM_ITEM_TYPE_WEAPON = BIT(3),
17 RANDOM_ITEM_TYPE_POWERUP = BIT(4),
18 RANDOM_ITEM_TYPE_ALL = BITS(5)
21 /// \brief Returns a random classname of the item.
22 /// \param[in] prefix Prefix of the cvars that hold probabilities.
23 /// \return Random classname of the item.
24 /// \note This function will automatically detect gamemode and use cvars from
26 string RandomItems_GetRandomItemClassName(string prefix);
28 /// \brief Returns a random classname of the vanilla item.
29 /// \param[in] prefix Prefix of the cvars that hold probabilities.
30 /// \param[in] types Bitmask of the types. See RANDOM_ITEM_TYPE constants.
31 /// \return Random classname of the vanilla item.
32 /// \note This includes mutator items that don't change gameplay a lot such as
33 /// jetpack and new toys.
34 string RandomItems_GetRandomVanillaItemClassName(string prefix, int types);
36 /// \brief Called when random item classname is requested.
37 #define EV_RandomItems_GetRandomItemClassName(i, o) \
38 /** prefix */ i(string, MUTATOR_ARGV_0_string) \
39 /** classname */ o(string, MUTATOR_ARGV_1_string) \
41 MUTATOR_HOOKABLE(RandomItems_GetRandomItemClassName,
42 EV_RandomItems_GetRandomItemClassName);
44 REGISTER_MUTATOR(random_items, (autocvar_g_random_items ||
45 autocvar_g_random_loot));