From 82815f66e5384b8e8427d50720e23aebd3e10da0 Mon Sep 17 00:00:00 2001 From: John Gross Date: Thu, 17 Aug 2017 09:09:51 -0700 Subject: [PATCH] # Torch 1.1.229.265 * Features - Added more lenient version parsing for plugins (v#.# should work) - Added countdown option to restart command (!restart [seconds]) * Fixes - General fixes to work with the latest SE version - Fixed config changes not saving - Fixed crash on servers using the Windows Classic theme --- CHANGELOG.md | 9 +++ Torch.Client/Properties/AssemblyInfo.cs | 4 +- Torch.Client/Torch.Client.csproj | 3 + Torch.Client/TorchClient.cs | 5 +- Torch.Server/ListBoxExtensions.cs | 59 +++++++++++++++++++ Torch.Server/Managers/InstanceManager.cs | 2 +- Torch.Server/Properties/AssemblyInfo.cs | 4 +- Torch.Server/Torch.Server.csproj | 1 + Torch.Server/TorchServer.cs | 3 +- .../ViewModels/SessionSettingsViewModel.cs | 6 ++ Torch.Server/Views/ChatControl.xaml.cs | 5 +- Torch.Server/Views/ConfigControl.xaml | 4 ++ Torch.Server/Views/ConfigControl.xaml.cs | 29 +-------- Torch.Server/Views/TorchUI.xaml.cs | 3 +- Torch/Commands/TorchCommands.cs | 49 +++++++++++++-- Torch/Managers/ChatManager.cs | 2 +- Torch/Managers/MultiplayerManager.cs | 5 +- Torch/Managers/UpdateManager.cs | 5 +- Torch/SteamService.cs | 43 +++++++++----- Torch/Torch.csproj | 3 + 20 files changed, 180 insertions(+), 64 deletions(-) create mode 100644 Torch.Server/ListBoxExtensions.cs diff --git a/CHANGELOG.md b/CHANGELOG.md index 26db267..73b7085 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,12 @@ +# Torch 1.1.229.265 +* Features + - Added more lenient version parsing for plugins (v#.# should work) + - Added countdown option to restart command (!restart [seconds]) +* Fixes + - General fixes to work with the latest SE version + - Fixed config changes not saving + - (hopefully) Fixed issue causing crashes on servers using the Windows Classic theme + # Torch 1.1.207.7 * Notes - This release makes significant changes to TorchConfig.xml. It has been renamed to Torch.cfg and has different options. diff --git a/Torch.Client/Properties/AssemblyInfo.cs b/Torch.Client/Properties/AssemblyInfo.cs index fc07d79..be8ba40 100644 --- a/Torch.Client/Properties/AssemblyInfo.cs +++ b/Torch.Client/Properties/AssemblyInfo.cs @@ -1,4 +1,4 @@ using System.Reflection; -[assembly: AssemblyVersion("1.0.213.390")] -[assembly: AssemblyFileVersion("1.0.213.390")] \ No newline at end of file +[assembly: AssemblyVersion("1.0.229.265")] +[assembly: AssemblyFileVersion("1.0.229.265")] \ No newline at end of file diff --git a/Torch.Client/Torch.Client.csproj b/Torch.Client/Torch.Client.csproj index f279cf8..66d3145 100644 --- a/Torch.Client/Torch.Client.csproj +++ b/Torch.Client/Torch.Client.csproj @@ -103,6 +103,9 @@ ..\GameBinaries\VRage.Render11.dll False + + ..\..\..\..\..\..\..\steamcmd\steamapps\common\SpaceEngineersDedicatedServer\DedicatedServer64\VRage.Steam.dll + diff --git a/Torch.Client/TorchClient.cs b/Torch.Client/TorchClient.cs index 350cb60..719fdf4 100644 --- a/Torch.Client/TorchClient.cs +++ b/Torch.Client/TorchClient.cs @@ -11,6 +11,7 @@ using Sandbox.Engine.Utils; using Sandbox.Game; using Sandbox.ModAPI; using SpaceEngineers.Game; +using VRage.Steam; using Torch.API; using VRage.FileSystem; using VRageRender; @@ -22,7 +23,6 @@ namespace Torch.Client private MyCommonProgramStartup _startup; private IMyRender _renderer; private const uint APP_ID = 244850; - private VRageGameServices _services; public override void Init() { @@ -59,7 +59,6 @@ namespace Torch.Client InitializeRender(); - _services = new VRageGameServices(mySteamService); if (!Game.IsDedicated) MyFileSystem.InitUserSpecific(mySteamService.UserId.ToString()); } @@ -85,7 +84,7 @@ namespace Torch.Client public override void Start() { - using (var spaceEngineersGame = new SpaceEngineersGame(_services, RunArgs)) + using (var spaceEngineersGame = new SpaceEngineersGame(RunArgs)) { Log.Info("Starting client"); spaceEngineersGame.OnGameLoaded += SpaceEngineersGame_OnGameLoaded; diff --git a/Torch.Server/ListBoxExtensions.cs b/Torch.Server/ListBoxExtensions.cs new file mode 100644 index 0000000..adcc22f --- /dev/null +++ b/Torch.Server/ListBoxExtensions.cs @@ -0,0 +1,59 @@ +using System; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Controls.Primitives; +using System.Windows.Media; + +namespace Torch.Server +{ + public static class ListBoxExtensions + { + //https://stackoverflow.com/questions/28689125/how-to-autoscroll-listbox-to-bottom-wpf-c + public static void ScrollToItem(this ListBox listBox, int index) + { + // Find a container + UIElement container = null; + for (int i = index; i > 0; i--) + { + container = listBox.ItemContainerGenerator.ContainerFromIndex(i) as UIElement; + if (container != null) + { + break; + } + } + if (container == null) + return; + + // Find the ScrollContentPresenter + ScrollContentPresenter presenter = null; + for (Visual vis = container; vis != null && vis != listBox; vis = VisualTreeHelper.GetParent(vis) as Visual) + if ((presenter = vis as ScrollContentPresenter) != null) + break; + if (presenter == null) + return; + + // Find the IScrollInfo + var scrollInfo = + !presenter.CanContentScroll ? presenter : + presenter.Content as IScrollInfo ?? + FirstVisualChild(presenter.Content as ItemsPresenter) as IScrollInfo ?? + presenter; + + // Find the amount of items that is "Visible" in the ListBox + var height = (container as ListBoxItem).ActualHeight; + var lbHeight = listBox.ActualHeight; + var showCount = (int)Math.Floor(lbHeight / height) - 1; + + //Set the scrollbar + if (scrollInfo.CanVerticallyScroll) + scrollInfo.SetVerticalOffset(index - showCount); + } + + private static DependencyObject FirstVisualChild(Visual visual) + { + if (visual == null) return null; + if (VisualTreeHelper.GetChildrenCount(visual) == 0) return null; + return VisualTreeHelper.GetChild(visual, 0); + } + } +} diff --git a/Torch.Server/Managers/InstanceManager.cs b/Torch.Server/Managers/InstanceManager.cs index b9b1d91..11a689e 100644 --- a/Torch.Server/Managers/InstanceManager.cs +++ b/Torch.Server/Managers/InstanceManager.cs @@ -129,7 +129,7 @@ namespace Torch.Server.Managers public void SaveConfig() { - DedicatedConfig.Model.Save(); + DedicatedConfig.Save(); Log.Info("Saved dedicated config."); try diff --git a/Torch.Server/Properties/AssemblyInfo.cs b/Torch.Server/Properties/AssemblyInfo.cs index 1ef7f82..34b834d 100644 --- a/Torch.Server/Properties/AssemblyInfo.cs +++ b/Torch.Server/Properties/AssemblyInfo.cs @@ -1,4 +1,4 @@ using System.Reflection; -[assembly: AssemblyVersion("1.1.213.390")] -[assembly: AssemblyFileVersion("1.1.213.390")] \ No newline at end of file +[assembly: AssemblyVersion("1.1.229.265")] +[assembly: AssemblyFileVersion("1.1.229.265")] \ No newline at end of file diff --git a/Torch.Server/Torch.Server.csproj b/Torch.Server/Torch.Server.csproj index 34742d8..e57334d 100644 --- a/Torch.Server/Torch.Server.csproj +++ b/Torch.Server/Torch.Server.csproj @@ -185,6 +185,7 @@ + diff --git a/Torch.Server/TorchServer.cs b/Torch.Server/TorchServer.cs index 7df0d0a..41df9e5 100644 --- a/Torch.Server/TorchServer.cs +++ b/Torch.Server/TorchServer.cs @@ -79,7 +79,7 @@ namespace Torch.Server MyFinalBuildConstants.APP_VERSION = MyPerGameSettings.BasicGameInfo.GameVersion; InvokeBeforeRun(); - MyObjectBuilderSerializer.RegisterFromAssembly(typeof(MyObjectBuilder_CheckpointSerializer).Assembly); + //MyObjectBuilderSerializer.RegisterFromAssembly(typeof(MyObjectBuilder_CheckpointSerializer).Assembly); MyPlugins.RegisterGameAssemblyFile(MyPerGameSettings.GameModAssembly); MyPlugins.RegisterGameObjectBuildersAssemblyFile(MyPerGameSettings.GameModObjBuildersAssembly); MyPlugins.RegisterSandboxAssemblyFile(MyPerGameSettings.SandboxAssembly); @@ -131,7 +131,6 @@ namespace Torch.Server _uptime = Stopwatch.StartNew(); IsRunning = true; GameThread = Thread.CurrentThread; - Config.Save(); State = ServerState.Starting; Log.Info("Starting server."); diff --git a/Torch.Server/ViewModels/SessionSettingsViewModel.cs b/Torch.Server/ViewModels/SessionSettingsViewModel.cs index 4dc3875..f354dd5 100644 --- a/Torch.Server/ViewModels/SessionSettingsViewModel.cs +++ b/Torch.Server/ViewModels/SessionSettingsViewModel.cs @@ -74,6 +74,12 @@ namespace Torch.Server.ViewModels { get => _settings.HackSpeedMultiplier; set { _settings.HackSpeedMultiplier = value; OnPropertyChanged(); } } + + /// + public float WelderSpeedMultiplier + { + get => _settings.WelderSpeedMultiplier; set { _settings.WelderSpeedMultiplier = value; OnPropertyChanged(); } + } #endregion #region NPCs diff --git a/Torch.Server/Views/ChatControl.xaml.cs b/Torch.Server/Views/ChatControl.xaml.cs index 832f329..03bab57 100644 --- a/Torch.Server/Views/ChatControl.xaml.cs +++ b/Torch.Server/Views/ChatControl.xaml.cs @@ -49,12 +49,15 @@ namespace Torch.Server private void ChatHistory_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e) { + ChatItems.ScrollToItem(ChatItems.Items.Count - 1); + /* if (VisualTreeHelper.GetChildrenCount(ChatItems) > 0) { + Border border = (Border)VisualTreeHelper.GetChild(ChatItems, 0); ScrollViewer scrollViewer = (ScrollViewer)VisualTreeHelper.GetChild(border, 0); scrollViewer.ScrollToBottom(); - } + }*/ } private void SendButton_Click(object sender, RoutedEventArgs e) diff --git a/Torch.Server/Views/ConfigControl.xaml b/Torch.Server/Views/ConfigControl.xaml index 864fc94..d8b8327 100644 --- a/Torch.Server/Views/ConfigControl.xaml +++ b/Torch.Server/Views/ConfigControl.xaml @@ -104,6 +104,10 @@ + + ..\..\..\..\..\..\..\steamcmd\steamapps\common\SpaceEngineersDedicatedServer\DedicatedServer64\VRage.Steam.dll +