Release v0.15.12.0

This commit is contained in:
Joonas Rikkonen
2021-10-27 18:50:57 +03:00
parent bf95e82d80
commit 234fb6bc06
450 changed files with 26042 additions and 10457 deletions
@@ -249,6 +249,17 @@ namespace Barotrauma
get { return subBody?.HullVertices; }
}
private int? submarineSpecificIDTag;
public int SubmarineSpecificIDTag
{
get
{
submarineSpecificIDTag ??= ToolBox.StringToInt((Level.Loaded?.Seed ?? "") + Info.Name);
return submarineSpecificIDTag.Value;
}
}
public bool AtDamageDepth
{
get
@@ -329,48 +340,6 @@ namespace Barotrauma
DockedTo.ForEach(s => s.ShowSonarMarker = false);
PhysicsBody.FarseerBody.BodyType = BodyType.Static;
TeamID = CharacterTeamType.None;
string defaultTag = Level.Loaded.GetWreckIDTag("wreck_id", this);
ReplaceIDCardTagRequirements("wreck_id", defaultTag);
foreach (Item item in Item.ItemList)
{
if (item.Submarine != this) { continue; }
if (item.prefab.Identifier == "idcardwreck" || item.prefab.Identifier == "idcard")
{
foreach (string tag in item.GetTags().ToList())
{
if (tag == "smallitem") { continue; }
string newTag = Level.Loaded.GetWreckIDTag(tag, this);
item.ReplaceTag(tag, newTag);
ReplaceIDCardTagRequirements(tag, newTag);
}
}
}
void ReplaceIDCardTagRequirements(string oldTag, string newTag)
{
foreach (Item item in Item.ItemList)
{
if (item.Submarine != this) { continue; }
foreach (ItemComponent ic in item.Components)
{
ReplaceIDCardTagRequirement(ic, RelatedItem.RelationType.Picked, oldTag, newTag);
ReplaceIDCardTagRequirement(ic, RelatedItem.RelationType.Equipped, oldTag, newTag);
}
}
}
static void ReplaceIDCardTagRequirement(ItemComponent ic, RelatedItem.RelationType relationType, string oldTag, string newTag)
{
if (!ic.requiredItems.ContainsKey(relationType)) { return; }
foreach (RelatedItem requiredItem in ic.requiredItems[relationType])
{
int index = Array.IndexOf(requiredItem.Identifiers, oldTag);
if (index == -1) { continue; }
requiredItem.Identifiers[index] = newTag;
}
}
}
public WreckAI WreckAI { get; private set; }
@@ -945,9 +914,11 @@ namespace Barotrauma
mapEntity.Move(-HiddenSubPosition);
}
var prevBodyType = subBody.Body.BodyType;
Vector2 pos = new Vector2(subBody.Position.X, subBody.Position.Y);
subBody.Body.Remove();
subBody = new SubmarineBody(this);
subBody.Body.BodyType = prevBodyType;
SetPosition(pos, new List<Submarine>(parents.Where(p => p != this)));
if (entityGrid != null)
@@ -1460,6 +1431,11 @@ namespace Barotrauma
}
}
}
else if (info.IsRuin)
{
ShowSonarMarker = false;
PhysicsBody.FarseerBody.BodyType = BodyType.Static;
}
}
if (entityGrid != null)
@@ -1718,7 +1694,10 @@ namespace Barotrauma
PhysicsBody.RemoveAll();
GameMain.World.Clear();
GameMain.World?.Clear();
GameMain.World = null;
GC.Collect();
Unloading = false;
}
@@ -1730,6 +1709,9 @@ namespace Barotrauma
subBody?.Remove();
subBody = null;
outdoorNodes?.Clear();
outdoorNodes = null;
if (GameMain.GameSession?.Campaign?.UpgradeManager != null)
{
GameMain.GameSession.Campaign.UpgradeManager.OnUpgradesChanged -= ResetCrushDepth;
@@ -1743,8 +1725,8 @@ namespace Barotrauma
visibleEntities = null;
if (MainSub == this) MainSub = null;
if (MainSubs[1] == this) MainSubs[1] = null;
if (MainSub == this) { MainSub = null; }
if (MainSubs[1] == this) { MainSubs[1] = null; }
ConnectedDockingPorts?.Clear();