From d01226f41612f76b59917a67bfedeaa9b1cc6536 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Pivo=C5=88ka?= Date: Wed, 12 Jul 2023 23:33:24 +0200 Subject: [PATCH] Add map name change --- EnvimixForTmuf/EnvimixForTmufTool.cs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/EnvimixForTmuf/EnvimixForTmufTool.cs b/EnvimixForTmuf/EnvimixForTmufTool.cs index 4539301..286577b 100644 --- a/EnvimixForTmuf/EnvimixForTmufTool.cs +++ b/EnvimixForTmuf/EnvimixForTmufTool.cs @@ -35,6 +35,7 @@ public IEnumerable> Produce() }; var prevPlayerModel = map.PlayerModel; + var defaultMapName = map.MapName; for (int i = 0; i < cars.Length; i++) { @@ -57,8 +58,6 @@ public IEnumerable> Produce() if (map.Collection == "Stadium" && car == "StadiumCar") continue; } - map.PlayerModel = (car, "Vehicles", ""); - var modernCar = car switch { "American" => "DesertCar", @@ -67,12 +66,18 @@ public IEnumerable> Produce() _ => car }; - var pureFileName = $"{string.Format(Config.MapNameFormat, TextFormatter.Deformat(map.MapName), modernCar)}.Challenge.Gbx"; + map.PlayerModel = (car, "Vehicles", ""); + map.MapName = string.Format(Config.MapNameFormat, defaultMapName, modernCar); + + var pureFileName = $"{TextFormatter.Deformat(map.MapName)}.Challenge.Gbx"; var validFileName = string.Join("_", pureFileName.Split(Path.GetInvalidFileNameChars())); + // Each map executes the save method yield return new(map, $"Tracks/Envimix/{validFileName}", IsManiaPlanet: false); } + // Return to previous to temporarily fix the mutability issue map.PlayerModel = prevPlayerModel; + map.MapName = defaultMapName; } }