(6eeea9b7c) v0.9.10.0.0

This commit is contained in:
Joonas Rikkonen
2020-06-04 16:41:07 +03:00
parent ce4ccd99ac
commit eeac247a8e
366 changed files with 7772 additions and 3692 deletions
@@ -2,8 +2,7 @@
using System.Xml.Linq;
using System.Collections.Generic;
using Microsoft.Xna.Framework;
using System.Xml;
using System.IO;
using Barotrauma.IO;
using Barotrauma.Extensions;
#if CLIENT
using Microsoft.Xna.Framework.Input;
@@ -37,6 +36,8 @@ namespace Barotrauma
public bool VSyncEnabled { get; set; }
public bool TextureCompressionEnabled { get; set; }
public bool EnableSplashScreen { get; set; }
public int ParticleLimit { get; set; }
@@ -66,6 +67,7 @@ namespace Barotrauma
#if CLIENT
private KeyOrMouse[] keyMapping;
private KeyOrMouse[] inventoryKeyMapping;
#endif
private WindowMode windowMode;
@@ -207,7 +209,7 @@ namespace Barotrauma
{
musicVolume = MathHelper.Clamp(value, 0.0f, 1.0f);
#if CLIENT
GameMain.SoundManager?.SetCategoryGainMultiplier("music", musicVolume, 0);
GameMain.SoundManager?.SetCategoryGainMultiplier("music", musicVolume * 0.7f, 0);
#endif
}
}
@@ -267,7 +269,7 @@ namespace Barotrauma
public bool TextManagerDebugModeEnabled { get; set; }
#endif
private FileSystemWatcher modsFolderWatcher;
private System.IO.FileSystemWatcher modsFolderWatcher;
private int ContentFileLoadOrder(ContentFile a)
{
@@ -301,58 +303,11 @@ namespace Barotrauma
!otherCorePackage.Files.Any(f2 =>
Path.GetFullPath(f1.Path).CleanUpPath() == Path.GetFullPath(f2.Path).CleanUpPath())).ToList();
bool shouldRefreshSubs = false;
bool shouldRefreshFabricationRecipes = false;
bool shouldRefreshSoundPlayer = false;
bool shouldRefreshRuinGenerationParams = false;
bool shouldRefreshScriptedEventSets = false;
bool shouldRefreshMissionPrefabs = false;
bool shouldRefreshLevelObjectPrefabs = false;
bool shouldRefreshLocationTypes = false;
bool shouldRefreshMapGenerationParams = false;
bool shouldRefreshLevelGenerationParams = false;
bool shouldRefreshAfflictions = false;
DisableContentPackageItems(filesToRemove.OrderBy(ContentFileLoadOrder));
DisableContentPackageItems(filesToRemove.OrderBy(ContentFileLoadOrder),
ref shouldRefreshSubs,
ref shouldRefreshFabricationRecipes,
ref shouldRefreshSoundPlayer,
ref shouldRefreshRuinGenerationParams,
ref shouldRefreshScriptedEventSets,
ref shouldRefreshMissionPrefabs,
ref shouldRefreshLevelObjectPrefabs,
ref shouldRefreshLocationTypes,
ref shouldRefreshMapGenerationParams,
ref shouldRefreshLevelGenerationParams,
ref shouldRefreshAfflictions);
EnableContentPackageItems(filesToAdd.OrderBy(ContentFileLoadOrder));
EnableContentPackageItems(filesToAdd.OrderBy(ContentFileLoadOrder),
ref shouldRefreshSubs,
ref shouldRefreshFabricationRecipes,
ref shouldRefreshSoundPlayer,
ref shouldRefreshRuinGenerationParams,
ref shouldRefreshScriptedEventSets,
ref shouldRefreshMissionPrefabs,
ref shouldRefreshLevelObjectPrefabs,
ref shouldRefreshLocationTypes,
ref shouldRefreshMapGenerationParams,
ref shouldRefreshLevelGenerationParams,
ref shouldRefreshAfflictions);
if (shouldRefreshAfflictions) { AfflictionPrefab.LoadAll(GameMain.Instance.GetFilesOfType(ContentType.Afflictions)); }
if (shouldRefreshSubs) { SubmarineInfo.RefreshSavedSubs(); }
if (shouldRefreshFabricationRecipes) { ItemPrefab.InitFabricationRecipes(); }
if (shouldRefreshRuinGenerationParams) { RuinGeneration.RuinGenerationParams.ClearAll(); }
if (shouldRefreshScriptedEventSets) { ScriptedEventSet.LoadPrefabs(); }
if (shouldRefreshMissionPrefabs) { MissionPrefab.Init(); }
if (shouldRefreshLevelObjectPrefabs) { LevelObjectPrefab.LoadAll(); }
if (shouldRefreshLocationTypes) { LocationType.Init(); }
if (shouldRefreshMapGenerationParams) { MapGenerationParams.Init(); }
if (shouldRefreshLevelGenerationParams) { LevelGenerationParams.LoadPresets(); }
#if CLIENT
if (shouldRefreshSoundPlayer) { SoundPlayer.Init().ForEach(_ => { return; }); }
#endif
RefreshContentPackageItems(filesToAdd.Concat(filesToRemove));
}
public void SelectContentPackage(ContentPackage contentPackage)
@@ -362,45 +317,9 @@ namespace Barotrauma
SelectedContentPackages.Add(contentPackage);
ContentPackage.SortContentPackages();
bool shouldRefreshSubs = false;
bool shouldRefreshFabricationRecipes = false;
bool shouldRefreshSoundPlayer = false;
bool shouldRefreshRuinGenerationParams = false;
bool shouldRefreshScriptedEventSets = false;
bool shouldRefreshMissionPrefabs = false;
bool shouldRefreshLevelObjectPrefabs = false;
bool shouldRefreshLocationTypes = false;
bool shouldRefreshMapGenerationParams = false;
bool shouldRefreshLevelGenerationParams = false;
bool shouldRefreshAfflictions = false;
EnableContentPackageItems(contentPackage.Files.OrderBy(ContentFileLoadOrder));
EnableContentPackageItems(contentPackage.Files.OrderBy(ContentFileLoadOrder),
ref shouldRefreshSubs,
ref shouldRefreshFabricationRecipes,
ref shouldRefreshSoundPlayer,
ref shouldRefreshRuinGenerationParams,
ref shouldRefreshScriptedEventSets,
ref shouldRefreshMissionPrefabs,
ref shouldRefreshLevelObjectPrefabs,
ref shouldRefreshLocationTypes,
ref shouldRefreshMapGenerationParams,
ref shouldRefreshLevelGenerationParams,
ref shouldRefreshAfflictions);
if (shouldRefreshAfflictions) { AfflictionPrefab.LoadAll(GameMain.Instance.GetFilesOfType(ContentType.Afflictions)); }
if (shouldRefreshSubs) { SubmarineInfo.RefreshSavedSubs(); }
if (shouldRefreshFabricationRecipes) { ItemPrefab.InitFabricationRecipes(); }
if (shouldRefreshRuinGenerationParams) { RuinGeneration.RuinGenerationParams.ClearAll(); }
if (shouldRefreshScriptedEventSets) { ScriptedEventSet.LoadPrefabs(); }
if (shouldRefreshMissionPrefabs) { MissionPrefab.Init(); }
if (shouldRefreshLevelObjectPrefabs) { LevelObjectPrefab.LoadAll(); }
if (shouldRefreshLocationTypes) { LocationType.Init(); }
if (shouldRefreshMapGenerationParams) { MapGenerationParams.Init(); }
if (shouldRefreshLevelGenerationParams) { LevelGenerationParams.LoadPresets(); }
#if CLIENT
if (shouldRefreshSoundPlayer) { SoundPlayer.Init().ForEach(_ => { return; }); }
#endif
RefreshContentPackageItems(contentPackage.Files);
}
}
@@ -411,61 +330,14 @@ namespace Barotrauma
SelectedContentPackages.Remove(contentPackage);
ContentPackage.SortContentPackages();
bool shouldRefreshSubs = false;
bool shouldRefreshFabricationRecipes = false;
bool shouldRefreshSoundPlayer = false;
bool shouldRefreshRuinGenerationParams = false;
bool shouldRefreshScriptedEventSets = false;
bool shouldRefreshMissionPrefabs = false;
bool shouldRefreshLevelObjectPrefabs = false;
bool shouldRefreshLocationTypes = false;
bool shouldRefreshMapGenerationParams = false;
bool shouldRefreshLevelGenerationParams = false;
bool shouldRefreshAfflictions = false;
DisableContentPackageItems(contentPackage.Files.OrderBy(ContentFileLoadOrder));
DisableContentPackageItems(contentPackage.Files.OrderBy(ContentFileLoadOrder),
ref shouldRefreshSubs,
ref shouldRefreshFabricationRecipes,
ref shouldRefreshSoundPlayer,
ref shouldRefreshRuinGenerationParams,
ref shouldRefreshScriptedEventSets,
ref shouldRefreshMissionPrefabs,
ref shouldRefreshLevelObjectPrefabs,
ref shouldRefreshLocationTypes,
ref shouldRefreshMapGenerationParams,
ref shouldRefreshLevelGenerationParams,
ref shouldRefreshAfflictions);
if (shouldRefreshAfflictions) { AfflictionPrefab.LoadAll(GameMain.Instance.GetFilesOfType(ContentType.Afflictions)); }
if (shouldRefreshSubs) { SubmarineInfo.RefreshSavedSubs(); }
if (shouldRefreshFabricationRecipes) { ItemPrefab.InitFabricationRecipes(); }
if (shouldRefreshRuinGenerationParams) { RuinGeneration.RuinGenerationParams.ClearAll(); }
if (shouldRefreshScriptedEventSets) { ScriptedEventSet.LoadPrefabs(); }
if (shouldRefreshMissionPrefabs) { MissionPrefab.Init(); }
if (shouldRefreshLevelObjectPrefabs) { LevelObjectPrefab.LoadAll(); }
if (shouldRefreshLocationTypes) { LocationType.Init(); }
if (shouldRefreshMapGenerationParams) { MapGenerationParams.Init(); }
if (shouldRefreshLevelGenerationParams) { LevelGenerationParams.LoadPresets(); }
#if CLIENT
if (shouldRefreshSoundPlayer) { SoundPlayer.Init().ForEach(_ => { return; }); }
#endif
RefreshContentPackageItems(contentPackage.Files);
}
}
private void EnableContentPackageItems(IOrderedEnumerable<ContentFile> files,
ref bool shouldRefreshSubs,
ref bool shouldRefreshFabricationRecipes,
ref bool shouldRefreshSoundPlayer,
ref bool shouldRefreshRuinGenerationParams,
ref bool shouldRefreshScriptedEventSets,
ref bool shouldRefreshMissionPrefabs,
ref bool shouldRefreshLevelObjectPrefabs,
ref bool shouldRefreshLocationTypes,
ref bool shouldRefreshMapGenerationParams,
ref bool shouldRefreshLevelGenerationParams,
ref bool shouldRefreshAfflictions)
private void EnableContentPackageItems(IOrderedEnumerable<ContentFile> files)
{
foreach (ContentFile file in files)
{
@@ -474,6 +346,9 @@ namespace Barotrauma
case ContentType.Character:
CharacterPrefab.LoadFromFile(file);
break;
case ContentType.Corpses:
CorpsePrefab.LoadFromFile(file);
break;
case ContentType.NPCConversations:
NPCConversation.LoadFromFile(file);
break;
@@ -482,7 +357,6 @@ namespace Barotrauma
break;
case ContentType.Item:
ItemPrefab.LoadFromFile(file);
shouldRefreshFabricationRecipes = true;
break;
case ContentType.ItemAssembly:
new ItemAssemblyPrefab(file.Path);
@@ -490,40 +364,10 @@ namespace Barotrauma
case ContentType.Structure:
StructurePrefab.LoadFromFile(file);
break;
case ContentType.Submarine:
shouldRefreshSubs = true;
break;
case ContentType.Text:
TextManager.LoadTextPack(file.Path);
break;
case ContentType.Afflictions:
shouldRefreshAfflictions = true;
break;
case ContentType.RuinConfig:
shouldRefreshRuinGenerationParams = true;
break;
case ContentType.RandomEvents:
shouldRefreshScriptedEventSets = true;
break;
case ContentType.Missions:
shouldRefreshMissionPrefabs = true;
break;
case ContentType.LevelObjectPrefabs:
shouldRefreshLevelObjectPrefabs = true;
break;
case ContentType.LocationTypes:
shouldRefreshLocationTypes = true;
break;
case ContentType.MapGenerationParameters:
shouldRefreshMapGenerationParams = true;
break;
case ContentType.LevelGenerationParameters:
shouldRefreshLevelGenerationParams = true;
break;
#if CLIENT
case ContentType.Sounds:
shouldRefreshSoundPlayer = true;
break;
case ContentType.Particles:
GameMain.ParticleManager?.LoadPrefabsFromFile(file);
break;
@@ -537,18 +381,7 @@ namespace Barotrauma
}
}
private void DisableContentPackageItems(IOrderedEnumerable<ContentFile> files,
ref bool shouldRefreshSubs,
ref bool shouldRefreshFabricationRecipes,
ref bool shouldRefreshSoundPlayer,
ref bool shouldRefreshRuinGenerationParams,
ref bool shouldRefreshScriptedEventSets,
ref bool shouldRefreshMissionPrefabs,
ref bool shouldRefreshLevelObjectPrefabs,
ref bool shouldRefreshLocationTypes,
ref bool shouldRefreshMapGenerationParams,
ref bool shouldRefreshLevelGenerationParams,
ref bool shouldRefreshAfflictions)
private void DisableContentPackageItems(IOrderedEnumerable<ContentFile> files)
{
foreach (ContentFile file in files)
{
@@ -557,6 +390,9 @@ namespace Barotrauma
case ContentType.Character:
CharacterPrefab.RemoveByFile(file.Path);
break;
case ContentType.Corpses:
CorpsePrefab.RemoveByFile(file.Path);
break;
case ContentType.NPCConversations:
NPCConversation.RemoveByFile(file.Path);
break;
@@ -565,7 +401,6 @@ namespace Barotrauma
break;
case ContentType.Item:
ItemPrefab.RemoveByFile(file.Path);
shouldRefreshFabricationRecipes = true;
break;
case ContentType.ItemAssembly:
ItemAssemblyPrefab.Remove(file.Path);
@@ -573,40 +408,10 @@ namespace Barotrauma
case ContentType.Structure:
StructurePrefab.RemoveByFile(file.Path);
break;
case ContentType.Submarine:
shouldRefreshSubs = true;
break;
case ContentType.Text:
TextManager.RemoveTextPack(file.Path);
break;
case ContentType.Afflictions:
shouldRefreshAfflictions = true;
break;
case ContentType.RuinConfig:
shouldRefreshRuinGenerationParams = true;
break;
case ContentType.RandomEvents:
shouldRefreshScriptedEventSets = true;
break;
case ContentType.Missions:
shouldRefreshMissionPrefabs = true;
break;
case ContentType.LevelObjectPrefabs:
shouldRefreshLevelObjectPrefabs = true;
break;
case ContentType.LocationTypes:
shouldRefreshLocationTypes = true;
break;
case ContentType.MapGenerationParameters:
shouldRefreshMapGenerationParams = true;
break;
case ContentType.LevelGenerationParameters:
shouldRefreshLevelGenerationParams = true;
break;
#if CLIENT
case ContentType.Sounds:
shouldRefreshSoundPlayer = true;
break;
case ContentType.Particles:
GameMain.ParticleManager?.RemovePrefabsByFile(file.Path);
break;
@@ -620,39 +425,74 @@ namespace Barotrauma
}
}
private void RefreshContentPackageItems(IEnumerable<ContentFile> files)
{
if (files.Any(f => f.Type == ContentType.Afflictions)) { AfflictionPrefab.LoadAll(GameMain.Instance.GetFilesOfType(ContentType.Afflictions)); }
if (files.Any(f => f.Type == ContentType.Submarine)) { SubmarineInfo.RefreshSavedSubs(); }
if (files.Any(f => f.Type == ContentType.Item)) { ItemPrefab.InitFabricationRecipes(); }
if (files.Any(f => f.Type == ContentType.RuinConfig)) { RuinGeneration.RuinGenerationParams.ClearAll(); }
if (files.Any(f => f.Type == ContentType.RandomEvents)) { ScriptedEventSet.LoadPrefabs(); }
if (files.Any(f => f.Type == ContentType.Missions)) { MissionPrefab.Init(); }
if (files.Any(f => f.Type == ContentType.LevelObjectPrefabs)) { LevelObjectPrefab.LoadAll(); }
if (files.Any(f => f.Type == ContentType.LocationTypes)) { LocationType.Init(); }
if (files.Any(f => f.Type == ContentType.MapGenerationParameters)) { MapGenerationParams.Init(); }
if (files.Any(f => f.Type == ContentType.LevelGenerationParameters)) { LevelGenerationParams.LoadPresets(); }
if (files.Any(f => f.Type == ContentType.TraitorMissions)) { TraitorMissionPrefab.Init(); }
if (files.Any(f => f.Type == ContentType.Orders)) { Order.Init(); }
if (files.Any(f => f.Type == ContentType.EventManagerSettings)) { EventManagerSettings.Init(); }
if (files.Any(f => f.Type == ContentType.WreckAIConfig)) { WreckAIConfig.LoadAll(); }
if (files.Any(f => f.Type == ContentType.SkillSettings)) { SkillSettings.Load(GameMain.Instance.GetFilesOfType(ContentType.SkillSettings)); }
#if CLIENT
if (files.Any(f => f.Type == ContentType.Tutorials)) { Tutorial.Init(); }
if (files.Any(f => f.Type == ContentType.Sounds)) { SoundPlayer.Init().ForEach(_ => { return; }); }
#endif
}
private readonly static ContentType[] hotswappableContentTypes = new ContentType[]
{
ContentType.Character,
ContentType.Corpses,
ContentType.NPCConversations,
ContentType.Jobs,
ContentType.Orders,
ContentType.EventManagerSettings,
ContentType.Item,
ContentType.ItemAssembly,
ContentType.Structure,
ContentType.Submarine,
ContentType.Text,
ContentType.Afflictions,
ContentType.RuinConfig,
ContentType.RandomEvents,
ContentType.Missions,
ContentType.LevelObjectPrefabs,
ContentType.LocationTypes,
ContentType.MapGenerationParameters,
ContentType.LevelGenerationParameters,
ContentType.Sounds,
ContentType.Particles,
ContentType.Decals,
ContentType.Outpost,
ContentType.Wreck,
ContentType.WreckAIConfig,
ContentType.BackgroundCreaturePrefabs,
ContentType.ServerExecutable,
ContentType.TraitorMissions,
ContentType.Tutorials,
ContentType.SkillSettings,
ContentType.None
};
private void UpdateContentPackageDirtyFlag(ContentFile file)
{
switch (file.Type)
if (!hotswappableContentTypes.Contains(file.Type))
{
case ContentType.Character:
case ContentType.NPCConversations:
case ContentType.Jobs:
case ContentType.Item:
case ContentType.ItemAssembly:
case ContentType.Structure:
case ContentType.Submarine:
case ContentType.Text:
case ContentType.Afflictions:
case ContentType.RuinConfig:
case ContentType.RandomEvents:
case ContentType.Missions:
case ContentType.LevelObjectPrefabs:
case ContentType.LocationTypes:
case ContentType.MapGenerationParameters:
case ContentType.LevelGenerationParameters:
case ContentType.Sounds:
case ContentType.Particles:
case ContentType.Decals:
case ContentType.Outpost:
case ContentType.Wreck:
case ContentType.BackgroundCreaturePrefabs:
case ContentType.ServerExecutable:
case ContentType.None:
break; //do nothing here if the content type is supported
default:
if (ContentPackage.MultiplayerIncompatibleContent.Contains(file.Type))
{
ContentPackageSelectionDirty = true;
ContentPackageSelectionDirtyNotification = true;
break;
}
ContentPackageSelectionDirtyNotification = true;
}
}
@@ -682,6 +522,11 @@ namespace Barotrauma
LocationType.Init();
MapGenerationParams.Init();
LevelGenerationParams.LoadPresets();
TraitorMissionPrefab.Init();
Order.Init();
EventManagerSettings.Init();
WreckAIConfig.LoadAll();
SkillSettings.Load(GameMain.Instance.GetFilesOfType(ContentType.SkillSettings));
#if CLIENT
GameMain.DecalManager.Prefabs.SortAll();
@@ -780,21 +625,21 @@ namespace Barotrauma
LoadPlayerConfig();
modsFolderWatcher = new FileSystemWatcher("Mods");
modsFolderWatcher = new System.IO.FileSystemWatcher("Mods");
modsFolderWatcher.Filter = "*";
modsFolderWatcher.NotifyFilter = NotifyFilters.LastWrite | NotifyFilters.FileName | NotifyFilters.DirectoryName;
modsFolderWatcher.NotifyFilter = System.IO.NotifyFilters.LastWrite | System.IO.NotifyFilters.FileName | System.IO.NotifyFilters.DirectoryName;
modsFolderWatcher.Created += OnModFolderUpdate;
modsFolderWatcher.Deleted += OnModFolderUpdate;
modsFolderWatcher.Renamed += OnModFolderUpdate;
modsFolderWatcher.EnableRaisingEvents = true;
}
private void OnModFolderUpdate(object sender, FileSystemEventArgs e)
private void OnModFolderUpdate(object sender, System.IO.FileSystemEventArgs e)
{
if (SuppressModFolderWatcher || (GameMain.NetworkMember?.IsClient ?? false)) { return; }
switch (e.ChangeType)
{
case WatcherChangeTypes.Created:
case System.IO.WatcherChangeTypes.Created:
{
string cpPath = Path.GetFullPath(Path.Combine(e.FullPath, Steam.SteamManager.MetadataFileName)).CleanUpPath();
if (File.Exists(cpPath) && !ContentPackage.List.Any(cp => Path.GetFullPath(cp.Path).CleanUpPath() == cpPath))
@@ -804,7 +649,7 @@ namespace Barotrauma
}
}
break;
case WatcherChangeTypes.Deleted:
case System.IO.WatcherChangeTypes.Deleted:
{
string cpPath = Path.GetFullPath(Path.Combine(e.FullPath, Steam.SteamManager.MetadataFileName)).CleanUpPath();
var toRemove = ContentPackage.List.Where(cp => Path.GetFullPath(cp.Path).CleanUpPath() == cpPath).ToList();
@@ -827,9 +672,9 @@ namespace Barotrauma
}
}
break;
case WatcherChangeTypes.Renamed:
case System.IO.WatcherChangeTypes.Renamed:
{
RenamedEventArgs renameArgs = e as RenamedEventArgs;
System.IO.RenamedEventArgs renameArgs = e as System.IO.RenamedEventArgs;
string cpPath = Path.GetFullPath(Path.Combine(renameArgs.OldFullPath, Steam.SteamManager.MetadataFileName)).CleanUpPath();
var toRemove = ContentPackage.List.Where(cp => Path.GetFullPath(cp.Path).CleanUpPath() == cpPath).ToList();
@@ -980,13 +825,29 @@ namespace Barotrauma
doc.Root.Add(keyMappingElement);
for (int i = 0; i < keyMapping.Length; i++)
{
if (keyMapping[i].MouseButton == MouseButton.None)
KeyOrMouse bind = keyMapping[i];
if (bind.MouseButton == MouseButton.None)
{
keyMappingElement.Add(new XAttribute(((InputType)i).ToString(), keyMapping[i].Key));
keyMappingElement.Add(new XAttribute(((InputType)i).ToString(), bind.Key));
}
else
{
keyMappingElement.Add(new XAttribute(((InputType)i).ToString(), keyMapping[i].MouseButton));
keyMappingElement.Add(new XAttribute(((InputType)i).ToString(), bind.MouseButton));
}
}
var inventoryKeyMappingElement = new XElement("inventorykeymapping");
doc.Root.Add(inventoryKeyMappingElement);
for (int i = 0; i < inventoryKeyMapping.Length; i++)
{
KeyOrMouse bind = inventoryKeyMapping[i];
if (bind.MouseButton == MouseButton.None)
{
inventoryKeyMappingElement.Add(new XAttribute($"slot{i}", bind.Key));
}
else
{
inventoryKeyMappingElement.Add(new XAttribute($"slot{i}", bind.MouseButton));
}
}
#endif
@@ -1014,7 +875,7 @@ namespace Barotrauma
new XAttribute("faceattachmentindex", CharacterFaceAttachmentIndex));
doc.Root.Add(playerElement);
XmlWriterSettings settings = new XmlWriterSettings
System.Xml.XmlWriterSettings settings = new System.Xml.XmlWriterSettings
{
Indent = true,
OmitXmlDeclaration = true,
@@ -1110,7 +971,7 @@ namespace Barotrauma
SelectedContentPackages.Clear();
foreach (string path in contentPackagePaths)
{
var matchingContentPackage = ContentPackage.List.Find(cp => System.IO.Path.GetFullPath(cp.Path).CleanUpPath() == path.CleanUpPath());
var matchingContentPackage = ContentPackage.List.Find(cp => Barotrauma.IO.Path.GetFullPath(cp.Path).CleanUpPath() == path.CleanUpPath());
if (matchingContentPackage == null)
{
@@ -1279,6 +1140,7 @@ namespace Barotrauma
new XAttribute("width", GraphicsWidth),
new XAttribute("height", GraphicsHeight),
new XAttribute("vsync", VSyncEnabled),
new XAttribute("compresstextures", TextureCompressionEnabled),
new XAttribute("framelimit", Timing.FrameLimit),
new XAttribute("displaymode", windowMode));
}
@@ -1300,7 +1162,7 @@ namespace Barotrauma
new XAttribute("voipattenuationenabled", VoipAttenuationEnabled),
new XAttribute("usedirectionalvoicechat", UseDirectionalVoiceChat),
new XAttribute("voicesetting", VoiceSetting),
new XAttribute("voicecapturedevice", VoiceCaptureDevice ?? ""),
new XAttribute("voicecapturedevice", System.Xml.XmlConvert.EncodeName(VoiceCaptureDevice ?? "")),
new XAttribute("noisegatethreshold", NoiseGateThreshold));
XElement gSettings = doc.Root.Element("graphicssettings");
@@ -1340,6 +1202,21 @@ namespace Barotrauma
keyMappingElement.Add(new XAttribute(((InputType)i).ToString(), keyMapping[i].MouseButton));
}
}
var inventoryKeyMappingElement = new XElement("inventorykeymapping");
doc.Root.Add(inventoryKeyMappingElement);
for (int i = 0; i < inventoryKeyMapping.Length; i++)
{
KeyOrMouse bind = inventoryKeyMapping[i];
if (bind.MouseButton == MouseButton.None)
{
inventoryKeyMappingElement.Add(new XAttribute($"slot{i}", bind.Key));
}
else
{
inventoryKeyMappingElement.Add(new XAttribute($"slot{i}", bind.MouseButton));
}
}
#endif
var gameplay = new XElement("gameplay");
@@ -1384,7 +1261,7 @@ namespace Barotrauma
}
doc.Root.Add(tutorialElement);
XmlWriterSettings settings = new XmlWriterSettings
System.Xml.XmlWriterSettings settings = new System.Xml.XmlWriterSettings
{
Indent = true,
OmitXmlDeclaration = true,
@@ -1485,6 +1362,7 @@ namespace Barotrauma
GraphicsWidth = graphicsMode.GetAttributeInt("width", GraphicsWidth);
GraphicsHeight = graphicsMode.GetAttributeInt("height", GraphicsHeight);
VSyncEnabled = graphicsMode.GetAttributeBool("vsync", VSyncEnabled);
TextureCompressionEnabled = graphicsMode.GetAttributeBool("compresstextures", TextureCompressionEnabled);
Timing.FrameLimit = graphicsMode.GetAttributeInt("framelimit", 200);
XElement graphicsSettings = doc.Root.Element("graphicssettings");
@@ -1526,7 +1404,7 @@ namespace Barotrauma
MuteOnFocusLost = audioSettings.GetAttributeBool("muteonfocuslost", MuteOnFocusLost);
UseDirectionalVoiceChat = audioSettings.GetAttributeBool("usedirectionalvoicechat", UseDirectionalVoiceChat);
VoiceCaptureDevice = audioSettings.GetAttributeString("voicecapturedevice", VoiceCaptureDevice);
VoiceCaptureDevice = System.Xml.XmlConvert.DecodeName(audioSettings.GetAttributeString("voicecapturedevice", VoiceCaptureDevice));
NoiseGateThreshold = audioSettings.GetAttributeFloat("noisegatethreshold", NoiseGateThreshold);
MicrophoneVolume = audioSettings.GetAttributeFloat("microphonevolume", MicrophoneVolume);
string voiceSettingStr = audioSettings.GetAttributeString("voicesetting", "");
@@ -1568,6 +1446,7 @@ namespace Barotrauma
GraphicsWidth = 0;
GraphicsHeight = 0;
VSyncEnabled = true;
TextureCompressionEnabled = true;
Timing.FrameLimit = 200;
#if DEBUG
EnableSplashScreen = false;