Skip to content

Commit

Permalink
Add setDebugViewActive (in addition to isDebugViewActive)
Browse files Browse the repository at this point in the history
  • Loading branch information
jushar committed Dec 4, 2016
1 parent 5bf160c commit e8a3ed0
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
26 changes: 25 additions & 1 deletion Client/mods/deathmatch/logic/luadefs/CLuaGUIDefs.cpp
Expand Up @@ -21,6 +21,7 @@ void CLuaGUIDefs::LoadFunctions ( void )
CLuaCFunctions::AddFunction ( "isChatBoxInputActive", GUIIsChatBoxInputActive );
CLuaCFunctions::AddFunction ( "isConsoleActive", GUIIsConsoleActive );
CLuaCFunctions::AddFunction ( "isDebugViewActive", GUIIsDebugViewActive );
CLuaCFunctions::AddFunction ( "setDebugViewActive", GUISetDebugViewActive );
CLuaCFunctions::AddFunction ( "isMainMenuActive", GUIIsMainMenuActive );
CLuaCFunctions::AddFunction ( "isMTAWindowActive", GUIIsMTAWindowActive );
CLuaCFunctions::AddFunction ( "isTransferBoxActive", GUIIsTransferBoxActive );
Expand Down Expand Up @@ -185,6 +186,7 @@ void CLuaGUIDefs::AddGuiElementClass ( lua_State* luaVM )
lua_classfunction ( luaVM, "isChatBoxInputActive", "isChatBoxInputActive" );
lua_classfunction ( luaVM, "isConsoleActive", "isConsoleActive" );
lua_classfunction ( luaVM, "isDebugViewActive", "isDebugViewActive" );
lua_classfunction ( luaVM, "setDebugViewActive", "setDebugViewActive" );
lua_classfunction ( luaVM, "isMainMenuActive", "isMainMenuActive" );
lua_classfunction ( luaVM, "isMTAWindowActive", "isMTAWindowActive" );
lua_classfunction ( luaVM, "isTransferBoxActive", "isTransferBoxActive" );
Expand Down Expand Up @@ -215,7 +217,7 @@ void CLuaGUIDefs::AddGuiElementClass ( lua_State* luaVM )

lua_classvariable ( luaVM, "chatBoxInputActive", NULL, "isChatBoxInputActive" );
lua_classvariable ( luaVM, "consoleActive", NULL, "isConsoleActive" );
lua_classvariable ( luaVM, "debugViewActive", NULL, "isDebugViewActive" );
lua_classvariable ( luaVM, "debugViewActive", "setDebugViewActive", "isDebugViewActive" );
lua_classvariable ( luaVM, "mainMenuActive", NULL, "isMainMenuActive" );
lua_classvariable ( luaVM, "mtaWindowActive", NULL, "isMTAWindowActive" );
lua_classvariable ( luaVM, "transferBoxActive", NULL, "isTransferBoxActive" );
Expand Down Expand Up @@ -615,6 +617,28 @@ int CLuaGUIDefs::GUIIsDebugViewActive ( lua_State* luaVM )
}


int CLuaGUIDefs::GUISetDebugViewActive(lua_State* luaVM)
{
bool enabled;

CScriptArgReader argStream(luaVM);
argStream.ReadBool(enabled);

if (!argStream.HasErrors())
{
g_pCore->SetDebugVisible(enabled);

lua_pushboolean(luaVM, true);
return 1;
}
else
m_pScriptDebugging->LogCustom(luaVM, argStream.GetFullErrorMessage());

lua_pushboolean(luaVM, false);
return 1;
}


int CLuaGUIDefs::GUIIsMainMenuActive ( lua_State* luaVM )
{
lua_pushboolean ( luaVM, g_pCore->IsMenuVisible () );
Expand Down
1 change: 1 addition & 0 deletions Client/mods/deathmatch/logic/luadefs/CLuaGUIDefs.h
Expand Up @@ -25,6 +25,7 @@ class CLuaGUIDefs : public CLuaDefs
LUA_DECLARE ( GUIIsChatBoxInputActive );
LUA_DECLARE ( GUIIsConsoleActive );
LUA_DECLARE ( GUIIsDebugViewActive );
LUA_DECLARE ( GUISetDebugViewActive );
LUA_DECLARE ( GUIIsMainMenuActive );
LUA_DECLARE ( GUIIsMTAWindowActive );
LUA_DECLARE ( GUIIsTransferBoxActive );
Expand Down

0 comments on commit e8a3ed0

Please sign in to comment.