diff --git a/scripting/include/feedthetrolls/events.inc b/scripting/include/feedthetrolls/events.inc index 085e0c6..e4118c8 100644 --- a/scripting/include/feedthetrolls/events.inc +++ b/scripting/include/feedthetrolls/events.inc @@ -27,6 +27,7 @@ public void OnMapStart() { public void OnClientPutInServer(int client) { pdata[client].pendingTrollBan = 0; pdata[client].shootAtTarget = 0; + fAntiRushFrequencyCounter[client] = 0.0; if(IsTrollActive(client, "Voice Mute")) BaseComm_SetClientMute(client, true); SDKHook(client, SDKHook_OnTakeDamage, Event_TakeDamage); @@ -907,12 +908,15 @@ public bool TraceEntityFilterPlayer(int entity, int mask, any data) { return data != entity && entity <= MaxClients && GetClientTeam(entity) == 2 && IsPlayerAlive(entity); } -float iLastAntiRushEvent[MAXPLAYERS+1]; +// TODO: Increase the frequency of spawns the longer they are in antirush. Possibly increase int and decrease over time public Action OnAntiRush(int client, int &type, float distance) { if(client && client > 0 && client <= MaxClients && type == 3 && IsPlayerAlive(client) && !IsPlayerIncapped(client)) { - if(GetGameTime() - iLastAntiRushEvent[client] > 30.0) { - SpecialType special = view_as(GetRandomInt(1,6)); - iLastAntiRushEvent[client] = GetGameTime(); + if(GetGameTime() - fLastAntiRushEvent[client] > ANTI_RUSH_DEFAULT_FREQUENCY - fAntiRushFrequencyCounter[client]) { < + if(fAntiRushFrequencyCounter[client] < ANTI_RUSH_DEFAULT_FREQUENCY) { + fAntiRushFrequencyCounter[client] += ANTI_RUSH_FREQ_INC; + } + SpecialType special = view_as(GetRandomInt(1,6)); + fLastAntiRushEvent[client] = GetGameTime(); SpawnSpecialForTarget(special, client); PrintToConsoleAll("[FTT] Spawning anti-rush special on %N (dist=%f) (special=%s)", client, distance, SPECIAL_NAMES[view_as(special)-1]); } @@ -920,6 +924,17 @@ public Action OnAntiRush(int client, int &type, float distance) { return Plugin_Continue; } +Action Timer_DecreaseAntiRush(Handle h) { + for(int i = 1; i <= MaxClients; i++) { + if(fAntiRushFrequencyCounter[i] > 1.0) { + fAntiRushFrequencyCounter[i]--; + } else { + fAntiRushFrequencyCounter = 0.0; + } + } + return Plugin_Continue; +} + public void L4D2_CInsectSwarm_CanHarm_Post(int acid, int spitter, int entity) { if(entity <= MaxClients) pdata[entity].lastInSpitTime = GetGameTime(); @@ -964,4 +979,4 @@ void Event_HealSuccess(Event event, const char[] name, bool dontBroadcast) { if(client > 0 && userid == healTargetPlayer) { StopHealingBots(); } -} \ No newline at end of file +} diff --git a/scripting/include/ftt.inc b/scripting/include/ftt.inc index 8abf562..983cab0 100644 --- a/scripting/include/ftt.inc +++ b/scripting/include/ftt.inc @@ -93,6 +93,9 @@ Handle stopHealingTimer; float entLastHeight[2048]; +float fLastAntiRushEvent[MAXPLAYERS+1]; +float fAntiRushFrequencyCounter[MAXPLAYERS+1]; + #define MODEL_CAR "models/props_vehicles/cara_95sedan.mdl" diff --git a/scripting/l4d2_feedthetrolls.sp b/scripting/l4d2_feedthetrolls.sp index 32dd64d..887dbc0 100644 --- a/scripting/l4d2_feedthetrolls.sp +++ b/scripting/l4d2_feedthetrolls.sp @@ -5,6 +5,8 @@ #define MAIN_TIMER_INTERVAL_S 5.0 #define PLUGIN_VERSION "1.0" +#define ANTI_RUSH_DEFAULT_FREQUENCY 30.0 +#define ANTI_RUSH_FREQ_INC 0.5 #include #include @@ -44,6 +46,8 @@ public void OnPluginStart() { SetupTrolls(); SetupsTrollCombos(); + CreateTimer(1.0, Timer_DecreaseAntiRush, TIMER_REPEAT); + g_spSpawnQueue = new ArrayList(sizeof(SpecialSpawnRequest)); // Witch target overwrite stuff: