mirror of
https://github.com/MaSzyna-EU07/StarterNG.git
synced 2026-11-19 06:55:59 +01:00
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:
@@ -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) ||
|
||||
|
||||
@@ -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())
|
||||
|
||||
Reference in New Issue
Block a user