v0.14.6.0

This commit is contained in:
Joonas Rikkonen
2021-06-17 17:54:52 +03:00
parent 3f324b14e8
commit c27e2ea5ab
348 changed files with 13156 additions and 4266 deletions
@@ -23,7 +23,7 @@ namespace Barotrauma
HideInMenus = 2
}
public enum SubmarineType { Player, Outpost, OutpostModule, Wreck, BeaconStation }
public enum SubmarineType { Player, Outpost, OutpostModule, Wreck, BeaconStation, EnemySubmarine }
public enum SubmarineClass { Undefined, Scout, Attack, Transport, DeepDiver }
partial class SubmarineInfo : IDisposable
@@ -133,6 +133,12 @@ namespace Barotrauma
private set;
}
public int CargoCapacity
{
get;
private set;
}
public string FilePath
{
get;
@@ -261,6 +267,7 @@ namespace Barotrauma
SubmarineClass = original.SubmarineClass;
hash = !string.IsNullOrEmpty(original.FilePath) ? original.MD5Hash : null;
Dimensions = original.Dimensions;
CargoCapacity = original.CargoCapacity;
FilePath = original.FilePath;
RequiredContentPackages = new HashSet<string>(original.RequiredContentPackages);
IsFileCorrupted = original.IsFileCorrupted;
@@ -323,6 +330,7 @@ namespace Barotrauma
Tags = tags;
}
Dimensions = SubmarineElement.GetAttributeVector2("dimensions", Vector2.Zero);
CargoCapacity = SubmarineElement.GetAttributeInt("cargocapacity", -1);
RecommendedCrewSizeMin = SubmarineElement.GetAttributeInt("recommendedcrewsizemin", 0);
RecommendedCrewSizeMax = SubmarineElement.GetAttributeInt("recommendedcrewsizemax", 0);
RecommendedCrewExperience = SubmarineElement.GetAttributeString("recommendedcrewexperience", "Unknown");
@@ -511,10 +519,14 @@ namespace Barotrauma
//saving/loading ----------------------------------------------------
public bool SaveAs(string filePath, System.IO.MemoryStream previewImage = null)
{
var newElement = new XElement(SubmarineElement.Name,
SubmarineElement.Attributes().Where(a => !string.Equals(a.Name.LocalName, "previewimage", StringComparison.InvariantCultureIgnoreCase) &&
!string.Equals(a.Name.LocalName, "name", StringComparison.InvariantCultureIgnoreCase)),
var newElement = new XElement(
SubmarineElement.Name,
SubmarineElement.Attributes()
.Where(a =>
!string.Equals(a.Name.LocalName, "previewimage", StringComparison.InvariantCultureIgnoreCase) &&
!string.Equals(a.Name.LocalName, "name", StringComparison.InvariantCultureIgnoreCase)),
SubmarineElement.Elements());
if (Type == SubmarineType.OutpostModule)
{
OutpostModuleInfo.Save(newElement);
@@ -523,7 +535,6 @@ namespace Barotrauma
XDocument doc = new XDocument(newElement);
doc.Root.Add(new XAttribute("name", Name));
if (previewImage != null)
{
doc.Root.Add(new XAttribute("previewimage", Convert.ToBase64String(previewImage.ToArray())));
@@ -574,7 +585,7 @@ namespace Barotrauma
var contentPackageSubs = ContentPackage.GetFilesOfType(
GameMain.Config.AllEnabledPackages,
ContentType.Submarine, ContentType.Outpost, ContentType.OutpostModule,
ContentType.Wreck, ContentType.BeaconStation);
ContentType.Wreck, ContentType.BeaconStation, ContentType.EnemySubmarine);
for (int i = savedSubmarines.Count - 1; i >= 0; i--)
{
@@ -680,8 +691,6 @@ namespace Barotrauma
}
}
static readonly string TempFolder = Path.Combine("Submarine", "Temp");
public static XDocument OpenFile(string file)
{
return OpenFile(file, out _);
@@ -711,7 +720,7 @@ namespace Barotrauma
if (extension == ".sub")
{
System.IO.Stream stream = null;
System.IO.Stream stream;
try
{
stream = SaveUtil.DecompressFiletoStream(file);