v0.10.5.1

This commit is contained in:
Juan Pablo Arce
2020-09-22 11:31:56 -03:00
parent 44032d0ae0
commit 0002ad2c50
343 changed files with 12276 additions and 5023 deletions
@@ -115,7 +115,7 @@ namespace Barotrauma
{
get
{
availableMissions.RemoveAll(m => m.Completed);
availableMissions.RemoveAll(m => m.Completed || m.Failed);
return availableMissions;
}
}
@@ -6,6 +6,7 @@ using System.Globalization;
using Barotrauma.IO;
using System.Linq;
using System.Xml.Linq;
using Barotrauma.Extensions;
namespace Barotrauma
{
@@ -207,6 +208,16 @@ namespace Barotrauma
{
List.Clear();
var locationTypeFiles = GameMain.Instance.GetFilesOfType(ContentType.LocationTypes);
if (!locationTypeFiles.Any())
{
DebugConsole.ThrowError("No location types configured in any of the selected content packages. Attempting to load from the vanilla content package...");
locationTypeFiles = ContentPackage.GetFilesOfType(GameMain.VanillaContent.ToEnumerable(), ContentType.LocationTypes);
if (!locationTypeFiles.Any())
{
throw new Exception("No location types configured in any of the selected content packages. Please try uninstalling mods or reinstalling the game.");
}
}
foreach (ContentFile file in locationTypeFiles)
{
XDocument doc = XMLExtensions.TryLoadXml(file.Path);
@@ -8,7 +8,9 @@ using Voronoi2;
namespace Barotrauma
{
partial class Map
{
{
public bool AllowDebugTeleport;
private readonly MapGenerationParams generationParams;
private Location furthestDiscoveredLocation;
@@ -112,7 +114,15 @@ namespace Barotrauma
}
else
{
DebugConsole.ThrowError("Error while loading the map (start location index out of bounds).");
DebugConsole.AddWarning($"Error while loading the map. Start location index out of bounds (index: {startLocationindex}, location count: {Locations.Count}).");
foreach (Location location in Locations)
{
if (!location.Type.HasOutpost) { continue; }
if (StartLocation == null || location.MapPosition.X < StartLocation.MapPosition.X)
{
StartLocation = location;
}
}
}
int endLocationindex = element.GetAttributeInt("endlocation", -1);
if (endLocationindex > 0 && endLocationindex < Locations.Count)
@@ -121,7 +131,7 @@ namespace Barotrauma
}
else
{
DebugConsole.ThrowError("Error while loading the map (end location index out of bounds).");
DebugConsole.AddWarning($"Error while loading the map. End location index out of bounds (index: {endLocationindex}, location count: {Locations.Count}).");
foreach (Location location in Locations)
{
if (EndLocation == null || location.MapPosition.X > EndLocation.MapPosition.X)
@@ -166,6 +176,7 @@ namespace Barotrauma
CurrentLocation = StartLocation = furthestDiscoveredLocation = location;
}
}
System.Diagnostics.Debug.Assert(StartLocation != null, "Start location not assigned after level generation.");
CurrentLocation.CreateStore();
CurrentLocation.Discovered = true;
@@ -640,7 +651,24 @@ namespace Barotrauma
}
}
public void ProgressWorld()
public void ProgressWorld(CampaignMode.TransitionType transitionType, float roundDuration)
{
//one step per 10 minutes of play time
int steps = (int)Math.Floor(roundDuration / (60.0f * 10.0f));
if (transitionType == CampaignMode.TransitionType.ProgressToNextLocation ||
transitionType == CampaignMode.TransitionType.ProgressToNextEmptyLocation)
{
//at least one step when progressing to the next location, regardless of how long the round took
steps = Math.Max(1, steps);
}
steps = Math.Min(steps, 5);
for (int i = 0; i < steps; i++)
{
ProgressWorld();
}
}
private void ProgressWorld()
{
foreach (Location location in Locations)
{
@@ -651,6 +679,8 @@ namespace Barotrauma
furthestDiscoveredLocation = location;
}
if (location == CurrentLocation || location == SelectedLocation) { continue; }
//find which types of locations this one can change to
List<LocationTypeChange> allowedTypeChanges = new List<LocationTypeChange>();
List<LocationTypeChange> readyTypeChanges = new List<LocationTypeChange>();
@@ -844,6 +874,15 @@ namespace Barotrauma
{
SelectLocation(Connections[currentLocationConnection].OtherLocation(CurrentLocation));
}
else
{
//this should not be possible, you can't enter non-outpost locations (= natural formations)
if (CurrentLocation != null && !CurrentLocation.Type.HasOutpost && SelectedConnection == null)
{
DebugConsole.AddWarning($"Error while loading campaign map state. Submarine in a location with no outpost ({CurrentLocation.Name}). Loading the first adjacent connection...");
SelectLocation(CurrentLocation.Connections[0].OtherLocation(CurrentLocation));
}
}
}
public void Save(XElement element)
@@ -128,7 +128,7 @@ namespace Barotrauma
public static void Init()
{
var files = ContentPackage.GetFilesOfType(GameMain.Config.SelectedContentPackages, ContentType.MapGenerationParameters);
var files = ContentPackage.GetFilesOfType(GameMain.Config.AllEnabledPackages, ContentType.MapGenerationParameters);
if (!files.Any())
{
DebugConsole.ThrowError("No map generation parameters found in the selected content packages!");