From: bones_was_here Date: Mon, 13 Mar 2023 15:17:06 +0000 (+1000) Subject: Fix mapinfo settemp of individual powerup cvars X-Git-Tag: xonotic-v0.8.6~150 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=b95beb262077d8f733bbee7cb0d5f4c05b7b3e2f;p=xonotic%2Fxonotic-data.pk3dir.git Fix mapinfo settemp of individual powerup cvars The cvars were read before the settemps were applied. When StartItem() calls .m_iteminit() the settemps have been applied. --- diff --git a/qcsrc/common/mutators/mutator/powerups/powerup/invisibility.qh b/qcsrc/common/mutators/mutator/powerups/powerup/invisibility.qh index d920aab9f..53264eeb2 100644 --- a/qcsrc/common/mutators/mutator/powerups/powerup/invisibility.qh +++ b/qcsrc/common/mutators/mutator/powerups/powerup/invisibility.qh @@ -21,6 +21,11 @@ float autocvar_g_balance_powerup_invisibility_alpha = 0.15; float autocvar_g_balance_powerup_invisibility_time = 30; void powerup_invisibility_init(Pickup this, entity item) { + if(autocvar_g_powerups_invisibility) + this.spawnflags = ITEM_FLAG_NORMAL; + else + this.spawnflags = ITEM_FLAG_MUTATORBLOCKED; + if(!item.invisibility_finished) item.invisibility_finished = (item.count) ? item.count : autocvar_g_balance_powerup_invisibility_time; } @@ -28,11 +33,6 @@ void powerup_invisibility_init(Pickup this, entity item) REGISTER_ITEM(Invisibility, Powerup) { this.m_canonical_spawnfunc = "item_invisibility"; #ifdef SVQC - if(autocvar_g_powerups_invisibility) - this.spawnflags = ITEM_FLAG_NORMAL; - else - this.spawnflags = ITEM_FLAG_MUTATORBLOCKED; - this.m_iteminit = powerup_invisibility_init; #endif #ifdef GAMEQC diff --git a/qcsrc/common/mutators/mutator/powerups/powerup/shield.qh b/qcsrc/common/mutators/mutator/powerups/powerup/shield.qh index 508a39487..d665fb894 100644 --- a/qcsrc/common/mutators/mutator/powerups/powerup/shield.qh +++ b/qcsrc/common/mutators/mutator/powerups/powerup/shield.qh @@ -20,6 +20,11 @@ float autocvar_g_balance_powerup_invincible_takeforce = 0.33; float autocvar_g_balance_powerup_invincible_time; void powerup_shield_init(Pickup this, entity item) { + if(autocvar_g_powerups_shield) + this.spawnflags = ITEM_FLAG_NORMAL; + else + this.spawnflags = ITEM_FLAG_MUTATORBLOCKED; + if(!item.invincible_finished) item.invincible_finished = (item.count) ? item.count : autocvar_g_balance_powerup_invincible_time; } @@ -27,11 +32,6 @@ void powerup_shield_init(Pickup this, entity item) REGISTER_ITEM(Shield, Powerup) { this.m_canonical_spawnfunc = "item_shield"; #ifdef SVQC - if(autocvar_g_powerups_shield) - this.spawnflags = ITEM_FLAG_NORMAL; - else - this.spawnflags = ITEM_FLAG_MUTATORBLOCKED; - this.m_iteminit = powerup_shield_init; #endif #ifdef GAMEQC diff --git a/qcsrc/common/mutators/mutator/powerups/powerup/speed.qh b/qcsrc/common/mutators/mutator/powerups/powerup/speed.qh index 5b71df808..4bda28e35 100644 --- a/qcsrc/common/mutators/mutator/powerups/powerup/speed.qh +++ b/qcsrc/common/mutators/mutator/powerups/powerup/speed.qh @@ -22,6 +22,11 @@ float autocvar_g_balance_powerup_speed_highspeed = 1.5; float autocvar_g_balance_powerup_speed_time = 30; void powerup_speed_init(Pickup this, entity item) { + if(autocvar_g_powerups_speed) + this.spawnflags = ITEM_FLAG_NORMAL; + else + this.spawnflags = ITEM_FLAG_MUTATORBLOCKED; + if(!item.speed_finished) item.speed_finished = (item.count) ? item.count : autocvar_g_balance_powerup_speed_time; } @@ -29,11 +34,6 @@ void powerup_speed_init(Pickup this, entity item) REGISTER_ITEM(Speed, Powerup) { this.m_canonical_spawnfunc = "item_speed"; #ifdef SVQC - if(autocvar_g_powerups_speed) - this.spawnflags = ITEM_FLAG_NORMAL; - else - this.spawnflags = ITEM_FLAG_MUTATORBLOCKED; - this.m_iteminit = powerup_speed_init; #endif #ifdef GAMEQC diff --git a/qcsrc/common/mutators/mutator/powerups/powerup/strength.qh b/qcsrc/common/mutators/mutator/powerups/powerup/strength.qh index 9392a6a2d..aea3bcf2f 100644 --- a/qcsrc/common/mutators/mutator/powerups/powerup/strength.qh +++ b/qcsrc/common/mutators/mutator/powerups/powerup/strength.qh @@ -22,6 +22,11 @@ float autocvar_g_balance_powerup_strength_selfforce; float autocvar_g_balance_powerup_strength_time; void powerup_strength_init(Pickup this, entity item) { + if(autocvar_g_powerups_strength) + this.spawnflags = ITEM_FLAG_NORMAL; + else + this.spawnflags = ITEM_FLAG_MUTATORBLOCKED; + if(!item.strength_finished) item.strength_finished = (item.count) ? item.count : autocvar_g_balance_powerup_strength_time; } @@ -29,11 +34,6 @@ void powerup_strength_init(Pickup this, entity item) REGISTER_ITEM(Strength, Powerup) { this.m_canonical_spawnfunc = "item_strength"; #ifdef SVQC - if(autocvar_g_powerups_strength) - this.spawnflags = ITEM_FLAG_NORMAL; - else - this.spawnflags = ITEM_FLAG_MUTATORBLOCKED; - this.m_iteminit = powerup_strength_init; #endif #ifdef GAMEQC