Skip to content

Commit

Permalink
Separated to multi routines on Main
Browse files Browse the repository at this point in the history
  • Loading branch information
GreepTheSheep committed Jul 4, 2023
1 parent 3d10e5f commit af8c2a7
Showing 1 changed file with 30 additions and 9 deletions.
39 changes: 30 additions & 9 deletions src/Main.as
Original file line number Diff line number Diff line change
Expand Up @@ -238,17 +238,14 @@ void Main(){
#endif

#if DEPENDENCY_BETTERCHAT
BetterChat::RegisterCommand("mx", MXBetterChat::OpenMapOnMXCmd());
BetterChat::RegisterCommand("maniaexchange", MXBetterChat::OpenMapOnMXCmd());
BetterChat::RegisterCommand("mx-page", MXBetterChat::MXPage(false));
BetterChat::RegisterCommand("mx-tell-page", MXBetterChat::MXPage(true));
BetterChat::RegisterCommand("mx-awards", MXBetterChat::MapAwards(false));
BetterChat::RegisterCommand("mx-tell-awards", MXBetterChat::MapAwards(true));
BetterChat::RegisterCommand("mx-tell-plugin", MXBetterChat::TellMXPlugin());

if (isDevMode) BetterChat::RegisterCommand("mx-json", MXBetterChat::ShowMapInfoJson());
startnew(BetterChatRegisterCommands);
#endif

startnew(MapLoader);
startnew(MapChecker);
}

void MapLoader() {
while(true){
yield();

Expand All @@ -265,6 +262,12 @@ void Main(){
MX::DownloadMap(MX::mapToDL);
MX::mapToDL = -1;
}
}
}

void MapChecker() {
while(true){
yield();

// Checks current played map
auto currentMap = GetCurrentMap();
Expand All @@ -286,6 +289,24 @@ void Main(){
}
}

#if DEPENDENCY_BETTERCHAT
void BetterChatRegisterCommands() {
try {
BetterChat::RegisterCommand("mx", MXBetterChat::OpenMapOnMXCmd());
BetterChat::RegisterCommand("maniaexchange", MXBetterChat::OpenMapOnMXCmd());
BetterChat::RegisterCommand("mx-page", MXBetterChat::MXPage(false));
BetterChat::RegisterCommand("mx-tell-page", MXBetterChat::MXPage(true));
BetterChat::RegisterCommand("mx-awards", MXBetterChat::MapAwards(false));
BetterChat::RegisterCommand("mx-tell-awards", MXBetterChat::MapAwards(true));
BetterChat::RegisterCommand("mx-tell-plugin", MXBetterChat::TellMXPlugin());

if (isDevMode) BetterChat::RegisterCommand("mx-json", MXBetterChat::ShowMapInfoJson());
} catch {
mxError("Better Chat: unable to register commands: " + getExceptionInfo(), true);
}
}
#endif

void RenderInterface(){
mxMenu.Render();
}
Expand Down

0 comments on commit af8c2a7

Please sign in to comment.