Parts of the submarine that are left behind in the level will stay there, it's possible to leave the level without the main sub (e.g. in an escape shuttle)
This commit is contained in:
@@ -145,12 +145,12 @@ namespace Barotrauma
|
||||
|
||||
if (Submarine.MainSub == null) return;
|
||||
|
||||
if (Submarine.MainSub.AtEndPosition)
|
||||
if (Submarine.Loaded.Any(s=> s.AtEndPosition))
|
||||
{
|
||||
endShiftButton.Text = "Enter " + Map.SelectedLocation.Name;
|
||||
endShiftButton.Draw(spriteBatch);
|
||||
}
|
||||
else if (Submarine.MainSub.AtStartPosition)
|
||||
else if (Submarine.Loaded.Any(s => s.AtStartPosition))
|
||||
{
|
||||
endShiftButton.Text = "Enter " + Map.CurrentLocation.Name;
|
||||
endShiftButton.Draw(spriteBatch);
|
||||
@@ -204,6 +204,24 @@ namespace Barotrauma
|
||||
Map.MoveToNextLocation();
|
||||
}
|
||||
|
||||
if (!Submarine.MainSub.AtEndPosition && !Submarine.MainSub.AtStartPosition)
|
||||
{
|
||||
Submarine newMainSub = Submarine.Loaded.Find(s => s.AtEndPosition || s.AtStartPosition);
|
||||
Submarine oldMainSub = Submarine.MainSub;
|
||||
Submarine.MainSub = newMainSub;
|
||||
|
||||
GameMain.GameSession.Submarine = newMainSub;
|
||||
|
||||
List<Submarine> subsToLeaveBehind = Submarine.Loaded.FindAll(s => s != Submarine.MainSub && !Submarine.MainSub.DockedTo.Contains(s));
|
||||
|
||||
foreach (Submarine sub in subsToLeaveBehind)
|
||||
{
|
||||
MapEntity.mapEntityList.RemoveAll(e => e.Submarine == sub && e is LinkedSubmarine);
|
||||
LinkedSubmarine.CreateDummy(newMainSub, sub);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
SaveUtil.SaveGame(GameMain.GameSession.SaveFile);
|
||||
}
|
||||
|
||||
|
||||
@@ -54,6 +54,7 @@ namespace Barotrauma
|
||||
public Submarine Submarine
|
||||
{
|
||||
get { return submarine; }
|
||||
set { submarine = value; }
|
||||
}
|
||||
|
||||
public string SaveFile
|
||||
@@ -124,7 +125,7 @@ namespace Barotrauma
|
||||
DebugConsole.ThrowError("Couldn't start game session, submarine not selected");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (reloadSub || Submarine.MainSub != submarine) submarine.Load(true);
|
||||
Submarine.MainSub = submarine;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user