mirror of
https://github.com/JezuzLizard/T4SP-Server-Plugin.git
synced 2025-07-03 09:41:49 +00:00
Add codecallback_actorspawned, and codecallback_hudelemspawned.
Reimplement the generatePath() builtin to use a custom implementation to handle drop down nodes.
This commit is contained in:
@ -95,17 +95,20 @@ namespace scheduler
|
||||
}
|
||||
|
||||
utils::hook::detour com_init_hook;
|
||||
utils::hook::detour gscr_postloadscripts_hook;
|
||||
|
||||
std::vector<std::function<void()>> post_init_funcs;
|
||||
bool inited = false;
|
||||
bool com_inited = false;
|
||||
std::vector<std::function<void()>> post_loadscripts_funcs;
|
||||
bool postloadscripts_inited = false;
|
||||
|
||||
void on_post_init_hook()
|
||||
{
|
||||
if (inited)
|
||||
if (com_inited)
|
||||
{
|
||||
return;
|
||||
}
|
||||
inited = true;
|
||||
com_inited = true;
|
||||
for (const auto& func : post_init_funcs)
|
||||
{
|
||||
func();
|
||||
@ -117,6 +120,26 @@ namespace scheduler
|
||||
com_init_hook.invoke<void>();
|
||||
on_post_init_hook();
|
||||
}
|
||||
|
||||
void on_post_postloadscripts_hook()
|
||||
{
|
||||
if (postloadscripts_inited)
|
||||
{
|
||||
return;
|
||||
}
|
||||
for (const auto& func : post_loadscripts_funcs)
|
||||
{
|
||||
func();
|
||||
}
|
||||
}
|
||||
|
||||
void postloadscripts_stub()
|
||||
{
|
||||
postloadscripts_inited = false;
|
||||
gscr_postloadscripts_hook.invoke<void>();
|
||||
on_post_postloadscripts_hook();
|
||||
postloadscripts_inited = true;
|
||||
}
|
||||
}
|
||||
|
||||
void schedule(const std::function<bool()>& callback, const pipeline type,
|
||||
@ -154,7 +177,7 @@ namespace scheduler
|
||||
|
||||
void on_init(const std::function<void()>& callback)
|
||||
{
|
||||
if (inited)
|
||||
if (com_inited)
|
||||
{
|
||||
callback();
|
||||
}
|
||||
@ -164,6 +187,11 @@ namespace scheduler
|
||||
}
|
||||
}
|
||||
|
||||
void on_postloadscripts(const std::function<void()>& callback)
|
||||
{
|
||||
post_loadscripts_funcs.push_back(callback);
|
||||
}
|
||||
|
||||
class component final : public component_interface
|
||||
{
|
||||
public:
|
||||
@ -178,9 +206,11 @@ namespace scheduler
|
||||
}
|
||||
});
|
||||
|
||||
com_init_hook.create(0x59D710, com_init_stub);
|
||||
com_init_hook.create(SELECT(0x0, 0x59D710), com_init_stub);
|
||||
|
||||
utils::hook::call(0x503B5D, execute_server);
|
||||
gscr_postloadscripts_hook.create(SELECT(0x0, 0x5150E0), postloadscripts_stub);
|
||||
|
||||
utils::hook::call(SELECT(0x0, 0x503B5D), execute_server);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
Reference in New Issue
Block a user