refactor hooks with new LuaResult

This commit is contained in:
Evil Factory
2021-09-21 17:11:49 -03:00
parent 784baf550f
commit b07e5d9b0b
9 changed files with 119 additions and 206 deletions
@@ -117,19 +117,13 @@ namespace Barotrauma.Networking
return;
}
var should = GameMain.Lua.hook.Call("chatMessage", new object[] { txt, c, type });
var should = new LuaResult(GameMain.Lua.hook.Call("chatMessage", new object[] { txt, c, type }));
if(should != null)
{
if (should is DynValue dyn)
{
if (dyn.CastToBool())
{
return;
}
}
}
if (should.Bool())
{
return;
}
if (type == ChatMessageType.Order)
{