Skip to content

Commit

Permalink
ChaosMod/LuaScripts: Block WAIT during script evaluation as well
Browse files Browse the repository at this point in the history
  • Loading branch information
pongo1231 committed Jan 24, 2025
1 parent 6b9c156 commit ba4f88c
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion ChaosMod/Components/LuaScripts.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,6 @@ static const std::vector<ExposableFunc> ms_Exposables {
E("GET_HASH_KEY", GET_HASH_KEY),
E("print", [](const sol::this_environment &curEnv, const std::string &text)
{ LuaPrint(curEnv.env->get<sol::table>("EnvInfo")["ScriptName"], text); }),
E("WAIT", WAIT),
E("IsKeyPressed",
[](unsigned char key)
{
Expand Down Expand Up @@ -466,6 +465,7 @@ LuaScripts::LuaScripts()
{
return LuaInvoke(curEnv, hash, returnType, args);
};
m_GlobalState["WAIT"] = WAIT;
}
else
{
Expand All @@ -475,6 +475,10 @@ LuaScripts::LuaScripts()
LOG("WARNING: Blocked invocation of native 0x" << std::uppercase << std::hex << hash << std::setfill(' ')
<< " during script evaluation!");
};
m_GlobalState["WAIT"] = []()
{
LOG("WARNING: Blocked invocation of WAIT during script evaluation!");
};
}

for (auto dir : ms_ScriptDirs)
Expand Down Expand Up @@ -506,6 +510,7 @@ LuaScripts::LuaScripts()
{
return LuaInvoke(curEnv, hash, returnType, args);
};
m_GlobalState["WAIT"] = WAIT;
}
}

Expand Down

0 comments on commit ba4f88c

Please sign in to comment.