Merge pull request #9599 from ChaoticMind/lua_debug

Add a Lua wrapper to display debug messages (shows if setting enabled)
This commit is contained in:
Pavel Penev
2015-11-14 20:00:38 +02:00
5 changed files with 26 additions and 2 deletions

View File

@@ -199,6 +199,15 @@ namespace OpenRA.Mods.Common.Scripting
Game.AddChatLine(c, prefix, text);
}
[Desc("Displays a debug message to the player, if \"Show Map Debug Messages\" is checked in the settings.")]
public void Debug(string text)
{
if (string.IsNullOrEmpty(text) || !Game.Settings.Debug.LuaDebug)
return;
Game.Debug(text);
}
[Desc("Display a text message at the specified location.")]
public void FloatingText(string text, WPos position, int duration = 30, HSLColor? color = null)
{

View File

@@ -564,6 +564,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
BindCheckboxPref(panel, "CHECKUNSYNCED_CHECKBOX", ds, "SanityCheckUnsyncedCode");
BindCheckboxPref(panel, "BOTDEBUG_CHECKBOX", ds, "BotDebug");
BindCheckboxPref(panel, "FETCH_NEWS_CHECKBOX", gs, "FetchNews");
BindCheckboxPref(panel, "LUADEBUG_CHECKBOX", ds, "LuaDebug");
return () => { };
}
@@ -583,6 +584,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
ds.PerfGraph = dds.PerfGraph;
ds.SanityCheckUnsyncedCode = dds.SanityCheckUnsyncedCode;
ds.BotDebug = dds.BotDebug;
ds.LuaDebug = dds.LuaDebug;
};
}