h1-mod/src/client/component/lui.cpp

51 lines
986 B
C++
Raw Normal View History

2022-02-11 22:21:53 -05:00
#include <std_include.hpp>
#include "loader/component_loader.hpp"
#include "game/game.hpp"
#include "command.hpp"
#include "console.hpp"
#include <utils/hook.hpp>
namespace lui
{
class component final : public component_interface
{
public:
void post_unpack() override
{
command::add("lui_open", [](const command::params& params)
2022-02-23 15:23:00 -05:00
{
if (params.size() <= 1)
2022-02-11 22:21:53 -05:00
{
2022-02-23 15:23:00 -05:00
console::info("usage: lui_open <name>\n");
return;
}
2022-02-11 22:21:53 -05:00
2022-02-23 15:23:00 -05:00
game::LUI_OpenMenu(0, params[1], 0, 0, 0);
});
2022-02-11 22:21:53 -05:00
command::add("lui_open_popup", [](const command::params& params)
2022-02-23 15:23:00 -05:00
{
if (params.size() <= 1)
2022-02-11 22:21:53 -05:00
{
2022-02-23 15:23:00 -05:00
console::info("usage: lui_open_popup <name>\n");
return;
}
2022-02-11 22:21:53 -05:00
2022-02-23 15:23:00 -05:00
game::LUI_OpenMenu(0, params[1], 1, 0, 0);
});
2022-02-11 22:21:53 -05:00
command::add("runMenuScript", [](const command::params& params)
2022-02-23 15:23:00 -05:00
{
const auto args_str = params.join(1);
const auto* args = args_str.data();
game::UI_RunMenuScript(0, &args);
});
2022-02-11 22:21:53 -05:00
}
};
}
2022-05-19 18:06:09 -04:00
REGISTER_COMPONENT(lui::component)