Fix suppressed fatal error, make world config importing manual

This commit is contained in:
John Gross
2018-04-02 21:00:36 -07:00
parent 3dd646d6e9
commit f03bfd2d7a
6 changed files with 12 additions and 10 deletions

View File

@@ -86,15 +86,18 @@ namespace Torch.Server.Managers
public void SelectWorld(string worldPath, bool modsOnly = true)
{
DedicatedConfig.LoadWorld = worldPath;
DedicatedConfig.SelectedWorld = DedicatedConfig.Worlds.FirstOrDefault(x => x.WorldPath == worldPath);
ImportWorldConfig(modsOnly);
DedicatedConfig.SelectedWorld = DedicatedConfig.Worlds.First(x => x.WorldPath == worldPath);
}
public void SelectWorld(WorldViewModel world, bool modsOnly = true)
{
DedicatedConfig.LoadWorld = world.WorldPath;
DedicatedConfig.SelectedWorld = world;
ImportWorldConfig(world, modsOnly);
}
public void ImportSelectedWorldConfig()
{
ImportWorldConfig(DedicatedConfig.SelectedWorld, false);
}
private void ImportWorldConfig(WorldViewModel world, bool modsOnly = true)
@@ -103,7 +106,7 @@ namespace Torch.Server.Managers
foreach (var mod in world.Checkpoint.Mods)
sb.AppendLine(mod.PublishedFileId.ToString());
DedicatedConfig.Mods = world.Checkpoint.Mods.Select(x => x.PublishedFileId).ToList(); //sb.ToString();
DedicatedConfig.Mods = world.Checkpoint.Mods.Select(x => x.PublishedFileId).ToList();
Log.Debug("Loaded mod list from world");

View File

@@ -56,7 +56,6 @@ namespace Torch.Server
sessionManager.AddFactory(x => new MultiplayerManagerDedicated(this));
}
//public MyConfigDedicated<MyObjectBuilder_SessionSettings> DedicatedConfig { get; set; }
/// <inheritdoc />
public float SimulationRatio { get => _simRatio; set => SetValue(ref _simRatio, value); }

View File

@@ -27,7 +27,7 @@
</Grid.RowDefinitions>
<DockPanel Grid.Row="0">
<Label Content="World:" DockPanel.Dock="Left" />
<Button Content="New World" Margin="3" DockPanel.Dock="Right" Click="NewWorld_OnClick" IsEnabled="false" ToolTip="Feature is not yet complete"/>
<Button Content="Import World Config" Margin="3" DockPanel.Dock="Right" Click="ImportConfig_OnClick" ToolTip="Override the DS config with the one from the selected world."/>
<ComboBox ItemsSource="{Binding Worlds}" SelectedItem="{Binding SelectedWorld}" Margin="3"
SelectionChanged="Selector_OnSelectionChanged">
<ComboBox.ItemTemplate>

View File

@@ -93,9 +93,9 @@ namespace Torch.Server.Views
_instanceManager.SaveConfig();
}
private void NewWorld_OnClick(object sender, RoutedEventArgs e)
private void ImportConfig_OnClick(object sender, RoutedEventArgs e)
{
new WorldGeneratorDialog(_instanceManager).ShowDialog();
_instanceManager.ImportSelectedWorldConfig();
}
private void Selector_OnSelectionChanged(object sender, SelectionChangedEventArgs e)

View File

@@ -86,6 +86,7 @@
</ItemGroup>
<ItemGroup>
<Service Include="{508349B6-6B84-4DF5-91F0-309BEEBAD82D}" />
<Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="$(SolutionDir)\TransformOnBuild.targets" />

View File

@@ -232,8 +232,7 @@ namespace Torch
if (MySandboxGame.FatalErrorDuringInit)
{
_log.Warn("Failed to start sandbox game: fatal error during init");
return;
throw new InvalidOperationException("Failed to start sandbox game: fatal error during init");
}
try
{