if (item.strength_finished)
{
pickedup = true;
- StatusEffects_apply(STATUSEFFECT_Strength, player, max(StatusEffects_gettime(STATUSEFFECT_Strength, player), time) + item.strength_finished, 0);
+ float t = max(StatusEffects_gettime(STATUSEFFECT_Strength, player), time);
+ if (autocvar_g_powerups_stack)
+ t += item.strength_finished;
+ else
+ t = max(t, time + item.strength_finished);
+ StatusEffects_apply(STATUSEFFECT_Strength, player, t, 0);
}
if (item.invincible_finished)
{
pickedup = true;
- StatusEffects_apply(STATUSEFFECT_Shield, player, max(StatusEffects_gettime(STATUSEFFECT_Shield, player), time) + item.invincible_finished, 0);
+ float t = max(StatusEffects_gettime(STATUSEFFECT_Shield, player), time);
+ if (autocvar_g_powerups_stack)
+ t += item.invincible_finished;
+ else
+ t = max(t, time + item.invincible_finished);
+ StatusEffects_apply(STATUSEFFECT_Shield, player, t, 0);
}
if (item.speed_finished)
{
pickedup = true;
- StatusEffects_apply(STATUSEFFECT_Speed, player, max(StatusEffects_gettime(STATUSEFFECT_Speed, player), time) + item.speed_finished, 0);
+ float t = max(StatusEffects_gettime(STATUSEFFECT_Speed, player), time);
+ if (autocvar_g_powerups_stack)
+ t += item.speed_finished;
+ else
+ t = max(t, time + item.speed_finished);
+ StatusEffects_apply(STATUSEFFECT_Speed, player, t, 0);
}
if (item.invisibility_finished)
{
pickedup = true;
- StatusEffects_apply(STATUSEFFECT_Invisibility, player, max(StatusEffects_gettime(STATUSEFFECT_Invisibility, player), time) + item.invisibility_finished, 0);
+ float t = max(StatusEffects_gettime(STATUSEFFECT_Invisibility, player), time);
+ if (autocvar_g_powerups_stack)
+ t += item.invisibility_finished;
+ else
+ t = max(t, time + item.invisibility_finished);
+ StatusEffects_apply(STATUSEFFECT_Invisibility, player, t, 0);
}
if (item.superweapons_finished)
{
set g_weapon_stay 0 "1: ghost weapons can be picked up but give no ammo, thrown guns have ammo 2: ghost weapons can be picked up and refill ammo to one pickup size, thrown guns have no ammo (to prevent infinite ammo abuse)"
set g_weapon_throwable 1 "if set to 1, weapons can be dropped"
set g_powerups -1 "if set to 0 no powerups will spawn, if 1 they will spawn in all game modes, -1 is game mode default"
+set g_powerups_stack 0 "enables stacking of powerup timers when picking up a powerup you already have; otherwise timer is reset to the time granted by the item, if greater than the time you currently have"
set g_powerups_strength 1 "allow strength powerups to spawn"
set g_powerups_shield 1 "allow shield powerups to spawn"
set g_powerups_speed 1 "allow speed powerups to spawn"