Skip to content
This repository has been archived by the owner on Jan 6, 2022. It is now read-only.

Commit

Permalink
Fixed issue where mod would load primary car color as secondary
Browse files Browse the repository at this point in the history
  • Loading branch information
REHERC committed Dec 25, 2020
1 parent 85bc3b5 commit e904260
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions Distance.CustomCar/ProfileCarColors.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,21 +19,18 @@ protected void Load()
protected void Awake()
{
Load();

Save();
}

protected Section Profile(string profileName)
{
Section profile = Config.GetOrCreate(profileName, new Section());
Save();
return profile;
}

protected Section Vehicle(string profileName, string vehicleName)
{
Section vehicle = Profile(profileName).GetOrCreate(vehicleName, new Section());
Save();
return vehicle;
}

Expand All @@ -43,12 +40,11 @@ protected CarColors GetCarColors(string profileName, string vehicleName)
CarColors colors = new CarColors
{
primary_ = GetColor(vehicle, "primary", Colors.whiteSmoke),
secondary_ = GetColor(vehicle, "primary", Colors.darkGray),
secondary_ = GetColor(vehicle, "secondary", Colors.darkGray),
glow_ = GetColor(vehicle, "glow", Colors.cyan),
sparkle_ = GetColor(vehicle, "sparkle", Colors.lightSlateGray)
};
SetCarColors(profileName, vehicleName, colors);
Save();
return colors;
}

Expand Down Expand Up @@ -77,8 +73,6 @@ protected void SetCarColors(string profileName, string vehicleName, CarColors co
profile[vehicleName] = vehicle;

Config[profileName] = profile;

Save();
}

protected Section ToSection(Color color)
Expand All @@ -90,7 +84,6 @@ protected Section ToSection(Color color)
["b"] = color.b,
["a"] = color.a
};
Save();
return section;
}

Expand Down Expand Up @@ -148,6 +141,8 @@ public void SaveAll()
SetCarColors(currentProfile.FileName_, carInfo.name_, colors);
}
}

Save();
}
}
}

0 comments on commit e904260

Please sign in to comment.