Skip to content

Commit

Permalink
bug fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
ssypchenko committed Jun 6, 2024
1 parent bc13d2b commit c242ee5
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions GG1MapChooser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ namespace MapChooser;
public class MapChooser : BasePlugin, IPluginConfig<MCConfig>
{
public override string ModuleName => "GG1_MapChooser";
public override string ModuleVersion => "v1.2.1";
public override string ModuleVersion => "v1.2.2";
public readonly IStringLocalizer<MapChooser> _localizer;
public MaxRoundsManager roundsManager;
public MapChooser (IStringLocalizer<MapChooser> localizer)
Expand Down Expand Up @@ -66,6 +66,7 @@ public void OnConfigParsed (MCConfig config)
private int _votedMap;
private string NoMapcycle = "[GGMC] Could not load mapcycle! Change Map will not work";
private string? _selectedMap;
private string? _roundEndMap;
private List<string> _playedMaps = new List<string>();
public string MapToChange = "";
public bool MapIsChanging = false;
Expand Down Expand Up @@ -114,6 +115,7 @@ public override void Load(bool hotReload)
return;
}
}
_selectedMap = null;
MapToChange = "";
RestartProblems = 0;
/* if (!mapChangedOnStart ) // just in case to check that a map from workshop is loaded after the first restart
Expand Down Expand Up @@ -292,9 +294,9 @@ public HookResult EventCsWinPanelMatchHandler(EventCsWinPanelMatch @event, GameE

AddTimer(delay, () =>
{
if (_selectedMap != null)
if (_roundEndMap != null)
{
DoMapChange(_selectedMap, SSMC_ChangeMapTime.ChangeMapTime_Now);
DoMapChange(_roundEndMap, SSMC_ChangeMapTime.ChangeMapTime_Now);
}
else
{
Expand Down Expand Up @@ -1620,6 +1622,7 @@ private void TimerVoteMap(SSMC_ChangeMapTime changeTime = SSMC_ChangeMapTime.Cha
if (_selectedMap != null )
{
IsVoteInProgress = false;
_roundEndMap = _selectedMap;
DoMapChange(_selectedMap, changeTime);
return;
}
Expand All @@ -1630,11 +1633,12 @@ private void TimerVoteMap(SSMC_ChangeMapTime changeTime = SSMC_ChangeMapTime.Cha
}
private void ResetData()
{
Logger.LogInformation("ResetData");
IsVoteInProgress = false;
nominatedMaps.Clear();
mapsToVote.Clear();
_votedMap = 0;
_selectedMap = null;
_votedMap = 0;
optionCounts = new Dictionary<string, int>(0);
canRtv = true;
CleanRTVArrays();
Expand Down

0 comments on commit c242ee5

Please sign in to comment.