diff --git a/GameRealisticMap.Arma3.CommandLine/GenerateObjectLayerOptions.cs b/GameRealisticMap.Arma3.CommandLine/GenerateObjectLayerOptions.cs index 0875a02c..ecad1861 100644 --- a/GameRealisticMap.Arma3.CommandLine/GenerateObjectLayerOptions.cs +++ b/GameRealisticMap.Arma3.CommandLine/GenerateObjectLayerOptions.cs @@ -8,7 +8,7 @@ internal class GenerateObjectLayerOptions : MapOptionsBase [Option('l', "layer", Required = true, HelpText = "Requested layer")] public string LayerName { get; set; } = string.Empty; - [Option('t', "target", Required = true, HelpText = "Target directpry")] + [Option('t', "target", Required = true, HelpText = "Target directory")] public string TargetDirectory { get; set; } = string.Empty; } } diff --git a/GameRealisticMap.Arma3.CommandLine/GenerateTerrainBuilderOptions.cs b/GameRealisticMap.Arma3.CommandLine/GenerateTerrainBuilderOptions.cs new file mode 100644 index 00000000..d435a029 --- /dev/null +++ b/GameRealisticMap.Arma3.CommandLine/GenerateTerrainBuilderOptions.cs @@ -0,0 +1,11 @@ +using CommandLine; + +namespace GameRealisticMap.Arma3.CommandLine +{ + [Verb("gentb")] + internal class GenerateTerrainBuilderOptions : MapOptionsBase + { + [Option('t', "target", Required = true, HelpText = "Target directory")] + public string TargetDirectory { get; set; } = string.Empty; + } +} \ No newline at end of file diff --git a/GameRealisticMap.Arma3.CommandLine/Program.cs b/GameRealisticMap.Arma3.CommandLine/Program.cs index 602af882..251a7c93 100644 --- a/GameRealisticMap.Arma3.CommandLine/Program.cs +++ b/GameRealisticMap.Arma3.CommandLine/Program.cs @@ -10,11 +10,12 @@ static async Task Main(string[] args) { try { - return await Parser.Default.ParseArguments(args) + return await Parser.Default.ParseArguments(args) .MapResult( (GenerateObjectLayerOptions opts) => GenerateObjectLayer(opts), (GenerateWrpOptions opts) => GenerateWrp(opts), (GenerateModOptions opts) => GenerateMod(opts), + (GenerateTerrainBuilderOptions opts) => GenerateTerrainBuilder(opts), errs => Task.FromResult(1)); } catch (Exception ex) @@ -24,6 +25,15 @@ static async Task Main(string[] args) } } + private static async Task GenerateTerrainBuilder(GenerateTerrainBuilderOptions opts) + { + using var workspace = await opts.CreateWorkspace(); + var generator = new Arma3TerrainBuilderGenerator(workspace.Assets, workspace.ProjectDrive); + Directory.CreateDirectory(opts.TargetDirectory); + await generator.GenerateTerrainBuilderFiles(workspace.Progress, workspace.MapConfig, opts.TargetDirectory); + return 0; + } + private static async Task GenerateObjectLayer(GenerateObjectLayerOptions opts) { using var workspace = await opts.CreateWorkspace(); diff --git a/GameRealisticMap.Arma3/GameEngine/DependencyUnpacker.cs b/GameRealisticMap.Arma3/GameEngine/DependencyUnpacker.cs index c623d4a8..4e16b952 100644 --- a/GameRealisticMap.Arma3/GameEngine/DependencyUnpacker.cs +++ b/GameRealisticMap.Arma3/GameEngine/DependencyUnpacker.cs @@ -41,6 +41,10 @@ private List GetRequiredFiles(IEnumerable usedModels) private void UnpackFiles(IProgressTask progress, IReadOnlyCollection files) { + if (!OperatingSystem.IsWindows()) + { + return; // Unsupported on Linux + } using var report = progress.CreateStep("UnpackFiles", files.Count); foreach (var model in files) { diff --git a/GameRealisticMap.Arma3/IO/ProjectDrive.cs b/GameRealisticMap.Arma3/IO/ProjectDrive.cs index 3257b14c..5c313ef1 100644 --- a/GameRealisticMap.Arma3/IO/ProjectDrive.cs +++ b/GameRealisticMap.Arma3/IO/ProjectDrive.cs @@ -48,10 +48,6 @@ private string ToRelativePhysicalPath(string gamePath) public bool EnsureLocalFileCopy(string path) { - if (!OperatingSystem.IsWindows()) - { - return true; // Unsupported on Linux - } var fullPath = GetFullPath(path); if (File.Exists(fullPath)) {