2023-06-06 07:40:40 +00:00
|
|
|
#pragma once
|
|
|
|
#include "bindings/gui/gui_element.hpp"
|
|
|
|
#include "lua_patch.hpp"
|
|
|
|
#include "sol.hpp"
|
2023-07-02 00:59:02 +02:00
|
|
|
#include "core/data/menu_event.hpp"
|
2023-07-05 00:30:57 +02:00
|
|
|
#include <services/gui/gui_service.hpp>
|
2023-06-06 07:40:40 +00:00
|
|
|
|
|
|
|
namespace big
|
|
|
|
{
|
|
|
|
class script;
|
|
|
|
|
|
|
|
class lua_module
|
|
|
|
{
|
|
|
|
sol::state m_state;
|
2023-07-02 22:32:46 +02:00
|
|
|
|
2023-06-06 07:40:40 +00:00
|
|
|
std::string m_module_name;
|
|
|
|
rage::joaat_t m_module_id;
|
|
|
|
|
2023-07-02 22:32:46 +02:00
|
|
|
std::chrono::time_point<std::chrono::file_clock> m_last_write_time;
|
|
|
|
|
2023-06-06 07:40:40 +00:00
|
|
|
public:
|
|
|
|
std::vector<script*> m_registered_scripts;
|
|
|
|
std::vector<std::shared_ptr<lua_patch>> m_registered_patches;
|
2023-07-05 00:30:57 +02:00
|
|
|
|
|
|
|
std::vector<big::tabs> m_owned_tabs;
|
|
|
|
|
|
|
|
std::unordered_map<big::tabs, std::vector<big::tabs>> m_tab_to_sub_tabs;
|
|
|
|
|
2023-06-06 07:40:40 +00:00
|
|
|
std::unordered_map<rage::joaat_t, std::vector<std::shared_ptr<lua::gui::gui_element>>> m_gui;
|
2023-07-02 00:59:02 +02:00
|
|
|
std::unordered_map<menu_event, std::vector<sol::function>> m_event_callbacks;
|
2023-06-06 07:40:40 +00:00
|
|
|
std::vector<void*> m_allocated_memory;
|
|
|
|
|
|
|
|
lua_module(std::string module_name);
|
|
|
|
~lua_module();
|
2023-06-27 20:13:05 +02:00
|
|
|
|
2023-07-02 22:32:46 +02:00
|
|
|
rage::joaat_t module_id() const;
|
|
|
|
const std::string& module_name() const;
|
|
|
|
const std::chrono::time_point<std::chrono::file_clock> last_write_time() const;
|
2023-06-27 20:13:05 +02:00
|
|
|
|
|
|
|
// used for adding our own paths to the search paths of the lua require function
|
|
|
|
void add_folder_to_require_available_paths(const big::folder& scripts_folder);
|
|
|
|
|
|
|
|
void init_lua_api();
|
2023-06-06 07:40:40 +00:00
|
|
|
};
|
|
|
|
}
|