Description:
This plugin aims to clamp the amount of common infected to the 'z_common_limit' without interfering with the AI director on default campaigns (or any campaign that doesn't force spawn common infected). It does this by giving an initial leniency, and if that leniency is passed then a short timer is started before checking if the amount of common infected is still above the `z_common_limit` threshold. It will delete the common infected above 'z_common_limit', and then keep deleting any common that spawns if the total common exceeds 'z_common_limit'. After enough time has passed that no common infected has been deleted, it will disable instant deletion of common infected.
By Default:
- The leniency amount is 5 (30 + 5 = 35) before it creates a timer.
- The timer is 3.0 seconds, before instant deleting.
- The instant deleting disables after 5.0 seconds have elapsed without any deletions occurring.
Features:
sm_common_limit - Prints the current amount of common infected, max common infected, and leniency.
Thanks:
- Silvershot - Initial plugin
- Addie - Helping on Discord
Changelog:
Code:
0.5 (03-Jun-2024)
- Console messages are now prefixed by "[Max_Common]".
- Removed a check on initial clean-up loop, so that common amount is reduced to z_common_limit (not with leniency).
- Moved some code around, so that OnEntityDestroyed also checks the elapsed time to deactive the hard lock and instant delete.
- sm_common_limit will now print if instant destruction is active.
0.3 (25-May-2024)
- Initial release.
Reason:
This plugin is
heavily inspired by Silvers's plugin:
[L4D & L4D2] Common Limiter and has a lot of similarities.
Silver's plugin was a lifesaver for custom campaigns like
Wormwood that could spawn infinite amount of common infected, causing the server to stutter and or become unresponsive. However, I noticed with his plugin that instantly removing common infected caused issues with the AI director on default (and other campaigns).
If you are in a multi-floored building, or are around the corner filled with common infected, the common count is going to be max (30/30) since the room next is filled with all the naturally spawned common infected. However, if the AI director spawns a horde (which it does on timer intervals, based on difficulty), it will spawn slightly over the `z_common_limit` reaching up to 33 or 34. As it does this, it slowly overtime deletes common infected that are idle and not part of the horde it just spawned.
Because of this AI director behavior, plugins that instantly delete common infected will cull the horde amount that spawns. Resulting in much weaker hordes than vanilla's director intended.
Note(s):
This plugin does not prevent custom campaigns from changing z_common_limit through ConVar.SetValue() or through director script options. This is also my first plugin. So hopefully there are no issues. I am running this on my public servers.