v0.18.15.0

This commit is contained in:
Regalis11
2022-07-14 16:54:36 +03:00
parent 497045de7e
commit 4a03ee5ab2
36 changed files with 240 additions and 151 deletions
@@ -308,6 +308,8 @@ namespace Barotrauma.MapCreatures.Behavior
private BallastFloraBranch? root;
private readonly List<Body> bodies = new List<Body>();
private bool isDead;
public readonly BallastFloraStateMachine StateMachine;
public int GrowthWarps;
@@ -1230,6 +1232,8 @@ namespace Barotrauma.MapCreatures.Behavior
public void Kill()
{
isDead = true;
foreach (var branch in Branches)
{
branch.DisconnectedFromRoot = true;
@@ -203,7 +203,7 @@ namespace Barotrauma
if (Screen.Selected == GameMain.SubEditorScreen)
{
linkedSub = CreateDummy(submarine, element, pos, id);
linkedSub.saveElement = element;
linkedSub.saveElement = new XElement(element);
linkedSub.purchasedLostShuttles = false;
}
else
@@ -215,7 +215,7 @@ namespace Barotrauma
purchasedLostShuttles =
(GameMain.GameSession?.GameMode is CampaignMode campaign && campaign.PurchasedLostShuttles) ||
element.GetAttributeBool("purchasedlostshuttle", false),
saveElement = element
saveElement = new XElement(element)
};
bool levelMatches = string.IsNullOrWhiteSpace(levelSeed) || levelData == null || levelData.Seed == levelSeed;
@@ -453,12 +453,15 @@ namespace Barotrauma
saveElement.SetAttributeValue("pos", XMLExtensions.Vector2ToString(Position - Submarine.HiddenSubPosition));
var linkedPort =
linkedTo.FirstOrDefault(lt => (lt is Item item) && item.GetComponent<DockingPort>() != null) ??
FindEntityByID(linkedToID.First()) as MapEntity;
if (linkedPort != null)
if (linkedTo.Any() || linkedToID.Any())
{
saveElement.SetAttributeValue("linkedto", linkedPort.ID);
var linkedPort =
linkedTo.FirstOrDefault(lt => (lt is Item item) && item.GetComponent<DockingPort>() != null) ??
FindEntityByID(linkedToID.First()) as MapEntity;
if (linkedPort != null)
{
saveElement.SetAttributeValue("linkedto", linkedPort.ID);
}
}
}
else
@@ -113,15 +113,23 @@ namespace Barotrauma
string teamStr = element.GetAttributeString("outpostteam", "FriendlyNPC");
Enum.TryParse(teamStr, out OutpostTeam);
ContentPath nameFile = element.GetAttributeContentPath("namefile") ?? ContentPath.FromRaw(null, "Content/Map/locationNames.txt");
try
string[] rawNamePaths = element.GetAttributeStringArray("namefile", new string[] { "Content/Map/locationNames.txt" });
names = new List<string>();
foreach (string rawPath in rawNamePaths)
{
names = File.ReadAllLines(nameFile.Value).ToList();
try
{
var path = ContentPath.FromRaw(element.ContentPackage, rawPath.Trim());
names.AddRange(File.ReadAllLines(path.Value).ToList());
}
catch (Exception e)
{
DebugConsole.ThrowError($"Failed to read name file \"rawPath\" for location type \"{Identifier}\"!", e);
}
}
catch (Exception e)
if (!names.Any())
{
DebugConsole.ThrowError("Failed to read name file for location type \"" + Identifier + "\"!", e);
names = new List<string>() { "Name file not found" };
names.Add("ERROR: No names found");
}
string[] commonnessPerZoneStrs = element.GetAttributeStringArray("commonnessperzone", Array.Empty<string>());
@@ -92,6 +92,9 @@ namespace Barotrauma
set;
}
/// <summary>
/// Note: Refreshed for loaded submarines when they are saved, when they are loaded, and on round end. If you need to refresh it, please use Submarine.CheckFuel() method!
/// </summary>
public bool LowFuel
{
get;