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
@@ -650,20 +650,10 @@ namespace Barotrauma
if (Math.Max(hull1.WorldSurface + hull1.WaveY[hull1.WaveY.Length - 1], hull2.WorldSurface + hull2.WaveY[0]) > WorldRect.Y) { return; }
}
#if SERVER
var should = GameMain.Lua.hook.Call("gapOxygenUpdate", new object[] { this, hull1, hull2 });
var should = new LuaResult(GameMain.Lua.hook.Call("gapOxygenUpdate", new object[] { this, hull1, hull2 }));
if (should != null)
{
if (should is DynValue dyn)
{
if (dyn.CastToBool())
{
return;
}
}
}
#endif
if (should.Bool())
return;
float totalOxygen = hull1.Oxygen + hull2.Oxygen;
float totalVolume = (hull1.Volume + hull2.Volume);