Xonotic
|
Source file that contains implementation of the random items mutator. More...
#include "sv_random_items.qh"
Go to the source code of this file.
Functions | |
MUTATOR_HOOKFUNCTION (random_items, BuildMutatorsString) | |
MUTATOR_HOOKFUNCTION (random_items, BuildMutatorsPrettyString) | |
MUTATOR_HOOKFUNCTION (random_items, FilterItem, CBC_ORDER_LAST) | |
Hook that is called when an item is about to spawn. More... | |
MUTATOR_HOOKFUNCTION (random_items, ItemTouched, CBC_ORDER_LAST) | |
Hook that is called after the player has touched an item. More... | |
MUTATOR_HOOKFUNCTION (random_items, PlayerDies) | |
Hook which is called when the player dies. More... | |
string | RandomItems_GetItemReplacementClassNames (entity item) |
Returns list of classnames to replace a map item with. More... | |
string | RandomItems_GetRandomItemClassName (string prefix) |
Returns a random classname of the item. More... | |
string | RandomItems_GetRandomItemClassNameWithProperty (string prefix,.bool item_property) |
Returns a random classname of the item with specific property. More... | |
string | RandomItems_GetRandomVanillaItemClassName (string prefix, int types) |
Returns a random classname of the vanilla item. More... | |
entity | RandomItems_ReplaceMapItem (entity item) |
Replaces a map item. More... | |
void | RandomItems_SpawnLootItem (vector position) |
Spawns a random loot item. More... | |
Variables | |
float | autocvar_g_random_loot_max |
Maximum amount of loot items. More... | |
float | autocvar_g_random_loot_min |
Classnames to replace s with. More... | |
float | autocvar_g_random_loot_spread |
How far can loot be thrown. More... | |
float | autocvar_g_random_loot_time |
Amount of time the loot will stay. More... | |
bool | random_items_is_spawning = false |
Probability of random s spawning as loot. More... | |
Source file that contains implementation of the random items mutator.
Definition in file sv_random_items.qc.
MUTATOR_HOOKFUNCTION | ( | random_items | , |
BuildMutatorsString | |||
) |
Definition at line 334 of file sv_random_items.qc.
References M_ARGV, and strcat().
MUTATOR_HOOKFUNCTION | ( | random_items | , |
BuildMutatorsPrettyString | |||
) |
Definition at line 339 of file sv_random_items.qc.
References M_ARGV, and strcat().
MUTATOR_HOOKFUNCTION | ( | random_items | , |
FilterItem | , | ||
CBC_ORDER_LAST | |||
) |
Hook that is called when an item is about to spawn.
Definition at line 345 of file sv_random_items.qc.
References autocvar_g_random_items, entity(), Item_IsLoot(), M_ARGV, NULL, random_items_is_spawning, and RandomItems_ReplaceMapItem().
MUTATOR_HOOKFUNCTION | ( | random_items | , |
ItemTouched | , | ||
CBC_ORDER_LAST | |||
) |
Hook that is called after the player has touched an item.
Definition at line 369 of file sv_random_items.qc.
References autocvar_g_random_items, entity(), Item_IsLoot(), Item_ScheduleRespawn(), M_ARGV, NULL, and RandomItems_ReplaceMapItem().
MUTATOR_HOOKFUNCTION | ( | random_items | , |
PlayerDies | |||
) |
Hook which is called when the player dies.
Definition at line 391 of file sv_random_items.qc.
References autocvar_g_random_loot, autocvar_g_random_loot_max, autocvar_g_random_loot_min, entity(), floor(), M_ARGV, random(), RandomItems_SpawnLootItem(), and vector().
Returns list of classnames to replace a map item with.
[in] | item | Item to inspect. |
Definition at line 200 of file sv_random_items.qc.
References cvar_string(), CVAR_TYPEFLAG_EXISTS, and LOG_WARNF.
Referenced by RandomItems_ReplaceMapItem().
Returns a random classname of the item.
[in] | prefix | Prefix of the cvars that hold probabilities. |
Definition at line 54 of file sv_random_items.qc.
References M_ARGV, MUTATOR_CALLHOOK, RANDOM_ITEM_TYPE_ALL, RandomItems_GetRandomItemClassName(), and RandomItems_GetRandomVanillaItemClassName().
Referenced by RandomItems_GetRandomItemClassName(), RandomItems_ReplaceMapItem(), and RandomItems_SpawnLootItem().
Returns a random classname of the item with specific property.
[in] | prefix | Prefix of the cvars that hold probabilities. |
Definition at line 211 of file sv_random_items.qc.
References cvar(), CVAR_TYPEFLAG_EXISTS, FOREACH, ITEM_FLAG_NORMAL, Item_IsDefinitionAllowed(), LOG_WARNF, RandomSelection_AddString, RandomSelection_chosen_string, and RandomSelection_Init().
Referenced by RandomItems_GetRandomVanillaItemClassName().
Returns a random classname of the vanilla item.
[in] | prefix | Prefix of the cvars that hold probabilities. |
[in] | types | Bitmask of the types. See RANDOM_ITEM_TYPE constants. |
Definition at line 64 of file sv_random_items.qc.
References cvar(), CVAR_TYPEFLAG_EXISTS, FOREACH, LOG_WARNF, RANDOM_ITEM_TYPE_ARMOR, RANDOM_ITEM_TYPE_HEALTH, RANDOM_ITEM_TYPE_POWERUP, RANDOM_ITEM_TYPE_RESOURCE, RANDOM_ITEM_TYPE_WEAPON, RandomItems_GetRandomItemClassNameWithProperty(), RandomSelection_AddFloat, RandomSelection_AddString, RandomSelection_chosen_float, RandomSelection_chosen_string, RandomSelection_Init(), and WEP_FLAG_MUTATORBLOCKED.
Referenced by RandomItems_GetRandomItemClassName().
Replaces a map item.
[in] | item | Item to replace. |
Definition at line 233 of file sv_random_items.qc.
References argv(), entity(), floor(), Item_Create(), Item_Initialize(), Item_ShouldKeepPosition(), MUTATOR_IS_ENABLED, NULL, random(), random_items_is_spawning, RandomItems_GetItemReplacementClassNames(), RandomItems_GetRandomItemClassName(), setorigin(), spawn(), strzone(), and tokenize_console.
Referenced by MUTATOR_HOOKFUNCTION().
Spawns a random loot item.
[in] | position | Position of the item. |
Definition at line 305 of file sv_random_items.qc.
References autocvar_g_random_loot_spread, autocvar_g_random_loot_time, entity(), Item_CreateLoot(), Item_InitializeLoot(), MUTATOR_IS_ENABLED, random_items_is_spawning, RandomItems_GetRandomItemClassName(), randomvec(), spawn(), and vector().
Referenced by MUTATOR_HOOKFUNCTION().
float autocvar_g_random_loot_max |
Maximum amount of loot items.
Definition at line 28 of file sv_random_items.qc.
Referenced by MUTATOR_HOOKFUNCTION().
float autocvar_g_random_loot_min |
Classnames to replace s with.
string autocvar_g_random_items_replace_s; Probability of random s spawning in the map. float autocvar_g_random_items_s_probability; Probability of random s spawning in the map during overkill. float autocvar_g_random_items_overkill_s_probability; Minimum amount of loot items.
Definition at line 27 of file sv_random_items.qc.
Referenced by MUTATOR_HOOKFUNCTION().
float autocvar_g_random_loot_spread |
How far can loot be thrown.
Definition at line 30 of file sv_random_items.qc.
Referenced by RandomItems_SpawnLootItem().
float autocvar_g_random_loot_time |
Amount of time the loot will stay.
Definition at line 29 of file sv_random_items.qc.
Referenced by RandomItems_SpawnLootItem().
Probability of random s spawning as loot.
float autocvar_g_random_loot_s_probability; Probability of random s spawning as loot during overkill. float autocvar_g_random_loot_overkill_s_probability; Holds whether random item is spawning. Used to prevent infinite recursion.
Definition at line 42 of file sv_random_items.qc.
Referenced by MUTATOR_HOOKFUNCTION(), RandomItems_ReplaceMapItem(), and RandomItems_SpawnLootItem().