From 4660e9d8e7cad43ae76cdd930f508a68733db96a Mon Sep 17 00:00:00 2001 From: LegendaryGuard Date: Sun, 16 Oct 2022 13:35:48 +0200 Subject: [PATCH] Add server side cvar for tandem nade to enable/disable special items, weapons, vehicles and turrets (disabled by default) --- mutators.cfg | 3 ++- qcsrc/common/mutators/mutator/nades/nades.qc | 26 ++++++++++++++------ qcsrc/common/mutators/mutator/nades/nades.qh | 1 + 3 files changed, 21 insertions(+), 9 deletions(-) diff --git a/mutators.cfg b/mutators.cfg index 0055680074..17e1570b36 100644 --- a/mutators.cfg +++ b/mutators.cfg @@ -281,7 +281,8 @@ set g_nades_tandem_ball_lifetime 1 "How long the ball will last" set g_nades_tandem_fountain_lifetime 1 "Time period during which fountain is ejected" set g_nades_tandem_fountain_delay 5 "Delay between emissions by the fountain" set g_nades_tandem_item_lifetime 5 "Life time of the item" -set g_nades_tandem_item_includespecial 0 "Include jetpack and powerups" +set g_nades_tandem_includespecial 0 "Include weapons, monsters, vehicles and turrets" +set g_nades_tandem_item_includespecial 0 "Include ammo, jetpack and powerups" set g_nades_tandem_randomweapon_includespecial 0 "Include special and super weapons" // Entrap (8) diff --git a/qcsrc/common/mutators/mutator/nades/nades.qc b/qcsrc/common/mutators/mutator/nades/nades.qc index 777852540c..ce18c8b0c4 100644 --- a/qcsrc/common/mutators/mutator/nades/nades.qc +++ b/qcsrc/common/mutators/mutator/nades/nades.qc @@ -711,16 +711,16 @@ void nade_tandem_spawnitem(entity e, vector org) case "ammo" : { itm = (random() > 0.5) ? - ITEM_Shells : (random() > 0.5) ? - ITEM_Bullets : (random() > 0.5) ? - ITEM_Rockets : ITEM_Plasma; + ITEM_Shells : (random() > 0.5) ? + ITEM_Bullets : (random() > 0.5) ? + ITEM_Rockets : ITEM_Plasma; break; } - case "jetpack" : + case "jetpack": { itm = (!autocvar_g_nades_tandem_item_includespecial) ? - ITEM_JetpackFuel : (random() < 0.5) ? - ITEM_JetpackFuel : ITEM_Jetpack; + ITEM_JetpackFuel : (random() < 0.5) ? + ITEM_JetpackFuel : ITEM_Jetpack; break; } default: { itm = nade_tandem_randomitem(); break; } @@ -755,7 +755,14 @@ void nade_tandem_dropping(entity this, vector org) { switch (this.pokenade_type) { - case "weapon" : { nade_tandem_randomweapon(e, org); return; } + case "weapon" : + { + if (autocvar_g_nades_tandem_includespecial) + { + nade_tandem_randomweapon(e, org); + return; + } + } case "health" : case "armor" : case "ammo" : @@ -917,7 +924,10 @@ void nade_tandem_boom(entity this) this.nade_item_spawncount = 0; - switch (this.tandemnade_type) + int tandemnade_type_select = (autocvar_g_nades_tandem_includespecial) ? + this.tandemnade_type : 1; + + switch (tandemnade_type_select) { case 1: { diff --git a/qcsrc/common/mutators/mutator/nades/nades.qh b/qcsrc/common/mutators/mutator/nades/nades.qh index 1877948693..85aa8f6ef2 100644 --- a/qcsrc/common/mutators/mutator/nades/nades.qh +++ b/qcsrc/common/mutators/mutator/nades/nades.qh @@ -65,6 +65,7 @@ float autocvar_g_nades_entrap_time = 10; float autocvar_g_nades_veil_time = 8; float autocvar_g_nades_veil_radius = 300; float autocvar_g_nades_tandem_item_lifetime; +bool autocvar_g_nades_tandem_includespecial; bool autocvar_g_nades_tandem_randomweapon_includespecial = false; bool autocvar_g_nades_tandem_item_includespecial; float autocvar_g_nades_tandem_ball_item_spawncount = 1; -- 2.39.2