Files
BarotraumaModServer/LocalMods/Dont Open Debug Console On Errors/Lua/ForcedAutorun/patch.lua
T

19 lines
809 BLFS
Lua
Executable File

if SERVER then return end
DebugConsole = LuaUserData.CreateStatic("Barotrauma.DebugConsole")
local debugConsoleWasOpen = false
Hook.Patch("Barotrauma.DebugConsole", "ThrowError", {"System.String", "System.Exception", "Barotrauma.ContentPackage", "System.Boolean", "System.Boolean"}, function (instance, ptable)
if ptable["createMessageBox"] then return end
debugConsoleWasOpen = DebugConsole.IsOpen
end, Hook.HookMethodType.Before)
Hook.Patch("Barotrauma.DebugConsole", "ThrowError", {"System.String", "System.Exception", "Barotrauma.ContentPackage", "System.Boolean", "System.Boolean"}, function (instance, ptable)
if ptable["createMessageBox"] then return end
if not debugConsoleWasOpen then
DebugConsole.IsOpen = false
end
end, Hook.HookMethodType.After)