(048b753e6) Merge branch 'dev' into human-ai
This commit is contained in:
@@ -217,6 +217,7 @@ namespace Barotrauma
|
||||
{
|
||||
return corePackageRequiredFiles.All(fileType => Files.Any(file => file.Type == fileType));
|
||||
}
|
||||
|
||||
public bool ContainsRequiredCorePackageFiles(out List<ContentType> missingContentTypes)
|
||||
{
|
||||
missingContentTypes = new List<ContentType>();
|
||||
@@ -230,6 +231,25 @@ namespace Barotrauma
|
||||
return missingContentTypes.Count == 0;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Make sure all the files defined in the content package are present
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public bool VerifyFiles(out List<string> errorMessages)
|
||||
{
|
||||
errorMessages = new List<string>();
|
||||
foreach (ContentFile file in Files)
|
||||
{
|
||||
if (!File.Exists(file.Path))
|
||||
{
|
||||
errorMessages.Add("File \"" + file.Path + "\" not found.");
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
return errorMessages.Count == 0;
|
||||
}
|
||||
|
||||
public static ContentPackage CreatePackage(string name, string path, bool corePackage)
|
||||
{
|
||||
ContentPackage newPackage = new ContentPackage()
|
||||
@@ -398,6 +418,13 @@ namespace Barotrauma
|
||||
return path == "Mods";
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Are mods allowed to install a file into the specified path. If a content package XML includes files
|
||||
/// with a prohibited path, they are treated as references to external files. For example, a mod could include
|
||||
/// some vanilla files in the XML, in which case the game will simply use the vanilla files present in the game folder.
|
||||
/// </summary>
|
||||
/// <param name="path"></param>
|
||||
/// <returns></returns>
|
||||
public static bool IsModFilePathAllowed(string path)
|
||||
{
|
||||
while (true)
|
||||
@@ -422,16 +449,6 @@ namespace Barotrauma
|
||||
return contentPackages.SelectMany(f => f.Files).Where(f => f.Type == type).Select(f => f.Path);
|
||||
}
|
||||
|
||||
public IEnumerable<string> GetFilesOfType(ContentType type)
|
||||
{
|
||||
return Files.Where(f => f.Type == type).Select(f => f.Path);
|
||||
}
|
||||
|
||||
public static IEnumerable<string> GetFilesOfType(IEnumerable<ContentPackage> contentPackages, ContentType type)
|
||||
{
|
||||
return contentPackages.SelectMany(f => f.Files).Where(f => f.Type == type).Select(f => f.Path);
|
||||
}
|
||||
|
||||
public IEnumerable<string> GetFilesOfType(ContentType type)
|
||||
{
|
||||
return Files.Where(f => f.Type == type).Select(f => f.Path);
|
||||
|
||||
Reference in New Issue
Block a user