mapvote 2.1.1

Code refactor
Doesn't add or change anything
This commit is contained in:
Resxt 2023-01-26 03:06:23 +01:00
parent 9e76a0c712
commit 7a2c32a228
2 changed files with 8 additions and 4 deletions

Binary file not shown.

View File

@ -20,7 +20,7 @@ Init()
{ {
if (GetDvarInt("mapvote_enable")) if (GetDvarInt("mapvote_enable"))
{ {
level.mapvote_rotate_function = ::DoRotation; level.mapvote_rotate_function = ::StartRotation;
InitMapvote(); InitMapvote();
} }
@ -554,8 +554,7 @@ ListenForEndVote()
Print("[MAPVOTE] Rotating to " + mapName + " | " + modeName + " (" + modeCfg + ".cfg)"); Print("[MAPVOTE] Rotating to " + mapName + " | " + modeName + " (" + modeCfg + ".cfg)");
} }
SetDvar("sv_maprotationcurrent", "exec " + modeCfg + ".cfg map " + mapName); DoRotation(modeCfg, mapName);
SetDvar("sv_maprotation", "exec " + modeCfg + ".cfg map " + mapName);
} }
SetMapvoteData(type) SetMapvoteData(type)
@ -697,11 +696,16 @@ RotateDefault()
mapName = GetMapCodeName(dataSplitted[0]); mapName = GetMapCodeName(dataSplitted[0]);
} }
DoRotation(modeCfg, mapName);
}
DoRotation(modeCfg, mapName)
{
SetDvar("sv_maprotationcurrent", "exec " + modeCfg + ".cfg map " + mapName); SetDvar("sv_maprotationcurrent", "exec " + modeCfg + ".cfg map " + mapName);
SetDvar("sv_maprotation", "exec " + modeCfg + ".cfg map " + mapName); SetDvar("sv_maprotation", "exec " + modeCfg + ".cfg map " + mapName);
} }
DoRotation() StartRotation()
{ {
if (ShouldRotateDefault()) if (ShouldRotateDefault())
{ {