#pragma once #include "loader/module_loader.hpp" #include "game/game.hpp" #include "utils/hook.hpp" class scripting final : public module { public: class variable final { public: variable(game::native::VariableValue value); ~variable(); operator game::native::VariableValue() const; private: game::native::VariableValue value_; }; void post_start() override; void post_load() override; void pre_destroy() override; static void on_start(const std::function& callback); static void on_stop(const std::function& callback); private: std::unique_ptr chai_; std::vector&)>> callbacks_; void initialize(); void load_scripts() const; static utils::hook start_hook_; static utils::hook stop_hook_; static std::mutex mutex_; static std::vector> start_callbacks_; static std::vector> stop_callbacks_; static void start_execution(); static void stop_execution(); };