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

View File

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

View File

@@ -27,7 +27,7 @@
</Grid.RowDefinitions> </Grid.RowDefinitions>
<DockPanel Grid.Row="0"> <DockPanel Grid.Row="0">
<Label Content="World:" DockPanel.Dock="Left" /> <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" <ComboBox ItemsSource="{Binding Worlds}" SelectedItem="{Binding SelectedWorld}" Margin="3"
SelectionChanged="Selector_OnSelectionChanged"> SelectionChanged="Selector_OnSelectionChanged">
<ComboBox.ItemTemplate> <ComboBox.ItemTemplate>

View File

@@ -93,9 +93,9 @@ namespace Torch.Server.Views
_instanceManager.SaveConfig(); _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) private void Selector_OnSelectionChanged(object sender, SelectionChangedEventArgs e)

View File

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

View File

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