new signalReceived hook with better performance

signalReceived.YourComponent, with the checks in the lua-side this hook was being called too many times and it was using up to 10% cpu of the server
This commit is contained in:
Evil Factory
2021-09-07 11:02:24 -03:00
parent 5df4207521
commit 76f389dff9
2 changed files with 11 additions and 12 deletions
@@ -574,21 +574,18 @@ namespace Barotrauma
foreach (HookFunction hf in hookFunctions[name].Values)
{
if (hf.name == name)
try
{
try
var result = env.lua.Call(hf.function, args);
if (result.IsNil() == false)
{
var result = env.lua.Call(hf.function, args);
if (result.IsNil() == false)
{
return result;
}
}
catch (Exception e)
{
env.HandleLuaException(e);
return result;
}
}
catch (Exception e)
{
env.HandleLuaException(e);
}
}
return null;