Skip to content

Commit f03bfd2

Browse files
committed
Fix suppressed fatal error, make world config importing manual
1 parent 3dd646d commit f03bfd2

6 files changed

Lines changed: 12 additions & 10 deletions

File tree

‎Torch.Server/Managers/InstanceManager.cs‎

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -86,15 +86,18 @@ public void LoadInstance(string path, bool validate = true)
8686
public void SelectWorld(string worldPath, bool modsOnly = true)
8787
{
8888
DedicatedConfig.LoadWorld = worldPath;
89-
DedicatedConfig.SelectedWorld = DedicatedConfig.Worlds.FirstOrDefault(x => x.WorldPath == worldPath);
90-
ImportWorldConfig(modsOnly);
89+
DedicatedConfig.SelectedWorld = DedicatedConfig.Worlds.First(x => x.WorldPath == worldPath);
9190
}
9291

9392
public void SelectWorld(WorldViewModel world, bool modsOnly = true)
9493
{
9594
DedicatedConfig.LoadWorld = world.WorldPath;
9695
DedicatedConfig.SelectedWorld = world;
97-
ImportWorldConfig(world, modsOnly);
96+
}
97+
98+
public void ImportSelectedWorldConfig()
99+
{
100+
ImportWorldConfig(DedicatedConfig.SelectedWorld, false);
98101
}
99102

100103
private void ImportWorldConfig(WorldViewModel world, bool modsOnly = true)
@@ -103,7 +106,7 @@ private void ImportWorldConfig(WorldViewModel world, bool modsOnly = true)
103106
foreach (var mod in world.Checkpoint.Mods)
104107
sb.AppendLine(mod.PublishedFileId.ToString());
105108

106-
DedicatedConfig.Mods = world.Checkpoint.Mods.Select(x => x.PublishedFileId).ToList(); //sb.ToString();
109+
DedicatedConfig.Mods = world.Checkpoint.Mods.Select(x => x.PublishedFileId).ToList();
107110

108111
Log.Debug("Loaded mod list from world");
109112

‎Torch.Server/TorchServer.cs‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ public TorchServer(TorchConfig config = null)
5656
sessionManager.AddFactory(x => new MultiplayerManagerDedicated(this));
5757
}
5858

59-
//public MyConfigDedicated<MyObjectBuilder_SessionSettings> DedicatedConfig { get; set; }
6059
/// <inheritdoc />
6160
public float SimulationRatio { get => _simRatio; set => SetValue(ref _simRatio, value); }
6261

‎Torch.Server/Views/ConfigControl.xaml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
</Grid.RowDefinitions>
2828
<DockPanel Grid.Row="0">
2929
<Label Content="World:" DockPanel.Dock="Left" />
30-
<Button Content="New World" Margin="3" DockPanel.Dock="Right" Click="NewWorld_OnClick" IsEnabled="false" ToolTip="Feature is not yet complete"/>
30+
<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."/>
3131
<ComboBox ItemsSource="{Binding Worlds}" SelectedItem="{Binding SelectedWorld}" Margin="3"
3232
SelectionChanged="Selector_OnSelectionChanged">
3333
<ComboBox.ItemTemplate>

‎Torch.Server/Views/ConfigControl.xaml.cs‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,9 +93,9 @@ private void Save_OnClick(object sender, RoutedEventArgs e)
9393
_instanceManager.SaveConfig();
9494
}
9595

96-
private void NewWorld_OnClick(object sender, RoutedEventArgs e)
96+
private void ImportConfig_OnClick(object sender, RoutedEventArgs e)
9797
{
98-
new WorldGeneratorDialog(_instanceManager).ShowDialog();
98+
_instanceManager.ImportSelectedWorldConfig();
9999
}
100100

101101
private void Selector_OnSelectionChanged(object sender, SelectionChangedEventArgs e)

‎Torch.Tests/Torch.Tests.csproj‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@
8686
</ItemGroup>
8787
<ItemGroup>
8888
<Service Include="{508349B6-6B84-4DF5-91F0-309BEEBAD82D}" />
89+
<Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
8990
</ItemGroup>
9091
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
9192
<Import Project="$(SolutionDir)\TransformOnBuild.targets" />

‎Torch/VRageGame.cs‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -232,8 +232,7 @@ private void DoStart()
232232

233233
if (MySandboxGame.FatalErrorDuringInit)
234234
{
235-
_log.Warn("Failed to start sandbox game: fatal error during init");
236-
return;
235+
throw new InvalidOperationException("Failed to start sandbox game: fatal error during init");
237236
}
238237
try
239238
{

0 commit comments

Comments
 (0)