ImGui: add shortcut button for reparsing all scripts

The "Reparse all scripts" button reparses every script file, and reloads/reconnects the game.
This commit is contained in:
Kawe Mazidjatari 2024-07-01 00:25:31 +02:00
parent a1bd8bd012
commit fea8603258

View File

@ -591,7 +591,9 @@ void CBrowser::DrawHostPanel(void)
ImGui::Spacing();
const ImVec2 contentRegionMax = ImGui::GetContentRegionAvail();
const bool serverActive = g_pServer->IsActive();
const bool clientActive = g_pClientState->IsActive();
if (!g_pHostState->m_bActiveGame)
{
@ -665,7 +667,7 @@ void CBrowser::DrawHostPanel(void)
ImGui::Separator();
ImGui::Spacing();
if (ImGui::Button("AI network rebuild", ImVec2(contentRegionMax.x, 32)))
if (ImGui::Button("Rebuild AI network", ImVec2(contentRegionMax.x, 32)))
{
ProcessCommand("BuildAINFile");
}
@ -679,9 +681,9 @@ void CBrowser::DrawHostPanel(void)
ImGui::Separator();
ImGui::Spacing();
if (ImGui::Button("AI settings reparse", ImVec2(contentRegionMax.x, 32)))
if (ImGui::Button("Reparse AI settings", ImVec2(contentRegionMax.x, 32)))
{
Msg(eDLL_T::ENGINE, "Reparsing AI data on %s\n", g_pClientState->IsActive() ? "server and client" : "server");
Msg(eDLL_T::ENGINE, "Reparsing AI data on %s\n", clientActive ? "server and client" : "server");
ProcessCommand("aisettings_reparse");
if (g_pClientState->IsActive())
@ -690,13 +692,56 @@ void CBrowser::DrawHostPanel(void)
}
}
if (ImGui::Button("Weapon settings reparse", ImVec2(contentRegionMax.x, 32)))
if (ImGui::Button("Reparse Weapon settings", ImVec2(contentRegionMax.x, 32)))
{
Msg(eDLL_T::ENGINE, "Reparsing weapon data on %s\n", g_pClientState->IsActive() ? "server and client" : "server");
Msg(eDLL_T::ENGINE, "Reparsing weapon data on %s\n", clientActive ? "server and client" : "server");
ProcessCommand("weapon_reparse");
}
}
}
ImGui::Spacing();
ImGui::Separator();
ImGui::Spacing();
if (ImGui::Button("Reparse all scripts", ImVec2(contentRegionMax.x, 32)))
{
Msg(eDLL_T::ENGINE, "Reparsing all scripts on %s\n", "server and client");
// NOTE: the following are already called during "reload" or "reconnect".
//"aisettings_reparse"
//"aisettings_reparse_client"
//"damagedefs_reparse"
//"damagedefs_reparse_client"
//"playerSettings_reparse"
//"fx_impact_reparse"
ProcessCommand("ReloadAimAssistSettings");
ProcessCommand("reload_localization");
ProcessCommand("playlist_reload");
ProcessCommand("banlist_reload");
ProcessCommand("weapon_reparse");
// Recompile all UI scripts
ProcessCommand("uiscript_reset");
if (serverActive)
{
// If we hit this code path, we are connected to a listen server,
// reconnect to it to recompile all server and client side scripts.
ProcessCommand("reload");
}
else if (clientActive)
{
// If we hit this code path, we are connected to a remote server,
// reconnect to it to recompile all client side scripts.
ProcessCommand("reconnect");
}
}
#endif // !CLIENT_DLL
}