Tell apart the halves of a unit that share one skin

The ET42-026 dresses both halves in 112E-026 and the scenery tells them apart
by the model. Textures were keyed by the skin alone, so the B half became a
second A: not part of the set, and listed on its own. A shared skin now gets
the model in its id, vehicles are looked up by skin and model, and the
vehicle cache is rebuilt for the new ids.
This commit is contained in:
maj00r
2026-10-04 19:05:32 +02:00
parent 37dd038b96
commit e5c46d23ea
12 changed files with 99 additions and 30 deletions

View File

@@ -8,6 +8,9 @@ public sealed class TexturesTxtParser
{
private const string DeriveCategory = "*";
/// <summary>Goes into the vehicle cache stamp, so a change to what is parsed rebuilds the cache.</summary>
public const int Version = 2;
public VehicleEntry? Parse(string directory, IReadOnlyList<string> lines)
{
var entry = new VehicleEntry { Uuid = "legacy:" + directory };
@@ -133,9 +136,16 @@ public sealed class TexturesTxtParser
Implicit = true
});
// One skin may dress several models - the ET42-026 has a single 112E-026 for
// both halves - and the scenery tells them apart by the model, so the later
// ones are named by it as well, or they would all be the first.
string uuid = $"legacy:{directory}{skin}";
if (entry.Textures.Exists(t => string.Equals(t.Skinfile, skin, StringComparison.OrdinalIgnoreCase)))
uuid += "#" + lead.Model;
var texture = new VehicleTexture
{
Uuid = $"legacy:{directory}{skin}",
Uuid = uuid,
Directory = directory,
Skinfile = skin,
Wreck = skin.Contains("wreck", StringComparison.OrdinalIgnoreCase) ||

View File

@@ -79,7 +79,8 @@ public sealed class VehicleCacheRepository : IVehicleRepository
/// </summary>
private (string Text, int Sources) Stamp()
{
var stamp = new StringBuilder().Append("root|").Append(Path.GetFullPath(_paths.Root)).Append('\n');
var stamp = new StringBuilder().Append("root|").Append(Path.GetFullPath(_paths.Root)).Append('\n')
.Append("parser|").Append(TexturesTxtParser.Version).Append('\n');
int sources = 0;
foreach (string path in _legacy.Sources())