diff --git a/Torch.Server.Tests/Torch.Server.Tests.csproj b/Torch.Server.Tests/Torch.Server.Tests.csproj
index a3e28b1..dc35067 100644
--- a/Torch.Server.Tests/Torch.Server.Tests.csproj
+++ b/Torch.Server.Tests/Torch.Server.Tests.csproj
@@ -46,6 +46,10 @@
+
+ False
+ ..\..\..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\SpaceEngineers\Bin64\VRage.Game.dll
+
..\packages\xunit.abstractions.2.0.1\lib\net35\xunit.abstractions.dll
@@ -65,6 +69,7 @@
+
diff --git a/Torch.Server.Tests/TorchServerSessionSettingsTest.cs b/Torch.Server.Tests/TorchServerSessionSettingsTest.cs
new file mode 100644
index 0000000..662fcca
--- /dev/null
+++ b/Torch.Server.Tests/TorchServerSessionSettingsTest.cs
@@ -0,0 +1,26 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Reflection;
+using System.Text;
+using System.Threading.Tasks;
+using Torch.Server.ViewModels;
+using VRage.Game;
+using Xunit;
+
+namespace Torch.Server.Tests
+{
+ public class TorchServerSessionSettingsTest
+ {
+ public static PropertyInfo[] ViewModelProperties = typeof(SessionSettingsViewModel).GetProperties(BindingFlags.Public | BindingFlags.Instance);
+ public static IEnumerable
@@ -315,6 +326,10 @@
+
+ Designer
+ MSBuild:Compile
+
Designer
MSBuild:Compile
@@ -359,11 +374,11 @@
Designer
MSBuild:Compile
-
+
Designer
MSBuild:Compile
-
+
Designer
MSBuild:Compile
@@ -375,6 +390,10 @@
MSBuild:Compile
Designer
+
+ Designer
+ MSBuild:Compile
+
@@ -382,7 +401,12 @@
-
+
+
+ TextTemplatingFileGenerator
+ SessionSettingsViewModel.cs
+
+
diff --git a/Torch.Server/ViewModels/CheckpointViewModel.cs b/Torch.Server/ViewModels/CheckpointViewModel.cs
new file mode 100644
index 0000000..e846ea0
--- /dev/null
+++ b/Torch.Server/ViewModels/CheckpointViewModel.cs
@@ -0,0 +1,132 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Torch.Collections;
+using VRage;
+using VRage.Game;
+using VRage.Game.ModAPI;
+using VRage.ObjectBuilders;
+using VRage.Serialization;
+using VRageMath;
+
+namespace Torch.Server.ViewModels
+{
+ public class CheckpointViewModel : ViewModel
+ {
+ private MyObjectBuilder_Checkpoint _checkpoint;
+ private SessionSettingsViewModel _sessionSettings;
+
+ public CheckpointViewModel(MyObjectBuilder_Checkpoint checkpoint)
+ {
+ _checkpoint = checkpoint;
+ _sessionSettings = new SessionSettingsViewModel(_checkpoint.Settings);
+ }
+
+ public static implicit operator MyObjectBuilder_Checkpoint(CheckpointViewModel model)
+ {
+ return model._checkpoint;
+ }
+
+ public Vector3I CurrentSector { get => _checkpoint.CurrentSector; set => SetValue(ref _checkpoint.CurrentSector, value); }
+
+ public long ElapsedGameTime { get => _checkpoint.ElapsedGameTime; set => SetValue(ref _checkpoint.ElapsedGameTime, value); }
+
+ public string SessionName { get => _checkpoint.SessionName; set => SetValue(ref _checkpoint.SessionName, value); }
+
+ public MyPositionAndOrientation SpectatorPosition { get => _checkpoint.SpectatorPosition; set => SetValue(ref _checkpoint.SpectatorPosition, value); }
+
+ public bool SpectatorIsLightOn { get => _checkpoint.SpectatorIsLightOn; set => SetValue(ref _checkpoint.SpectatorIsLightOn, value); }
+
+ public MyCameraControllerEnum CameraController { get => _checkpoint.CameraController; set => SetValue(ref _checkpoint.CameraController, value); }
+
+ public long CameraEntity { get => _checkpoint.CameraEntity; set => SetValue(ref _checkpoint.CameraEntity, value); }
+
+ public long ControlledObject { get => _checkpoint.ControlledObject; set => SetValue(ref _checkpoint.ControlledObject, value); }
+
+ public string Password { get => _checkpoint.Password; set => SetValue(ref _checkpoint.Password, value); }
+
+ public string Description { get => _checkpoint.Description; set => SetValue(ref _checkpoint.Description, value); }
+
+ public DateTime LastSaveTime { get => _checkpoint.LastSaveTime; set => SetValue(ref _checkpoint.LastSaveTime, value); }
+
+ public float SpectatorDistance { get => _checkpoint.SpectatorDistance; set => SetValue(ref _checkpoint.SpectatorDistance, value); }
+
+ public ulong? WorkshopId { get => _checkpoint.WorkshopId; set => SetValue(ref _checkpoint.WorkshopId, value); }
+
+ public MyObjectBuilder_Toolbar CharacterToolbar { get => _checkpoint.CharacterToolbar; set => SetValue(ref _checkpoint.CharacterToolbar, value); }
+
+ public SerializableDictionaryCompat ControlledEntities { get => _checkpoint.ControlledEntities; set => SetValue(ref _checkpoint.ControlledEntities, value); }
+
+ public SessionSettingsViewModel Settings
+ {
+ get => _sessionSettings;
+ set
+ {
+ SetValue(ref _sessionSettings, value);
+ _checkpoint.Settings = _sessionSettings;
+ }
+ }
+
+ public MyObjectBuilder_ScriptManager ScriptManagerData => throw new NotImplementedException();
+
+ public int AppVersion { get => _checkpoint.AppVersion; set => SetValue(ref _checkpoint.AppVersion, value); }
+
+ public MyObjectBuilder_FactionCollection Factions => throw new NotImplementedException();
+
+ public List Mods { get => _checkpoint.Mods; set => SetValue(ref _checkpoint.Mods, value); }
+
+ public SerializableDictionary PromotedUsers { get => _checkpoint.PromotedUsers; set => SetValue(ref _checkpoint.PromotedUsers, value); }
+
+ public HashSet CreativeTools { get => _checkpoint.CreativeTools; set => SetValue(ref _checkpoint.CreativeTools, value); }
+
+ public SerializableDefinitionId Scenario { get => _checkpoint.Scenario; set => SetValue(ref _checkpoint.Scenario, value); }
+
+ public List RespawnCooldowns { get => _checkpoint.RespawnCooldowns; set => SetValue(ref _checkpoint.RespawnCooldowns, value); }
+
+ public List Identities { get => _checkpoint.Identities; set => SetValue(ref _checkpoint.Identities, value); }
+
+ public List Clients { get => _checkpoint.Clients; set => SetValue(ref _checkpoint.Clients, value); }
+
+ public MyEnvironmentHostilityEnum? PreviousEnvironmentHostility { get => _checkpoint.PreviousEnvironmentHostility; set => SetValue(ref _checkpoint.PreviousEnvironmentHostility, value); }
+
+ public SerializableDictionary AllPlayersData { get => _checkpoint.AllPlayersData; set => SetValue(ref _checkpoint.AllPlayersData, value); }
+
+ public SerializableDictionary> AllPlayersColors { get => _checkpoint.AllPlayersColors; set => SetValue(ref _checkpoint.AllPlayersColors, value); }
+
+ public List ChatHistory { get => _checkpoint.ChatHistory; set => SetValue(ref _checkpoint.ChatHistory, value); }
+
+ public List FactionChatHistory { get => _checkpoint.FactionChatHistory; set => SetValue(ref _checkpoint.FactionChatHistory, value); }
+
+ public List NonPlayerIdentities { get => _checkpoint.NonPlayerIdentities; set => SetValue(ref _checkpoint.NonPlayerIdentities, value); }
+
+ public SerializableDictionary Gps { get => _checkpoint.Gps; set => SetValue(ref _checkpoint.Gps, value); }
+
+ public SerializableBoundingBoxD? WorldBoundaries { get => _checkpoint.WorldBoundaries; set => SetValue(ref _checkpoint.WorldBoundaries, value); }
+
+ public List SessionComponents { get => _checkpoint.SessionComponents; set => SetValue(ref _checkpoint.SessionComponents, value); }
+
+ public SerializableDefinitionId GameDefinition { get => _checkpoint.GameDefinition; set => SetValue(ref _checkpoint.GameDefinition, value); }
+
+ public HashSet SessionComponentEnabled { get => _checkpoint.SessionComponentEnabled; set => SetValue(ref _checkpoint.SessionComponentEnabled, value); }
+
+ public HashSet SessionComponentDisabled { get => _checkpoint.SessionComponentDisabled; set => SetValue(ref _checkpoint.SessionComponentDisabled, value); }
+
+ public DateTime InGameTime { get => _checkpoint.InGameTime; set => SetValue(ref _checkpoint.InGameTime, value); }
+
+ public MyObjectBuilder_SessionComponentMission MissionTriggers { get => _checkpoint.MissionTriggers; set => SetValue(ref _checkpoint.MissionTriggers, value); }
+
+ public string Briefing { get => _checkpoint.Briefing; set => SetValue(ref _checkpoint.Briefing, value); }
+
+ public string BriefingVideo { get => _checkpoint.BriefingVideo; set => SetValue(ref _checkpoint.BriefingVideo, value); }
+
+ public string CustomLoadingScreenImage { get => _checkpoint.CustomLoadingScreenImage; set => SetValue(ref _checkpoint.BriefingVideo, value); }
+
+ public string CustomLoadingScreenText { get => _checkpoint.CustomLoadingScreenText; set => SetValue(ref _checkpoint.CustomLoadingScreenText, value); }
+
+ public string CustomSkybox { get => _checkpoint.CustomSkybox; set => SetValue(ref _checkpoint.CustomSkybox, value); }
+
+ public int RequiresDX { get => _checkpoint.RequiresDX; set => SetValue(ref _checkpoint.RequiresDX, value); }
+ }
+}
diff --git a/Torch.Server/ViewModels/ConfigDedicatedViewModel.cs b/Torch.Server/ViewModels/ConfigDedicatedViewModel.cs
index 5a6498e..ab63510 100644
--- a/Torch.Server/ViewModels/ConfigDedicatedViewModel.cs
+++ b/Torch.Server/ViewModels/ConfigDedicatedViewModel.cs
@@ -7,6 +7,7 @@ using System.Threading.Tasks;
using NLog;
using Sandbox.Engine.Utils;
using Torch.Collections;
+using Torch.Server.Managers;
using VRage.Game;
using VRage.Game.ModAPI;
@@ -62,7 +63,18 @@ namespace Torch.Server.ViewModels
private SessionSettingsViewModel _sessionSettings;
public SessionSettingsViewModel SessionSettings { get => _sessionSettings; set { _sessionSettings = value; OnPropertyChanged(); } }
- public MtObservableList WorldPaths { get; } = new MtObservableList();
+ public MtObservableList Worlds { get; } = new MtObservableList();
+ private WorldViewModel _selectedWorld;
+ public WorldViewModel SelectedWorld
+ {
+ get => _selectedWorld;
+ set
+ {
+ SetValue(ref _selectedWorld, value);
+ LoadWorld = _selectedWorld.WorldPath;
+ }
+ }
+
private string _administrators;
public string Administrators { get => _administrators; set { _administrators = value; OnPropertyChanged(); } }
private string _banned;
diff --git a/Torch.Server/ViewModels/SessionSettingsViewModel.cs b/Torch.Server/ViewModels/SessionSettingsViewModel.cs
index f045c2f..401969e 100644
--- a/Torch.Server/ViewModels/SessionSettingsViewModel.cs
+++ b/Torch.Server/ViewModels/SessionSettingsViewModel.cs
@@ -1,388 +1,253 @@
-using System;
+// This file is generated automatically! Any changes will be overwritten.
+
+using System;
using System.Collections.Generic;
-using System.Collections.ObjectModel;
using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using SharpDX.Toolkit.Collections;
+using Torch;
using Torch.Collections;
using VRage.Game;
using VRage.Library.Utils;
+using VRage.Serialization;
namespace Torch.Server.ViewModels
{
- ///
- /// View model for
- ///
- public class SessionSettingsViewModel : ViewModel
- {
- private MyObjectBuilder_SessionSettings _settings;
+ public class SessionSettingsViewModel : ViewModel
+ {
+ private MyObjectBuilder_SessionSettings _settings;
+ ///
+ public string GameMode { get => _settings.GameMode.ToString(); set { Enum.TryParse(value, true, out VRage.Library.Utils.MyGameModeEnum parsedVal); SetValue(ref _settings.GameMode, parsedVal); } }
+ public List GameModeValues { get; } = new List {"Creative", "Survival"};
- ///
- /// Creates a new view model with a new object.
- ///
- public SessionSettingsViewModel() : this(new MyObjectBuilder_SessionSettings())
- {
+ ///
+ public System.Single InventorySizeMultiplier { get => _settings.InventorySizeMultiplier; set => SetValue(ref _settings.InventorySizeMultiplier, value); }
- }
+ ///
+ public System.Single AssemblerSpeedMultiplier { get => _settings.AssemblerSpeedMultiplier; set => SetValue(ref _settings.AssemblerSpeedMultiplier, value); }
- ///
- /// Creates a view model using an existing object.
- ///
- public SessionSettingsViewModel(MyObjectBuilder_SessionSettings settings)
- {
- _settings = settings;
- foreach (var limit in settings.BlockTypeLimits.Dictionary)
- BlockLimits.Add(new BlockLimitViewModel(this, limit.Key, limit.Value));
- }
+ ///
+ public System.Single AssemblerEfficiencyMultiplier { get => _settings.AssemblerEfficiencyMultiplier; set => SetValue(ref _settings.AssemblerEfficiencyMultiplier, value); }
- public MtObservableList BlockLimits { get; } = new MtObservableList();
+ ///
+ public System.Single RefinerySpeedMultiplier { get => _settings.RefinerySpeedMultiplier; set => SetValue(ref _settings.RefinerySpeedMultiplier, value); }
- #region Multipliers
+ ///
+ public string OnlineMode { get => _settings.OnlineMode.ToString(); set { Enum.TryParse(value, true, out VRage.Game.MyOnlineModeEnum parsedVal); SetValue(ref _settings.OnlineMode, parsedVal); } }
+ public List OnlineModeValues { get; } = new List {"OFFLINE", "PUBLIC", "FRIENDS", "PRIVATE"};
- ///
- public float InventorySizeMultiplier
- {
- get => _settings.InventorySizeMultiplier; set { _settings.InventorySizeMultiplier = value; OnPropertyChanged(); }
- }
+ ///
+ public System.Int16 MaxPlayers { get => _settings.MaxPlayers; set => SetValue(ref _settings.MaxPlayers, value); }
- ///
- public float RefinerySpeedMultiplier
- {
- get => _settings.RefinerySpeedMultiplier; set { _settings.RefinerySpeedMultiplier = value; OnPropertyChanged(); }
- }
+ ///
+ public System.Int16 MaxFloatingObjects { get => _settings.MaxFloatingObjects; set => SetValue(ref _settings.MaxFloatingObjects, value); }
- ///
- public float AssemblerEfficiencyMultiplier
- {
- get => _settings.AssemblerEfficiencyMultiplier; set { _settings.AssemblerEfficiencyMultiplier = value; OnPropertyChanged(); }
- }
+ ///
+ public System.Int16 MaxBackupSaves { get => _settings.MaxBackupSaves; set => SetValue(ref _settings.MaxBackupSaves, value); }
- ///
- public float AssemblerSpeedMultiplier
- {
- get => _settings.AssemblerSpeedMultiplier; set { _settings.AssemblerSpeedMultiplier = value; OnPropertyChanged(); }
- }
+ ///
+ public System.Int32 MaxGridSize { get => _settings.MaxGridSize; set => SetValue(ref _settings.MaxGridSize, value); }
- ///
- public float GrinderSpeedMultiplier
- {
- get => _settings.GrinderSpeedMultiplier; set { _settings.GrinderSpeedMultiplier = value; OnPropertyChanged(); }
- }
+ ///
+ public System.Int32 MaxBlocksPerPlayer { get => _settings.MaxBlocksPerPlayer; set => SetValue(ref _settings.MaxBlocksPerPlayer, value); }
- ///
- public float HackSpeedMultiplier
- {
- get => _settings.HackSpeedMultiplier; set { _settings.HackSpeedMultiplier = value; OnPropertyChanged(); }
- }
+ ///
+ public System.Boolean EnableBlockLimits { get => _settings.EnableBlockLimits; set => SetValue(ref _settings.EnableBlockLimits, value); }
- ///
- public float WelderSpeedMultiplier
- {
- get => _settings.WelderSpeedMultiplier; set { _settings.WelderSpeedMultiplier = value; OnPropertyChanged(); }
- }
- #endregion
+ ///
+ public System.Boolean EnableRemoteBlockRemoval { get => _settings.EnableRemoteBlockRemoval; set => SetValue(ref _settings.EnableRemoteBlockRemoval, value); }
- #region NPCs
+ ///
+ public string EnvironmentHostility { get => _settings.EnvironmentHostility.ToString(); set { Enum.TryParse(value, true, out VRage.Game.MyEnvironmentHostilityEnum parsedVal); SetValue(ref _settings.EnvironmentHostility, parsedVal); } }
+ public List EnvironmentHostilityValues { get; } = new List {"SAFE", "NORMAL", "CATACLYSM", "CATACLYSM_UNREAL"};
- ///
- public bool EnableDrones
- {
- get => _settings.EnableDrones; set { _settings.EnableDrones = value; OnPropertyChanged(); }
- }
+ ///
+ public System.Boolean AutoHealing { get => _settings.AutoHealing; set => SetValue(ref _settings.AutoHealing, value); }
- ///
- public bool EnableEncounters
- {
- get => _settings.EnableEncounters; set { _settings.EnableEncounters = value; OnPropertyChanged(); }
- }
+ ///
+ public System.Boolean EnableCopyPaste { get => _settings.EnableCopyPaste; set => SetValue(ref _settings.EnableCopyPaste, value); }
- ///
- public bool EnableSpiders
- {
- get => _settings.EnableSpiders; set { _settings.EnableSpiders = value; OnPropertyChanged(); }
- }
+ ///
+ public System.Boolean WeaponsEnabled { get => _settings.WeaponsEnabled; set => SetValue(ref _settings.WeaponsEnabled, value); }
- ///
- public bool EnableWolves
- {
- get => _settings.EnableWolfs; set { _settings.EnableWolfs = value; OnPropertyChanged(); }
- }
+ ///
+ public System.Boolean ShowPlayerNamesOnHud { get => _settings.ShowPlayerNamesOnHud; set => SetValue(ref _settings.ShowPlayerNamesOnHud, value); }
- ///
- public bool EnableCargoShips
- {
- get => _settings.CargoShipsEnabled; set { _settings.CargoShipsEnabled = value; OnPropertyChanged(); }
- }
- #endregion
+ ///
+ public System.Boolean ThrusterDamage { get => _settings.ThrusterDamage; set => SetValue(ref _settings.ThrusterDamage, value); }
- #region Environment
+ ///
+ public System.Boolean CargoShipsEnabled { get => _settings.CargoShipsEnabled; set => SetValue(ref _settings.CargoShipsEnabled, value); }
- ///
- public bool EnableSunRotation
- {
- get => _settings.EnableSunRotation; set { _settings.EnableSunRotation = value; OnPropertyChanged(); }
- }
+ ///
+ public System.Boolean EnableSpectator { get => _settings.EnableSpectator; set => SetValue(ref _settings.EnableSpectator, value); }
- ///
- public bool EnableAirtightness
- {
- get => _settings.EnableOxygenPressurization; set { _settings.EnableOxygenPressurization = value; OnPropertyChanged(); }
- }
+ ///
+ public System.Int32 WorldSizeKm { get => _settings.WorldSizeKm; set => SetValue(ref _settings.WorldSizeKm, value); }
- ///
- public bool EnableOxygen
- {
- get => _settings.EnableOxygen; set { _settings.EnableOxygen = value; OnPropertyChanged(); }
- }
+ ///
+ public System.Boolean RespawnShipDelete { get => _settings.RespawnShipDelete; set => SetValue(ref _settings.RespawnShipDelete, value); }
- ///
- public bool EnableDestructibleBlocks
- {
- get => _settings.DestructibleBlocks; set { _settings.DestructibleBlocks = value; OnPropertyChanged(); }
- }
+ ///
+ public System.Boolean ResetOwnership { get => _settings.ResetOwnership; set => SetValue(ref _settings.ResetOwnership, value); }
- ///
- public bool EnableToolShake
- {
- get => _settings.EnableToolShake; set { _settings.EnableToolShake = value; OnPropertyChanged(); }
- }
+ ///
+ public System.Single WelderSpeedMultiplier { get => _settings.WelderSpeedMultiplier; set => SetValue(ref _settings.WelderSpeedMultiplier, value); }
- ///
- public bool EnableVoxelDestruction
- {
- get => _settings.EnableVoxelDestruction; set { _settings.EnableVoxelDestruction = value; OnPropertyChanged(); }
- }
+ ///
+ public System.Single GrinderSpeedMultiplier { get => _settings.GrinderSpeedMultiplier; set => SetValue(ref _settings.GrinderSpeedMultiplier, value); }
- ///
- /// List used to populate the environment hostility combo box.
- ///
- public List EnvironmentHostilityValues { get; } = Enum.GetNames(typeof(MyEnvironmentHostilityEnum)).ToList();
+ ///
+ public System.Boolean RealisticSound { get => _settings.RealisticSound; set => SetValue(ref _settings.RealisticSound, value); }
- ///
- public string EnvironmentHostility
- {
- get => _settings.EnvironmentHostility.ToString(); set { Enum.TryParse(value, true, out _settings.EnvironmentHostility); OnPropertyChanged(); }
- }
+ ///
+ public System.Single HackSpeedMultiplier { get => _settings.HackSpeedMultiplier; set => SetValue(ref _settings.HackSpeedMultiplier, value); }
- ///
- public bool EnableFlora
- {
- get => _settings.EnableFlora; set { _settings.EnableFlora = value; OnPropertyChanged(); }
- }
- #endregion
+ ///
+ public System.Nullable PermanentDeath { get => _settings.PermanentDeath; set => SetValue(ref _settings.PermanentDeath, value); }
- ///
- /// List used to populate the game mode combobox.
- ///
- public List GameModeValues { get; } = Enum.GetNames(typeof(MyGameModeEnum)).ToList();
+ ///
+ public System.UInt32 AutoSaveInMinutes { get => _settings.AutoSaveInMinutes; set => SetValue(ref _settings.AutoSaveInMinutes, value); }
- ///
- public string GameMode
- {
- get => _settings.GameMode.ToString(); set { Enum.TryParse(value, true, out _settings.GameMode); OnPropertyChanged(); }
- }
+ ///
+ public System.Boolean EnableSaving { get => _settings.EnableSaving; set => SetValue(ref _settings.EnableSaving, value); }
- ///
- public bool EnableAutoHealing
- {
- get => _settings.AutoHealing; set { _settings.AutoHealing = value; OnPropertyChanged(); }
- }
+ ///
+ public System.Boolean EnableRespawnScreen { get => _settings.EnableRespawnScreen; set => SetValue(ref _settings.EnableRespawnScreen, value); }
- ///
- public bool EnableCopyPaste
- {
- get => _settings.EnableCopyPaste; set { _settings.EnableCopyPaste = value; OnPropertyChanged(); }
- }
+ ///
+ public System.Boolean InfiniteAmmo { get => _settings.InfiniteAmmo; set => SetValue(ref _settings.InfiniteAmmo, value); }
- ///
- public bool ShowPlayerNamesOnHud
- {
- get => _settings.ShowPlayerNamesOnHud; set { _settings.ShowPlayerNamesOnHud = value; OnPropertyChanged(); }
- }
+ ///
+ public System.Boolean EnableContainerDrops { get => _settings.EnableContainerDrops; set => SetValue(ref _settings.EnableContainerDrops, value); }
- ///
- public bool EnableThirdPerson
- {
- get => _settings.Enable3rdPersonView; set { _settings.Enable3rdPersonView = value; OnPropertyChanged(); }
- }
+ ///
+ public System.Single SpawnShipTimeMultiplier { get => _settings.SpawnShipTimeMultiplier; set => SetValue(ref _settings.SpawnShipTimeMultiplier, value); }
- ///
- public bool EnableSpectator
- {
- get => _settings.EnableSpectator; set { _settings.EnableSpectator = value; OnPropertyChanged(); }
- }
+ ///
+ public System.Single ProceduralDensity { get => _settings.ProceduralDensity; set => SetValue(ref _settings.ProceduralDensity, value); }
- ///
- public bool SpawnWithTools
- {
- get => _settings.SpawnWithTools; set { _settings.SpawnWithTools = value; OnPropertyChanged(); }
- }
+ ///
+ public System.Int32 ProceduralSeed { get => _settings.ProceduralSeed; set => SetValue(ref _settings.ProceduralSeed, value); }
- ///
- public bool EnableConvertToStation
- {
- get => _settings.EnableConvertToStation; set { _settings.EnableConvertToStation = value; OnPropertyChanged(); }
- }
+ ///
+ public System.Boolean DestructibleBlocks { get => _settings.DestructibleBlocks; set => SetValue(ref _settings.DestructibleBlocks, value); }
- ///
- public bool EnableJetpack
- {
- get => _settings.EnableJetpack; set { _settings.EnableJetpack = value; OnPropertyChanged(); }
- }
+ ///
+ public System.Boolean EnableIngameScripts { get => _settings.EnableIngameScripts; set => SetValue(ref _settings.EnableIngameScripts, value); }
- ///
- public bool EnableRemoteOwnerRemoval
- {
- get => _settings.EnableRemoteBlockRemoval; set { _settings.EnableRemoteBlockRemoval = value; OnPropertyChanged(); }
- }
+ ///
+ public System.Int32 ViewDistance { get => _settings.ViewDistance; set => SetValue(ref _settings.ViewDistance, value); }
- ///
- public bool EnableRespawnShips
- {
- get => _settings.EnableRespawnShips; set { _settings.EnableRespawnShips = value; OnPropertyChanged(); }
- }
+ ///
+ public System.Int32 FloraDensity { get => _settings.FloraDensity; set => SetValue(ref _settings.FloraDensity, value); }
- ///
- public bool EnableScripterRole
- {
- get => _settings.EnableScripterRole; set { _settings.EnableScripterRole = value; OnPropertyChanged(); }
- }
+ ///
+ public System.Boolean EnableToolShake { get => _settings.EnableToolShake; set => SetValue(ref _settings.EnableToolShake, value); }
- ///
- public bool EnableRealisticSound
- {
- get => _settings.RealisticSound; set { _settings.RealisticSound = value; OnPropertyChanged(); }
- }
+ ///
+ public System.Int32 VoxelGeneratorVersion { get => _settings.VoxelGeneratorVersion; set => SetValue(ref _settings.VoxelGeneratorVersion, value); }
- ///
- public bool ResetOwnership
- {
- get => _settings.ResetOwnership; set { _settings.ResetOwnership = value; OnPropertyChanged(); }
- }
+ ///
+ public System.Boolean EnableOxygen { get => _settings.EnableOxygen; set => SetValue(ref _settings.EnableOxygen, value); }
- ///
- public bool DeleteRespawnShips
- {
- get => _settings.RespawnShipDelete; set { _settings.RespawnShipDelete = value; OnPropertyChanged(); }
- }
+ ///
+ public System.Boolean EnableOxygenPressurization { get => _settings.EnableOxygenPressurization; set => SetValue(ref _settings.EnableOxygenPressurization, value); }
- ///
- public bool EnableThrusterDamage
- {
- get => _settings.ThrusterDamage; set { _settings.ThrusterDamage = value; OnPropertyChanged(); }
- }
+ ///
+ public System.Boolean Enable3rdPersonView { get => _settings.Enable3rdPersonView; set => SetValue(ref _settings.Enable3rdPersonView, value); }
- ///
- public bool EnableWeapons
- {
- get => _settings.WeaponsEnabled; set { _settings.WeaponsEnabled = value; OnPropertyChanged(); }
- }
+ ///
+ public System.Boolean EnableEncounters { get => _settings.EnableEncounters; set => SetValue(ref _settings.EnableEncounters, value); }
- ///
- public bool EnableIngameScripts
- {
- get => _settings.EnableIngameScripts; set { _settings.EnableIngameScripts = value; OnPropertyChanged(); }
- }
+ ///
+ public System.Boolean EnableFlora { get => _settings.EnableFlora; set => SetValue(ref _settings.EnableFlora, value); }
- ///
- public uint AutosaveInterval
- {
- get => _settings.AutoSaveInMinutes; set { _settings.AutoSaveInMinutes = value; OnPropertyChanged(); }
- }
+ ///
+ public System.Boolean EnableConvertToStation { get => _settings.EnableConvertToStation; set => SetValue(ref _settings.EnableConvertToStation, value); }
- ///
- public int FloraDensity
- {
- get => _settings.FloraDensity; set { _settings.FloraDensity = value; OnPropertyChanged(); }
- }
+ ///
+ public System.Boolean StationVoxelSupport { get => _settings.StationVoxelSupport; set => SetValue(ref _settings.StationVoxelSupport, value); }
- ///
- public float FloraDensityMultiplier
- {
- get => _settings.FloraDensityMultiplier; set { _settings.FloraDensityMultiplier = value; OnPropertyChanged(); }
- }
+ ///
+ public System.Boolean EnableSunRotation { get => _settings.EnableSunRotation; set => SetValue(ref _settings.EnableSunRotation, value); }
- ///
- public short MaxBackupSaves
- {
- get => _settings.MaxBackupSaves; set { _settings.MaxBackupSaves = value; OnPropertyChanged(); }
- }
+ ///
+ public System.Boolean EnableRespawnShips { get => _settings.EnableRespawnShips; set => SetValue(ref _settings.EnableRespawnShips, value); }
- ///
- public int MaxBlocksPerPlayer
- {
- get => _settings.MaxBlocksPerPlayer; set { _settings.MaxBlocksPerPlayer = value; OnPropertyChanged(); }
- }
+ ///
+ public System.Boolean ScenarioEditMode { get => _settings.ScenarioEditMode; set => SetValue(ref _settings.ScenarioEditMode, value); }
- ///
- public short MaxFloatingObjects
- {
- get => _settings.MaxFloatingObjects; set { _settings.MaxFloatingObjects = value; OnPropertyChanged(); }
- }
+ ///
+ public System.Boolean Scenario { get => _settings.Scenario; set => SetValue(ref _settings.Scenario, value); }
- ///
- public int MaxGridSize
- {
- get => _settings.MaxGridSize; set { _settings.MaxGridSize = value; OnPropertyChanged(); }
- }
+ ///
+ public System.Boolean CanJoinRunning { get => _settings.CanJoinRunning; set => SetValue(ref _settings.CanJoinRunning, value); }
- ///
- public short MaxPlayers
- {
- get => _settings.MaxPlayers; set { _settings.MaxPlayers = value; OnPropertyChanged(); }
- }
+ ///
+ public System.Int32 PhysicsIterations { get => _settings.PhysicsIterations; set => SetValue(ref _settings.PhysicsIterations, value); }
- ///
- public int PhysicsIterations
- {
- get => _settings.PhysicsIterations; set { _settings.PhysicsIterations = value; OnPropertyChanged(); }
- }
+ ///
+ public System.Single SunRotationIntervalMinutes { get => _settings.SunRotationIntervalMinutes; set => SetValue(ref _settings.SunRotationIntervalMinutes, value); }
- ///
- public float SpawnTimeMultiplier
- {
- get => _settings.SpawnShipTimeMultiplier; set { _settings.SpawnShipTimeMultiplier = value; OnPropertyChanged(); }
- }
+ ///
+ public System.Boolean EnableJetpack { get => _settings.EnableJetpack; set => SetValue(ref _settings.EnableJetpack, value); }
- ///
- public float SunRotationInterval
- {
- get => _settings.SunRotationIntervalMinutes; set { _settings.SunRotationIntervalMinutes = value; OnPropertyChanged(); }
- }
+ ///
+ public System.Boolean SpawnWithTools { get => _settings.SpawnWithTools; set => SetValue(ref _settings.SpawnWithTools, value); }
- ///
- public int ViewDistance
- {
- get => _settings.ViewDistance; set { _settings.ViewDistance = value; OnPropertyChanged(); }
- }
+ ///
+ public System.Boolean StartInRespawnScreen { get => _settings.StartInRespawnScreen; set => SetValue(ref _settings.StartInRespawnScreen, value); }
- ///
- public int WorldSize
- {
- get => _settings.WorldSizeKm; set { _settings.WorldSizeKm = value; OnPropertyChanged(); }
- }
+ ///
+ public System.Boolean EnableVoxelDestruction { get => _settings.EnableVoxelDestruction; set => SetValue(ref _settings.EnableVoxelDestruction, value); }
- ///
- public float ProceduralDensity
- {
- get => _settings.ProceduralDensity; set { _settings.ProceduralDensity = value; OnPropertyChanged(); }
- }
+ ///
+ public System.Int32 MaxDrones { get => _settings.MaxDrones; set => SetValue(ref _settings.MaxDrones, value); }
- ///
- public int ProceduralSeed
- {
- get => _settings.ProceduralSeed;
- set { _settings.ProceduralSeed = value; OnPropertyChanged(); }
- }
+ ///
+ public System.Boolean EnableDrones { get => _settings.EnableDrones; set => SetValue(ref _settings.EnableDrones, value); }
- ///
- public static implicit operator MyObjectBuilder_SessionSettings(SessionSettingsViewModel viewModel)
- {
- viewModel._settings.BlockTypeLimits.Dictionary.Clear();
- foreach (var limit in viewModel.BlockLimits)
- viewModel._settings.BlockTypeLimits.Dictionary.Add(limit.BlockType, limit.Limit);
- return viewModel._settings;
- }
- }
+ ///
+ public System.Boolean EnableWolfs { get => _settings.EnableWolfs; set => SetValue(ref _settings.EnableWolfs, value); }
+
+ ///
+ public System.Boolean EnableSpiders { get => _settings.EnableSpiders; set => SetValue(ref _settings.EnableSpiders, value); }
+
+ ///
+ public System.Single FloraDensityMultiplier { get => _settings.FloraDensityMultiplier; set => SetValue(ref _settings.FloraDensityMultiplier, value); }
+
+ ///
+ public System.Boolean EnableStructuralSimulation { get => _settings.EnableStructuralSimulation; set => SetValue(ref _settings.EnableStructuralSimulation, value); }
+
+ ///
+ public System.Int32 MaxActiveFracturePieces { get => _settings.MaxActiveFracturePieces; set => SetValue(ref _settings.MaxActiveFracturePieces, value); }
+
+ ///
+ public VRage.Serialization.SerializableDictionary BlockTypeLimits { get => _settings.BlockTypeLimits; set => SetValue(ref _settings.BlockTypeLimits, value); }
+
+ ///
+ public System.Boolean EnableScripterRole { get => _settings.EnableScripterRole; set => SetValue(ref _settings.EnableScripterRole, value); }
+
+ ///
+ public System.Int32 MinDropContainerRespawnTime { get => _settings.MinDropContainerRespawnTime; set => SetValue(ref _settings.MinDropContainerRespawnTime, value); }
+
+ ///
+ public System.Int32 MaxDropContainerRespawnTime { get => _settings.MaxDropContainerRespawnTime; set => SetValue(ref _settings.MaxDropContainerRespawnTime, value); }
+
+ ///
+ public System.Boolean EnableTurretsFriendlyFire { get => _settings.EnableTurretsFriendlyFire; set => SetValue(ref _settings.EnableTurretsFriendlyFire, value); }
+
+ ///
+ public System.Boolean EnableSubgridDamage { get => _settings.EnableSubgridDamage; set => SetValue(ref _settings.EnableSubgridDamage, value); }
+
+
+ public SessionSettingsViewModel(MyObjectBuilder_SessionSettings settings)
+ {
+ _settings = settings;
+ }
+
+ public static implicit operator MyObjectBuilder_SessionSettings(SessionSettingsViewModel viewModel)
+ {
+ return viewModel._settings;
+ }
+ }
}
diff --git a/Torch.Server/ViewModels/SessionSettingsViewModel.tt b/Torch.Server/ViewModels/SessionSettingsViewModel.tt
new file mode 100644
index 0000000..f399fc0
--- /dev/null
+++ b/Torch.Server/ViewModels/SessionSettingsViewModel.tt
@@ -0,0 +1,92 @@
+<#@ template debug="false" hostspecific="false" language="C#" #>
+<#@ assembly name="System.Core" #>
+<#@ assembly name="$(SolutionDir)\GameBinaries\VRage.Game.dll" #>
+<#@ assembly name="$(SolutionDir)\GameBinaries\VRage.Library.dll" #>
+<#@ import namespace="System.Collections" #>
+<#@ import namespace="System.Linq" #>
+<#@ import namespace="System.Text" #>
+<#@ import namespace="System.Collections.Generic" #>
+<#@ import namespace="System.Reflection" #>
+<#@ import namespace="VRage.Game" #>
+<#@ import namespace="VRage.Serialization" #>
+<#@ output extension=".cs" #>
+// This file is generated automatically! Any changes will be overwritten.
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using Torch;
+using Torch.Collections;
+using VRage.Game;
+using VRage.Library.Utils;
+using VRage.Serialization;
+
+namespace Torch.Server.ViewModels
+{
+ public class SessionSettingsViewModel : ViewModel
+ {
+ private MyObjectBuilder_SessionSettings _settings;
+ <#
+ var typeFields = typeof(MyObjectBuilder_SessionSettings).GetFields(BindingFlags.Instance | BindingFlags.Public);
+
+ PushIndent(" ");
+ foreach (var field in typeFields)
+ {
+ var getSet = "";
+ WriteLine(GetPropertySummary(field));
+ if (field.FieldType.IsEnum)
+ {
+ Write($"public string {field.Name} ");
+ WriteLine($"{{ get => _settings.{field.Name}.ToString(); set {{ Enum.TryParse(value, true, out {field.FieldType} parsedVal); SetValue(ref _settings.{field.Name}, parsedVal); }} }}");
+ WriteLine($"public List {field.Name}Values {{ get; }} = new List {{{string.Join(", ", Enum.GetNames(field.FieldType).Select(x => $"\"{x}\""))}}};");
+ }
+ else
+ WriteLine($"public {GetSyntaxName(field.FieldType)} {field.Name} {{ get => _settings.{field.Name}; set => SetValue(ref _settings.{field.Name}, value); }}");
+
+ WriteLine("");
+ }
+ ClearIndent();
+
+ string GetSyntaxName(Type t)
+ {
+ if (!t.IsGenericType)
+ return t.FullName;
+
+ var endIndex = t.FullName.IndexOf("`");
+ var baseName = t.FullName.Substring(0, endIndex);
+
+ return $"{baseName}{GetGenericSuffix(t)}";
+ }
+
+ string GetGenericSuffix(Type t)
+ {
+ return $"<{string.Join(", ", t.GenericTypeArguments.Select(GetSyntaxName))}>";
+ }
+
+ string GetPropertySummary(FieldInfo info)
+ {
+ return $"/// ";
+ }
+
+ string GetPropertyName(FieldInfo info)
+ {
+ return $"public {GetSyntaxName(info.FieldType)} {info.Name}";
+ }
+
+ string GetSimplePropertyBody(FieldInfo info)
+ {
+ return $"{{ get => _settings.{info.Name}; set => SetValue(ref _settings.{info.Name}, value); }}";
+ }
+ #>
+
+ public SessionSettingsViewModel(MyObjectBuilder_SessionSettings settings)
+ {
+ _settings = settings;
+ }
+
+ public static implicit operator MyObjectBuilder_SessionSettings(SessionSettingsViewModel viewModel)
+ {
+ return viewModel._settings;
+ }
+ }
+}
diff --git a/Torch.Server/ViewModels/SessionSettingsViewModel1.cs b/Torch.Server/ViewModels/SessionSettingsViewModel1.cs
new file mode 100644
index 0000000..401969e
--- /dev/null
+++ b/Torch.Server/ViewModels/SessionSettingsViewModel1.cs
@@ -0,0 +1,253 @@
+// This file is generated automatically! Any changes will be overwritten.
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using Torch;
+using Torch.Collections;
+using VRage.Game;
+using VRage.Library.Utils;
+using VRage.Serialization;
+
+namespace Torch.Server.ViewModels
+{
+ public class SessionSettingsViewModel : ViewModel
+ {
+ private MyObjectBuilder_SessionSettings _settings;
+ ///
+ public string GameMode { get => _settings.GameMode.ToString(); set { Enum.TryParse(value, true, out VRage.Library.Utils.MyGameModeEnum parsedVal); SetValue(ref _settings.GameMode, parsedVal); } }
+ public List GameModeValues { get; } = new List {"Creative", "Survival"};
+
+ ///
+ public System.Single InventorySizeMultiplier { get => _settings.InventorySizeMultiplier; set => SetValue(ref _settings.InventorySizeMultiplier, value); }
+
+ ///
+ public System.Single AssemblerSpeedMultiplier { get => _settings.AssemblerSpeedMultiplier; set => SetValue(ref _settings.AssemblerSpeedMultiplier, value); }
+
+ ///
+ public System.Single AssemblerEfficiencyMultiplier { get => _settings.AssemblerEfficiencyMultiplier; set => SetValue(ref _settings.AssemblerEfficiencyMultiplier, value); }
+
+ ///
+ public System.Single RefinerySpeedMultiplier { get => _settings.RefinerySpeedMultiplier; set => SetValue(ref _settings.RefinerySpeedMultiplier, value); }
+
+ ///
+ public string OnlineMode { get => _settings.OnlineMode.ToString(); set { Enum.TryParse(value, true, out VRage.Game.MyOnlineModeEnum parsedVal); SetValue(ref _settings.OnlineMode, parsedVal); } }
+ public List OnlineModeValues { get; } = new List {"OFFLINE", "PUBLIC", "FRIENDS", "PRIVATE"};
+
+ ///
+ public System.Int16 MaxPlayers { get => _settings.MaxPlayers; set => SetValue(ref _settings.MaxPlayers, value); }
+
+ ///
+ public System.Int16 MaxFloatingObjects { get => _settings.MaxFloatingObjects; set => SetValue(ref _settings.MaxFloatingObjects, value); }
+
+ ///
+ public System.Int16 MaxBackupSaves { get => _settings.MaxBackupSaves; set => SetValue(ref _settings.MaxBackupSaves, value); }
+
+ ///
+ public System.Int32 MaxGridSize { get => _settings.MaxGridSize; set => SetValue(ref _settings.MaxGridSize, value); }
+
+ ///
+ public System.Int32 MaxBlocksPerPlayer { get => _settings.MaxBlocksPerPlayer; set => SetValue(ref _settings.MaxBlocksPerPlayer, value); }
+
+ ///
+ public System.Boolean EnableBlockLimits { get => _settings.EnableBlockLimits; set => SetValue(ref _settings.EnableBlockLimits, value); }
+
+ ///
+ public System.Boolean EnableRemoteBlockRemoval { get => _settings.EnableRemoteBlockRemoval; set => SetValue(ref _settings.EnableRemoteBlockRemoval, value); }
+
+ ///
+ public string EnvironmentHostility { get => _settings.EnvironmentHostility.ToString(); set { Enum.TryParse(value, true, out VRage.Game.MyEnvironmentHostilityEnum parsedVal); SetValue(ref _settings.EnvironmentHostility, parsedVal); } }
+ public List EnvironmentHostilityValues { get; } = new List {"SAFE", "NORMAL", "CATACLYSM", "CATACLYSM_UNREAL"};
+
+ ///
+ public System.Boolean AutoHealing { get => _settings.AutoHealing; set => SetValue(ref _settings.AutoHealing, value); }
+
+ ///
+ public System.Boolean EnableCopyPaste { get => _settings.EnableCopyPaste; set => SetValue(ref _settings.EnableCopyPaste, value); }
+
+ ///
+ public System.Boolean WeaponsEnabled { get => _settings.WeaponsEnabled; set => SetValue(ref _settings.WeaponsEnabled, value); }
+
+ ///
+ public System.Boolean ShowPlayerNamesOnHud { get => _settings.ShowPlayerNamesOnHud; set => SetValue(ref _settings.ShowPlayerNamesOnHud, value); }
+
+ ///
+ public System.Boolean ThrusterDamage { get => _settings.ThrusterDamage; set => SetValue(ref _settings.ThrusterDamage, value); }
+
+ ///
+ public System.Boolean CargoShipsEnabled { get => _settings.CargoShipsEnabled; set => SetValue(ref _settings.CargoShipsEnabled, value); }
+
+ ///
+ public System.Boolean EnableSpectator { get => _settings.EnableSpectator; set => SetValue(ref _settings.EnableSpectator, value); }
+
+ ///
+ public System.Int32 WorldSizeKm { get => _settings.WorldSizeKm; set => SetValue(ref _settings.WorldSizeKm, value); }
+
+ ///
+ public System.Boolean RespawnShipDelete { get => _settings.RespawnShipDelete; set => SetValue(ref _settings.RespawnShipDelete, value); }
+
+ ///
+ public System.Boolean ResetOwnership { get => _settings.ResetOwnership; set => SetValue(ref _settings.ResetOwnership, value); }
+
+ ///
+ public System.Single WelderSpeedMultiplier { get => _settings.WelderSpeedMultiplier; set => SetValue(ref _settings.WelderSpeedMultiplier, value); }
+
+ ///
+ public System.Single GrinderSpeedMultiplier { get => _settings.GrinderSpeedMultiplier; set => SetValue(ref _settings.GrinderSpeedMultiplier, value); }
+
+ ///
+ public System.Boolean RealisticSound { get => _settings.RealisticSound; set => SetValue(ref _settings.RealisticSound, value); }
+
+ ///
+ public System.Single HackSpeedMultiplier { get => _settings.HackSpeedMultiplier; set => SetValue(ref _settings.HackSpeedMultiplier, value); }
+
+ ///
+ public System.Nullable PermanentDeath { get => _settings.PermanentDeath; set => SetValue(ref _settings.PermanentDeath, value); }
+
+ ///
+ public System.UInt32 AutoSaveInMinutes { get => _settings.AutoSaveInMinutes; set => SetValue(ref _settings.AutoSaveInMinutes, value); }
+
+ ///
+ public System.Boolean EnableSaving { get => _settings.EnableSaving; set => SetValue(ref _settings.EnableSaving, value); }
+
+ ///
+ public System.Boolean EnableRespawnScreen { get => _settings.EnableRespawnScreen; set => SetValue(ref _settings.EnableRespawnScreen, value); }
+
+ ///
+ public System.Boolean InfiniteAmmo { get => _settings.InfiniteAmmo; set => SetValue(ref _settings.InfiniteAmmo, value); }
+
+ ///
+ public System.Boolean EnableContainerDrops { get => _settings.EnableContainerDrops; set => SetValue(ref _settings.EnableContainerDrops, value); }
+
+ ///
+ public System.Single SpawnShipTimeMultiplier { get => _settings.SpawnShipTimeMultiplier; set => SetValue(ref _settings.SpawnShipTimeMultiplier, value); }
+
+ ///
+ public System.Single ProceduralDensity { get => _settings.ProceduralDensity; set => SetValue(ref _settings.ProceduralDensity, value); }
+
+ ///
+ public System.Int32 ProceduralSeed { get => _settings.ProceduralSeed; set => SetValue(ref _settings.ProceduralSeed, value); }
+
+ ///
+ public System.Boolean DestructibleBlocks { get => _settings.DestructibleBlocks; set => SetValue(ref _settings.DestructibleBlocks, value); }
+
+ ///
+ public System.Boolean EnableIngameScripts { get => _settings.EnableIngameScripts; set => SetValue(ref _settings.EnableIngameScripts, value); }
+
+ ///
+ public System.Int32 ViewDistance { get => _settings.ViewDistance; set => SetValue(ref _settings.ViewDistance, value); }
+
+ ///
+ public System.Int32 FloraDensity { get => _settings.FloraDensity; set => SetValue(ref _settings.FloraDensity, value); }
+
+ ///
+ public System.Boolean EnableToolShake { get => _settings.EnableToolShake; set => SetValue(ref _settings.EnableToolShake, value); }
+
+ ///
+ public System.Int32 VoxelGeneratorVersion { get => _settings.VoxelGeneratorVersion; set => SetValue(ref _settings.VoxelGeneratorVersion, value); }
+
+ ///
+ public System.Boolean EnableOxygen { get => _settings.EnableOxygen; set => SetValue(ref _settings.EnableOxygen, value); }
+
+ ///
+ public System.Boolean EnableOxygenPressurization { get => _settings.EnableOxygenPressurization; set => SetValue(ref _settings.EnableOxygenPressurization, value); }
+
+ ///
+ public System.Boolean Enable3rdPersonView { get => _settings.Enable3rdPersonView; set => SetValue(ref _settings.Enable3rdPersonView, value); }
+
+ ///
+ public System.Boolean EnableEncounters { get => _settings.EnableEncounters; set => SetValue(ref _settings.EnableEncounters, value); }
+
+ ///
+ public System.Boolean EnableFlora { get => _settings.EnableFlora; set => SetValue(ref _settings.EnableFlora, value); }
+
+ ///
+ public System.Boolean EnableConvertToStation { get => _settings.EnableConvertToStation; set => SetValue(ref _settings.EnableConvertToStation, value); }
+
+ ///
+ public System.Boolean StationVoxelSupport { get => _settings.StationVoxelSupport; set => SetValue(ref _settings.StationVoxelSupport, value); }
+
+ ///
+ public System.Boolean EnableSunRotation { get => _settings.EnableSunRotation; set => SetValue(ref _settings.EnableSunRotation, value); }
+
+ ///
+ public System.Boolean EnableRespawnShips { get => _settings.EnableRespawnShips; set => SetValue(ref _settings.EnableRespawnShips, value); }
+
+ ///
+ public System.Boolean ScenarioEditMode { get => _settings.ScenarioEditMode; set => SetValue(ref _settings.ScenarioEditMode, value); }
+
+ ///
+ public System.Boolean Scenario { get => _settings.Scenario; set => SetValue(ref _settings.Scenario, value); }
+
+ ///
+ public System.Boolean CanJoinRunning { get => _settings.CanJoinRunning; set => SetValue(ref _settings.CanJoinRunning, value); }
+
+ ///
+ public System.Int32 PhysicsIterations { get => _settings.PhysicsIterations; set => SetValue(ref _settings.PhysicsIterations, value); }
+
+ ///
+ public System.Single SunRotationIntervalMinutes { get => _settings.SunRotationIntervalMinutes; set => SetValue(ref _settings.SunRotationIntervalMinutes, value); }
+
+ ///
+ public System.Boolean EnableJetpack { get => _settings.EnableJetpack; set => SetValue(ref _settings.EnableJetpack, value); }
+
+ ///
+ public System.Boolean SpawnWithTools { get => _settings.SpawnWithTools; set => SetValue(ref _settings.SpawnWithTools, value); }
+
+ ///
+ public System.Boolean StartInRespawnScreen { get => _settings.StartInRespawnScreen; set => SetValue(ref _settings.StartInRespawnScreen, value); }
+
+ ///
+ public System.Boolean EnableVoxelDestruction { get => _settings.EnableVoxelDestruction; set => SetValue(ref _settings.EnableVoxelDestruction, value); }
+
+ ///
+ public System.Int32 MaxDrones { get => _settings.MaxDrones; set => SetValue(ref _settings.MaxDrones, value); }
+
+ ///
+ public System.Boolean EnableDrones { get => _settings.EnableDrones; set => SetValue(ref _settings.EnableDrones, value); }
+
+ ///
+ public System.Boolean EnableWolfs { get => _settings.EnableWolfs; set => SetValue(ref _settings.EnableWolfs, value); }
+
+ ///
+ public System.Boolean EnableSpiders { get => _settings.EnableSpiders; set => SetValue(ref _settings.EnableSpiders, value); }
+
+ ///
+ public System.Single FloraDensityMultiplier { get => _settings.FloraDensityMultiplier; set => SetValue(ref _settings.FloraDensityMultiplier, value); }
+
+ ///
+ public System.Boolean EnableStructuralSimulation { get => _settings.EnableStructuralSimulation; set => SetValue(ref _settings.EnableStructuralSimulation, value); }
+
+ ///
+ public System.Int32 MaxActiveFracturePieces { get => _settings.MaxActiveFracturePieces; set => SetValue(ref _settings.MaxActiveFracturePieces, value); }
+
+ ///
+ public VRage.Serialization.SerializableDictionary BlockTypeLimits { get => _settings.BlockTypeLimits; set => SetValue(ref _settings.BlockTypeLimits, value); }
+
+ ///
+ public System.Boolean EnableScripterRole { get => _settings.EnableScripterRole; set => SetValue(ref _settings.EnableScripterRole, value); }
+
+ ///
+ public System.Int32 MinDropContainerRespawnTime { get => _settings.MinDropContainerRespawnTime; set => SetValue(ref _settings.MinDropContainerRespawnTime, value); }
+
+ ///
+ public System.Int32 MaxDropContainerRespawnTime { get => _settings.MaxDropContainerRespawnTime; set => SetValue(ref _settings.MaxDropContainerRespawnTime, value); }
+
+ ///
+ public System.Boolean EnableTurretsFriendlyFire { get => _settings.EnableTurretsFriendlyFire; set => SetValue(ref _settings.EnableTurretsFriendlyFire, value); }
+
+ ///
+ public System.Boolean EnableSubgridDamage { get => _settings.EnableSubgridDamage; set => SetValue(ref _settings.EnableSubgridDamage, value); }
+
+
+ public SessionSettingsViewModel(MyObjectBuilder_SessionSettings settings)
+ {
+ _settings = settings;
+ }
+
+ public static implicit operator MyObjectBuilder_SessionSettings(SessionSettingsViewModel viewModel)
+ {
+ return viewModel._settings;
+ }
+ }
+}
diff --git a/Torch.Server/Views/ConfigControl.xaml b/Torch.Server/Views/ConfigControl.xaml
index 12b07f7..04b7d16 100644
--- a/Torch.Server/Views/ConfigControl.xaml
+++ b/Torch.Server/Views/ConfigControl.xaml
@@ -5,6 +5,7 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:Torch.Server.Views"
xmlns:viewModels="clr-namespace:Torch.Server.ViewModels"
+ xmlns:managers="clr-namespace:Torch.Server.Managers"
mc:Ignorable="d"
Background="White">
@@ -18,7 +19,22 @@
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -60,186 +76,7 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
diff --git a/Torch.Server/Views/ConfigControl.xaml.cs b/Torch.Server/Views/ConfigControl.xaml.cs
index cc5a157..70e2d68 100644
--- a/Torch.Server/Views/ConfigControl.xaml.cs
+++ b/Torch.Server/Views/ConfigControl.xaml.cs
@@ -17,28 +17,23 @@ namespace Torch.Server.Views
{
InitializeComponent();
_instanceManager = TorchBase.Instance.Managers.GetManager();
+ _instanceManager.InstanceLoaded += _instanceManager_InstanceLoaded;
DataContext = _instanceManager.DedicatedConfig;
}
+ private void _instanceManager_InstanceLoaded(ConfigDedicatedViewModel obj)
+ {
+ Dispatcher.Invoke(() => DataContext = obj);
+ }
+
private void Save_OnClick(object sender, RoutedEventArgs e)
{
_instanceManager.SaveConfig();
}
- private void RemoveLimit_OnClick(object sender, RoutedEventArgs e)
- {
- var vm = (BlockLimitViewModel)((Button)sender).DataContext;
- _instanceManager.DedicatedConfig.SessionSettings.BlockLimits.Remove(vm);
- }
-
- private void AddLimit_OnClick(object sender, RoutedEventArgs e)
- {
- _instanceManager.DedicatedConfig.SessionSettings.BlockLimits.Add(new BlockLimitViewModel(_instanceManager.DedicatedConfig.SessionSettings, "", 0));
- }
-
private void NewWorld_OnClick(object sender, RoutedEventArgs e)
{
- MessageBox.Show("Feature coming soon :)");
+ new WorldGeneratorDialog(_instanceManager).ShowDialog();
}
private void Selector_OnSelectionChanged(object sender, SelectionChangedEventArgs e)
@@ -46,7 +41,9 @@ namespace Torch.Server.Views
//The control doesn't update the binding before firing the event.
if (e.AddedItems.Count > 0)
{
- _instanceManager.SelectWorld((string)e.AddedItems[0]);
+ var result = MessageBoxResult.Yes; //MessageBox.Show("Do you want to import the session settings from the selected world?", "Import Config", MessageBoxButton.YesNo);
+ var world = (WorldViewModel)e.AddedItems[0];
+ _instanceManager.SelectWorld(world.WorldPath, result != MessageBoxResult.Yes);
}
}
}
diff --git a/Torch.Server/Views/DynamicView.xaml b/Torch.Server/Views/DynamicView.xaml
new file mode 100644
index 0000000..d47a748
--- /dev/null
+++ b/Torch.Server/Views/DynamicView.xaml
@@ -0,0 +1,12 @@
+
+
+
+
+
diff --git a/Torch.Server/Views/DynamicView.xaml.cs b/Torch.Server/Views/DynamicView.xaml.cs
new file mode 100644
index 0000000..392ac98
--- /dev/null
+++ b/Torch.Server/Views/DynamicView.xaml.cs
@@ -0,0 +1,81 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Reflection;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using System.Windows.Navigation;
+using System.Windows.Shapes;
+
+namespace Torch.Server.Views
+{
+ ///
+ /// Interaction logic for DynamicView.xaml
+ ///
+ public partial class DynamicView : UserControl
+ {
+ private static Dictionary _map = new Dictionary();
+
+ public DynamicView()
+ {
+ InitializeComponent();
+ DataContextChanged += DynamicView_DataContextChanged;
+ }
+
+ private void DynamicView_DataContextChanged(object sender, DependencyPropertyChangedEventArgs e)
+ {
+ var content = GenerateForType(e.NewValue.GetType());
+ content.DataContext = e.NewValue;
+ Content = content;
+ }
+
+ public static StackPanel GenerateForType(Type t)
+ {
+ if (_map.TryGetValue(t, out StackPanel v))
+ return v;
+
+ var properties = t.GetProperties(BindingFlags.Instance | BindingFlags.Public);
+
+ var panel = new StackPanel();
+
+ foreach (var property in properties)
+ {
+ panel.Children.Add(GenerateDefault(property));
+ }
+
+ _map.Add(t, panel);
+ return panel;
+ }
+
+ private static StackPanel GenerateBool(PropertyInfo propInfo)
+ {
+ var panel = new StackPanel { Orientation = Orientation.Horizontal };
+ var label = new Label { Content = propInfo.Name };
+ var checkbox = new CheckBox();
+ checkbox.SetBinding(CheckBox.IsCheckedProperty, propInfo.Name);
+
+ panel.Children.Add(checkbox);
+ panel.Children.Add(label);
+ return panel;
+ }
+
+ private static StackPanel GenerateDefault(PropertyInfo propInfo)
+ {
+ var panel = new StackPanel { Orientation = Orientation.Horizontal };
+ var label = new Label { Content = propInfo.Name };
+ var textbox = new TextBox();
+ textbox.SetBinding(TextBox.TextProperty, propInfo.Name);
+
+ panel.Children.Add(label);
+ panel.Children.Add(textbox);
+ return panel;
+ }
+ }
+}
diff --git a/Torch.Server/Views/FirstTimeSetup.xaml b/Torch.Server/Views/FirstTimeSetup.xaml
deleted file mode 100644
index 5defc52..0000000
--- a/Torch.Server/Views/FirstTimeSetup.xaml
+++ /dev/null
@@ -1,30 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/Torch.Server/Views/FirstTimeSetup.xaml.cs b/Torch.Server/Views/FirstTimeSetup.xaml.cs
deleted file mode 100644
index 26f8317..0000000
--- a/Torch.Server/Views/FirstTimeSetup.xaml.cs
+++ /dev/null
@@ -1,32 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using System.Windows;
-using System.Windows.Controls;
-using System.Windows.Data;
-using System.Windows.Documents;
-using System.Windows.Input;
-using System.Windows.Media;
-using System.Windows.Media.Imaging;
-using System.Windows.Shapes;
-
-namespace Torch.Server.Views
-{
- ///
- /// Interaction logic for FirstTimeSetup.xaml
- ///
- public partial class FirstTimeSetup : Window
- {
- public FirstTimeSetup()
- {
- InitializeComponent();
- }
-
- private void ButtonBase_OnClick(object sender, RoutedEventArgs e)
- {
- Close();
- }
- }
-}
diff --git a/Torch.Server/Views/SessionSettingsView.xaml b/Torch.Server/Views/SessionSettingsView.xaml
new file mode 100644
index 0000000..98ec5e9
--- /dev/null
+++ b/Torch.Server/Views/SessionSettingsView.xaml
@@ -0,0 +1,189 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Torch.Server/Views/SessionSettingsView.xaml.cs b/Torch.Server/Views/SessionSettingsView.xaml.cs
new file mode 100644
index 0000000..b19821f
--- /dev/null
+++ b/Torch.Server/Views/SessionSettingsView.xaml.cs
@@ -0,0 +1,40 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using System.Windows.Navigation;
+using System.Windows.Shapes;
+using Torch.Server.ViewModels;
+
+namespace Torch.Server.Views
+{
+ ///
+ /// Interaction logic for SessionSettingsView.xaml
+ ///
+ public partial class SessionSettingsView : UserControl
+ {
+ public SessionSettingsView()
+ {
+ InitializeComponent();
+ }
+
+ private void RemoveLimit_OnClick(object sender, RoutedEventArgs e)
+ {
+ var vm = (BlockLimitViewModel)((Button)sender).DataContext;
+ //_instanceManager.DedicatedConfig.SessionSettings.BlockLimits.Remove(vm);
+ }
+
+ private void AddLimit_OnClick(object sender, RoutedEventArgs e)
+ {
+ //_instanceManager.DedicatedConfig.SessionSettings.BlockLimits.Add(new BlockLimitViewModel(_instanceManager.DedicatedConfig.SessionSettings, "", 0));
+ }
+ }
+}
diff --git a/Torch.Server/Views/TorchUI.xaml b/Torch.Server/Views/TorchUI.xaml
index 1848f6c..d6b15fd 100644
--- a/Torch.Server/Views/TorchUI.xaml
+++ b/Torch.Server/Views/TorchUI.xaml
@@ -49,9 +49,6 @@
-
-
diff --git a/Torch.Server/Views/TorchUI.xaml.cs b/Torch.Server/Views/TorchUI.xaml.cs
index 1bee4c3..b983b29 100644
--- a/Torch.Server/Views/TorchUI.xaml.cs
+++ b/Torch.Server/Views/TorchUI.xaml.cs
@@ -59,7 +59,7 @@ namespace Torch.Server
_config = config;
Dispatcher.Invoke(() =>
{
- InstancePathBox.Text = config.InstancePath;
+ //InstancePathBox.Text = config.InstancePath;
});
}
diff --git a/Torch.Server/Views/WorldGeneratorDialog.xaml b/Torch.Server/Views/WorldGeneratorDialog.xaml
new file mode 100644
index 0000000..c06deae
--- /dev/null
+++ b/Torch.Server/Views/WorldGeneratorDialog.xaml
@@ -0,0 +1,38 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Torch.Server/Views/WorldGeneratorDialog.xaml.cs b/Torch.Server/Views/WorldGeneratorDialog.xaml.cs
new file mode 100644
index 0000000..0dc3c4b
--- /dev/null
+++ b/Torch.Server/Views/WorldGeneratorDialog.xaml.cs
@@ -0,0 +1,85 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using NLog;
+using Sandbox.Definitions;
+using Torch.Server.Managers;
+using VRage.Game.Localization;
+using VRage.Utils;
+
+namespace Torch.Server
+{
+ ///
+ /// Interaction logic for WorldGeneratorDialog.xaml
+ ///
+ public partial class WorldGeneratorDialog : Window
+ {
+ private InstanceManager _instanceManager;
+ private List _checkpoints = new List();
+
+ public WorldGeneratorDialog(InstanceManager instanceManager)
+ {
+ _instanceManager = instanceManager;
+ InitializeComponent();
+
+ MyDefinitionManager.Static.LoadScenarios();
+ var scenarios = MyDefinitionManager.Static.GetScenarioDefinitions();
+ MyDefinitionManager.Static.UnloadData();
+ foreach (var scenario in scenarios)
+ {
+ //TODO: Load localization
+ _checkpoints.Add(new PremadeCheckpointItem { Name = scenario.DisplayNameText, Icon = @"C:\Users\jgross\Documents\Projects\TorchAPI\Torch\bin\x64\Release\Content\CustomWorlds\Empty World\thumb.jpg" });
+ }
+
+ /*
+ var premadeCheckpoints = Directory.EnumerateDirectories(Path.Combine("Content", "CustomWorlds"));
+ foreach (var path in premadeCheckpoints)
+ {
+ var thumbPath = Path.GetFullPath(Directory.EnumerateFiles(path).First(x => x.Contains("thumb")));
+
+ _checkpoints.Add(new PremadeCheckpointItem
+ {
+ Path = path,
+ Icon = thumbPath,
+ Name = Path.GetFileName(path)
+ });
+ }*/
+ PremadeCheckpoints.ItemsSource = _checkpoints;
+ }
+
+ private void ButtonBase_OnClick(object sender, RoutedEventArgs e)
+ {
+ /*
+ var worldPath = Path.Combine("Instance", "Saves", WorldName.Text);
+ var checkpointItem = (PremadeCheckpointItem)PremadeCheckpoints.SelectedItem;
+ if (Directory.Exists(worldPath))
+ {
+ MessageBox.Show("World already exists with that name.");
+ return;
+ }
+ Directory.CreateDirectory(worldPath);
+ foreach (var file in Directory.EnumerateFiles(checkpointItem.Path, "*", SearchOption.AllDirectories))
+ {
+ File.Copy(file, Path.Combine(worldPath, file.Replace($"{checkpointItem.Path}\\", "")));
+ }
+ _instanceManager.SelectWorld(worldPath, false);*/
+ }
+ }
+
+ public class PremadeCheckpointItem
+ {
+ public string Path { get; set; }
+ public string Name { get; set; }
+ public string Icon { get; set; }
+ }
+}
diff --git a/Torch.sln b/Torch.sln
index d2f57a3..e78e377 100644
--- a/Torch.sln
+++ b/Torch.sln
@@ -1,7 +1,7 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
-VisualStudioVersion = 15.0.27004.2006
+VisualStudioVersion = 15.0.27004.2010
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Torch", "Torch\Torch.csproj", "{7E01635C-3B67-472E-BCD6-C5539564F214}"
EndProject
diff --git a/Torch/Commands/TorchCommands.cs b/Torch/Commands/TorchCommands.cs
index 469a00e..6387288 100644
--- a/Torch/Commands/TorchCommands.cs
+++ b/Torch/Commands/TorchCommands.cs
@@ -136,7 +136,7 @@ namespace Torch.Commands
{
Task.Run(() =>
{
- var countdown = RestartCountdown(countdownSeconds).GetEnumerator();
+ var countdown = RestartCountdown(countdownSeconds, save).GetEnumerator();
while (countdown.MoveNext())
{
Thread.Sleep(1000);
@@ -144,7 +144,7 @@ namespace Torch.Commands
});
}
- private IEnumerable RestartCountdown(int countdown)
+ private IEnumerable RestartCountdown(int countdown, bool save)
{
for (var i = countdown; i >= 0; i--)
{
@@ -163,10 +163,16 @@ namespace Torch.Commands
}
else
{
- Context.Torch.Restart();
+ if (save)
+ Context.Torch.Save(Context.Player?.IdentityId ?? 0).ContinueWith(x => Restart());
+ else
+ Restart();
+
yield break;
}
}
+
+ void Restart() => Context.Torch.Invoke(() => Context.Torch.Restart());
}
private string Pluralize(int num)
diff --git a/Torch/TorchBase.cs b/Torch/TorchBase.cs
index 886376d..a788852 100644
--- a/Torch/TorchBase.cs
+++ b/Torch/TorchBase.cs
@@ -309,10 +309,9 @@ namespace Torch
SpaceEngineersGame.SetupPerGameSettings();
ObjectFactoryInitPatch.ForceRegisterAssemblies();
- Debug.Assert(MyPerGameSettings.BasicGameInfo.GameVersion != null,
- "MyPerGameSettings.BasicGameInfo.GameVersion != null");
- GameVersion = new Version(new MyVersion(MyPerGameSettings.BasicGameInfo.GameVersion.Value).FormattedText
- .ToString().Replace("_", "."));
+ Debug.Assert(MyPerGameSettings.BasicGameInfo.GameVersion != null, "MyPerGameSettings.BasicGameInfo.GameVersion != null");
+ GameVersion = new MyVersion(MyPerGameSettings.BasicGameInfo.GameVersion.Value);
+
try
{
Console.Title = $"{Config.InstanceName} - Torch {TorchVersion}, SE {GameVersion}";
diff --git a/Torch/ViewModels/ViewModel.cs b/Torch/ViewModels/ViewModel.cs
index cbd3581..de20362 100644
--- a/Torch/ViewModels/ViewModel.cs
+++ b/Torch/ViewModels/ViewModel.cs
@@ -50,7 +50,7 @@ namespace Torch
protected virtual void SetValue(ref T backingField, T value, [CallerMemberName] string propName = "")
{
- if (backingField.Equals(value))
+ if (backingField != null && backingField.Equals(value))
return;
backingField = value;