Scripting fix
This commit is contained in:
parent
447a0f5e94
commit
ba4fc58d14
@ -47,6 +47,8 @@ namespace scripting
|
||||
|
||||
utils::hook::detour scr_run_current_threads_hook;
|
||||
|
||||
utils::hook::detour scr_delete_hook;
|
||||
|
||||
game::dvar_t* scr_auto_respawn = nullptr;
|
||||
|
||||
std::string current_scriptfile;
|
||||
@ -291,6 +293,17 @@ namespace scripting
|
||||
}
|
||||
return spawn_point;
|
||||
}
|
||||
|
||||
void scr_delete_stub(game::scr_entref_t ref)
|
||||
{
|
||||
if (ref.entnum == 0 && ref.classnum == 0)
|
||||
{
|
||||
console::warn("Script tried to delete entity 0\n");
|
||||
return;
|
||||
}
|
||||
|
||||
scr_delete_hook.invoke<void>(ref);
|
||||
}
|
||||
}
|
||||
|
||||
std::string get_token_single(unsigned int id)
|
||||
@ -341,6 +354,8 @@ namespace scripting
|
||||
|
||||
scr_get_dvar_int_hook.create(0x1404F0730, scr_get_dvar_int_stub);
|
||||
|
||||
scr_delete_hook.create(0x1404F0460, scr_delete_stub);
|
||||
|
||||
utils::hook::call(0x1404B07D2, get_spawn_point_stub);
|
||||
|
||||
scheduler::loop([]()
|
||||
|
@ -80,6 +80,12 @@ namespace scripting
|
||||
const std::vector<script_value>& arguments)
|
||||
{
|
||||
const auto entref = entity.get_entity_reference();
|
||||
const auto ent_id = entity.get_entity_id();
|
||||
|
||||
if (!is_entity_variable(entref, ent_id))
|
||||
{
|
||||
return {};
|
||||
}
|
||||
|
||||
const auto is_method_call = *reinterpret_cast<const int*>(&entref) != -1;
|
||||
const auto function = find_function(name, !is_method_call);
|
||||
|
Loading…
Reference in New Issue
Block a user