mapvote 2.1.2

The mapvote is now enabled by default (mapvote_enable set to 1 by default instead of 0)

The default rotation system now has an additional dvar dedicated to enabling/disabling it, it no longer relies on the player count dvar to be enabled or disabled which allows it to work with the min and max dvars set to 0 (only rotate the default rotation if there's no human player)
This commit is contained in:
Resxt
2023-08-06 21:54:08 +02:00
parent 05fdd3c679
commit 014b568c97
2 changed files with 16 additions and 19 deletions

View File

@@ -18,6 +18,8 @@
Init()
{
SetDvarIfNotInitialized("mapvote_enable", true);
if (GetDvarInt("mapvote_enable"))
{
level.mapvote_rotate_function = ::StartRotation;
@@ -82,6 +84,7 @@ InitDvars()
SetDvarIfNotInitialized("mapvote_blur_fade_in_time", 2);
SetDvarIfNotInitialized("mapvote_horizontal_spacing", 75);
SetDvarIfNotInitialized("mapvote_display_wait_time", 1);
SetDvarIfNotInitialized("mapvote_default_rotation_enable", false);
SetDvarIfNotInitialized("mapvote_default_rotation_min_players", 0);
SetDvarIfNotInitialized("mapvote_default_rotation_max_players", 0);
}
@@ -665,18 +668,6 @@ GetVoteLimits(mapsAmount, modesAmount)
return limits;
}
ShouldRotateDefault()
{
humanPlayersCount = GetHumanPlayers().size;
if (GetDvarInt("mapvote_default_rotation_max_players") > 0 && humanPlayersCount >= GetDvarInt("mapvote_default_rotation_min_players") && humanPlayersCount <= GetDvarInt("mapvote_default_rotation_max_players"))
{
return true;
}
return false;
}
RotateDefault()
{
mapName = "";
@@ -707,7 +698,9 @@ DoRotation(modeCfg, mapName)
StartRotation()
{
if (ShouldRotateDefault())
humanPlayersCount = GetHumanPlayers().size;
if (GetDvarInt("mapvote_default_rotation_enable") && humanPlayersCount >= GetDvarInt("mapvote_default_rotation_min_players") && humanPlayersCount <= GetDvarInt("mapvote_default_rotation_max_players"))
{
RotateDefault();
}