This commit is contained in:
Federico Cecchetto
2021-12-13 03:05:22 +01:00
parent e918bdf28f
commit 0ac5225114
7 changed files with 48 additions and 26 deletions

View File

@ -29,6 +29,8 @@ namespace scripting
std::string current_file;
std::vector<std::function<void()>> shutdown_callbacks;
void vm_notify_stub(const unsigned int notify_list_owner_id, const unsigned int string_value,
game::VariableValue* top)
{
@ -77,6 +79,13 @@ namespace scripting
{
userinfo::clear_overrides();
command::clear_script_commands();
for (const auto& callback : shutdown_callbacks)
{
callback();
}
shutdown_callbacks = {};
g_shutdown_game_hook.invoke<void>(free_scripts);
}
@ -106,6 +115,11 @@ namespace scripting
}
}
void on_shutdown(const std::function<void()>& callback)
{
shutdown_callbacks.push_back(callback);
}
class component final : public component_interface
{
public: