Add option to disable random round-robin mother infection cycle
This commit is contained in:
parent
d15957de1b
commit
f9193641d2
@ -104,6 +104,7 @@ enum CvarsList
|
|||||||
Handle:CVAR_INFECT_SPAWNTIME_MIN,
|
Handle:CVAR_INFECT_SPAWNTIME_MIN,
|
||||||
Handle:CVAR_INFECT_SPAWNTIME_MAX,
|
Handle:CVAR_INFECT_SPAWNTIME_MAX,
|
||||||
Handle:CVAR_INFECT_CONSECUTIVE_BLOCK,
|
Handle:CVAR_INFECT_CONSECUTIVE_BLOCK,
|
||||||
|
Handle:CVAR_INFECT_ROUND_ROBIN,
|
||||||
Handle:CVAR_INFECT_WEAPONS_DROP,
|
Handle:CVAR_INFECT_WEAPONS_DROP,
|
||||||
Handle:CVAR_INFECT_KNIFE_COOLDOWN,
|
Handle:CVAR_INFECT_KNIFE_COOLDOWN,
|
||||||
Handle:CVAR_INFECT_MAX_DISTANCE,
|
Handle:CVAR_INFECT_MAX_DISTANCE,
|
||||||
@ -335,6 +336,7 @@ CvarsCreate()
|
|||||||
g_hCvarsList[CVAR_INFECT_SPAWNTIME_MIN] = CreateConVar("zr_infect_spawntime_min", "30.0", "Minimum time from the start of the round until picking the mother zombie(s).");
|
g_hCvarsList[CVAR_INFECT_SPAWNTIME_MIN] = CreateConVar("zr_infect_spawntime_min", "30.0", "Minimum time from the start of the round until picking the mother zombie(s).");
|
||||||
g_hCvarsList[CVAR_INFECT_SPAWNTIME_MAX] = CreateConVar("zr_infect_spawntime_max", "50.0", "Maximum time from the start of the round until picking the mother zombie(s).");
|
g_hCvarsList[CVAR_INFECT_SPAWNTIME_MAX] = CreateConVar("zr_infect_spawntime_max", "50.0", "Maximum time from the start of the round until picking the mother zombie(s).");
|
||||||
g_hCvarsList[CVAR_INFECT_CONSECUTIVE_BLOCK] = CreateConVar("zr_infect_consecutive_block", "1", "Prevent a player from being chosen as mother zombie two rounds in a row.");
|
g_hCvarsList[CVAR_INFECT_CONSECUTIVE_BLOCK] = CreateConVar("zr_infect_consecutive_block", "1", "Prevent a player from being chosen as mother zombie two rounds in a row.");
|
||||||
|
g_hCvarsList[CVAR_INFECT_ROUND_ROBIN] = CreateConVar("zr_infect_round_robin", "1", "Use randomized round-robin (with SteamID cache) for mother zombie infection.");
|
||||||
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.");
|
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.");
|
||||||
g_hCvarsList[CVAR_INFECT_KNIFE_COOLDOWN] = CreateConVar("zr_infect_knife_cooldown", "1.0", "Time in seconds during which knife can not be used after becoming a zombie.");
|
g_hCvarsList[CVAR_INFECT_KNIFE_COOLDOWN] = CreateConVar("zr_infect_knife_cooldown", "1.0", "Time in seconds during which knife can not be used after becoming a zombie.");
|
||||||
g_hCvarsList[CVAR_INFECT_MAX_DISTANCE] = CreateConVar("zr_infect_max_distance", "80.0", "The maximum allowed distance between a client and an attacker for a successful infection. [0.0 = Disabled]");
|
g_hCvarsList[CVAR_INFECT_MAX_DISTANCE] = CreateConVar("zr_infect_max_distance", "80.0", "The maximum allowed distance between a client and an attacker for a successful infection. [0.0 = Disabled]");
|
||||||
|
@ -537,6 +537,7 @@ public Action:InfectMotherZombie(Handle:timer)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
new bool:infectroundrobin = GetConVarBool(g_hCvarsList[CVAR_INFECT_ROUND_ROBIN]);
|
||||||
new candidatesMain = 0;
|
new candidatesMain = 0;
|
||||||
new candidatesAlt = 0;
|
new candidatesAlt = 0;
|
||||||
new Handle:aCandidatesMain = CreateArray();
|
new Handle:aCandidatesMain = CreateArray();
|
||||||
@ -550,7 +551,7 @@ public Action:InfectMotherZombie(Handle:timer)
|
|||||||
if (!g_bInfectMotherLast[client])
|
if (!g_bInfectMotherLast[client])
|
||||||
{
|
{
|
||||||
// If client hasn't been chosen this cycle, put into aCandidatesMain array.
|
// If client hasn't been chosen this cycle, put into aCandidatesMain array.
|
||||||
if (!SteamidCacheClientExists(g_hInfectMotherCycle, client))
|
if (!infectroundrobin || !SteamidCacheClientExists(g_hInfectMotherCycle, client))
|
||||||
{
|
{
|
||||||
PushArrayCell(aCandidatesMain, client);
|
PushArrayCell(aCandidatesMain, client);
|
||||||
candidatesMain++;
|
candidatesMain++;
|
||||||
@ -597,7 +598,7 @@ public Action:InfectMotherZombie(Handle:timer)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
// No main candidates, reset the mother zombie cycle now before infecting anyone else.
|
// No main candidates, reset the mother zombie cycle now before infecting anyone else.
|
||||||
if (!resetcycle)
|
if (infectroundrobin && !resetcycle)
|
||||||
{
|
{
|
||||||
resetcycle = true;
|
resetcycle = true;
|
||||||
// Clear mother zombie round-robin cycle storage.
|
// Clear mother zombie round-robin cycle storage.
|
||||||
@ -750,20 +751,15 @@ InfectHumanToZombie(client, attacker = -1, bool:motherinfect = false, bool:respa
|
|||||||
|
|
||||||
// Check if consecutive infection protection is enabled.
|
// Check if consecutive infection protection is enabled.
|
||||||
new bool:infectconsecutiveblock = GetConVarBool(g_hCvarsList[CVAR_INFECT_CONSECUTIVE_BLOCK]);
|
new bool:infectconsecutiveblock = GetConVarBool(g_hCvarsList[CVAR_INFECT_CONSECUTIVE_BLOCK]);
|
||||||
if (infectconsecutiveblock)
|
new bool:infectroundrobin = GetConVarBool(g_hCvarsList[CVAR_INFECT_ROUND_ROBIN]);
|
||||||
{
|
|
||||||
// If this is a mother infect, update the mother zombie protection status
|
// If this is a mother infect, update the mother zombie protection status
|
||||||
if (motherinfect)
|
if (motherinfect)
|
||||||
{
|
{
|
||||||
g_bInfectMotherLast[client] = true;
|
g_bInfectMotherLast[client] = infectconsecutiveblock;
|
||||||
|
if(infectroundrobin)
|
||||||
SteamidCacheAddClient(g_hInfectMotherCycle, client);
|
SteamidCacheAddClient(g_hInfectMotherCycle, client);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// Consecutive infection protection is disabled. No immunity.
|
|
||||||
g_bInfectMotherLast[client] = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Apply effects.
|
// Apply effects.
|
||||||
InfectFireEffects(client);
|
InfectFireEffects(client);
|
||||||
|
Loading…
Reference in New Issue
Block a user