Added cvar to disable explosion entirely on infect.

This commit is contained in:
Greyscale 2009-06-21 13:08:02 -07:00
parent 209c13a3f9
commit a0d2f58c35
3 changed files with 45 additions and 35 deletions

View File

@ -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"

View File

@ -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.");

View File

@ -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)