(2402e736e) Tester's build, January 25th 2020

This commit is contained in:
Joonas Rikkonen
2020-01-25 12:48:13 +02:00
parent 4a58987eae
commit eaa18a20a3
57 changed files with 710 additions and 139 deletions
@@ -980,8 +980,7 @@ namespace Barotrauma
public void GiveJobItems(WayPoint spawnPoint = null)
{
if (info == null || info.Job == null) return;
if (info == null || info.Job == null) { return; }
info.Job.GiveJobItems(this, spawnPoint);
}
@@ -420,7 +420,7 @@ namespace Barotrauma
if (logging)
{
var fileMd5 = new Md5Hash(hash);
DebugConsole.NewMessage(" " + file.Path + ": " + fileMd5.ShortHash);
DebugConsole.NewMessage(" " + file.Path + ": " + fileMd5.Hash);
}
hashes.Add(hash);
}
@@ -440,7 +440,7 @@ namespace Barotrauma
md5Hash = new Md5Hash(bytes);
if (logging)
{
DebugConsole.NewMessage("****************************** Package hash: " + md5Hash.ShortHash);
DebugConsole.NewMessage("****************************** Package hash: " + md5Hash.Hash);
}
}
@@ -470,6 +470,14 @@ namespace Barotrauma
break;
}
if (filePaths.Count > 1)
{
using (MD5 tempMd5 = MD5.Create())
{
filePaths = filePaths.OrderBy(f => ToolBox.StringToUInt32Hash(f.CleanUpPathCrossPlatform(true), tempMd5)).ToList();
}
}
foreach (string filePath in filePaths)
{
if (!File.Exists(filePath)) continue;
@@ -489,6 +489,14 @@ namespace Barotrauma
}
}));
commands.Add(new Command("dumptofile", "", (string[] args) =>
{
string filename = "consoleOutput.txt";
if (args.Length > 0) { filename = string.Join(" ", args); }
File.WriteAllLines(filename, Messages.Select(m => m.Text).ToArray());
}));
commands.Add(new Command("findentityids", "findentityids [entityname]", (string[] args) =>
{
if (args.Length == 0) return;
@@ -924,6 +932,12 @@ namespace Barotrauma
}));
commands.Add(new Command("difficulty|leveldifficulty", "difficulty [0-100]: Change the level difficulty setting in the server lobby.", null));
commands.Add(new Command("autoitemplacerdebug|outfitdebug", "autoitemplacerdebug: Toggle automatic item placer debug info on/off. The automatically placed items are listed in the debug console at the start of a round.", (string[] args) =>
{
AutoItemPlacer.OutputDebugInfo = !AutoItemPlacer.OutputDebugInfo;
NewMessage((AutoItemPlacer.OutputDebugInfo ? "Enabled" : "Disabled") + " automatic item placer logging.", Color.White);
}, isCheat: false));
commands.Add(new Command("verboselogging", "verboselogging: Toggle verbose console logging on/off. When on, additional debug information is written to the debug console.", (string[] args) =>
{
@@ -1373,10 +1387,7 @@ namespace Barotrauma
var variant = job != null ? Rand.Range(0, job.Variants, Rand.RandSync.Server) : 0;
CharacterInfo characterInfo = new CharacterInfo(CharacterPrefab.HumanSpeciesName, jobPrefab: job, variant: variant);
spawnedCharacter = Character.Create(characterInfo, spawnPosition, ToolBox.RandomSeed(8));
if (job != null)
{
spawnedCharacter.GiveJobItems(spawnPoint);
}
spawnedCharacter.GiveJobItems(spawnPoint);
if (GameMain.GameSession != null)
{
@@ -10,6 +10,8 @@ namespace Barotrauma
{
private static readonly List<Item> spawnedItems = new List<Item>();
public static bool OutputDebugInfo = false;
public static void PlaceIfNeeded(GameMode gameMode)
{
if (GameMain.NetworkMember != null && !GameMain.NetworkMember.IsServer) { return; }
@@ -82,14 +84,24 @@ namespace Barotrauma
// Spawn items that don't have containers last
prefabsWithoutContainer.Randomize().ForEach(i => SpawnItems(i));
DebugConsole.NewMessage("Automatically placed items: ");
foreach (string itemName in spawnedItems.Select(it => it.Name).Distinct())
if (OutputDebugInfo)
{
DebugConsole.NewMessage(" - " + itemName + " x" + spawnedItems.Count(it => it.Name == itemName));
DebugConsole.NewMessage("Automatically placed items: ");
foreach (string itemName in spawnedItems.Select(it => it.Name).Distinct())
{
DebugConsole.NewMessage(" - " + itemName + " x" + spawnedItems.Count(it => it.Name == itemName));
}
}
bool SpawnItems(ItemPrefab itemPrefab)
{
if (itemPrefab == null)
{
string errorMsg = "Error in AutoItemPlacer.SpawnItems - itemPrefab was null.\n"+Environment.StackTrace;
DebugConsole.ThrowError(errorMsg);
GameAnalyticsManager.AddErrorEventOnce("AutoItemPlacer.SpawnItems:ItemNull", GameAnalyticsSDK.Net.EGAErrorSeverity.Error, errorMsg);
return false;
}
bool success = false;
foreach (PreferredContainer preferredContainer in itemPrefab.PreferredContainers)
{
@@ -907,6 +907,7 @@ namespace Barotrauma
new XAttribute("width", GraphicsWidth),
new XAttribute("height", GraphicsHeight),
new XAttribute("vsync", VSyncEnabled),
new XAttribute("framelimit", Timing.FrameLimit),
new XAttribute("displaymode", windowMode));
}
@@ -1228,6 +1229,7 @@ namespace Barotrauma
new XAttribute("width", GraphicsWidth),
new XAttribute("height", GraphicsHeight),
new XAttribute("vsync", VSyncEnabled),
new XAttribute("framelimit", Timing.FrameLimit),
new XAttribute("displaymode", windowMode));
}
@@ -1423,6 +1425,7 @@ namespace Barotrauma
GraphicsWidth = graphicsMode.GetAttributeInt("width", GraphicsWidth);
GraphicsHeight = graphicsMode.GetAttributeInt("height", GraphicsHeight);
VSyncEnabled = graphicsMode.GetAttributeBool("vsync", VSyncEnabled);
Timing.FrameLimit = graphicsMode.GetAttributeInt("framelimit", 200);
XElement graphicsSettings = doc.Root.Element("graphicssettings");
ParticleLimit = graphicsSettings.GetAttributeInt("particlelimit", ParticleLimit);
@@ -1504,6 +1507,7 @@ namespace Barotrauma
GraphicsWidth = 0;
GraphicsHeight = 0;
VSyncEnabled = true;
Timing.FrameLimit = 200;
#if DEBUG
EnableSplashScreen = false;
#else
@@ -1283,7 +1283,7 @@ namespace Barotrauma
}
}
ApplyStatusEffects(ActionType.Always, deltaTime, null);
ApplyStatusEffects(ActionType.Always, deltaTime, character: (parentInventory as CharacterInventory)?.Owner as Character);
for (int i = 0; i < updateableComponents.Count; i++)
{
@@ -1306,7 +1306,7 @@ namespace Barotrauma
#endif
ic.WasUsed = false;
ic.ApplyStatusEffects(parentInventory == null ? ActionType.OnNotContained : ActionType.OnContained, deltaTime);
ic.ApplyStatusEffects(parentInventory == null ? ActionType.OnNotContained : ActionType.OnContained, deltaTime, character: (parentInventory as CharacterInventory)?.Owner as Character);
if (ic.IsActive)
{
@@ -228,7 +228,9 @@ namespace Barotrauma
if (hulls[i] == null) hulls[i] = Hull.FindHullOld(searchPos[i], null, false, true);
}
if (hulls[0] == null && hulls[1] == null) return;
if (hulls[1] == hulls[0]) { hulls[1] = null; }
if (hulls[0] == null && hulls[1] == null) { return; }
if (hulls[0] == null && hulls[1] != null)
{
@@ -619,7 +619,10 @@ namespace Barotrauma
if (Bodies != null)
{
foreach (Body b in Bodies)
{
GameMain.World.Remove(b);
}
Bodies.Clear();
}
if (Sections != null)
@@ -648,7 +651,10 @@ namespace Barotrauma
if (Bodies != null)
{
foreach (Body b in Bodies)
{
GameMain.World.Remove(b);
}
Bodies.Clear();
}
if (Sections != null)
@@ -14,6 +14,7 @@ namespace Barotrauma.Networking
private static Stream writeStream;
private static Stream readStream;
private static volatile bool shutDown;
private static ManualResetEvent writeManualResetEvent;
private static byte[] tempBytes;
private enum ReadState
@@ -49,6 +50,8 @@ namespace Barotrauma.Networking
readCancellationToken = new CancellationTokenSource();
writeManualResetEvent = new ManualResetEvent(false);
readThread = new Thread(UpdateRead);
writeThread = new Thread(UpdateWrite);
readThread.Start();
@@ -58,6 +61,7 @@ namespace Barotrauma.Networking
private static void PrivateShutDown()
{
shutDown = true;
writeManualResetEvent.Set();
readCancellationToken?.Cancel();
readThread?.Join(); readThread = null;
writeThread?.Join(); writeThread = null;
@@ -152,7 +156,11 @@ namespace Barotrauma.Networking
msgAvailable = msgsToWrite.TryDequeue(out msg);
}
}
Thread.Yield();
if (!shutDown)
{
writeManualResetEvent.Reset();
writeManualResetEvent.WaitOne();
}
}
}
@@ -163,6 +171,7 @@ namespace Barotrauma.Networking
lock (msgsToWrite)
{
msgsToWrite.Enqueue(msg);
writeManualResetEvent.Set();
}
}
@@ -154,10 +154,16 @@ namespace Barotrauma.Networking
}
}
string fileName = ServerName + "_" + DateTime.Now.ToString("yyyy-MM-dd_HH:mm") + ".txt";
string fileName = ServerName + "_" + DateTime.Now.ToString("yyyy-MM-dd_HH:mm");
fileName = ToolBox.RemoveInvalidFileNameChars(fileName);
string filePath = Path.Combine(SavePath, fileName);
string filePath = Path.Combine(SavePath, fileName + ".txt");
int i = 2;
while (File.Exists(filePath))
{
filePath = Path.Combine(SavePath, fileName + " (" + i + ").txt");
i++;
}
try
{
@@ -20,10 +20,12 @@
public virtual void Select()
{
if (selected != null && selected != this)
{
selected.Deselect();
#if CLIENT
GUI.ClearCursorWait();
//make sure any textbox in the previously selected screen doesn't stay selected
if (GUI.KeyboardDispatcher.Subscriber != DebugConsole.TextBox)
{
@@ -10,7 +10,28 @@ namespace Barotrauma
public static double TotalTime;
public static double Accumulator;
public static double Step = 1.0 / 60.0;
public const int FixedUpdateRate = 60;
public static double Step = 1.0 / FixedUpdateRate;
private static int frameLimit;
/// <summary>
/// Maximum FPS (0 = unlimited).
/// </summary>
public static int FrameLimit
{
get { return frameLimit; }
set
{
if (value <= 0)
{
frameLimit = 0;
}
else
{
frameLimit = Math.Max(value, FixedUpdateRate);
}
}
}
public static double Alpha
{