ftt: Use a queue for special spawning

This commit is contained in:
Jackzie 2022-05-11 23:04:21 -05:00
parent c3e43d744a
commit d9241b2949
No known key found for this signature in database
GPG key ID: 1E834FE36520537A
11 changed files with 329 additions and 158 deletions

View file

@ -11,18 +11,25 @@ public Action Timer_ThrowTimer(Handle timer) {
}
public Action Timer_Main(Handle timer) {
static int loop;
static int loopTick;
static int slowDrainIndex;
if(!slowDrainIndex) slowDrainIndex = GetTrollID("Slow Drain");
static int tempHealthQuickDrainIndex;
if(!tempHealthQuickDrainIndex) tempHealthQuickDrainIndex = GetTrollID("Temp Health Quick Drain");
static int swarmIndex;
if(!swarmIndex) swarmIndex = GetTrollID("Swarm");
for(int i = 1; i <= MaxClients; i++) {
if(IsClientConnected(i) && IsClientInGame(i) && IsPlayerAlive(i)) {
if(IsTrollActive(i, "Slow Drain")) {
if(loop % 4 == 0) {
if(Trolls[slowDrainIndex].IsActive(i)) {
if(loopTick % 4 == 0) {
int hp = GetClientHealth(i);
if(hp > 50) {
SetEntProp(i, Prop_Send, "m_iHealth", hp - 1);
}
}
}else if(IsTrollActive(i, "Temp Health Quick Drain")) {
if(loop % 2 == 0) {
}else if(Trolls[tempHealthQuickDrainIndex].IsActive(i)) {
if(loopTick % 2 == 0) {
float bufferTime = GetEntPropFloat(i, Prop_Send, "m_healthBufferTime");
float buffer = GetEntPropFloat(i, Prop_Send, "m_healthBuffer");
float tempHealth = GetTempHealth(i);
@ -32,13 +39,17 @@ public Action Timer_Main(Handle timer) {
SetEntPropFloat(i, Prop_Send, "m_healthBufferTime", bufferTime - 7.0);
}
}
}else if(IsTrollActive(i, "Swarm")) {
}else if(Trolls[swarmIndex].IsActive(i)) {
L4D2_RunScript("RushVictim(GetPlayerFromUserID(%d), %d)", GetClientUserId(i), 15000);
} else if(Trolls[slipperyShoesIndex].IsActive(i) && Trolls[slipperyShoesIndex].activeFlagClients[i] & 1) {
if(GetRandomFloat() <= 0.4) {
L4D_StaggerPlayer(i, i, NULL_VECTOR);
}
}
}
}
if(++loop >= 60) {
loop = 0;
if(++loopTick >= 60) {
loopTick = 0;
}
return Plugin_Continue;
}
@ -102,13 +113,6 @@ public Action Timer_KickBot(Handle timer, int client) {
}
}
public Action Timer_InstaFailed(Handle h) {
if(gInstaSpecialType != -1) {
gInstaSpecialType = -1;
gInstaSpecialTarget = 0;
}
}
public Action Timer_ShootReverse(Handle h, DataPack pack) {
pack.Reset();
int attacker = pack.ReadCell();