(bf212a41f) v0.9.2.0 pre-release test version

This commit is contained in:
Joonas Rikkonen
2019-07-27 21:06:07 +03:00
parent afa2137bd2
commit 0f63da27b2
154 changed files with 3959 additions and 1428 deletions
@@ -745,6 +745,12 @@ namespace Barotrauma
private static readonly Dictionary<Body, float> bodyDist = new Dictionary<Body, float>();
private static readonly List<Body> bodies = new List<Body>();
public static float LastPickedBodyDist(Body body)
{
if (!bodyDist.ContainsKey(body)) { return 0.0f; }
return bodyDist[body];
}
/// <summary>
/// Returns a list of physics bodies the ray intersects with, sorted according to distance (the closest body is at the beginning of the list).
/// </summary>
@@ -1067,16 +1073,14 @@ namespace Barotrauma
//Level.Loaded.Move(-amount);
}
public static Submarine FindClosest(Vector2 worldPosition, bool ignoreOutposts = false)
public static Submarine FindClosest(Vector2 worldPosition, bool ignoreOutposts = false, bool ignoreOutsideLevel = true)
{
Submarine closest = null;
float closestDist = 0.0f;
foreach (Submarine sub in loaded)
{
if (ignoreOutposts && sub.IsOutpost)
{
continue;
}
if (ignoreOutposts && sub.IsOutpost) { continue; }
if (ignoreOutsideLevel && Level.Loaded != null && sub.WorldPosition.Y > Level.Loaded.Size.Y) { continue; }
float dist = Vector2.DistanceSquared(worldPosition, sub.WorldPosition);
if (closest == null || dist < closestDist)
{
@@ -1209,7 +1213,34 @@ namespace Barotrauma
foreach (string path in filePaths)
{
var sub = new Submarine(path);
if (!sub.IsFileCorrupted)
if (sub.IsFileCorrupted)
{
#if CLIENT
if (DebugConsole.IsOpen) { DebugConsole.Toggle(); }
var deleteSubPrompt = new GUIMessageBox(
TextManager.Get("Error"),
TextManager.GetWithVariable("SubLoadError", "[subname]", sub.name) +"\n"+
TextManager.GetWithVariable("DeleteFileVerification", "[filename]", sub.name),
new string[] { TextManager.Get("Yes"), TextManager.Get("No") });
string filePath = path;
deleteSubPrompt.Buttons[0].OnClicked += (btn, userdata) =>
{
try
{
File.Delete(filePath);
}
catch (Exception e)
{
DebugConsole.ThrowError($"Failed to delete file \"{filePath}\".", e);
}
deleteSubPrompt.Close();
return true;
};
deleteSubPrompt.Buttons[1].OnClicked += deleteSubPrompt.Close;
#endif
}
else
{
savedSubmarines.Add(sub);
}
@@ -1621,7 +1652,6 @@ namespace Barotrauma
if (wp.isObstructed) { continue; }
foreach (var connection in node.connections)
{
bool isObstructed = false;
var connectedWp = connection.Waypoint;
if (connectedWp.isObstructed) { continue; }
Vector2 start = ConvertUnits.ToSimUnits(wp.WorldPosition);
@@ -1652,7 +1682,6 @@ namespace Barotrauma
if (wp.isObstructed) { continue; }
foreach (var connection in node.connections)
{
bool isObstructed = false;
var connectedWp = connection.Waypoint;
if (connectedWp.isObstructed) { continue; }
Vector2 start = ConvertUnits.ToSimUnits(wp.WorldPosition) - otherSub.SimPosition;