set g_random_items_replace_weapon_rifle "random" "Classnames to replace rifle with."
set g_random_items_replace_weapon_seeker "random" "Classnames to replace TAG seeker with."
set g_random_items_replace_weapon_vaporizer "random" "Classnames to replace vaporizer with."
+set g_random_items_replace_weapon_hmg "random" "Classnames to replace HMG with."
+set g_random_items_replace_weapon_rpc "random" "Classnames to replace RPC with."
set g_random_items_replace_item_strength "random" "Classnames to replace strength with."
set g_random_items_replace_item_shield "random" "Classnames to replace shield with."
set g_random_items_replace_item_fuel_regen "random" "Classnames to replace fuel regeneration with."
set g_random_items_armor_probability 1 "Probability of random armor items spawning in the map."
set g_random_items_resource_probability 1 "Probability of random ammo items spawning in the map."
set g_random_items_weapon_probability 1 "Probability of random weapons spawning in the map."
-set g_random_items_powerup_probability 0.175 "Probability of random powerups spawning in the map."
+set g_random_items_powerup_probability 0.15 "Probability of random powerups spawning in the map."
set g_random_items_health_small_probability 10 "Probability of random small health spawning in the map."
set g_random_items_health_medium_probability 4 "Probability of random medium health spawning in the map."
set g_random_items_health_big_probability 2 "Probability of random big health spawning in the map."
set g_random_items_invisibility_probability 1 "Probability of random invisibility spawning in the map."
set g_random_items_extralife_probability 1 "Probability of random extra life spawning in the map."
set g_random_items_speed_probability 1 "Probability of random speed spawning in the map."
+set g_random_items_overkill_health_mega_probability 1 "Probability of random mega health spawning in the map during overkill."
+set g_random_items_overkill_armor_small_probability 10 "Probability of random small armor spawning in the map during overkill."
+set g_random_items_overkill_armor_medium_probability 4 "Probability of random medium armor spawning in the map during overkill."
+set g_random_items_overkill_armor_big_probability 2 "Probability of random big armor spawning in the map during overkill."
+set g_random_items_overkill_armor_mega_probability 1 "Probability of random mega armor spawning in the map during overkill."
+set g_random_items_overkill_weapon_hmg_probability 0.5 "Probability of random HMG spawning in the map during overkill."
+set g_random_items_overkill_weapon_rpc_probability 0.5 "Probability of random RPC spawning in the map during overkill."
set g_random_loot 0 "Whether to enable random loot."
set g_random_loot_min 0 "Minimum amount of loot items."
set g_random_loot_max 4 "Minimum amount of loot items."
set g_random_loot_invisibility_probability 1 "Probability of random invisibility spawning as loot."
set g_random_loot_extralife_probability 1 "Probability of random extra life spawning as loot."
set g_random_loot_speed_probability 1 "Probability of random speed spawning as loot."
+set g_random_loot_overkill_health_mega_probability 1 "Probability of random mega health spawning as loot during overkill."
+set g_random_loot_overkill_armor_small_probability 10 "Probability of random small armor spawning as loot during overkill."
+set g_random_loot_overkill_armor_medium_probability 4 "Probability of random medium armor spawning as loot during overkill."
+set g_random_loot_overkill_armor_big_probability 2 "Probability of random big armor spawning as loot during overkill."
+set g_random_loot_overkill_armor_mega_probability 1 "Probability of random mega armor spawning as loot during overkill."
+set g_random_loot_overkill_weapon_hmg_probability 1 "Probability of random HMG spawning as loot during overkill."
+set g_random_loot_overkill_weapon_rpc_probability 1 "Probability of random RPC spawning as loot during overkill."
RANDOM_ITEM_SUBTYPE_INSTAGIB_SPEED
};
+enum
+{
+ RANDOM_ITEM_SUBTYPE_OVERKILL_HEALTH_MEGA,
+ RANDOM_ITEM_SUBTYPE_OVERKILL_ARMOR_SMALL,
+ RANDOM_ITEM_SUBTYPE_OVERKILL_ARMOR_MEDIUM,
+ RANDOM_ITEM_SUBTYPE_OVERKILL_ARMOR_BIG,
+ RANDOM_ITEM_SUBTYPE_OVERKILL_ARMOR_MEGA,
+ RANDOM_ITEM_SUBTYPE_OVERKILL_WEAPON_HMG,
+ RANDOM_ITEM_SUBTYPE_OVERKILL_WEAPON_RPC
+};
+
//======================= Global variables ====================================
bool autocvar_g_random_items; ///< Whether to enable random items.
string autocvar_g_random_items_replace_weapon_seeker;
/// \brief Classnames to replace vaporizer with.
string autocvar_g_random_items_replace_weapon_vaporizer;
+/// \brief Classnames to replace HMG with.
+string autocvar_g_random_items_replace_weapon_hmg;
+/// \brief Classnames to replace RPC with.
+string autocvar_g_random_items_replace_weapon_rpc;
/// \brief Classnames to replace strength with.
string autocvar_g_random_items_replace_item_strength;
/// \brief Probability of random speed spawning in the map.
float autocvar_g_random_items_speed_probability;
+/// \brief Probability of random mega health spawning in the map during overkill.
+float autocvar_g_random_items_overkill_health_mega_probability;
+/// \brief Probability of random small armor spawning in the map during
+/// overkill.
+float autocvar_g_random_items_overkill_armor_small_probability;
+/// \brief Probability of random medium armor spawning in the map during
+/// overkill.
+float autocvar_g_random_items_overkill_armor_medium_probability;
+/// \brief Probability of random big armor spawning in the map during overkill.
+float autocvar_g_random_items_overkill_armor_big_probability;
+/// \brief Probability of random mega armor spawning in the map during overkill.
+float autocvar_g_random_items_overkill_armor_mega_probability;
+/// \brief Probability of random HMG spawning in the map during overkill.
+float autocvar_g_random_items_overkill_weapon_hmg_probability;
+/// \brief Probability of random RPC spawning in the map during overkill.
+float autocvar_g_random_items_overkill_weapon_rpc_probability;
+
// Loot
bool autocvar_g_random_loot; ///< Whether to enable random loot.
/// \brief Probability of random speed spawning as loot.
float autocvar_g_random_loot_speed_probability;
+/// \brief Probability of random mega health spawning as loot during overkill.
+float autocvar_g_random_loot_overkill_health_mega_probability;
+/// \brief Probability of random small armor spawning as loot during overkill.
+float autocvar_g_random_loot_overkill_armor_small_probability;
+/// \brief Probability of random medium armor spawning as loot during overkill.
+float autocvar_g_random_loot_overkill_armor_medium_probability;
+/// \brief Probability of random big armor spawning as loot during overkill.
+float autocvar_g_random_loot_overkill_armor_big_probability;
+/// \brief Probability of random mega armor spawning as loot during overkill.
+float autocvar_g_random_loot_overkill_armor_mega_probability;
+/// \brief Probability of random HMG spawning as loot during overkill.
+float autocvar_g_random_loot_overkill_weapon_hmg_probability;
+/// \brief Probability of random RPC spawning as loot during overkill.
+float autocvar_g_random_loot_overkill_weapon_rpc_probability;
+
+
/// \brief Holds whether random item is spawning. Used to prevent infinite
/// recursion.
bool random_items_is_spawning = false;
{
return autocvar_g_random_items_replace_weapon_vaporizer;
}
+ case "weapon_hmg":
+ {
+ return autocvar_g_random_items_replace_weapon_hmg;
+ }
+ case "weapon_rpc":
+ {
+ return autocvar_g_random_items_replace_weapon_rpc;
+ }
case "item_strength":
{
return autocvar_g_random_items_replace_item_strength;
}
}
-/// \brief Returns a random instagib classname of the map item.
-/// \return Random instagib classname of the map item.
+/// \brief Returns a random classname of the instagib map item.
+/// \return Random classname of the instagib map item.
string RandomItems_GetRandomInstagibMapItemClassName()
{
RandomSelection_Init();
return "";
}
+/// \brief Returns a random classname of the overkill map item.
+/// \return Random classname of the overkill map item.
+string RandomItems_GetRandomOverkillMapItemClassName()
+{
+ RandomSelection_Init();
+ if (!autocvar_g_overkill_filter_healthmega)
+ {
+ RandomSelection_AddFloat(RANDOM_ITEM_SUBTYPE_OVERKILL_HEALTH_MEGA,
+ autocvar_g_random_items_overkill_health_mega_probability, 1);
+ }
+ RandomSelection_AddFloat(RANDOM_ITEM_SUBTYPE_OVERKILL_ARMOR_SMALL,
+ autocvar_g_random_items_overkill_armor_small_probability, 1);
+ if (!autocvar_g_overkill_filter_armormedium)
+ {
+ RandomSelection_AddFloat(RANDOM_ITEM_SUBTYPE_OVERKILL_ARMOR_MEDIUM,
+ autocvar_g_random_items_overkill_armor_medium_probability, 1);
+ }
+ if (!autocvar_g_overkill_filter_armorbig)
+ {
+ RandomSelection_AddFloat(RANDOM_ITEM_SUBTYPE_OVERKILL_ARMOR_BIG,
+ autocvar_g_random_items_overkill_armor_big_probability, 1);
+ }
+ if (!autocvar_g_overkill_filter_armormega)
+ {
+ RandomSelection_AddFloat(RANDOM_ITEM_SUBTYPE_OVERKILL_ARMOR_MEGA,
+ autocvar_g_random_items_overkill_armor_mega_probability, 1);
+ }
+ RandomSelection_AddFloat(RANDOM_ITEM_SUBTYPE_OVERKILL_WEAPON_HMG,
+ autocvar_g_random_items_overkill_weapon_hmg_probability, 1);
+ RandomSelection_AddFloat(RANDOM_ITEM_SUBTYPE_OVERKILL_WEAPON_RPC,
+ autocvar_g_random_items_overkill_weapon_rpc_probability, 1);
+ int item_type = RandomSelection_chosen_float;
+ switch (item_type)
+ {
+ case RANDOM_ITEM_SUBTYPE_OVERKILL_HEALTH_MEGA:
+ {
+ return "item_health_mega";
+ }
+ case RANDOM_ITEM_SUBTYPE_OVERKILL_ARMOR_SMALL:
+ {
+ return "item_armor_small";
+ }
+ case RANDOM_ITEM_SUBTYPE_OVERKILL_ARMOR_MEDIUM:
+ {
+ return "item_armor_medium";
+ }
+ case RANDOM_ITEM_SUBTYPE_OVERKILL_ARMOR_BIG:
+ {
+ return "item_armor_big";
+ }
+ case RANDOM_ITEM_SUBTYPE_OVERKILL_ARMOR_MEGA:
+ {
+ return "item_armor_mega";
+ }
+ case RANDOM_ITEM_SUBTYPE_OVERKILL_WEAPON_HMG:
+ {
+ return "weapon_hmg";
+ }
+ case RANDOM_ITEM_SUBTYPE_OVERKILL_WEAPON_RPC:
+ {
+ return "weapon_rpc";
+ }
+ }
+ return "";
+}
+
/// \brief Returns a random classname of the map item.
/// \return Random classname of the map item.
string RandomItems_GetRandomMapItemClassName()
{
return RandomItems_GetRandomInstagibMapItemClassName();
}
+ if (autocvar_g_overkill)
+ {
+ return RandomItems_GetRandomOverkillMapItemClassName();
+ }
RandomSelection_Init();
RandomSelection_AddFloat(RANDOM_ITEM_TYPE_HEALTH,
autocvar_g_random_items_health_probability, 1);
return NULL;
}
random_items_is_spawning = true;
- entity new_item = Item_Create(strzone(new_classname), item.origin);
+ entity new_item;
+ if (!autocvar_g_overkill)
+ {
+ new_item = Item_Create(strzone(new_classname), item.origin);
+ }
+ else
+ {
+ new_item = spawn();
+ new_item.classname = strzone(new_classname);
+ new_item.spawnfunc_checked = true;
+ new_item.ok_item = true;
+ Item_Initialize(new_item, new_classname);
+ if (wasfreed(new_item))
+ {
+ return NULL;
+ }
+ setorigin(new_item, item.origin);
+ }
random_items_is_spawning = false;
return new_item;
}
-/// \brief Returns a random instagib classname of the loot item.
-/// \return Random instagib classname of the loot item.
+/// \brief Returns a random classname of the instagib loot item.
+/// \return Random classname of the instagib loot item.
string RandomItems_GetRandomInstagibLootItemClassName()
{
RandomSelection_Init();
return "";
}
+/// \brief Returns a random classname of the overkill loot item.
+/// \return Random classname of the overkill loot item.
+string RandomItems_GetRandomOverkillLootItemClassName()
+{
+ RandomSelection_Init();
+ if (!autocvar_g_overkill_filter_healthmega)
+ {
+ RandomSelection_AddFloat(RANDOM_ITEM_SUBTYPE_OVERKILL_HEALTH_MEGA,
+ autocvar_g_random_loot_overkill_health_mega_probability, 1);
+ }
+ RandomSelection_AddFloat(RANDOM_ITEM_SUBTYPE_OVERKILL_ARMOR_SMALL,
+ autocvar_g_random_loot_overkill_armor_small_probability, 1);
+ if (!autocvar_g_overkill_filter_armormedium)
+ {
+ RandomSelection_AddFloat(RANDOM_ITEM_SUBTYPE_OVERKILL_ARMOR_MEDIUM,
+ autocvar_g_random_loot_overkill_armor_medium_probability, 1);
+ }
+ if (!autocvar_g_overkill_filter_armorbig)
+ {
+ RandomSelection_AddFloat(RANDOM_ITEM_SUBTYPE_OVERKILL_ARMOR_BIG,
+ autocvar_g_random_loot_overkill_armor_big_probability, 1);
+ }
+ if (!autocvar_g_overkill_filter_armormega)
+ {
+ RandomSelection_AddFloat(RANDOM_ITEM_SUBTYPE_OVERKILL_ARMOR_MEGA,
+ autocvar_g_random_loot_overkill_armor_mega_probability, 1);
+ }
+ RandomSelection_AddFloat(RANDOM_ITEM_SUBTYPE_OVERKILL_WEAPON_HMG,
+ autocvar_g_random_loot_overkill_weapon_hmg_probability, 1);
+ RandomSelection_AddFloat(RANDOM_ITEM_SUBTYPE_OVERKILL_WEAPON_RPC,
+ autocvar_g_random_loot_overkill_weapon_rpc_probability, 1);
+ int item_type = RandomSelection_chosen_float;
+ switch (item_type)
+ {
+ case RANDOM_ITEM_SUBTYPE_OVERKILL_HEALTH_MEGA:
+ {
+ return "item_health_mega";
+ }
+ case RANDOM_ITEM_SUBTYPE_OVERKILL_ARMOR_SMALL:
+ {
+ return "item_armor_small";
+ }
+ case RANDOM_ITEM_SUBTYPE_OVERKILL_ARMOR_MEDIUM:
+ {
+ return "item_armor_medium";
+ }
+ case RANDOM_ITEM_SUBTYPE_OVERKILL_ARMOR_BIG:
+ {
+ return "item_armor_big";
+ }
+ case RANDOM_ITEM_SUBTYPE_OVERKILL_ARMOR_MEGA:
+ {
+ return "item_armor_mega";
+ }
+ case RANDOM_ITEM_SUBTYPE_OVERKILL_WEAPON_HMG:
+ {
+ return "weapon_hmg";
+ }
+ case RANDOM_ITEM_SUBTYPE_OVERKILL_WEAPON_RPC:
+ {
+ return "weapon_rpc";
+ }
+ }
+ return "";
+}
/// \brief Returns a random classname of the loot item.
/// \return Random classname of the loot item.
{
return RandomItems_GetRandomInstagibLootItemClassName();
}
+ if (autocvar_g_overkill)
+ {
+ return RandomItems_GetRandomOverkillLootItemClassName();
+ }
RandomSelection_Init();
RandomSelection_AddFloat(RANDOM_ITEM_TYPE_HEALTH,
autocvar_g_random_loot_health_probability, 1);
spread.z = autocvar_g_random_loot_spread / 2;
spread += randomvec() * autocvar_g_random_loot_spread;
random_items_is_spawning = true;
- Item_CreateLoot(class_name, position, spread, autocvar_g_random_loot_time);
+ if (!autocvar_g_overkill)
+ {
+ Item_CreateLoot(class_name, position, spread,
+ autocvar_g_random_loot_time);
+ }
+ else
+ {
+ entity item = spawn();
+ item.ok_item = true;
+ item.classname = class_name;
+ Item_InitializeLoot(item, class_name, position, spread,
+ autocvar_g_random_loot_time);
+ }
random_items_is_spawning = false;
}