Skip to content

Commit

Permalink
Add map name change
Browse files Browse the repository at this point in the history
  • Loading branch information
BigBang1112 committed Jul 12, 2023
1 parent 0f695a9 commit d01226f
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions EnvimixForTmuf/EnvimixForTmufTool.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ public IEnumerable<NodeFile<CGameCtnChallenge>> Produce()
};

var prevPlayerModel = map.PlayerModel;
var defaultMapName = map.MapName;

for (int i = 0; i < cars.Length; i++)
{
Expand All @@ -57,8 +58,6 @@ public IEnumerable<NodeFile<CGameCtnChallenge>> Produce()
if (map.Collection == "Stadium" && car == "StadiumCar") continue;
}

map.PlayerModel = (car, "Vehicles", "");

var modernCar = car switch
{
"American" => "DesertCar",
Expand All @@ -67,12 +66,18 @@ public IEnumerable<NodeFile<CGameCtnChallenge>> 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;
}
}

0 comments on commit d01226f

Please sign in to comment.