From b15e24d69cddd1c4d22e029f4f92386eb9288cad Mon Sep 17 00:00:00 2001 From: z411 Date: Wed, 24 Nov 2021 14:21:07 -0300 Subject: [PATCH] powerups_dropondeath: Make time to live configurable --- qcsrc/common/mutators/mutator/powerups/sv_powerups.qc | 2 +- qcsrc/common/mutators/mutator/powerups/sv_powerups.qh | 1 + qcsrc/server/world.qc | 1 + xonotic-server.cfg | 3 ++- 4 files changed, 5 insertions(+), 2 deletions(-) diff --git a/qcsrc/common/mutators/mutator/powerups/sv_powerups.qc b/qcsrc/common/mutators/mutator/powerups/sv_powerups.qc index a4b24af13..7bf005f91 100644 --- a/qcsrc/common/mutators/mutator/powerups/sv_powerups.qc +++ b/qcsrc/common/mutators/mutator/powerups/sv_powerups.qc @@ -94,7 +94,7 @@ void powerups_DropItem(entity this, StatusEffects effect) // If the timer is frozen, the item will stay on the floor for 20 secs (same as weapons), // otherwise it'll disappear after the timer runs out. - float time_to_live = (autocvar_g_powerups_dropondeath == 2 ? 20 : timeleft); + float time_to_live = (autocvar_g_powerups_dropondeath == 2 ? autocvar_g_powerups_dropondeath_ttl : timeleft); // TODO: items cannot hold their "item field" yet, so we need to list all the powerups here! switch(item) diff --git a/qcsrc/common/mutators/mutator/powerups/sv_powerups.qh b/qcsrc/common/mutators/mutator/powerups/sv_powerups.qh index c9e7282b5..eab884e57 100644 --- a/qcsrc/common/mutators/mutator/powerups/sv_powerups.qh +++ b/qcsrc/common/mutators/mutator/powerups/sv_powerups.qh @@ -6,6 +6,7 @@ int autocvar_g_powerups; int autocvar_g_powerups_dropondeath; +int autocvar_g_powerups_dropondeath_ttl; bool autocvar_g_powerups_stack; REGISTER_MUTATOR(powerups, true); diff --git a/qcsrc/server/world.qc b/qcsrc/server/world.qc index ee8bdbdde..043c5d8d2 100644 --- a/qcsrc/server/world.qc +++ b/qcsrc/server/world.qc @@ -462,6 +462,7 @@ void cvar_changes_init() BADCVAR("g_pinata"); BADCVAR("g_powerups"); BADCVAR("g_powerups_dropondeath"); + BADCVAR("g_powerups_dropondeath_ttl"); BADCVAR("g_player_brightness"); BADCVAR("g_rocket_flying"); BADCVAR("g_rocket_flying_disabledelays"); diff --git a/xonotic-server.cfg b/xonotic-server.cfg index 54e9c8be1..250086222 100644 --- a/xonotic-server.cfg +++ b/xonotic-server.cfg @@ -198,7 +198,8 @@ set g_shootfromfixedorigin "" "if set to a string like 0 y z, the gun is moved t 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_dropondeath 0 "whether or not held powerups should be droppd when the player dies (1 = timer keeps running, 2 = timer freezes until picked up)" +set g_powerups_dropondeath 0 "players will drop their powerups on death (1 = timer continues, 2 = timer freezes until picked up)" +set g_powerups_dropondeath_ttl 20 "seconds before a dropped powerup disappears if dropondeath is set to 2" 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" -- 2.39.2