refactor: Load tooltips from commands and disable unusable command buttons (#777)

* Set tooltips from command descriptions
* Disable unusable commands
This commit is contained in:
pelecanidae
2022-12-29 20:43:31 -05:00
committed by GitHub
parent 089bcebc17
commit 2df690b2c8
3 changed files with 24 additions and 8 deletions

View File

@ -8,19 +8,21 @@ namespace big
{
if (ImGui::TreeNode("Kick"))
{
auto const is_session_host = [] { return gta_util::get_network()->m_game_session_ptr->is_host(); };
components::player_command_button<"breakup">(g_player_service->get_selected());
components::player_command_button<"lckick">(g_player_service->get_selected());
components::disable_unless(std::not_fn(is_session_host), [] {
components::player_command_button<"lckick">(g_player_service->get_selected());
});
components::player_command_button<"bailkick">(g_player_service->get_selected());
components::player_command_button<"nfkick">(g_player_service->get_selected());
components::player_command_button<"oomkick">(g_player_service->get_selected());
components::player_command_button<"shkick">(g_player_service->get_selected());
components::player_command_button<"endkick">(g_player_service->get_selected());
if (ImGui::IsItemHovered())
ImGui::SetTooltip("The kick can take around 10 seconds to work");
components::player_command_button<"hostkick">(g_player_service->get_selected());
components::disable_unless(is_session_host, [] {
components::player_command_button<"hostkick">(g_player_service->get_selected());
});
components::player_command_button<"desync">(g_player_service->get_selected());
if (ImGui::IsItemHovered())
ImGui::SetTooltip("The kick can take around 10 seconds to work");
ImGui::TreePop();
}