Unstable 0.17.10.0

This commit is contained in:
Markus Isberg
2022-04-14 23:50:49 +09:00
parent 72328c29cb
commit cfe0d6cbc3
43 changed files with 624 additions and 723 deletions
@@ -262,11 +262,32 @@ namespace Barotrauma.CharacterEditor
FileSelection.OnFileSelected = (file) =>
{
string relativePath = Path.GetRelativePath(Environment.CurrentDirectory, Path.GetFullPath(file));
if (relativePath.StartsWith(ContentPackage.LocalModsDir))
{
string[] pathSplit = relativePath.Split('/', '\\');
string modDirName = $"{ContentPackage.LocalModsDir}/{pathSplit[1]}";
string selectedModDir
= (contentPackageDropDown.ListBox.SelectedData as ContentPackage)?.Dir.CleanUpPathCrossPlatform(correctFilenameCase: false)
?? "";
if (modDirName == selectedModDir)
{
relativePath = ContentPath.ModDirStr + "/" +
string.Join("/", pathSplit[2..]);
}
else
{
relativePath = string.Format(ContentPath.OtherModDirFmt,
pathSplit[1]) + "/" +
string.Join("/", pathSplit[2..]);
}
}
string destinationPath = relativePath;
//copy file to XML path if it's not located relative to the game's files
if (relativePath.StartsWith("..") ||
Path.GetPathRoot(Environment.CurrentDirectory) != Path.GetPathRoot(file))
//copy file to XML path if it's not located relative to the game's files
if (relativePath.StartsWith("..") ||
Path.GetPathRoot(Environment.CurrentDirectory) != Path.GetPathRoot(file))
{
destinationPath = Path.Combine(Path.GetDirectoryName(XMLPath), Path.GetFileName(file));
@@ -387,16 +408,20 @@ namespace Barotrauma.CharacterEditor
contentPackageDropDown.Flash();
return false;
}
string evaluatedTexturePath = ContentPath.FromRaw(
contentPackageDropDown.SelectedData as ContentPackage,
TexturePath).Value;
if (SourceCharacter?.SpeciesName != CharacterPrefab.HumanSpeciesName)
{
if (!File.Exists(TexturePath))
if (!File.Exists(evaluatedTexturePath))
{
GUI.AddMessage(GetCharacterEditorTranslation("TextureDoesNotExist"), GUIStyle.Red);
texturePathElement.Flash(GUIStyle.Red);
return false;
}
}
var path = Path.GetFileName(TexturePath);
var path = Path.GetFileName(evaluatedTexturePath);
if (!path.EndsWith(".png", StringComparison.OrdinalIgnoreCase))
{
GUI.AddMessage(TextManager.Get("WrongFileType"), GUIStyle.Red);
@@ -405,7 +430,7 @@ namespace Barotrauma.CharacterEditor
}
if (IsCopy)
{
SourceRagdoll.Texture = TexturePath;
SourceRagdoll.Texture = evaluatedTexturePath;
SourceRagdoll.CanEnterSubmarine = CanEnterSubmarine;
SourceRagdoll.CanWalk = CanWalk;
SourceRagdoll.Serialize();
@@ -748,7 +748,7 @@ namespace Barotrauma
foreach (GUITextBlock tutorialText in tutorialList.Content.Children)
{
if (((Tutorial)tutorialText.UserData).Completed)
if (CompletedTutorials.Instance.Contains(((Tutorial)tutorialText.UserData).Identifier))
{
completedTutorials++;
}
@@ -2561,27 +2561,30 @@ namespace Barotrauma
if (MainSub != null)
{
List<string> contentPacks = MainSub.Info.RequiredContentPackages.ToList();
List<string> allContentPacks = MainSub.Info.RequiredContentPackages.ToList();
foreach (ContentPackage contentPack in ContentPackageManager.AllPackages)
{
//don't show content packages that only define submarine files
//(it doesn't make sense to require another sub to be installed to install this one)
if (contentPack.Files.All(f => f is SubmarineFile)) { continue; }
if (contentPack.Files.All(f => f is SubmarineFile || f is ItemAssemblyFile)) { continue; }
if (!contentPacks.Contains(contentPack.Name))
if (!allContentPacks.Contains(contentPack.Name))
{
string altName = contentPack.AltNames.FirstOrDefault(n => contentPacks.Contains(n));
string altName = contentPack.AltNames.FirstOrDefault(n => allContentPacks.Contains(n));
if (!string.IsNullOrEmpty(altName))
{
MainSub.Info.RequiredContentPackages.Remove(altName);
MainSub.Info.RequiredContentPackages.Add(contentPack.Name);
contentPacks.Remove(altName);
if (MainSub.Info.RequiredContentPackages.Contains(altName))
{
MainSub.Info.RequiredContentPackages.Remove(altName);
MainSub.Info.RequiredContentPackages.Add(contentPack.Name);
}
allContentPacks.Remove(altName);
}
contentPacks.Add(contentPack.Name);
allContentPacks.Add(contentPack.Name);
}
}
foreach (string contentPackageName in contentPacks)
foreach (string contentPackageName in allContentPacks)
{
var cpTickBox = new GUITickBox(new RectTransform(new Vector2(0.2f, 0.2f), contentPackList.Content.RectTransform), contentPackageName, font: GUIStyle.SmallFont)
{