From: bones_was_here Date: Tue, 20 Jul 2021 00:06:18 +0000 (+1000) Subject: Add cvars to enable individual powerups X-Git-Tag: xonotic-v0.8.5~370^2~7 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=7c149ecca79a5c5b5eaacee96d39a8d9b0a413bf;p=xonotic%2Fxonotic-data.pk3dir.git Add cvars to enable individual powerups --- diff --git a/qcsrc/common/mutators/mutator/powerups/powerup/invisibility.qh b/qcsrc/common/mutators/mutator/powerups/powerup/invisibility.qh index d043e121f..294daaabe 100644 --- a/qcsrc/common/mutators/mutator/powerups/powerup/invisibility.qh +++ b/qcsrc/common/mutators/mutator/powerups/powerup/invisibility.qh @@ -16,6 +16,7 @@ SOUND(Invisibility, Item_Sound("powerup")); #ifdef SVQC .float invisibility_finished; +bool autocvar_g_powerups_invisibility; 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) @@ -26,8 +27,13 @@ void powerup_invisibility_init(Pickup this, entity item) #endif 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; +#endif #ifdef GAMEQC - this.spawnflags = ITEM_FLAG_NORMAL; // this.m_model = MDL_Invisibility_ITEM; // TODO: new model required this.m_model = MDL_BUFF; this.m_skin = 12; diff --git a/qcsrc/common/mutators/mutator/powerups/powerup/shield.qh b/qcsrc/common/mutators/mutator/powerups/powerup/shield.qh index 854c80276..4c273c0f2 100644 --- a/qcsrc/common/mutators/mutator/powerups/powerup/shield.qh +++ b/qcsrc/common/mutators/mutator/powerups/powerup/shield.qh @@ -14,6 +14,7 @@ SOUND(Shield, Item_Sound("powerup_shield")); #endif #ifdef SVQC +bool autocvar_g_powerups_shield; float autocvar_g_balance_powerup_invincible_takedamage; float autocvar_g_balance_powerup_invincible_takeforce = 0.33; float autocvar_g_balance_powerup_invincible_time; @@ -25,8 +26,13 @@ void powerup_shield_init(Pickup this, entity item) #endif 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; +#endif #ifdef GAMEQC - this.spawnflags = ITEM_FLAG_NORMAL; this.m_model = MDL_Shield_ITEM; this.m_sound = SND_Shield; this.m_glow = true; diff --git a/qcsrc/common/mutators/mutator/powerups/powerup/speed.qh b/qcsrc/common/mutators/mutator/powerups/powerup/speed.qh index f5970dac5..76f87ce57 100644 --- a/qcsrc/common/mutators/mutator/powerups/powerup/speed.qh +++ b/qcsrc/common/mutators/mutator/powerups/powerup/speed.qh @@ -16,6 +16,7 @@ SOUND(Speed, Item_Sound("powerup_shield")); #ifdef SVQC .float speed_finished; +bool autocvar_g_powerups_speed; float autocvar_g_balance_powerup_speed_attackrate = 0.8; float autocvar_g_balance_powerup_speed_highspeed = 1.5; float autocvar_g_balance_powerup_speed_time = 30; @@ -27,8 +28,13 @@ void powerup_speed_init(Pickup this, entity item) #endif 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; +#endif #ifdef GAMEQC - this.spawnflags = ITEM_FLAG_NORMAL; // this.m_model = MDL_Speed_ITEM; // TODO: new model required this.m_model = MDL_BUFF; this.m_skin = 9; diff --git a/qcsrc/common/mutators/mutator/powerups/powerup/strength.qh b/qcsrc/common/mutators/mutator/powerups/powerup/strength.qh index ce1914966..c594568f3 100644 --- a/qcsrc/common/mutators/mutator/powerups/powerup/strength.qh +++ b/qcsrc/common/mutators/mutator/powerups/powerup/strength.qh @@ -14,6 +14,7 @@ SOUND(Strength, Item_Sound("powerup")); #endif #ifdef SVQC +bool autocvar_g_powerups_strength; float autocvar_g_balance_powerup_strength_damage; float autocvar_g_balance_powerup_strength_force; float autocvar_g_balance_powerup_strength_selfdamage; @@ -27,8 +28,13 @@ void powerup_strength_init(Pickup this, entity item) #endif 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; +#endif #ifdef GAMEQC - this.spawnflags = ITEM_FLAG_NORMAL; this.m_model = MDL_Strength_ITEM; this.m_sound = SND_Strength; this.m_glow = true; diff --git a/xonotic-server.cfg b/xonotic-server.cfg index 09cb0e856..28d5101ed 100644 --- a/xonotic-server.cfg +++ b/xonotic-server.cfg @@ -197,7 +197,11 @@ set g_shootfromcenter 0 "weapon gets moved to the center, shots still come from set g_shootfromfixedorigin "" "if set to a string like 0 y z, the gun is moved to the given y and z coordinates. If set to a string like x y z, the whole shot origin is used" 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 the strength and shield (invincibility) will not spawn on the map, if 1 they will spawn in all game modes, -1 is game mode default" +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_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" +set g_powerups_invisibility 1 "allow invisibility powerups to spawn" set g_use_ammunition 1 "if set to 0 all weapons have unlimited ammo" set g_pickup_items -1 "if set to 0 all items (health, armor, ammo, weapons...) are removed from the map, if 1 they are forced to spawn" set g_pickup_respawntime_scaling_reciprocal 0 "Multiply respawn time by `reciprocal / (p + offset) + linear` where `p` is the current number of players, takes effect with 2 or more players present, `reciprocal` (with `offset` and `linear` set to 0) can be used to achieve a constant number of items spawned *per player*"