Unstable 0.1300.0.9

This commit is contained in:
Markus Isberg
2021-04-13 16:58:13 +03:00
parent 86597456ca
commit f48dfb5862
30 changed files with 245 additions and 57 deletions
@@ -3598,10 +3598,13 @@ namespace Barotrauma
if (!(GameMain.NetworkMember?.IsClient ?? false))
{
//empty the reactor
foreach (Item item in reactorContainer.Inventory.AllItems)
if (reactorContainer != null)
{
if (item.NonInteractable) { continue; }
Spawner.AddToRemoveQueue(item);
foreach (Item item in reactorContainer.Inventory.AllItems)
{
if (item.NonInteractable) { continue; }
Spawner.AddToRemoveQueue(item);
}
}
//remove wires
@@ -1082,6 +1082,7 @@ namespace Barotrauma
int currentLocationConnection = element.GetAttributeInt("currentlocationconnection", -1);
if (currentLocationConnection >= 0)
{
Connections[currentLocationConnection].Locked = false;
SelectLocation(Connections[currentLocationConnection].OtherLocation(CurrentLocation));
}
else
@@ -165,10 +165,7 @@ namespace Barotrauma
if (structure.Submarine != this || !structure.HasBody || structure.Indestructible) { continue; }
realWorldCrushDepth = Math.Min(structure.CrushDepth, realWorldCrushDepth.Value);
}
if (Info.SubmarineClass == SubmarineClass.DeepDiver)
{
realWorldCrushDepth *= 1.2f;
}
realWorldCrushDepth *= Info.GetRealWorldCrushDepthMultiplier();
}
return realWorldCrushDepth.Value;
}
@@ -1060,6 +1057,7 @@ namespace Barotrauma
}
steering.MaintainPos = true;
steering.PosToMaintain = WorldPosition;
steering.AutoPilot = true;
#if SERVER
steering.UnsentChanges = true;
@@ -464,6 +464,49 @@ namespace Barotrauma
}
}
/// <summary>
/// Calculated from <see cref="SubmarineElement"/>. Can be used when the sub hasn't been loaded and we can't access <see cref="Submarine.RealWorldCrushDepth"/>.
/// </summary>
public float GetRealWorldCrushDepth()
{
if (SubmarineElement == null) { return Level.DefaultRealWorldCrushDepth; }
bool structureCrushDepthsDefined = false;
float realWorldCrushDepth = float.PositiveInfinity;
foreach (var structureElement in SubmarineElement.GetChildElements("structure"))
{
string name = structureElement.Attribute("name")?.Value ?? "";
string identifier = structureElement.GetAttributeString("identifier", "");
var structurePrefab = Structure.FindPrefab(name, identifier);
if (structurePrefab == null || !structurePrefab.Body) { continue; }
if (!structureCrushDepthsDefined && structureElement.Attribute("crushdepth") != null)
{
structureCrushDepthsDefined = true;
}
float structureCrushDepth = structureElement.GetAttributeFloat("crushdepth", float.PositiveInfinity);
realWorldCrushDepth = Math.Min(structureCrushDepth, realWorldCrushDepth);
}
if (!structureCrushDepthsDefined)
{
realWorldCrushDepth = Level.DefaultRealWorldCrushDepth;
}
realWorldCrushDepth *= GetRealWorldCrushDepthMultiplier();
return realWorldCrushDepth;
}
/// <summary>
/// Based on <see cref="SubmarineClass"/>
/// </summary>
public float GetRealWorldCrushDepthMultiplier()
{
if (SubmarineClass == SubmarineClass.DeepDiver)
{
return 1.2f;
}
else
{
return 1.0f;
}
}
//saving/loading ----------------------------------------------------
public bool SaveAs(string filePath, System.IO.MemoryStream previewImage = null)