Map renderer rework (#37306)
* Update TilePainter.cs * Add support for custom offsets, grid files, and markers * Dynamic file category handling
This commit is contained in:
@@ -106,34 +106,7 @@ namespace Content.MapRenderer
|
||||
|
||||
if (arguments.ArgumentsAreFileNames)
|
||||
{
|
||||
Console.WriteLine("Retrieving map ids by map file names...");
|
||||
|
||||
Console.Write("Fetching map prototypes... ");
|
||||
await using var pair = await PoolManager.GetServerClient();
|
||||
var mapPrototypes = pair.Server
|
||||
.ResolveDependency<IPrototypeManager>()
|
||||
.EnumeratePrototypes<GameMapPrototype>()
|
||||
.ToArray();
|
||||
Console.WriteLine("[Done]");
|
||||
|
||||
var ids = new List<string>();
|
||||
|
||||
foreach (var mapPrototype in mapPrototypes)
|
||||
{
|
||||
if (arguments.Maps.Contains(mapPrototype.MapPath.Filename))
|
||||
{
|
||||
ids.Add(mapPrototype.ID);
|
||||
Console.WriteLine($"Found map: {mapPrototype.MapName}");
|
||||
}
|
||||
}
|
||||
|
||||
if (ids.Count == 0)
|
||||
{
|
||||
await Console.Error.WriteLineAsync("Found no maps for the given file names!");
|
||||
return;
|
||||
}
|
||||
|
||||
arguments.Maps = ids;
|
||||
Console.WriteLine("Retrieving maps by file names...");
|
||||
}
|
||||
|
||||
await Run(arguments);
|
||||
@@ -156,12 +129,14 @@ namespace Content.MapRenderer
|
||||
};
|
||||
|
||||
mapViewerData.ParallaxLayers.Add(LayerGroup.DefaultParallax());
|
||||
var directory = Path.Combine(arguments.OutputPath, map);
|
||||
var directory = Path.Combine(arguments.OutputPath, Path.GetFileNameWithoutExtension(map));
|
||||
|
||||
var i = 0;
|
||||
try
|
||||
{
|
||||
await foreach (var renderedGrid in MapPainter.Paint(map))
|
||||
await foreach (var renderedGrid in MapPainter.Paint(map,
|
||||
arguments.ArgumentsAreFileNames,
|
||||
arguments.ShowMarkers))
|
||||
{
|
||||
var grid = renderedGrid.Image;
|
||||
Directory.CreateDirectory(directory);
|
||||
|
||||
Reference in New Issue
Block a user