Merge branch 'master' of https://github.com/Regalis11/Barotrauma.git into Regalis11-master

This commit is contained in:
Evil Factory
2021-12-15 14:45:31 -03:00
388 changed files with 12646 additions and 8136 deletions
@@ -138,7 +138,7 @@ namespace Barotrauma
var newMsg = queuedMessages.Dequeue();
AddMessage(newMsg);
if (GameSettings.SaveDebugConsoleLogs)
if (GameSettings.SaveDebugConsoleLogs || GameSettings.VerboseLogging)
{
unsavedMessages.Add(newMsg);
if (unsavedMessages.Count >= messagesPerFile)
@@ -274,7 +274,10 @@ namespace Barotrauma
AddMessage(newMsg);
}
if (GameSettings.SaveDebugConsoleLogs) unsavedMessages.Add(newMsg);
if (GameSettings.SaveDebugConsoleLogs || GameSettings.VerboseLogging)
{
unsavedMessages.Add(newMsg);
}
}
}
}
@@ -537,7 +540,27 @@ namespace Barotrauma
return;
}
GameMain.MainMenuScreen.QuickStart(fixedSeed: false, subName);
float difficulty = 40;
if (args.Length > 1)
{
float.TryParse(args[1], out difficulty);
}
LevelGenerationParams levelGenerationParams = null;
if (args.Length > 2)
{
string levelGenerationIdentifier = args[2];
levelGenerationParams = LevelGenerationParams.LevelParams.FirstOrDefault(p => p.Identifier == levelGenerationIdentifier);
}
if (SubmarineInfo.SavedSubmarines.None(s => s.Name.ToLowerInvariant() == subName.ToLowerInvariant()))
{
ThrowError($"Cannot find a sub that matches the name \"{subName}\".");
return;
}
GameMain.MainMenuScreen.QuickStart(fixedSeed: false, subName, difficulty, levelGenerationParams);
}, getValidArgs: () => new[] { SubmarineInfo.SavedSubmarines.Select(s => s.Name).Distinct().ToArray() }));
commands.Add(new Command("steamnetdebug", "steamnetdebug: Toggles Steamworks networking debug logging.", (string[] args) =>
@@ -734,13 +757,10 @@ namespace Barotrauma
AssignOnExecute("teleportcharacter|teleport", (string[] args) =>
{
Character tpCharacter = (args.Length == 0) ? Character.Controlled : FindMatchingCharacter(args, false);
if (tpCharacter == null) return;
var cam = GameMain.GameScreen.Cam;
tpCharacter.AnimController.CurrentHull = null;
tpCharacter.Submarine = null;
tpCharacter.AnimController.SetPosition(ConvertUnits.ToSimUnits(cam.ScreenToWorld(PlayerInput.MousePosition)));
tpCharacter.AnimController.FindHull(cam.ScreenToWorld(PlayerInput.MousePosition), true);
if (tpCharacter != null)
{
tpCharacter.TeleportTo(GameMain.GameScreen.Cam.ScreenToWorld(PlayerInput.MousePosition));
}
});
AssignOnExecute("spawn|spawncharacter", (string[] args) =>
@@ -1413,7 +1433,7 @@ namespace Barotrauma
commands.Add(new Command("analyzeitem", "analyzeitem: Analyzes one item for exploits.", (string[] args) =>
{
if (args.Length < 1) return;
if (args.Length < 1) { return; }
List<FabricationRecipe> fabricableItems = new List<FabricationRecipe>();
foreach (ItemPrefab iPrefab in ItemPrefab.Prefabs)
@@ -1447,10 +1467,11 @@ namespace Barotrauma
{
foreach (ItemPrefab ingredientItemPrefab in ingredient.ItemPrefabs)
{
NewMessage(" Its ingredient " + ingredientItemPrefab.Name + " has base cost " + ingredientItemPrefab.DefaultPrice.Price);
totalPrice += ingredientItemPrefab.DefaultPrice.Price;
int defaultPrice = ingredientItemPrefab.DefaultPrice?.Price ?? 0;
NewMessage(" Its ingredient " + ingredientItemPrefab.Name + " has base cost " + defaultPrice);
totalPrice += defaultPrice;
totalBestPrice += ingredientItemPrefab.GetMinPrice();
int basePrice = ingredientItemPrefab.DefaultPrice.Price;
int basePrice = defaultPrice;
foreach (KeyValuePair<string, PriceInfo> ingredientItemLocationPrice in ingredientItemPrefab.GetBuyPricesUnder())
{
if (basePrice > ingredientItemLocationPrice.Value.Price)
@@ -1616,7 +1637,7 @@ namespace Barotrauma
var fabricationRecipe = fabricableItems.Find(f => f.TargetItem == parentItem);
int totalValue = 0;
NewMessage(parentItem.Name + " has the price " + parentItem.DefaultPrice.Price);
NewMessage(parentItem.Name + " has the price " + (parentItem.DefaultPrice?.Price ?? 0));
if (fabricationRecipe != null)
{
NewMessage(" It constructs from:");
@@ -1625,8 +1646,9 @@ namespace Barotrauma
{
foreach (ItemPrefab itemPrefab in requiredItem.ItemPrefabs)
{
NewMessage(" " + itemPrefab.Name + " has the price " + itemPrefab.DefaultPrice.Price);
totalValue += itemPrefab.DefaultPrice.Price;
int defaultPrice = itemPrefab.DefaultPrice?.Price ?? 0;
NewMessage(" " + itemPrefab.Name + " has the price " + defaultPrice);
totalValue += defaultPrice;
}
}
NewMessage("Its total value was: " + totalValue);
@@ -1637,10 +1659,16 @@ namespace Barotrauma
{
ItemPrefab itemPrefab =
(MapEntityPrefab.Find(deconstructItem.ItemIdentifier, identifier: null, showErrorMessages: false) ??
MapEntityPrefab.Find(null, identifier: itemNameOrId, showErrorMessages: false)) as ItemPrefab;
MapEntityPrefab.Find(null, identifier: deconstructItem.ItemIdentifier, showErrorMessages: false)) as ItemPrefab;
if (itemPrefab == null)
{
ThrowError($" Couldn't find deconstruct product \"{deconstructItem.ItemIdentifier}\"!");
continue;
}
NewMessage(" " + itemPrefab.Name + " has the price " + itemPrefab.DefaultPrice.Price);
totalValue += itemPrefab.DefaultPrice.Price;
int defaultPrice = itemPrefab.DefaultPrice?.Price ?? 0;
NewMessage(" " + itemPrefab.Name + " has the price " + defaultPrice);
totalValue += defaultPrice;
}
NewMessage("Its deconstruct value was: " + totalValue);
@@ -1792,7 +1820,7 @@ namespace Barotrauma
foreach (var talentTree in TalentTree.JobTalentTrees)
{
foreach (var talentSubTree in talentTree.Value.TalentSubTrees)
foreach (var talentSubTree in talentTree.TalentSubTrees)
{
string nameIdentifier = "talenttree." + talentSubTree.Identifier;
if (!tags[language].Contains(nameIdentifier))
@@ -1857,7 +1885,21 @@ namespace Barotrauma
commands.Add(new Command("eventstats", "", (string[] args) =>
{
var debugLines = EventSet.GetDebugStatistics();
List<string> debugLines;
if (args.Length > 0)
{
if (!Enum.TryParse(args[0], ignoreCase: true, out Level.PositionType spawnType))
{
var enums = Enum.GetNames(typeof(Level.PositionType));
ThrowError($"\"{args[0]}\" is not a valid Level.PositionType. Available options are: {string.Join(", ", enums)}");
return;
}
debugLines = EventSet.GetDebugStatistics(filter: monsterEvent => monsterEvent.SpawnPosType.HasFlag(spawnType));
}
else
{
debugLines = EventSet.GetDebugStatistics();
}
string filePath = "eventstats.txt";
Barotrauma.IO.Validation.SkipValidationInDebugBuilds = true;
File.WriteAllLines(filePath, debugLines);
@@ -2457,8 +2499,6 @@ namespace Barotrauma
NewMessage("Resolution set to 0 x 0 (screen resolution will be used)", Color.Green);
NewMessage("Fullscreen enabled", Color.Green);
GameSettings.ShowUserStatisticsPrompt = true;
GameSettings.VerboseLogging = false;
if (GameMain.Config.MasterServerUrl != "http://www.undertowgames.com/baromaster")
@@ -3134,7 +3174,7 @@ namespace Barotrauma
{
string errorMsg = "Failed to spawn a submarine. Arguments: \"" + string.Join(" ", args) + "\".";
ThrowError(errorMsg, e);
GameAnalyticsManager.AddErrorEventOnce("DebugConsole.SpawnSubmarine:Error", GameAnalyticsSDK.Net.EGAErrorSeverity.Error, errorMsg + '\n' + e.Message + '\n' + e.StackTrace.CleanupStackTrace());
GameAnalyticsManager.AddErrorEventOnce("DebugConsole.SpawnSubmarine:Error", GameAnalyticsManager.ErrorSeverity.Error, errorMsg + '\n' + e.Message + '\n' + e.StackTrace.CleanupStackTrace());
}
},
() =>