- File transfer improvements (switching the sub selection during transfer works, max transfer duration, waiting for transfers to finish before starting the round)

- Firesource changes (more particles with shorter lifetimes, combining bugfix)
- StatusEffects can target hulls and always be active
- Cyrillic character support
- Saving server settings
- Swapping items in inventory by dropping an item to a non-free slot
This commit is contained in:
Regalis
2016-02-27 21:01:10 +02:00
parent 7309201b11
commit cc4ada952f
31 changed files with 470 additions and 199 deletions

View File

@@ -3,6 +3,7 @@ using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml.Linq;
namespace Barotrauma.Networking
{
@@ -18,6 +19,8 @@ namespace Barotrauma.Networking
partial class GameServer : NetworkMember
{
public const string SettingsFile = "serversettings.xml";
public bool ShowNetStats;
private TimeSpan refreshMasterInterval = new TimeSpan(0, 0, 30);
@@ -91,6 +94,66 @@ namespace Barotrauma.Networking
public float EndVoteRequiredRatio = 0.5f;
private void SaveSettings()
{
XDocument doc = new XDocument(new XElement("serversettings"));
doc.Root.Add
(
new XAttribute("AllowSpectating", allowSpectating),
new XAttribute("RandomizeSeed", randomizeSeed),
new XAttribute("EndRoundAtLevelEnd", endRoundAtLevelEnd),
new XAttribute("AllowFileTransfers", allowFileTransfers),
new XAttribute("SaveServerLogs", saveServerLogs),
new XAttribute("LinesPerLogFile", log.LinesPerFile),
new XAttribute("SubSelection", subSelectionMode),
new XAttribute("ModeSelection", modeSelectionMode)
);
try
{
doc.Save(SettingsFile);
}
catch (Exception e)
{
DebugConsole.ThrowError("Saving server settings failed", e);
}
}
private void LoadSettings()
{
XDocument doc = null;
if (System.IO.File.Exists(SettingsFile))
{
doc = ToolBox.TryLoadXml(SettingsFile);
}
else
{
return;
}
if (doc == null)
{
doc = new XDocument(new XElement("serversettings"));
}
allowSpectating = ToolBox.GetAttributeBool(doc.Root, "AllowSpectating", true);
randomizeSeed = ToolBox.GetAttributeBool(doc.Root, "RandomizeSeed", true);
endRoundAtLevelEnd = ToolBox.GetAttributeBool(doc.Root, "EndRoundAtLevelEnd", true);
allowFileTransfers = ToolBox.GetAttributeBool(doc.Root, "AllowFileTransfers", true);
saveServerLogs = ToolBox.GetAttributeBool(doc.Root, "SaveServerLogs", true);
log.LinesPerFile = ToolBox.GetAttributeInt(doc.Root, "LinesPerLogFile", 800);
subSelectionMode = SelectionMode.Manual;
Enum.TryParse<SelectionMode>(ToolBox.GetAttributeString(doc.Root, "SubSelection", "Manual"), out subSelectionMode);
modeSelectionMode = SelectionMode.Manual;
Enum.TryParse<SelectionMode>(ToolBox.GetAttributeString(doc.Root, "ModeSelection", "Manual"), out modeSelectionMode);
}
private void CreateSettingsFrame()
{
settingsFrame = new GUIFrame(new Rectangle(0, 0, GameMain.GraphicsWidth, GameMain.GraphicsHeight), Color.Black * 0.5f);
@@ -227,6 +290,7 @@ namespace Barotrauma.Networking
else
{
settingsFrame = null;
SaveSettings();
}
return false;