Add a Utility class and update command interface.
This commit is contained in:
@@ -18,18 +18,18 @@ namespace OpenRA.Mods.Common.UtilityCommands
|
||||
{
|
||||
class ExtractLuaDocsCommand : IUtilityCommand
|
||||
{
|
||||
public string Name { get { return "--lua-docs"; } }
|
||||
string IUtilityCommand.Name { get { return "--lua-docs"; } }
|
||||
|
||||
public bool ValidateArguments(string[] args)
|
||||
bool IUtilityCommand.ValidateArguments(string[] args)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
[Desc("Generate Lua API documentation in MarkDown format.")]
|
||||
public void Run(ModData modData, string[] args)
|
||||
void IUtilityCommand.Run(Utility utility, string[] args)
|
||||
{
|
||||
// HACK: The engine code assumes that Game.modData is set.
|
||||
Game.ModData = modData;
|
||||
Game.ModData = utility.ModData;
|
||||
|
||||
Console.WriteLine("This is an automatically generated listing of the new Lua map scripting API, generated for {0} of OpenRA.", Game.ModData.Manifest.Mod.Version);
|
||||
Console.WriteLine();
|
||||
@@ -55,7 +55,7 @@ namespace OpenRA.Mods.Common.UtilityCommands
|
||||
Console.WriteLine("For a basic guide about map scripts see the [`Map Scripting` wiki page](https://github.com/OpenRA/OpenRA/wiki/Map-scripting).");
|
||||
Console.WriteLine();
|
||||
|
||||
var tables = Game.ModData.ObjectCreator.GetTypesImplementing<ScriptGlobal>()
|
||||
var tables = utility.ModData.ObjectCreator.GetTypesImplementing<ScriptGlobal>()
|
||||
.OrderBy(t => t.Name);
|
||||
|
||||
Console.WriteLine("<h3>Global Tables</h3>");
|
||||
@@ -77,7 +77,7 @@ namespace OpenRA.Mods.Common.UtilityCommands
|
||||
|
||||
Console.WriteLine("<h3>Actor Properties / Commands</h3>");
|
||||
|
||||
var actorCategories = Game.ModData.ObjectCreator.GetTypesImplementing<ScriptActorProperties>().SelectMany(cg =>
|
||||
var actorCategories = utility.ModData.ObjectCreator.GetTypesImplementing<ScriptActorProperties>().SelectMany(cg =>
|
||||
{
|
||||
var catAttr = cg.GetCustomAttributes<ScriptPropertyGroupAttribute>(false).FirstOrDefault();
|
||||
var category = catAttr != null ? catAttr.Category : "Unsorted";
|
||||
@@ -122,7 +122,7 @@ namespace OpenRA.Mods.Common.UtilityCommands
|
||||
|
||||
Console.WriteLine("<h3>Player Properties / Commands</h3>");
|
||||
|
||||
var playerCategories = Game.ModData.ObjectCreator.GetTypesImplementing<ScriptPlayerProperties>().SelectMany(cg =>
|
||||
var playerCategories = utility.ModData.ObjectCreator.GetTypesImplementing<ScriptPlayerProperties>().SelectMany(cg =>
|
||||
{
|
||||
var catAttr = cg.GetCustomAttributes<ScriptPropertyGroupAttribute>(false).FirstOrDefault();
|
||||
var category = catAttr != null ? catAttr.Category : "Unsorted";
|
||||
|
||||
Reference in New Issue
Block a user