set g_buffs_random_location_attempts 10 "number of random locations a single buff will attempt to respawn at before giving up"
set g_buffs_spawn_count 0 "how many buffs to spawn on the map if none exist already"
set g_buffs_replace_powerups 0 "replace powerups on the map with random buffs"
+set g_buffs_replace_available 1 "if a buff type is disabled replace it with another buff type, with this option disabled the buff will be deleted instead"
set g_buffs_drop 0 "allow dropping buffs"
set g_buffs_cooldown_activate 5 "cooldown period when buff is first activated"
set g_buffs_cooldown_respawn 3 "cooldown period when buff is reloading"
entity buff = this.buffdef;
- if(!buff || !buff_Available(buff))
+ // item_buff_random provides a null type so force randomization in that case
+ // otherwise replace the buff type if it's unavailable and the option is enabled
+ if(!buff || (autocvar_g_buffs_replace_available && !buff_Available(buff)))
+ {
buff_NewType(this);
+ buff = this.buffdef;
+ }
+
+ // the buff type is still invalid or unavailable, simply delete the item
+ if(!buff || !buff_Available(buff))
+ {
+ delete(this);
+ return;
+ }
this.classname = "item_buff";
this.solid = SOLID_TRIGGER;
int autocvar_g_buffs_random_location_attempts;
int autocvar_g_buffs_spawn_count;
bool autocvar_g_buffs_replace_powerups;
+bool autocvar_g_buffs_replace_available = true;
bool autocvar_g_buffs_drop = false;
float autocvar_g_buffs_cooldown_activate;
float autocvar_g_buffs_cooldown_respawn;