From a0d2f58c35c1dc0fdcd2cee150a8339f32e3bcd6 Mon Sep 17 00:00:00 2001 From: Greyscale Date: Sun, 21 Jun 2009 13:08:02 -0700 Subject: [PATCH] Added cvar to disable explosion entirely on infect. --- .../zombiereloaded/zombiereloaded.cfg | 10 +++- src/zr/cvars.inc | 12 ++-- src/zr/infect.inc | 58 ++++++++++--------- 3 files changed, 45 insertions(+), 35 deletions(-) diff --git a/cstrike/cfg/sourcemod/zombiereloaded/zombiereloaded.cfg b/cstrike/cfg/sourcemod/zombiereloaded/zombiereloaded.cfg index e7ef2b2..023e03d 100644 --- a/cstrike/cfg/sourcemod/zombiereloaded/zombiereloaded.cfg +++ b/cstrike/cfg/sourcemod/zombiereloaded/zombiereloaded.cfg @@ -233,15 +233,19 @@ zr_infect_weapons_drop "1" // Effects -// Spawn a fireball effect around player on infection. +Disabling this will disable the fireball, smoke cloud, and sparks in a more efficient way. +// Default: "1" +zr_infect_explosion "1" + +// Spawn a fireball effect around player on infection. [Dependency: zr_infect_explosion] // Default: "1" zr_infect_fireball "1" -// Spawn a smoke cloud effect around player on infection. +// Spawn a smoke cloud effect around player on infection. [Dependency: zr_infect_explosion] // Default: "1" zr_infect_smoke "1" -// Emit sparks from player on infection. +// Emit sparks from player on infection. [Dependency: zr_infect_explosion] // Default: "1" zr_infect_sparks "1" diff --git a/src/zr/cvars.inc b/src/zr/cvars.inc index c3bc222..a61dcc2 100644 --- a/src/zr/cvars.inc +++ b/src/zr/cvars.inc @@ -87,11 +87,12 @@ enum CvarsList Handle:CVAR_INFECT_WEAPONS_DROP, Handle:CVAR_INFECT_MZOMBIE_RATIO, Handle:CVAR_INFECT_MZOMBIE_RESPAWN, - Handle:CVAR_INFECT_SOUND, - Handle:CVAR_INFECT_ESPLASH, + Handle:CVAR_INFECT_EXPLOSION, Handle:CVAR_INFECT_FIREBALL, Handle:CVAR_INFECT_SMOKE, Handle:CVAR_INFECT_SPARKS, + Handle:CVAR_INFECT_SOUND, + Handle:CVAR_INFECT_ESPLASH, Handle:CVAR_INFECT_SHAKE, Handle:CVAR_INFECT_SHAKE_AMP, Handle:CVAR_INFECT_SHAKE_FREQUENCY, @@ -278,9 +279,10 @@ CvarsCreate() g_hCvarsList[CVAR_INFECT_WEAPONS_DROP] = CreateConVar("zr_infect_weapons_drop", "1", "Force player to drop all weapons on infect, disabling this will strip weapons instead."); // Effects - g_hCvarsList[CVAR_INFECT_FIREBALL] = CreateConVar("zr_infect_fireball", "1", "Spawn a fireball effect around player on infection."); - g_hCvarsList[CVAR_INFECT_SMOKE] = CreateConVar("zr_infect_smoke", "1", "Spawn a smoke cloud effect around player on infection."); - g_hCvarsList[CVAR_INFECT_SPARKS] = CreateConVar("zr_infect_sparks", "1", "Emit sparks from player on infection."); + g_hCvarsList[CVAR_INFECT_EXPLOSION] = CreateConVar("zr_infect_explosion", "1", "Disabling this will disable the fireball, smoke cloud, and sparks in a more efficient way."); + g_hCvarsList[CVAR_INFECT_FIREBALL] = CreateConVar("zr_infect_fireball", "1", "Spawn a fireball effect around player on infection. [Dependency: zr_infect_explosion]"); + g_hCvarsList[CVAR_INFECT_SMOKE] = CreateConVar("zr_infect_smoke", "1", "Spawn a smoke cloud effect around player on infection. [Dependency: zr_infect_explosion]"); + g_hCvarsList[CVAR_INFECT_SPARKS] = CreateConVar("zr_infect_sparks", "1", "Emit sparks from player on infection. [Dependency: zr_infect_explosion]"); g_hCvarsList[CVAR_INFECT_SOUND] = CreateConVar("zr_infect_sound", "npc/fast_zombie/fz_scream1.wav", "Sound, relative to \"sounds\" folder, to play from player on infection. ['\"\"' = No sound]"); g_hCvarsList[CVAR_INFECT_ESPLASH] = CreateConVar("zr_infect_esplash", "1", "Emit an energy splash from player on infection."); g_hCvarsList[CVAR_INFECT_SHAKE] = CreateConVar("zr_infect_shake", "1", "Shake player's view on infect."); diff --git a/src/zr/infect.inc b/src/zr/infect.inc index 969b0e2..ab5d6a8 100644 --- a/src/zr/infect.inc +++ b/src/zr/infect.inc @@ -726,6 +726,37 @@ InfectFireEffects(client) GetClientAbsOrigin(client, clientloc); clientloc[2] += 30; + new bool:explosion = GetConVarBool(g_hCvarsList[CVAR_INFECT_EXPLOSION]); + if (explosion) + { + // Initialize explosion flags variable. + new flags; + + // Set "nofireball" flag if fireball is disabled. + new bool:fireball = GetConVarBool(g_hCvarsList[CVAR_INFECT_FIREBALL]); + if (!fireball) + { + flags = flags | EXP_NOFIREBALL; + } + + // Set "nosmoke" flag if smoke is disabled. + new bool:smoke = GetConVarBool(g_hCvarsList[CVAR_INFECT_SMOKE]); + if (!smoke) + { + flags = flags | EXP_NOSMOKE; + } + + // Set "nosparks" flag if sparks are disabled. + new bool:sparks = GetConVarBool(g_hCvarsList[CVAR_INFECT_SPARKS]); + if (!sparks) + { + flags = flags | EXP_NOSPARKS; + } + + // Create explosion at client's origin. + VEffectsCreateExplosion(clientloc, flags); + } + // If cvar contains path, then continue. decl String:sound[PLATFORM_MAX_PATH]; GetConVarString(g_hCvarsList[CVAR_INFECT_SOUND], sound, sizeof(sound)); @@ -743,33 +774,6 @@ InfectFireEffects(client) VEffectsCreateEnergySplash(clientloc, direction, true); } - // Initialize explosion flags variable. - new flags; - - // Set "nofireball" flag if fireball is disabled. - new bool:fireball = GetConVarBool(g_hCvarsList[CVAR_INFECT_FIREBALL]); - if (!fireball) - { - flags = flags | EXP_NOFIREBALL; - } - - // Set "nosmoke" flag if smoke is disabled. - new bool:smoke = GetConVarBool(g_hCvarsList[CVAR_INFECT_SMOKE]); - if (!smoke) - { - flags = flags | EXP_NOSMOKE; - } - - // Set "nosparks" flag if sparks are disabled. - new bool:sparks = GetConVarBool(g_hCvarsList[CVAR_INFECT_SPARKS]); - if (!sparks) - { - flags = flags | EXP_NOSPARKS; - } - - // Create explosion at client's origin. - VEffectsCreateExplosion(clientloc, flags); - // If shake effect is enabled, then continue. new bool:shake = GetConVarBool(g_hCvarsList[CVAR_INFECT_SHAKE]); if (shake)