View model improvements, load world checkpoints for more config options

This commit is contained in:
John Gross
2017-12-03 09:34:28 -08:00
parent 930f1d43e0
commit 1be1c938cc
25 changed files with 1284 additions and 602 deletions

View File

@@ -46,6 +46,10 @@
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
<Reference Include="VRage.Game, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\SpaceEngineers\Bin64\VRage.Game.dll</HintPath>
</Reference>
<Reference Include="xunit.abstractions, Version=2.0.0.0, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c, processorArchitecture=MSIL">
<HintPath>..\packages\xunit.abstractions.2.0.1\lib\net35\xunit.abstractions.dll</HintPath>
</Reference>
@@ -65,6 +69,7 @@
</Compile>
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="TorchServerReflectionTest.cs" />
<Compile Include="TorchServerSessionSettingsTest.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Torch.API\Torch.API.csproj">

View File

@@ -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<object[]> ModelFields = typeof(MyObjectBuilder_SessionSettings).GetFields(BindingFlags.Public | BindingFlags.Instance).Select(x => new object[] { x });
[Theory]
[MemberData(nameof(ModelFields))]
public void MissingPropertyTest(FieldInfo modelField)
{
var match = ViewModelProperties.FirstOrDefault(p => p.Name.Equals(modelField.Name, StringComparison.InvariantCultureIgnoreCase));
Assert.NotNull(match);
}
}
}

View File

@@ -23,6 +23,8 @@ namespace Torch.Server.Managers
public class InstanceManager : Manager
{
private const string CONFIG_NAME = "SpaceEngineers-Dedicated.cfg";
public event Action<ConfigDedicatedViewModel> InstanceLoaded;
public ConfigDedicatedViewModel DedicatedConfig { get; set; }
private static readonly Logger Log = LogManager.GetLogger(nameof(InstanceManager));
[Dependency]
@@ -57,30 +59,46 @@ namespace Torch.Server.Managers
var worldFolders = Directory.EnumerateDirectories(Path.Combine(Torch.Config.InstancePath, "Saves"));
foreach (var f in worldFolders)
DedicatedConfig.WorldPaths.Add(f);
DedicatedConfig.Worlds.Add(new WorldViewModel(f, true));
if (DedicatedConfig.WorldPaths.Count == 0)
if (DedicatedConfig.Worlds.Count == 0)
{
Log.Warn($"No worlds found in the current instance {path}.");
return;
}
ImportWorldConfig();
SelectWorld(DedicatedConfig.LoadWorld ?? DedicatedConfig.Worlds.First().WorldPath, false);
/*
if (string.IsNullOrEmpty(DedicatedConfig.LoadWorld))
{
Log.Warn("No world specified, importing first available world.");
SelectWorld(DedicatedConfig.WorldPaths[0], false);
}*/
InstanceLoaded?.Invoke(DedicatedConfig);
}
public void SelectWorld(string worldPath, bool modsOnly = true)
{
DedicatedConfig.LoadWorld = worldPath;
DedicatedConfig.SelectedWorld = DedicatedConfig.Worlds.FirstOrDefault(x => x.WorldPath == worldPath);
ImportWorldConfig(modsOnly);
}
public void SelectWorld(WorldViewModel world, bool modsOnly = true)
{
DedicatedConfig.LoadWorld = world.WorldPath;
DedicatedConfig.SelectedWorld = world;
ImportWorldConfig(world, modsOnly);
}
private void ImportWorldConfig(WorldViewModel world, bool modsOnly = true)
{
var sb = new StringBuilder();
foreach (var mod in world.Checkpoint.Mods)
sb.AppendLine(mod.PublishedFileId.ToString());
DedicatedConfig.Mods = sb.ToString();
Log.Debug("Loaded mod list from world");
if (!modsOnly)
DedicatedConfig.SessionSettings = world.Checkpoint.Settings;
}
private void ImportWorldConfig(bool modsOnly = true)
{
@@ -162,4 +180,40 @@ namespace Torch.Server.Managers
config.Save(configPath);
}
}
public class WorldViewModel : ViewModel
{
public string FolderName { get; set; }
public string WorldPath { get; }
private string _checkpointPath;
public CheckpointViewModel Checkpoint { get; private set; }
public WorldViewModel(string worldPath, bool loadCheckpointAsync = false)
{
WorldPath = worldPath;
_checkpointPath = Path.Combine(WorldPath, "Sandbox.sbc");
FolderName = Path.GetFileName(worldPath);
LoadCheckpointAsync();
}
public async Task SaveCheckpointAsync()
{
await Task.Run(() =>
{
using (var f = File.Open(_checkpointPath, FileMode.Create))
MyObjectBuilderSerializer.SerializeXML(f, (MyObjectBuilder_Checkpoint)Checkpoint);
});
}
public async Task<CheckpointViewModel> LoadCheckpointAsync()
{
Checkpoint = await Task.Run(() =>
{
MyObjectBuilderSerializer.DeserializeXML(_checkpointPath, out MyObjectBuilder_Checkpoint checkpoint);
return new CheckpointViewModel(checkpoint);
});
OnPropertyChanged("Checkpoint");
return Checkpoint;
}
}
}

View File

@@ -211,6 +211,7 @@
<SubType>Component</SubType>
</Compile>
<Compile Include="ViewModels\BlockLimitViewModel.cs" />
<Compile Include="ViewModels\CheckpointViewModel.cs" />
<Compile Include="ViewModels\Entities\Blocks\BlockViewModel.cs" />
<Compile Include="ViewModels\Entities\Blocks\BlockViewModelGenerator.cs" />
<Compile Include="ViewModels\Entities\Blocks\PropertyViewModel.cs" />
@@ -218,6 +219,14 @@
<Compile Include="ViewModels\ConfigDedicatedViewModel.cs" />
<Compile Include="ViewModels\Entities\EntityControlViewModel.cs" />
<Compile Include="Views\Converters\DefinitionToIdConverter.cs" />
<Compile Include="ViewModels\SessionSettingsViewModel.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>SessionSettingsViewModel.tt</DependentUpon>
</Compile>
<Compile Include="Views\DynamicView.xaml.cs">
<DependentUpon>DynamicView.xaml</DependentUpon>
</Compile>
<Compile Include="Views\Entities\EntityControlHost.xaml.cs">
<DependentUpon>EntityControlHost.xaml</DependentUpon>
</Compile>
@@ -231,7 +240,6 @@
<Compile Include="ViewModels\ILazyLoad.cs" />
<Compile Include="ViewModels\PluginManagerViewModel.cs" />
<Compile Include="ViewModels\PluginViewModel.cs" />
<Compile Include="ViewModels\SessionSettingsViewModel.cs" />
<Compile Include="ViewModels\Entities\VoxelMapViewModel.cs" />
<Compile Include="ViewModels\SteamUserViewModel.cs" />
<Compile Include="Views\AddWorkshopItemsDialog.xaml.cs">
@@ -262,15 +270,15 @@
<Compile Include="Views\Entities\VoxelMapView.xaml.cs">
<DependentUpon>VoxelMapView.xaml</DependentUpon>
</Compile>
<Compile Include="Views\FirstTimeSetup.xaml.cs">
<DependentUpon>FirstTimeSetup.xaml</DependentUpon>
</Compile>
<Compile Include="Views\ModsControl.xaml.cs">
<DependentUpon>ModsControl.xaml</DependentUpon>
</Compile>
<Compile Include="Views\PluginsControl.xaml.cs">
<DependentUpon>PluginsControl.xaml</DependentUpon>
</Compile>
<Compile Include="Views\SessionSettingsView.xaml.cs">
<DependentUpon>SessionSettingsView.xaml</DependentUpon>
</Compile>
<Compile Include="Views\TorchUI.xaml.cs">
<DependentUpon>TorchUI.xaml</DependentUpon>
</Compile>
@@ -279,6 +287,9 @@
</Compile>
<Compile Include="Program.cs" />
<Compile Include="TorchServer.cs" />
<Compile Include="Views\WorldGeneratorDialog.xaml.cs">
<DependentUpon>WorldGeneratorDialog.xaml</DependentUpon>
</Compile>
</ItemGroup>
<ItemGroup>
<Compile Include="Properties\Resources.Designer.cs">
@@ -315,6 +326,10 @@
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Page Include="Views\DynamicView.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Views\Entities\EntityControlHost.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
@@ -359,11 +374,11 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Views\FirstTimeSetup.xaml">
<Page Include="Views\ModsControl.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Views\ModsControl.xaml">
<Page Include="Views\SessionSettingsView.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
@@ -375,6 +390,10 @@
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="Views\WorldGeneratorDialog.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
</ItemGroup>
<ItemGroup>
<Resource Include="torchicon.ico" />
@@ -382,7 +401,12 @@
<ItemGroup>
<Service Include="{508349B6-6B84-4DF5-91F0-309BEEBAD82D}" />
</ItemGroup>
<ItemGroup />
<ItemGroup>
<Content Include="ViewModels\SessionSettingsViewModel.tt">
<Generator>TextTemplatingFileGenerator</Generator>
<LastGenOutput>SessionSettingsViewModel.cs</LastGenOutput>
</Content>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="$(SolutionDir)\TransformOnBuild.targets" />
<PropertyGroup>

View File

@@ -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<long, MyObjectBuilder_Checkpoint.PlayerId, ulong> 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<MyObjectBuilder_Checkpoint.ModItem> Mods { get => _checkpoint.Mods; set => SetValue(ref _checkpoint.Mods, value); }
public SerializableDictionary<ulong, MyPromoteLevel> PromotedUsers { get => _checkpoint.PromotedUsers; set => SetValue(ref _checkpoint.PromotedUsers, value); }
public HashSet<ulong> CreativeTools { get => _checkpoint.CreativeTools; set => SetValue(ref _checkpoint.CreativeTools, value); }
public SerializableDefinitionId Scenario { get => _checkpoint.Scenario; set => SetValue(ref _checkpoint.Scenario, value); }
public List<MyObjectBuilder_Checkpoint.RespawnCooldownItem> RespawnCooldowns { get => _checkpoint.RespawnCooldowns; set => SetValue(ref _checkpoint.RespawnCooldowns, value); }
public List<MyObjectBuilder_Identity> Identities { get => _checkpoint.Identities; set => SetValue(ref _checkpoint.Identities, value); }
public List<MyObjectBuilder_Client> Clients { get => _checkpoint.Clients; set => SetValue(ref _checkpoint.Clients, value); }
public MyEnvironmentHostilityEnum? PreviousEnvironmentHostility { get => _checkpoint.PreviousEnvironmentHostility; set => SetValue(ref _checkpoint.PreviousEnvironmentHostility, value); }
public SerializableDictionary<MyObjectBuilder_Checkpoint.PlayerId, MyObjectBuilder_Player> AllPlayersData { get => _checkpoint.AllPlayersData; set => SetValue(ref _checkpoint.AllPlayersData, value); }
public SerializableDictionary<MyObjectBuilder_Checkpoint.PlayerId, List<Vector3>> AllPlayersColors { get => _checkpoint.AllPlayersColors; set => SetValue(ref _checkpoint.AllPlayersColors, value); }
public List<MyObjectBuilder_ChatHistory> ChatHistory { get => _checkpoint.ChatHistory; set => SetValue(ref _checkpoint.ChatHistory, value); }
public List<MyObjectBuilder_FactionChatHistory> FactionChatHistory { get => _checkpoint.FactionChatHistory; set => SetValue(ref _checkpoint.FactionChatHistory, value); }
public List<long> NonPlayerIdentities { get => _checkpoint.NonPlayerIdentities; set => SetValue(ref _checkpoint.NonPlayerIdentities, value); }
public SerializableDictionary<long, MyObjectBuilder_Gps> Gps { get => _checkpoint.Gps; set => SetValue(ref _checkpoint.Gps, value); }
public SerializableBoundingBoxD? WorldBoundaries { get => _checkpoint.WorldBoundaries; set => SetValue(ref _checkpoint.WorldBoundaries, value); }
public List<MyObjectBuilder_SessionComponent> SessionComponents { get => _checkpoint.SessionComponents; set => SetValue(ref _checkpoint.SessionComponents, value); }
public SerializableDefinitionId GameDefinition { get => _checkpoint.GameDefinition; set => SetValue(ref _checkpoint.GameDefinition, value); }
public HashSet<string> SessionComponentEnabled { get => _checkpoint.SessionComponentEnabled; set => SetValue(ref _checkpoint.SessionComponentEnabled, value); }
public HashSet<string> 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); }
}
}

View File

@@ -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<string> WorldPaths { get; } = new MtObservableList<string>();
public MtObservableList<WorldViewModel> Worlds { get; } = new MtObservableList<WorldViewModel>();
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;

View File

@@ -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
{
/// <summary>
/// View model for <see cref="MyObjectBuilder_SessionSettings"/>
/// </summary>
public class SessionSettingsViewModel : ViewModel
{
private MyObjectBuilder_SessionSettings _settings;
public class SessionSettingsViewModel : ViewModel
{
private MyObjectBuilder_SessionSettings _settings;
/// <inheritdoc cref="VRage.Game.MyObjectBuilder_SessionSettings.GameMode" />
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<string> GameModeValues { get; } = new List<string> {"Creative", "Survival"};
/// <summary>
/// Creates a new view model with a new <see cref="MyObjectBuilder_SessionSettings"/> object.
/// </summary>
public SessionSettingsViewModel() : this(new MyObjectBuilder_SessionSettings())
{
/// <inheritdoc cref="VRage.Game.MyObjectBuilder_SessionSettings.InventorySizeMultiplier" />
public System.Single InventorySizeMultiplier { get => _settings.InventorySizeMultiplier; set => SetValue(ref _settings.InventorySizeMultiplier, value); }
}
/// <inheritdoc cref="VRage.Game.MyObjectBuilder_SessionSettings.AssemblerSpeedMultiplier" />
public System.Single AssemblerSpeedMultiplier { get => _settings.AssemblerSpeedMultiplier; set => SetValue(ref _settings.AssemblerSpeedMultiplier, value); }
/// <summary>
/// Creates a view model using an existing <see cref="MyObjectBuilder_SessionSettings"/> object.
/// </summary>
public SessionSettingsViewModel(MyObjectBuilder_SessionSettings settings)
{
_settings = settings;
foreach (var limit in settings.BlockTypeLimits.Dictionary)
BlockLimits.Add(new BlockLimitViewModel(this, limit.Key, limit.Value));
}
/// <inheritdoc cref="VRage.Game.MyObjectBuilder_SessionSettings.AssemblerEfficiencyMultiplier" />
public System.Single AssemblerEfficiencyMultiplier { get => _settings.AssemblerEfficiencyMultiplier; set => SetValue(ref _settings.AssemblerEfficiencyMultiplier, value); }
public MtObservableList<BlockLimitViewModel> BlockLimits { get; } = new MtObservableList<BlockLimitViewModel>();
/// <inheritdoc cref="VRage.Game.MyObjectBuilder_SessionSettings.RefinerySpeedMultiplier" />
public System.Single RefinerySpeedMultiplier { get => _settings.RefinerySpeedMultiplier; set => SetValue(ref _settings.RefinerySpeedMultiplier, value); }
#region Multipliers
/// <inheritdoc cref="VRage.Game.MyObjectBuilder_SessionSettings.OnlineMode" />
public string OnlineMode { get => _settings.OnlineMode.ToString(); set { Enum.TryParse(value, true, out VRage.Game.MyOnlineModeEnum parsedVal); SetValue(ref _settings.OnlineMode, parsedVal); } }
public List<string> OnlineModeValues { get; } = new List<string> {"OFFLINE", "PUBLIC", "FRIENDS", "PRIVATE"};
/// <inheritdoc cref="MyObjectBuilder_SessionSettings.InventorySizeMultiplier"/>
public float InventorySizeMultiplier
{
get => _settings.InventorySizeMultiplier; set { _settings.InventorySizeMultiplier = value; OnPropertyChanged(); }
}
/// <inheritdoc cref="VRage.Game.MyObjectBuilder_SessionSettings.MaxPlayers" />
public System.Int16 MaxPlayers { get => _settings.MaxPlayers; set => SetValue(ref _settings.MaxPlayers, value); }
/// <inheritdoc cref="MyObjectBuilder_SessionSettings.RefinerySpeedMultiplier"/>
public float RefinerySpeedMultiplier
{
get => _settings.RefinerySpeedMultiplier; set { _settings.RefinerySpeedMultiplier = value; OnPropertyChanged(); }
}
/// <inheritdoc cref="VRage.Game.MyObjectBuilder_SessionSettings.MaxFloatingObjects" />
public System.Int16 MaxFloatingObjects { get => _settings.MaxFloatingObjects; set => SetValue(ref _settings.MaxFloatingObjects, value); }
/// <inheritdoc cref="MyObjectBuilder_SessionSettings.AssemblerEfficiencyMultiplier"/>
public float AssemblerEfficiencyMultiplier
{
get => _settings.AssemblerEfficiencyMultiplier; set { _settings.AssemblerEfficiencyMultiplier = value; OnPropertyChanged(); }
}
/// <inheritdoc cref="VRage.Game.MyObjectBuilder_SessionSettings.MaxBackupSaves" />
public System.Int16 MaxBackupSaves { get => _settings.MaxBackupSaves; set => SetValue(ref _settings.MaxBackupSaves, value); }
/// <inheritdoc cref="MyObjectBuilder_SessionSettings.AssemblerSpeedMultiplier"/>
public float AssemblerSpeedMultiplier
{
get => _settings.AssemblerSpeedMultiplier; set { _settings.AssemblerSpeedMultiplier = value; OnPropertyChanged(); }
}
/// <inheritdoc cref="VRage.Game.MyObjectBuilder_SessionSettings.MaxGridSize" />
public System.Int32 MaxGridSize { get => _settings.MaxGridSize; set => SetValue(ref _settings.MaxGridSize, value); }
/// <inheritdoc cref="MyObjectBuilder_SessionSettings.GrinderSpeedMultiplier"/>
public float GrinderSpeedMultiplier
{
get => _settings.GrinderSpeedMultiplier; set { _settings.GrinderSpeedMultiplier = value; OnPropertyChanged(); }
}
/// <inheritdoc cref="VRage.Game.MyObjectBuilder_SessionSettings.MaxBlocksPerPlayer" />
public System.Int32 MaxBlocksPerPlayer { get => _settings.MaxBlocksPerPlayer; set => SetValue(ref _settings.MaxBlocksPerPlayer, value); }
/// <inheritdoc cref="MyObjectBuilder_SessionSettings.HackSpeedMultiplier"/>
public float HackSpeedMultiplier
{
get => _settings.HackSpeedMultiplier; set { _settings.HackSpeedMultiplier = value; OnPropertyChanged(); }
}
/// <inheritdoc cref="VRage.Game.MyObjectBuilder_SessionSettings.EnableBlockLimits" />
public System.Boolean EnableBlockLimits { get => _settings.EnableBlockLimits; set => SetValue(ref _settings.EnableBlockLimits, value); }
/// <inheritdoc cref="MyObjectBuilder_SessionSettings.WelderSpeedMultiplier"/>
public float WelderSpeedMultiplier
{
get => _settings.WelderSpeedMultiplier; set { _settings.WelderSpeedMultiplier = value; OnPropertyChanged(); }
}
#endregion
/// <inheritdoc cref="VRage.Game.MyObjectBuilder_SessionSettings.EnableRemoteBlockRemoval" />
public System.Boolean EnableRemoteBlockRemoval { get => _settings.EnableRemoteBlockRemoval; set => SetValue(ref _settings.EnableRemoteBlockRemoval, value); }
#region NPCs
/// <inheritdoc cref="VRage.Game.MyObjectBuilder_SessionSettings.EnvironmentHostility" />
public string EnvironmentHostility { get => _settings.EnvironmentHostility.ToString(); set { Enum.TryParse(value, true, out VRage.Game.MyEnvironmentHostilityEnum parsedVal); SetValue(ref _settings.EnvironmentHostility, parsedVal); } }
public List<string> EnvironmentHostilityValues { get; } = new List<string> {"SAFE", "NORMAL", "CATACLYSM", "CATACLYSM_UNREAL"};
/// <inheritdoc cref="MyObjectBuilder_SessionSettings.EnableDrones"/>
public bool EnableDrones
{
get => _settings.EnableDrones; set { _settings.EnableDrones = value; OnPropertyChanged(); }
}
/// <inheritdoc cref="VRage.Game.MyObjectBuilder_SessionSettings.AutoHealing" />
public System.Boolean AutoHealing { get => _settings.AutoHealing; set => SetValue(ref _settings.AutoHealing, value); }
/// <inheritdoc cref="MyObjectBuilder_SessionSettings.EnableEncounters"/>
public bool EnableEncounters
{
get => _settings.EnableEncounters; set { _settings.EnableEncounters = value; OnPropertyChanged(); }
}
/// <inheritdoc cref="VRage.Game.MyObjectBuilder_SessionSettings.EnableCopyPaste" />
public System.Boolean EnableCopyPaste { get => _settings.EnableCopyPaste; set => SetValue(ref _settings.EnableCopyPaste, value); }
/// <inheritdoc cref="MyObjectBuilder_SessionSettings.EnableSpiders"/>
public bool EnableSpiders
{
get => _settings.EnableSpiders; set { _settings.EnableSpiders = value; OnPropertyChanged(); }
}
/// <inheritdoc cref="VRage.Game.MyObjectBuilder_SessionSettings.WeaponsEnabled" />
public System.Boolean WeaponsEnabled { get => _settings.WeaponsEnabled; set => SetValue(ref _settings.WeaponsEnabled, value); }
/// <inheritdoc cref="MyObjectBuilder_SessionSettings.EnableWolfs"/>
public bool EnableWolves
{
get => _settings.EnableWolfs; set { _settings.EnableWolfs = value; OnPropertyChanged(); }
}
/// <inheritdoc cref="VRage.Game.MyObjectBuilder_SessionSettings.ShowPlayerNamesOnHud" />
public System.Boolean ShowPlayerNamesOnHud { get => _settings.ShowPlayerNamesOnHud; set => SetValue(ref _settings.ShowPlayerNamesOnHud, value); }
/// <inheritdoc cref="MyObjectBuilder_SessionSettings.CargoShipsEnabled"/>
public bool EnableCargoShips
{
get => _settings.CargoShipsEnabled; set { _settings.CargoShipsEnabled = value; OnPropertyChanged(); }
}
#endregion
/// <inheritdoc cref="VRage.Game.MyObjectBuilder_SessionSettings.ThrusterDamage" />
public System.Boolean ThrusterDamage { get => _settings.ThrusterDamage; set => SetValue(ref _settings.ThrusterDamage, value); }
#region Environment
/// <inheritdoc cref="VRage.Game.MyObjectBuilder_SessionSettings.CargoShipsEnabled" />
public System.Boolean CargoShipsEnabled { get => _settings.CargoShipsEnabled; set => SetValue(ref _settings.CargoShipsEnabled, value); }
/// <inheritdoc cref="MyObjectBuilder_SessionSettings.EnableSunRotation"/>
public bool EnableSunRotation
{
get => _settings.EnableSunRotation; set { _settings.EnableSunRotation = value; OnPropertyChanged(); }
}
/// <inheritdoc cref="VRage.Game.MyObjectBuilder_SessionSettings.EnableSpectator" />
public System.Boolean EnableSpectator { get => _settings.EnableSpectator; set => SetValue(ref _settings.EnableSpectator, value); }
/// <inheritdoc cref="MyObjectBuilder_SessionSettings.EnableOxygenPressurization"/>
public bool EnableAirtightness
{
get => _settings.EnableOxygenPressurization; set { _settings.EnableOxygenPressurization = value; OnPropertyChanged(); }
}
/// <inheritdoc cref="VRage.Game.MyObjectBuilder_SessionSettings.WorldSizeKm" />
public System.Int32 WorldSizeKm { get => _settings.WorldSizeKm; set => SetValue(ref _settings.WorldSizeKm, value); }
/// <inheritdoc cref="MyObjectBuilder_SessionSettings.EnableOxygen"/>
public bool EnableOxygen
{
get => _settings.EnableOxygen; set { _settings.EnableOxygen = value; OnPropertyChanged(); }
}
/// <inheritdoc cref="VRage.Game.MyObjectBuilder_SessionSettings.RespawnShipDelete" />
public System.Boolean RespawnShipDelete { get => _settings.RespawnShipDelete; set => SetValue(ref _settings.RespawnShipDelete, value); }
/// <inheritdoc cref="MyObjectBuilder_SessionSettings.DestructibleBlocks"/>
public bool EnableDestructibleBlocks
{
get => _settings.DestructibleBlocks; set { _settings.DestructibleBlocks = value; OnPropertyChanged(); }
}
/// <inheritdoc cref="VRage.Game.MyObjectBuilder_SessionSettings.ResetOwnership" />
public System.Boolean ResetOwnership { get => _settings.ResetOwnership; set => SetValue(ref _settings.ResetOwnership, value); }
/// <inheritdoc cref="MyObjectBuilder_SessionSettings.EnableToolShake"/>
public bool EnableToolShake
{
get => _settings.EnableToolShake; set { _settings.EnableToolShake = value; OnPropertyChanged(); }
}
/// <inheritdoc cref="VRage.Game.MyObjectBuilder_SessionSettings.WelderSpeedMultiplier" />
public System.Single WelderSpeedMultiplier { get => _settings.WelderSpeedMultiplier; set => SetValue(ref _settings.WelderSpeedMultiplier, value); }
/// <inheritdoc cref="MyObjectBuilder_SessionSettings.EnableVoxelDestruction"/>
public bool EnableVoxelDestruction
{
get => _settings.EnableVoxelDestruction; set { _settings.EnableVoxelDestruction = value; OnPropertyChanged(); }
}
/// <inheritdoc cref="VRage.Game.MyObjectBuilder_SessionSettings.GrinderSpeedMultiplier" />
public System.Single GrinderSpeedMultiplier { get => _settings.GrinderSpeedMultiplier; set => SetValue(ref _settings.GrinderSpeedMultiplier, value); }
/// <summary>
/// List used to populate the environment hostility combo box.
/// </summary>
public List<string> EnvironmentHostilityValues { get; } = Enum.GetNames(typeof(MyEnvironmentHostilityEnum)).ToList();
/// <inheritdoc cref="VRage.Game.MyObjectBuilder_SessionSettings.RealisticSound" />
public System.Boolean RealisticSound { get => _settings.RealisticSound; set => SetValue(ref _settings.RealisticSound, value); }
/// <inheritdoc cref="MyObjectBuilder_SessionSettings.EnvironmentHostility"/>
public string EnvironmentHostility
{
get => _settings.EnvironmentHostility.ToString(); set { Enum.TryParse(value, true, out _settings.EnvironmentHostility); OnPropertyChanged(); }
}
/// <inheritdoc cref="VRage.Game.MyObjectBuilder_SessionSettings.HackSpeedMultiplier" />
public System.Single HackSpeedMultiplier { get => _settings.HackSpeedMultiplier; set => SetValue(ref _settings.HackSpeedMultiplier, value); }
/// <inheritdoc cref="MyObjectBuilder_SessionSettings.EnableFlora"/>
public bool EnableFlora
{
get => _settings.EnableFlora; set { _settings.EnableFlora = value; OnPropertyChanged(); }
}
#endregion
/// <inheritdoc cref="VRage.Game.MyObjectBuilder_SessionSettings.PermanentDeath" />
public System.Nullable<System.Boolean> PermanentDeath { get => _settings.PermanentDeath; set => SetValue(ref _settings.PermanentDeath, value); }
/// <summary>
/// List used to populate the game mode combobox.
/// </summary>
public List<string> GameModeValues { get; } = Enum.GetNames(typeof(MyGameModeEnum)).ToList();
/// <inheritdoc cref="VRage.Game.MyObjectBuilder_SessionSettings.AutoSaveInMinutes" />
public System.UInt32 AutoSaveInMinutes { get => _settings.AutoSaveInMinutes; set => SetValue(ref _settings.AutoSaveInMinutes, value); }
/// <inheritdoc cref="MyObjectBuilder_SessionSettings.GameMode"/>
public string GameMode
{
get => _settings.GameMode.ToString(); set { Enum.TryParse(value, true, out _settings.GameMode); OnPropertyChanged(); }
}
/// <inheritdoc cref="VRage.Game.MyObjectBuilder_SessionSettings.EnableSaving" />
public System.Boolean EnableSaving { get => _settings.EnableSaving; set => SetValue(ref _settings.EnableSaving, value); }
/// <inheritdoc cref="MyObjectBuilder_SessionSettings.AutoHealing"/>
public bool EnableAutoHealing
{
get => _settings.AutoHealing; set { _settings.AutoHealing = value; OnPropertyChanged(); }
}
/// <inheritdoc cref="VRage.Game.MyObjectBuilder_SessionSettings.EnableRespawnScreen" />
public System.Boolean EnableRespawnScreen { get => _settings.EnableRespawnScreen; set => SetValue(ref _settings.EnableRespawnScreen, value); }
/// <inheritdoc cref="MyObjectBuilder_SessionSettings.EnableCopyPaste"/>
public bool EnableCopyPaste
{
get => _settings.EnableCopyPaste; set { _settings.EnableCopyPaste = value; OnPropertyChanged(); }
}
/// <inheritdoc cref="VRage.Game.MyObjectBuilder_SessionSettings.InfiniteAmmo" />
public System.Boolean InfiniteAmmo { get => _settings.InfiniteAmmo; set => SetValue(ref _settings.InfiniteAmmo, value); }
/// <inheritdoc cref="MyObjectBuilder_SessionSettings.ShowPlayerNamesOnHud"/>
public bool ShowPlayerNamesOnHud
{
get => _settings.ShowPlayerNamesOnHud; set { _settings.ShowPlayerNamesOnHud = value; OnPropertyChanged(); }
}
/// <inheritdoc cref="VRage.Game.MyObjectBuilder_SessionSettings.EnableContainerDrops" />
public System.Boolean EnableContainerDrops { get => _settings.EnableContainerDrops; set => SetValue(ref _settings.EnableContainerDrops, value); }
/// <inheritdoc cref="MyObjectBuilder_SessionSettings.Enable3rdPersonView"/>
public bool EnableThirdPerson
{
get => _settings.Enable3rdPersonView; set { _settings.Enable3rdPersonView = value; OnPropertyChanged(); }
}
/// <inheritdoc cref="VRage.Game.MyObjectBuilder_SessionSettings.SpawnShipTimeMultiplier" />
public System.Single SpawnShipTimeMultiplier { get => _settings.SpawnShipTimeMultiplier; set => SetValue(ref _settings.SpawnShipTimeMultiplier, value); }
/// <inheritdoc cref="MyObjectBuilder_SessionSettings.EnableSpectator"/>
public bool EnableSpectator
{
get => _settings.EnableSpectator; set { _settings.EnableSpectator = value; OnPropertyChanged(); }
}
/// <inheritdoc cref="VRage.Game.MyObjectBuilder_SessionSettings.ProceduralDensity" />
public System.Single ProceduralDensity { get => _settings.ProceduralDensity; set => SetValue(ref _settings.ProceduralDensity, value); }
/// <inheritdoc cref="MyObjectBuilder_SessionSettings.SpawnWithTools"/>
public bool SpawnWithTools
{
get => _settings.SpawnWithTools; set { _settings.SpawnWithTools = value; OnPropertyChanged(); }
}
/// <inheritdoc cref="VRage.Game.MyObjectBuilder_SessionSettings.ProceduralSeed" />
public System.Int32 ProceduralSeed { get => _settings.ProceduralSeed; set => SetValue(ref _settings.ProceduralSeed, value); }
/// <inheritdoc cref="MyObjectBuilder_SessionSettings.EnableConvertToStation"/>
public bool EnableConvertToStation
{
get => _settings.EnableConvertToStation; set { _settings.EnableConvertToStation = value; OnPropertyChanged(); }
}
/// <inheritdoc cref="VRage.Game.MyObjectBuilder_SessionSettings.DestructibleBlocks" />
public System.Boolean DestructibleBlocks { get => _settings.DestructibleBlocks; set => SetValue(ref _settings.DestructibleBlocks, value); }
/// <inheritdoc cref="MyObjectBuilder_SessionSettings.EnableJetpack"/>
public bool EnableJetpack
{
get => _settings.EnableJetpack; set { _settings.EnableJetpack = value; OnPropertyChanged(); }
}
/// <inheritdoc cref="VRage.Game.MyObjectBuilder_SessionSettings.EnableIngameScripts" />
public System.Boolean EnableIngameScripts { get => _settings.EnableIngameScripts; set => SetValue(ref _settings.EnableIngameScripts, value); }
/// <inheritdoc cref="MyObjectBuilder_SessionSettings.EnableRemoteBlockRemoval"/>
public bool EnableRemoteOwnerRemoval
{
get => _settings.EnableRemoteBlockRemoval; set { _settings.EnableRemoteBlockRemoval = value; OnPropertyChanged(); }
}
/// <inheritdoc cref="VRage.Game.MyObjectBuilder_SessionSettings.ViewDistance" />
public System.Int32 ViewDistance { get => _settings.ViewDistance; set => SetValue(ref _settings.ViewDistance, value); }
/// <inheritdoc cref="MyObjectBuilder_SessionSettings.EnableRespawnShips"/>
public bool EnableRespawnShips
{
get => _settings.EnableRespawnShips; set { _settings.EnableRespawnShips = value; OnPropertyChanged(); }
}
/// <inheritdoc cref="VRage.Game.MyObjectBuilder_SessionSettings.FloraDensity" />
public System.Int32 FloraDensity { get => _settings.FloraDensity; set => SetValue(ref _settings.FloraDensity, value); }
/// <inheritdoc cref="MyObjectBuilder_SessionSettings.EnableScripterRole"/>
public bool EnableScripterRole
{
get => _settings.EnableScripterRole; set { _settings.EnableScripterRole = value; OnPropertyChanged(); }
}
/// <inheritdoc cref="VRage.Game.MyObjectBuilder_SessionSettings.EnableToolShake" />
public System.Boolean EnableToolShake { get => _settings.EnableToolShake; set => SetValue(ref _settings.EnableToolShake, value); }
/// <inheritdoc cref="MyObjectBuilder_SessionSettings.RealisticSound"/>
public bool EnableRealisticSound
{
get => _settings.RealisticSound; set { _settings.RealisticSound = value; OnPropertyChanged(); }
}
/// <inheritdoc cref="VRage.Game.MyObjectBuilder_SessionSettings.VoxelGeneratorVersion" />
public System.Int32 VoxelGeneratorVersion { get => _settings.VoxelGeneratorVersion; set => SetValue(ref _settings.VoxelGeneratorVersion, value); }
/// <inheritdoc cref="MyObjectBuilder_SessionSettings.ResetOwnership"/>
public bool ResetOwnership
{
get => _settings.ResetOwnership; set { _settings.ResetOwnership = value; OnPropertyChanged(); }
}
/// <inheritdoc cref="VRage.Game.MyObjectBuilder_SessionSettings.EnableOxygen" />
public System.Boolean EnableOxygen { get => _settings.EnableOxygen; set => SetValue(ref _settings.EnableOxygen, value); }
/// <inheritdoc cref="MyObjectBuilder_SessionSettings.RespawnShipDelete"/>
public bool DeleteRespawnShips
{
get => _settings.RespawnShipDelete; set { _settings.RespawnShipDelete = value; OnPropertyChanged(); }
}
/// <inheritdoc cref="VRage.Game.MyObjectBuilder_SessionSettings.EnableOxygenPressurization" />
public System.Boolean EnableOxygenPressurization { get => _settings.EnableOxygenPressurization; set => SetValue(ref _settings.EnableOxygenPressurization, value); }
/// <inheritdoc cref="MyObjectBuilder_SessionSettings.ThrusterDamage"/>
public bool EnableThrusterDamage
{
get => _settings.ThrusterDamage; set { _settings.ThrusterDamage = value; OnPropertyChanged(); }
}
/// <inheritdoc cref="VRage.Game.MyObjectBuilder_SessionSettings.Enable3rdPersonView" />
public System.Boolean Enable3rdPersonView { get => _settings.Enable3rdPersonView; set => SetValue(ref _settings.Enable3rdPersonView, value); }
/// <inheritdoc cref="MyObjectBuilder_SessionSettings.WeaponsEnabled"/>
public bool EnableWeapons
{
get => _settings.WeaponsEnabled; set { _settings.WeaponsEnabled = value; OnPropertyChanged(); }
}
/// <inheritdoc cref="VRage.Game.MyObjectBuilder_SessionSettings.EnableEncounters" />
public System.Boolean EnableEncounters { get => _settings.EnableEncounters; set => SetValue(ref _settings.EnableEncounters, value); }
/// <inheritdoc cref="MyObjectBuilder_SessionSettings.EnableIngameScripts"/>
public bool EnableIngameScripts
{
get => _settings.EnableIngameScripts; set { _settings.EnableIngameScripts = value; OnPropertyChanged(); }
}
/// <inheritdoc cref="VRage.Game.MyObjectBuilder_SessionSettings.EnableFlora" />
public System.Boolean EnableFlora { get => _settings.EnableFlora; set => SetValue(ref _settings.EnableFlora, value); }
/// <inheritdoc cref="MyObjectBuilder_SessionSettings.AutoSaveInMinutes"/>
public uint AutosaveInterval
{
get => _settings.AutoSaveInMinutes; set { _settings.AutoSaveInMinutes = value; OnPropertyChanged(); }
}
/// <inheritdoc cref="VRage.Game.MyObjectBuilder_SessionSettings.EnableConvertToStation" />
public System.Boolean EnableConvertToStation { get => _settings.EnableConvertToStation; set => SetValue(ref _settings.EnableConvertToStation, value); }
/// <inheritdoc cref="MyObjectBuilder_SessionSettings.FloraDensity"/>
public int FloraDensity
{
get => _settings.FloraDensity; set { _settings.FloraDensity = value; OnPropertyChanged(); }
}
/// <inheritdoc cref="VRage.Game.MyObjectBuilder_SessionSettings.StationVoxelSupport" />
public System.Boolean StationVoxelSupport { get => _settings.StationVoxelSupport; set => SetValue(ref _settings.StationVoxelSupport, value); }
/// <inheritdoc cref="MyObjectBuilder_SessionSettings.FloraDensityMultiplier"/>
public float FloraDensityMultiplier
{
get => _settings.FloraDensityMultiplier; set { _settings.FloraDensityMultiplier = value; OnPropertyChanged(); }
}
/// <inheritdoc cref="VRage.Game.MyObjectBuilder_SessionSettings.EnableSunRotation" />
public System.Boolean EnableSunRotation { get => _settings.EnableSunRotation; set => SetValue(ref _settings.EnableSunRotation, value); }
/// <inheritdoc cref="MyObjectBuilder_SessionSettings.MaxBackupSaves"/>
public short MaxBackupSaves
{
get => _settings.MaxBackupSaves; set { _settings.MaxBackupSaves = value; OnPropertyChanged(); }
}
/// <inheritdoc cref="VRage.Game.MyObjectBuilder_SessionSettings.EnableRespawnShips" />
public System.Boolean EnableRespawnShips { get => _settings.EnableRespawnShips; set => SetValue(ref _settings.EnableRespawnShips, value); }
/// <inheritdoc cref="MyObjectBuilder_SessionSettings.MaxBlocksPerPlayer"/>
public int MaxBlocksPerPlayer
{
get => _settings.MaxBlocksPerPlayer; set { _settings.MaxBlocksPerPlayer = value; OnPropertyChanged(); }
}
/// <inheritdoc cref="VRage.Game.MyObjectBuilder_SessionSettings.ScenarioEditMode" />
public System.Boolean ScenarioEditMode { get => _settings.ScenarioEditMode; set => SetValue(ref _settings.ScenarioEditMode, value); }
/// <inheritdoc cref="MyObjectBuilder_SessionSettings.MaxFloatingObjects"/>
public short MaxFloatingObjects
{
get => _settings.MaxFloatingObjects; set { _settings.MaxFloatingObjects = value; OnPropertyChanged(); }
}
/// <inheritdoc cref="VRage.Game.MyObjectBuilder_SessionSettings.Scenario" />
public System.Boolean Scenario { get => _settings.Scenario; set => SetValue(ref _settings.Scenario, value); }
/// <inheritdoc cref="MyObjectBuilder_SessionSettings.MaxGridSize"/>
public int MaxGridSize
{
get => _settings.MaxGridSize; set { _settings.MaxGridSize = value; OnPropertyChanged(); }
}
/// <inheritdoc cref="VRage.Game.MyObjectBuilder_SessionSettings.CanJoinRunning" />
public System.Boolean CanJoinRunning { get => _settings.CanJoinRunning; set => SetValue(ref _settings.CanJoinRunning, value); }
/// <inheritdoc cref="MyObjectBuilder_SessionSettings.MaxPlayers"/>
public short MaxPlayers
{
get => _settings.MaxPlayers; set { _settings.MaxPlayers = value; OnPropertyChanged(); }
}
/// <inheritdoc cref="VRage.Game.MyObjectBuilder_SessionSettings.PhysicsIterations" />
public System.Int32 PhysicsIterations { get => _settings.PhysicsIterations; set => SetValue(ref _settings.PhysicsIterations, value); }
/// <inheritdoc cref="MyObjectBuilder_SessionSettings.PhysicsIterations"/>
public int PhysicsIterations
{
get => _settings.PhysicsIterations; set { _settings.PhysicsIterations = value; OnPropertyChanged(); }
}
/// <inheritdoc cref="VRage.Game.MyObjectBuilder_SessionSettings.SunRotationIntervalMinutes" />
public System.Single SunRotationIntervalMinutes { get => _settings.SunRotationIntervalMinutes; set => SetValue(ref _settings.SunRotationIntervalMinutes, value); }
/// <inheritdoc cref="MyObjectBuilder_SessionSettings.SpawnShipTimeMultiplier"/>
public float SpawnTimeMultiplier
{
get => _settings.SpawnShipTimeMultiplier; set { _settings.SpawnShipTimeMultiplier = value; OnPropertyChanged(); }
}
/// <inheritdoc cref="VRage.Game.MyObjectBuilder_SessionSettings.EnableJetpack" />
public System.Boolean EnableJetpack { get => _settings.EnableJetpack; set => SetValue(ref _settings.EnableJetpack, value); }
/// <inheritdoc cref="MyObjectBuilder_SessionSettings.SunRotationIntervalMinutes"/>
public float SunRotationInterval
{
get => _settings.SunRotationIntervalMinutes; set { _settings.SunRotationIntervalMinutes = value; OnPropertyChanged(); }
}
/// <inheritdoc cref="VRage.Game.MyObjectBuilder_SessionSettings.SpawnWithTools" />
public System.Boolean SpawnWithTools { get => _settings.SpawnWithTools; set => SetValue(ref _settings.SpawnWithTools, value); }
/// <inheritdoc cref="MyObjectBuilder_SessionSettings.ViewDistance"/>
public int ViewDistance
{
get => _settings.ViewDistance; set { _settings.ViewDistance = value; OnPropertyChanged(); }
}
/// <inheritdoc cref="VRage.Game.MyObjectBuilder_SessionSettings.StartInRespawnScreen" />
public System.Boolean StartInRespawnScreen { get => _settings.StartInRespawnScreen; set => SetValue(ref _settings.StartInRespawnScreen, value); }
/// <inheritdoc cref="MyObjectBuilder_SessionSettings.WorldSizeKm"/>
public int WorldSize
{
get => _settings.WorldSizeKm; set { _settings.WorldSizeKm = value; OnPropertyChanged(); }
}
/// <inheritdoc cref="VRage.Game.MyObjectBuilder_SessionSettings.EnableVoxelDestruction" />
public System.Boolean EnableVoxelDestruction { get => _settings.EnableVoxelDestruction; set => SetValue(ref _settings.EnableVoxelDestruction, value); }
/// <inheritdoc cref="MyObjectBuilder_SessionSettings.ProceduralDensity"/>
public float ProceduralDensity
{
get => _settings.ProceduralDensity; set { _settings.ProceduralDensity = value; OnPropertyChanged(); }
}
/// <inheritdoc cref="VRage.Game.MyObjectBuilder_SessionSettings.MaxDrones" />
public System.Int32 MaxDrones { get => _settings.MaxDrones; set => SetValue(ref _settings.MaxDrones, value); }
/// <inheritdoc cref="MyObjectBuilder_SessionSettings.ProceduralSeed"/>
public int ProceduralSeed
{
get => _settings.ProceduralSeed;
set { _settings.ProceduralSeed = value; OnPropertyChanged(); }
}
/// <inheritdoc cref="VRage.Game.MyObjectBuilder_SessionSettings.EnableDrones" />
public System.Boolean EnableDrones { get => _settings.EnableDrones; set => SetValue(ref _settings.EnableDrones, value); }
/// <summary />
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;
}
}
/// <inheritdoc cref="VRage.Game.MyObjectBuilder_SessionSettings.EnableWolfs" />
public System.Boolean EnableWolfs { get => _settings.EnableWolfs; set => SetValue(ref _settings.EnableWolfs, value); }
/// <inheritdoc cref="VRage.Game.MyObjectBuilder_SessionSettings.EnableSpiders" />
public System.Boolean EnableSpiders { get => _settings.EnableSpiders; set => SetValue(ref _settings.EnableSpiders, value); }
/// <inheritdoc cref="VRage.Game.MyObjectBuilder_SessionSettings.FloraDensityMultiplier" />
public System.Single FloraDensityMultiplier { get => _settings.FloraDensityMultiplier; set => SetValue(ref _settings.FloraDensityMultiplier, value); }
/// <inheritdoc cref="VRage.Game.MyObjectBuilder_SessionSettings.EnableStructuralSimulation" />
public System.Boolean EnableStructuralSimulation { get => _settings.EnableStructuralSimulation; set => SetValue(ref _settings.EnableStructuralSimulation, value); }
/// <inheritdoc cref="VRage.Game.MyObjectBuilder_SessionSettings.MaxActiveFracturePieces" />
public System.Int32 MaxActiveFracturePieces { get => _settings.MaxActiveFracturePieces; set => SetValue(ref _settings.MaxActiveFracturePieces, value); }
/// <inheritdoc cref="VRage.Game.MyObjectBuilder_SessionSettings.BlockTypeLimits" />
public VRage.Serialization.SerializableDictionary<System.String, System.Int16> BlockTypeLimits { get => _settings.BlockTypeLimits; set => SetValue(ref _settings.BlockTypeLimits, value); }
/// <inheritdoc cref="VRage.Game.MyObjectBuilder_SessionSettings.EnableScripterRole" />
public System.Boolean EnableScripterRole { get => _settings.EnableScripterRole; set => SetValue(ref _settings.EnableScripterRole, value); }
/// <inheritdoc cref="VRage.Game.MyObjectBuilder_SessionSettings.MinDropContainerRespawnTime" />
public System.Int32 MinDropContainerRespawnTime { get => _settings.MinDropContainerRespawnTime; set => SetValue(ref _settings.MinDropContainerRespawnTime, value); }
/// <inheritdoc cref="VRage.Game.MyObjectBuilder_SessionSettings.MaxDropContainerRespawnTime" />
public System.Int32 MaxDropContainerRespawnTime { get => _settings.MaxDropContainerRespawnTime; set => SetValue(ref _settings.MaxDropContainerRespawnTime, value); }
/// <inheritdoc cref="VRage.Game.MyObjectBuilder_SessionSettings.EnableTurretsFriendlyFire" />
public System.Boolean EnableTurretsFriendlyFire { get => _settings.EnableTurretsFriendlyFire; set => SetValue(ref _settings.EnableTurretsFriendlyFire, value); }
/// <inheritdoc cref="VRage.Game.MyObjectBuilder_SessionSettings.EnableSubgridDamage" />
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;
}
}
}

View File

@@ -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<string> {field.Name}Values {{ get; }} = new List<string> {{{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 $"/// <inheritdoc cref=\"VRage.Game.MyObjectBuilder_SessionSettings.{info.Name}\" />";
}
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;
}
}
}

View File

@@ -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;
/// <inheritdoc cref="VRage.Game.MyObjectBuilder_SessionSettings.GameMode" />
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<string> GameModeValues { get; } = new List<string> {"Creative", "Survival"};
/// <inheritdoc cref="VRage.Game.MyObjectBuilder_SessionSettings.InventorySizeMultiplier" />
public System.Single InventorySizeMultiplier { get => _settings.InventorySizeMultiplier; set => SetValue(ref _settings.InventorySizeMultiplier, value); }
/// <inheritdoc cref="VRage.Game.MyObjectBuilder_SessionSettings.AssemblerSpeedMultiplier" />
public System.Single AssemblerSpeedMultiplier { get => _settings.AssemblerSpeedMultiplier; set => SetValue(ref _settings.AssemblerSpeedMultiplier, value); }
/// <inheritdoc cref="VRage.Game.MyObjectBuilder_SessionSettings.AssemblerEfficiencyMultiplier" />
public System.Single AssemblerEfficiencyMultiplier { get => _settings.AssemblerEfficiencyMultiplier; set => SetValue(ref _settings.AssemblerEfficiencyMultiplier, value); }
/// <inheritdoc cref="VRage.Game.MyObjectBuilder_SessionSettings.RefinerySpeedMultiplier" />
public System.Single RefinerySpeedMultiplier { get => _settings.RefinerySpeedMultiplier; set => SetValue(ref _settings.RefinerySpeedMultiplier, value); }
/// <inheritdoc cref="VRage.Game.MyObjectBuilder_SessionSettings.OnlineMode" />
public string OnlineMode { get => _settings.OnlineMode.ToString(); set { Enum.TryParse(value, true, out VRage.Game.MyOnlineModeEnum parsedVal); SetValue(ref _settings.OnlineMode, parsedVal); } }
public List<string> OnlineModeValues { get; } = new List<string> {"OFFLINE", "PUBLIC", "FRIENDS", "PRIVATE"};
/// <inheritdoc cref="VRage.Game.MyObjectBuilder_SessionSettings.MaxPlayers" />
public System.Int16 MaxPlayers { get => _settings.MaxPlayers; set => SetValue(ref _settings.MaxPlayers, value); }
/// <inheritdoc cref="VRage.Game.MyObjectBuilder_SessionSettings.MaxFloatingObjects" />
public System.Int16 MaxFloatingObjects { get => _settings.MaxFloatingObjects; set => SetValue(ref _settings.MaxFloatingObjects, value); }
/// <inheritdoc cref="VRage.Game.MyObjectBuilder_SessionSettings.MaxBackupSaves" />
public System.Int16 MaxBackupSaves { get => _settings.MaxBackupSaves; set => SetValue(ref _settings.MaxBackupSaves, value); }
/// <inheritdoc cref="VRage.Game.MyObjectBuilder_SessionSettings.MaxGridSize" />
public System.Int32 MaxGridSize { get => _settings.MaxGridSize; set => SetValue(ref _settings.MaxGridSize, value); }
/// <inheritdoc cref="VRage.Game.MyObjectBuilder_SessionSettings.MaxBlocksPerPlayer" />
public System.Int32 MaxBlocksPerPlayer { get => _settings.MaxBlocksPerPlayer; set => SetValue(ref _settings.MaxBlocksPerPlayer, value); }
/// <inheritdoc cref="VRage.Game.MyObjectBuilder_SessionSettings.EnableBlockLimits" />
public System.Boolean EnableBlockLimits { get => _settings.EnableBlockLimits; set => SetValue(ref _settings.EnableBlockLimits, value); }
/// <inheritdoc cref="VRage.Game.MyObjectBuilder_SessionSettings.EnableRemoteBlockRemoval" />
public System.Boolean EnableRemoteBlockRemoval { get => _settings.EnableRemoteBlockRemoval; set => SetValue(ref _settings.EnableRemoteBlockRemoval, value); }
/// <inheritdoc cref="VRage.Game.MyObjectBuilder_SessionSettings.EnvironmentHostility" />
public string EnvironmentHostility { get => _settings.EnvironmentHostility.ToString(); set { Enum.TryParse(value, true, out VRage.Game.MyEnvironmentHostilityEnum parsedVal); SetValue(ref _settings.EnvironmentHostility, parsedVal); } }
public List<string> EnvironmentHostilityValues { get; } = new List<string> {"SAFE", "NORMAL", "CATACLYSM", "CATACLYSM_UNREAL"};
/// <inheritdoc cref="VRage.Game.MyObjectBuilder_SessionSettings.AutoHealing" />
public System.Boolean AutoHealing { get => _settings.AutoHealing; set => SetValue(ref _settings.AutoHealing, value); }
/// <inheritdoc cref="VRage.Game.MyObjectBuilder_SessionSettings.EnableCopyPaste" />
public System.Boolean EnableCopyPaste { get => _settings.EnableCopyPaste; set => SetValue(ref _settings.EnableCopyPaste, value); }
/// <inheritdoc cref="VRage.Game.MyObjectBuilder_SessionSettings.WeaponsEnabled" />
public System.Boolean WeaponsEnabled { get => _settings.WeaponsEnabled; set => SetValue(ref _settings.WeaponsEnabled, value); }
/// <inheritdoc cref="VRage.Game.MyObjectBuilder_SessionSettings.ShowPlayerNamesOnHud" />
public System.Boolean ShowPlayerNamesOnHud { get => _settings.ShowPlayerNamesOnHud; set => SetValue(ref _settings.ShowPlayerNamesOnHud, value); }
/// <inheritdoc cref="VRage.Game.MyObjectBuilder_SessionSettings.ThrusterDamage" />
public System.Boolean ThrusterDamage { get => _settings.ThrusterDamage; set => SetValue(ref _settings.ThrusterDamage, value); }
/// <inheritdoc cref="VRage.Game.MyObjectBuilder_SessionSettings.CargoShipsEnabled" />
public System.Boolean CargoShipsEnabled { get => _settings.CargoShipsEnabled; set => SetValue(ref _settings.CargoShipsEnabled, value); }
/// <inheritdoc cref="VRage.Game.MyObjectBuilder_SessionSettings.EnableSpectator" />
public System.Boolean EnableSpectator { get => _settings.EnableSpectator; set => SetValue(ref _settings.EnableSpectator, value); }
/// <inheritdoc cref="VRage.Game.MyObjectBuilder_SessionSettings.WorldSizeKm" />
public System.Int32 WorldSizeKm { get => _settings.WorldSizeKm; set => SetValue(ref _settings.WorldSizeKm, value); }
/// <inheritdoc cref="VRage.Game.MyObjectBuilder_SessionSettings.RespawnShipDelete" />
public System.Boolean RespawnShipDelete { get => _settings.RespawnShipDelete; set => SetValue(ref _settings.RespawnShipDelete, value); }
/// <inheritdoc cref="VRage.Game.MyObjectBuilder_SessionSettings.ResetOwnership" />
public System.Boolean ResetOwnership { get => _settings.ResetOwnership; set => SetValue(ref _settings.ResetOwnership, value); }
/// <inheritdoc cref="VRage.Game.MyObjectBuilder_SessionSettings.WelderSpeedMultiplier" />
public System.Single WelderSpeedMultiplier { get => _settings.WelderSpeedMultiplier; set => SetValue(ref _settings.WelderSpeedMultiplier, value); }
/// <inheritdoc cref="VRage.Game.MyObjectBuilder_SessionSettings.GrinderSpeedMultiplier" />
public System.Single GrinderSpeedMultiplier { get => _settings.GrinderSpeedMultiplier; set => SetValue(ref _settings.GrinderSpeedMultiplier, value); }
/// <inheritdoc cref="VRage.Game.MyObjectBuilder_SessionSettings.RealisticSound" />
public System.Boolean RealisticSound { get => _settings.RealisticSound; set => SetValue(ref _settings.RealisticSound, value); }
/// <inheritdoc cref="VRage.Game.MyObjectBuilder_SessionSettings.HackSpeedMultiplier" />
public System.Single HackSpeedMultiplier { get => _settings.HackSpeedMultiplier; set => SetValue(ref _settings.HackSpeedMultiplier, value); }
/// <inheritdoc cref="VRage.Game.MyObjectBuilder_SessionSettings.PermanentDeath" />
public System.Nullable<System.Boolean> PermanentDeath { get => _settings.PermanentDeath; set => SetValue(ref _settings.PermanentDeath, value); }
/// <inheritdoc cref="VRage.Game.MyObjectBuilder_SessionSettings.AutoSaveInMinutes" />
public System.UInt32 AutoSaveInMinutes { get => _settings.AutoSaveInMinutes; set => SetValue(ref _settings.AutoSaveInMinutes, value); }
/// <inheritdoc cref="VRage.Game.MyObjectBuilder_SessionSettings.EnableSaving" />
public System.Boolean EnableSaving { get => _settings.EnableSaving; set => SetValue(ref _settings.EnableSaving, value); }
/// <inheritdoc cref="VRage.Game.MyObjectBuilder_SessionSettings.EnableRespawnScreen" />
public System.Boolean EnableRespawnScreen { get => _settings.EnableRespawnScreen; set => SetValue(ref _settings.EnableRespawnScreen, value); }
/// <inheritdoc cref="VRage.Game.MyObjectBuilder_SessionSettings.InfiniteAmmo" />
public System.Boolean InfiniteAmmo { get => _settings.InfiniteAmmo; set => SetValue(ref _settings.InfiniteAmmo, value); }
/// <inheritdoc cref="VRage.Game.MyObjectBuilder_SessionSettings.EnableContainerDrops" />
public System.Boolean EnableContainerDrops { get => _settings.EnableContainerDrops; set => SetValue(ref _settings.EnableContainerDrops, value); }
/// <inheritdoc cref="VRage.Game.MyObjectBuilder_SessionSettings.SpawnShipTimeMultiplier" />
public System.Single SpawnShipTimeMultiplier { get => _settings.SpawnShipTimeMultiplier; set => SetValue(ref _settings.SpawnShipTimeMultiplier, value); }
/// <inheritdoc cref="VRage.Game.MyObjectBuilder_SessionSettings.ProceduralDensity" />
public System.Single ProceduralDensity { get => _settings.ProceduralDensity; set => SetValue(ref _settings.ProceduralDensity, value); }
/// <inheritdoc cref="VRage.Game.MyObjectBuilder_SessionSettings.ProceduralSeed" />
public System.Int32 ProceduralSeed { get => _settings.ProceduralSeed; set => SetValue(ref _settings.ProceduralSeed, value); }
/// <inheritdoc cref="VRage.Game.MyObjectBuilder_SessionSettings.DestructibleBlocks" />
public System.Boolean DestructibleBlocks { get => _settings.DestructibleBlocks; set => SetValue(ref _settings.DestructibleBlocks, value); }
/// <inheritdoc cref="VRage.Game.MyObjectBuilder_SessionSettings.EnableIngameScripts" />
public System.Boolean EnableIngameScripts { get => _settings.EnableIngameScripts; set => SetValue(ref _settings.EnableIngameScripts, value); }
/// <inheritdoc cref="VRage.Game.MyObjectBuilder_SessionSettings.ViewDistance" />
public System.Int32 ViewDistance { get => _settings.ViewDistance; set => SetValue(ref _settings.ViewDistance, value); }
/// <inheritdoc cref="VRage.Game.MyObjectBuilder_SessionSettings.FloraDensity" />
public System.Int32 FloraDensity { get => _settings.FloraDensity; set => SetValue(ref _settings.FloraDensity, value); }
/// <inheritdoc cref="VRage.Game.MyObjectBuilder_SessionSettings.EnableToolShake" />
public System.Boolean EnableToolShake { get => _settings.EnableToolShake; set => SetValue(ref _settings.EnableToolShake, value); }
/// <inheritdoc cref="VRage.Game.MyObjectBuilder_SessionSettings.VoxelGeneratorVersion" />
public System.Int32 VoxelGeneratorVersion { get => _settings.VoxelGeneratorVersion; set => SetValue(ref _settings.VoxelGeneratorVersion, value); }
/// <inheritdoc cref="VRage.Game.MyObjectBuilder_SessionSettings.EnableOxygen" />
public System.Boolean EnableOxygen { get => _settings.EnableOxygen; set => SetValue(ref _settings.EnableOxygen, value); }
/// <inheritdoc cref="VRage.Game.MyObjectBuilder_SessionSettings.EnableOxygenPressurization" />
public System.Boolean EnableOxygenPressurization { get => _settings.EnableOxygenPressurization; set => SetValue(ref _settings.EnableOxygenPressurization, value); }
/// <inheritdoc cref="VRage.Game.MyObjectBuilder_SessionSettings.Enable3rdPersonView" />
public System.Boolean Enable3rdPersonView { get => _settings.Enable3rdPersonView; set => SetValue(ref _settings.Enable3rdPersonView, value); }
/// <inheritdoc cref="VRage.Game.MyObjectBuilder_SessionSettings.EnableEncounters" />
public System.Boolean EnableEncounters { get => _settings.EnableEncounters; set => SetValue(ref _settings.EnableEncounters, value); }
/// <inheritdoc cref="VRage.Game.MyObjectBuilder_SessionSettings.EnableFlora" />
public System.Boolean EnableFlora { get => _settings.EnableFlora; set => SetValue(ref _settings.EnableFlora, value); }
/// <inheritdoc cref="VRage.Game.MyObjectBuilder_SessionSettings.EnableConvertToStation" />
public System.Boolean EnableConvertToStation { get => _settings.EnableConvertToStation; set => SetValue(ref _settings.EnableConvertToStation, value); }
/// <inheritdoc cref="VRage.Game.MyObjectBuilder_SessionSettings.StationVoxelSupport" />
public System.Boolean StationVoxelSupport { get => _settings.StationVoxelSupport; set => SetValue(ref _settings.StationVoxelSupport, value); }
/// <inheritdoc cref="VRage.Game.MyObjectBuilder_SessionSettings.EnableSunRotation" />
public System.Boolean EnableSunRotation { get => _settings.EnableSunRotation; set => SetValue(ref _settings.EnableSunRotation, value); }
/// <inheritdoc cref="VRage.Game.MyObjectBuilder_SessionSettings.EnableRespawnShips" />
public System.Boolean EnableRespawnShips { get => _settings.EnableRespawnShips; set => SetValue(ref _settings.EnableRespawnShips, value); }
/// <inheritdoc cref="VRage.Game.MyObjectBuilder_SessionSettings.ScenarioEditMode" />
public System.Boolean ScenarioEditMode { get => _settings.ScenarioEditMode; set => SetValue(ref _settings.ScenarioEditMode, value); }
/// <inheritdoc cref="VRage.Game.MyObjectBuilder_SessionSettings.Scenario" />
public System.Boolean Scenario { get => _settings.Scenario; set => SetValue(ref _settings.Scenario, value); }
/// <inheritdoc cref="VRage.Game.MyObjectBuilder_SessionSettings.CanJoinRunning" />
public System.Boolean CanJoinRunning { get => _settings.CanJoinRunning; set => SetValue(ref _settings.CanJoinRunning, value); }
/// <inheritdoc cref="VRage.Game.MyObjectBuilder_SessionSettings.PhysicsIterations" />
public System.Int32 PhysicsIterations { get => _settings.PhysicsIterations; set => SetValue(ref _settings.PhysicsIterations, value); }
/// <inheritdoc cref="VRage.Game.MyObjectBuilder_SessionSettings.SunRotationIntervalMinutes" />
public System.Single SunRotationIntervalMinutes { get => _settings.SunRotationIntervalMinutes; set => SetValue(ref _settings.SunRotationIntervalMinutes, value); }
/// <inheritdoc cref="VRage.Game.MyObjectBuilder_SessionSettings.EnableJetpack" />
public System.Boolean EnableJetpack { get => _settings.EnableJetpack; set => SetValue(ref _settings.EnableJetpack, value); }
/// <inheritdoc cref="VRage.Game.MyObjectBuilder_SessionSettings.SpawnWithTools" />
public System.Boolean SpawnWithTools { get => _settings.SpawnWithTools; set => SetValue(ref _settings.SpawnWithTools, value); }
/// <inheritdoc cref="VRage.Game.MyObjectBuilder_SessionSettings.StartInRespawnScreen" />
public System.Boolean StartInRespawnScreen { get => _settings.StartInRespawnScreen; set => SetValue(ref _settings.StartInRespawnScreen, value); }
/// <inheritdoc cref="VRage.Game.MyObjectBuilder_SessionSettings.EnableVoxelDestruction" />
public System.Boolean EnableVoxelDestruction { get => _settings.EnableVoxelDestruction; set => SetValue(ref _settings.EnableVoxelDestruction, value); }
/// <inheritdoc cref="VRage.Game.MyObjectBuilder_SessionSettings.MaxDrones" />
public System.Int32 MaxDrones { get => _settings.MaxDrones; set => SetValue(ref _settings.MaxDrones, value); }
/// <inheritdoc cref="VRage.Game.MyObjectBuilder_SessionSettings.EnableDrones" />
public System.Boolean EnableDrones { get => _settings.EnableDrones; set => SetValue(ref _settings.EnableDrones, value); }
/// <inheritdoc cref="VRage.Game.MyObjectBuilder_SessionSettings.EnableWolfs" />
public System.Boolean EnableWolfs { get => _settings.EnableWolfs; set => SetValue(ref _settings.EnableWolfs, value); }
/// <inheritdoc cref="VRage.Game.MyObjectBuilder_SessionSettings.EnableSpiders" />
public System.Boolean EnableSpiders { get => _settings.EnableSpiders; set => SetValue(ref _settings.EnableSpiders, value); }
/// <inheritdoc cref="VRage.Game.MyObjectBuilder_SessionSettings.FloraDensityMultiplier" />
public System.Single FloraDensityMultiplier { get => _settings.FloraDensityMultiplier; set => SetValue(ref _settings.FloraDensityMultiplier, value); }
/// <inheritdoc cref="VRage.Game.MyObjectBuilder_SessionSettings.EnableStructuralSimulation" />
public System.Boolean EnableStructuralSimulation { get => _settings.EnableStructuralSimulation; set => SetValue(ref _settings.EnableStructuralSimulation, value); }
/// <inheritdoc cref="VRage.Game.MyObjectBuilder_SessionSettings.MaxActiveFracturePieces" />
public System.Int32 MaxActiveFracturePieces { get => _settings.MaxActiveFracturePieces; set => SetValue(ref _settings.MaxActiveFracturePieces, value); }
/// <inheritdoc cref="VRage.Game.MyObjectBuilder_SessionSettings.BlockTypeLimits" />
public VRage.Serialization.SerializableDictionary<System.String, System.Int16> BlockTypeLimits { get => _settings.BlockTypeLimits; set => SetValue(ref _settings.BlockTypeLimits, value); }
/// <inheritdoc cref="VRage.Game.MyObjectBuilder_SessionSettings.EnableScripterRole" />
public System.Boolean EnableScripterRole { get => _settings.EnableScripterRole; set => SetValue(ref _settings.EnableScripterRole, value); }
/// <inheritdoc cref="VRage.Game.MyObjectBuilder_SessionSettings.MinDropContainerRespawnTime" />
public System.Int32 MinDropContainerRespawnTime { get => _settings.MinDropContainerRespawnTime; set => SetValue(ref _settings.MinDropContainerRespawnTime, value); }
/// <inheritdoc cref="VRage.Game.MyObjectBuilder_SessionSettings.MaxDropContainerRespawnTime" />
public System.Int32 MaxDropContainerRespawnTime { get => _settings.MaxDropContainerRespawnTime; set => SetValue(ref _settings.MaxDropContainerRespawnTime, value); }
/// <inheritdoc cref="VRage.Game.MyObjectBuilder_SessionSettings.EnableTurretsFriendlyFire" />
public System.Boolean EnableTurretsFriendlyFire { get => _settings.EnableTurretsFriendlyFire; set => SetValue(ref _settings.EnableTurretsFriendlyFire, value); }
/// <inheritdoc cref="VRage.Game.MyObjectBuilder_SessionSettings.EnableSubgridDamage" />
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;
}
}
}

View File

@@ -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">
<UserControl.DataContext>
@@ -18,7 +19,22 @@
<DockPanel Grid.Row="0">
<Label Content="World:" DockPanel.Dock="Left" />
<Button Content="New World" Margin="3" DockPanel.Dock="Right" Click="NewWorld_OnClick"/>
<ComboBox Text="{Binding LoadWorld}" ItemsSource="{Binding WorldPaths}" IsEditable="True" Margin="3" SelectionChanged="Selector_OnSelectionChanged"/>
<ComboBox ItemsSource="{Binding Worlds}" SelectedItem="{Binding SelectedWorld}" Margin="3" SelectionChanged="Selector_OnSelectionChanged">
<ComboBox.ItemTemplate>
<DataTemplate DataType="managers:WorldViewModel">
<StackPanel>
<StackPanel Orientation="Horizontal">
<Label Content="Name: " Padding="0"/>
<Label Content="{Binding Checkpoint.SessionName}" FontStyle="Oblique" Padding="0"/>
</StackPanel>
<StackPanel Orientation="Horizontal">
<Label Content="Last saved: " Padding="0"/>
<Label Content="{Binding Checkpoint.LastSaveTime}" Padding="0"/>
</StackPanel>
</StackPanel>
</DataTemplate>
</ComboBox.ItemTemplate>
</ComboBox>
</DockPanel>
<Grid Grid.Row="1">
<Grid.ColumnDefinitions>
@@ -60,186 +76,7 @@
<Button Grid.Row="1" Content="Save Config" Margin="3" Click="Save_OnClick" />
</Grid>
<ScrollViewer Grid.Column="1" Margin="3">
<StackPanel DataContext="{Binding SessionSettings}">
<Expander Header="Block Limits">
<StackPanel Margin="10,0,0,0">
<StackPanel Orientation="Horizontal">
<TextBox Text="{Binding MaxBlocksPerPlayer}" Margin="3" Width="70" />
<Label Content="Max Blocks Per Player" />
</StackPanel>
<StackPanel Orientation="Horizontal">
<TextBox Text="{Binding MaxGridSize}" Margin="3" Width="70" />
<Label Content="Max Grid Size" />
</StackPanel>
<Button Content="Add" Margin="3" Click="AddLimit_OnClick" />
<ListView ItemsSource="{Binding BlockLimits}" Margin="3">
<ListView.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<TextBox Text="{Binding BlockType}" Width="150" Margin="3" />
<TextBox Text="{Binding Limit}" Width="50" Margin="3" />
<Button Content=" X " Margin="3" Click="RemoveLimit_OnClick" />
</StackPanel>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
</StackPanel>
</Expander>
<Expander Header="Multipliers">
<StackPanel Margin="10,0,0,0">
<StackPanel Orientation="Horizontal">
<TextBox Text="{Binding InventorySizeMultiplier}" Margin="3" Width="70" />
<Label Content="Inventory Size" />
</StackPanel>
<StackPanel Orientation="Horizontal">
<TextBox Text="{Binding RefinerySpeedMultiplier}" Margin="3" Width="70" />
<Label Content="Refinery Speed" />
</StackPanel>
<StackPanel Orientation="Horizontal">
<TextBox Text="{Binding AssemblerEfficiencyMultiplier}" Margin="3" Width="70" />
<Label Content="Assembler Efficiency" />
</StackPanel>
<StackPanel Orientation="Horizontal">
<TextBox Text="{Binding AssemblerSpeedMultiplier}" Margin="3" Width="70" />
<Label Content="Assembler Speed" />
</StackPanel>
<StackPanel Orientation="Horizontal">
<TextBox Text="{Binding WelderSpeedMultiplier}" Margin="3" Width="70" />
<Label Content="Welder Speed" />
</StackPanel>
<StackPanel Orientation="Horizontal">
<TextBox Text="{Binding GrinderSpeedMultiplier}" Margin="3" Width="70" />
<Label Content="Grinder Speed" />
</StackPanel>
<StackPanel Orientation="Horizontal">
<TextBox Text="{Binding HackSpeedMultiplier}" Margin="3" Width="70" />
<Label Content="Hacking Speed" />
</StackPanel>
</StackPanel>
</Expander>
<Expander Header="NPCs">
<StackPanel Margin="10,0,0,0">
<CheckBox IsChecked="{Binding EnableDrones}" Content="Enable Drones" Margin="3" />
<CheckBox IsChecked="{Binding EnableEncounters}" Content="Enable Encounters" Margin="3" />
<CheckBox IsChecked="{Binding EnableSpiders}" Content="Enable Spiders" Margin="3" />
<CheckBox IsChecked="{Binding EnableWolves}" Content="Enable Wolves" Margin="3" />
<CheckBox IsChecked="{Binding EnableCargoShips}" Content="Enable Cargo Ships" Margin="3" />
</StackPanel>
</Expander>
<Expander Header="Environment">
<StackPanel Margin="10,0,0,0">
<StackPanel Orientation="Horizontal" ToolTip="Increases physics precision at the cost of performance.">
<TextBox Text="{Binding PhysicsIterations}" Margin="3" Width="70" />
<Label Content="Physics Iterations" />
</StackPanel>
<StackPanel Orientation="Horizontal">
<TextBox Text="{Binding MaxFloatingObjects}" Margin="3" Width="70" />
<Label Content="Max Floating Objects" />
</StackPanel>
<CheckBox IsChecked="{Binding EnableRealisticSound}" Content="Enable Realistic Sound"
Margin="3" />
<CheckBox IsChecked="{Binding EnableAirtightness}" Content="Enable Airtightness" Margin="3" />
<CheckBox IsChecked="{Binding EnableOxygen}" Content="Enable Oxygen" Margin="3" />
<CheckBox IsChecked="{Binding EnableDestructibleBlocks}"
Content="Enable Destructible Blocks" Margin="3" />
<CheckBox IsChecked="{Binding EnableToolShake}" Content="Enable Tool Shake" Margin="3" />
<CheckBox IsChecked="{Binding EnableVoxelDestruction}" Content="Enable Voxel Destruction"
Margin="3" />
<CheckBox IsChecked="{Binding EnableSunRotation}" Content="Enable Sun Rotation" Margin="3" />
<StackPanel Orientation="Horizontal">
<TextBox Text="{Binding SunRotationInterval}" Margin="3" Width="70" />
<Label Content="Sun Rotation Interval (mins)" />
</StackPanel>
<CheckBox IsChecked="{Binding EnableFlora}" Content="Enable Flora" Margin="3" />
<StackPanel Orientation="Horizontal">
<TextBox Text="{Binding FloraDensity}" Margin="3" Width="70" />
<Label Content="Flora Density" />
</StackPanel>
<StackPanel Orientation="Horizontal">
<TextBox Text="{Binding FloraDensityMultiplier}" Margin="3" Width="70" />
<Label Content="Flora Density Multiplier" />
</StackPanel>
<StackPanel Orientation="Horizontal">
<TextBox Text="{Binding ViewDistance}" Margin="3" Width="70" />
<Label Content="View Distance (meters)" />
</StackPanel>
<StackPanel Orientation="Horizontal">
<TextBox Text="{Binding WorldSize}" Margin="3" Width="70" />
<Label Content="World Size (km)" />
</StackPanel>
<StackPanel Orientation="Horizontal">
<ComboBox SelectedItem="{Binding EnvironmentHostility}"
ItemsSource="{Binding EnvironmentHostilityValues}" Margin="3" Width="100"
DockPanel.Dock="Left" />
<Label Content="Environment Hostility" />
</StackPanel>
<StackPanel Orientation="Horizontal">
<TextBox Text="{Binding ProceduralDensity}" Margin="3" Width="70" />
<Label Content="Procedural Density" />
</StackPanel>
<StackPanel Orientation="Horizontal">
<TextBox Text="{Binding ProceduralSeed}" Margin="3" Width="70" />
<Label Content="Procedural Seed" />
</StackPanel>
</StackPanel>
</Expander>
<Expander Header="Players">
<StackPanel Margin="10,0,0,0">
<StackPanel Orientation="Horizontal">
<TextBox Text="{Binding MaxPlayers}" Margin="3" Width="70" />
<Label Content="Max Players" />
</StackPanel>
<CheckBox IsChecked="{Binding EnableThirdPerson}" Content="Enable 3rd Person Camera"
Margin="3" />
<CheckBox IsChecked="{Binding EnableJetpack}" Content="Enable Jetpack" Margin="3" />
<CheckBox IsChecked="{Binding EnableAutoHealing}" Content="Auto Healing" Margin="3" />
<CheckBox IsChecked="{Binding EnableCopyPaste}" Content="Enable Copy/Paste" Margin="3" />
<CheckBox IsChecked="{Binding ShowPlayerNamesOnHud}" Content="Show Player Names on HUD"
Margin="3" />
<StackPanel Orientation="Horizontal">
<TextBox Text="{Binding SpawnTimeMultiplier}" Margin="3" Width="70" />
<Label Content="Respawn Time Multiplier" />
</StackPanel>
<CheckBox IsChecked="{Binding ResetOwnership}" Content="Reset Ownership" Margin="3" />
<CheckBox IsChecked="{Binding SpawnWithTools}" Content="Spawn With Tools" Margin="3" />
</StackPanel>
</Expander>
<Expander Header="Miscellaneous">
<StackPanel Margin="10,0,0,0">
<StackPanel Orientation="Horizontal">
<TextBox Text="{Binding AutosaveInterval}" Margin="3" Width="70" />
<Label Content="Autosave Interval (minutes)" />
</StackPanel>
<CheckBox IsChecked="{Binding EnableConvertToStation}" Content="Enable Convert to Station"
Margin="3" />
<CheckBox IsChecked="{Binding EnableRemoteOwnerRemoval}"
Content="Enable Remote Ownership Removal" Margin="3" />
<CheckBox IsChecked="{Binding EnableRespawnShips}" Content="Enable Respawn Ships"
Margin="3" />
<CheckBox IsChecked="{Binding EnableScripterRole}" Content="Enable Scripter Role"
Margin="3" />
<CheckBox IsChecked="{Binding EnableSpectator}" Content="Enable Spectator Camera"
Margin="3" />
<CheckBox IsChecked="{Binding DeleteRespawnShips}" Content="Remove Respawn Ships on Logoff"
Margin="3" />
<CheckBox IsChecked="{Binding EnableThrusterDamage}" Content="Enable Thruster Damage"
Margin="3" />
<CheckBox IsChecked="{Binding EnableWeapons}" Content="Enable Weapons" Margin="3" />
<CheckBox IsChecked="{Binding EnableIngameScripts}" Content="Enable Ingame Scripts"
Margin="3" />
<StackPanel Orientation="Horizontal">
<ComboBox SelectedItem="{Binding GameMode}" ItemsSource="{Binding GameModeValues}"
Margin="3" Width="100" DockPanel.Dock="Left" />
<Label Content="Game Mode" />
</StackPanel>
<StackPanel Orientation="Horizontal">
<TextBox Text="{Binding MaxBackupSaves}" Margin="3" Width="70" />
<Label Content="Max Backup Saves" />
</StackPanel>
</StackPanel>
</Expander>
</StackPanel>
<local:SessionSettingsView DataContext="{Binding SessionSettings}"/>
</ScrollViewer>
</Grid>
</Grid>

View File

@@ -17,28 +17,23 @@ namespace Torch.Server.Views
{
InitializeComponent();
_instanceManager = TorchBase.Instance.Managers.GetManager<InstanceManager>();
_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);
}
}
}

View File

@@ -0,0 +1,12 @@
<UserControl x:Class="Torch.Server.Views.DynamicView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:Torch.Server.Views"
mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="300">
<Grid>
</Grid>
</UserControl>

View File

@@ -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
{
/// <summary>
/// Interaction logic for DynamicView.xaml
/// </summary>
public partial class DynamicView : UserControl
{
private static Dictionary<Type, StackPanel> _map = new Dictionary<Type, StackPanel>();
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;
}
}
}

View File

@@ -1,30 +0,0 @@
<Window x:Class="Torch.Server.Views.FirstTimeSetup"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:Torch.Server.Views"
xmlns:torch="clr-namespace:Torch;assembly=Torch"
xmlns:server="clr-namespace:Torch.Server"
mc:Ignorable="d"
Title="Torch First Time Setup" Height="200" Width="500">
<Window.DataContext>
<server:TorchConfig/>
</Window.DataContext>
<StackPanel>
<DockPanel ToolTip="This should be set to the folder that contains your mods and saves.">
<Label Content="Instance Path:" Width="150"/>
<TextBox Text="{Binding InstancePath}" Margin="3"/>
</DockPanel>
<DockPanel ToolTip="The name of your instance, this doesn't really matter.">
<Label Content="Instance Name:" Width="150"/>
<TextBox Text="{Binding InstanceName}" Margin="3"></TextBox>
</DockPanel>
<DockPanel ToolTip="This enables/disables automatic plugin updating.">
<Label Content="Automatic Plugin Updates:" Width="150"/>
<CheckBox IsChecked="{Binding EnableAutomaticUpdates}" VerticalAlignment="Center" Margin="3"/>
</DockPanel>
<Label Content="You can change these settings later by editing TorchConfig.xml"/>
<Button Content="Done" Margin="3" Click="ButtonBase_OnClick"></Button>
</StackPanel>
</Window>

View File

@@ -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
{
/// <summary>
/// Interaction logic for FirstTimeSetup.xaml
/// </summary>
public partial class FirstTimeSetup : Window
{
public FirstTimeSetup()
{
InitializeComponent();
}
private void ButtonBase_OnClick(object sender, RoutedEventArgs e)
{
Close();
}
}
}

View File

@@ -0,0 +1,189 @@
<UserControl x:Class="Torch.Server.Views.SessionSettingsView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:Torch.Server.Views"
mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="300">
<StackPanel>
<Expander Header="Block Limits">
<StackPanel Margin="10,0,0,0">
<StackPanel Orientation="Horizontal">
<TextBox Text="{Binding MaxBlocksPerPlayer}" Margin="3" Width="70" />
<Label Content="Max Blocks Per Player" />
</StackPanel>
<StackPanel Orientation="Horizontal">
<TextBox Text="{Binding MaxGridSize}" Margin="3" Width="70" />
<Label Content="Max Grid Size" />
</StackPanel>
<Button Content="Add" Margin="3" Click="AddLimit_OnClick" />
<ListView ItemsSource="{Binding BlockTypeLimits.Dictionary}" Margin="3">
<ListView.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<Label Content="{Binding Key, Mode=OneTime}" Width="150" Margin="3" />
<TextBox Text="{Binding Value, Mode=OneTime}" Width="50" Margin="3" />
<Button Content=" X " Margin="3" Click="RemoveLimit_OnClick" />
</StackPanel>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
</StackPanel>
</Expander>
<Expander Header="Multipliers">
<StackPanel Margin="10,0,0,0">
<StackPanel Orientation="Horizontal">
<TextBox Text="{Binding InventorySizeMultiplier}" Margin="3" Width="70" />
<Label Content="Inventory Size" />
</StackPanel>
<StackPanel Orientation="Horizontal">
<TextBox Text="{Binding RefinerySpeedMultiplier}" Margin="3" Width="70" />
<Label Content="Refinery Speed" />
</StackPanel>
<StackPanel Orientation="Horizontal">
<TextBox Text="{Binding AssemblerEfficiencyMultiplier}" Margin="3" Width="70" />
<Label Content="Assembler Efficiency" />
</StackPanel>
<StackPanel Orientation="Horizontal">
<TextBox Text="{Binding AssemblerSpeedMultiplier}" Margin="3" Width="70" />
<Label Content="Assembler Speed" />
</StackPanel>
<StackPanel Orientation="Horizontal">
<TextBox Text="{Binding WelderSpeedMultiplier}" Margin="3" Width="70" />
<Label Content="Welder Speed" />
</StackPanel>
<StackPanel Orientation="Horizontal">
<TextBox Text="{Binding GrinderSpeedMultiplier}" Margin="3" Width="70" />
<Label Content="Grinder Speed" />
</StackPanel>
<StackPanel Orientation="Horizontal">
<TextBox Text="{Binding HackSpeedMultiplier}" Margin="3" Width="70" />
<Label Content="Hacking Speed" />
</StackPanel>
</StackPanel>
</Expander>
<Expander Header="NPCs">
<StackPanel Margin="10,0,0,0">
<CheckBox IsChecked="{Binding EnableDrones}" Content="Enable Drones" Margin="3" />
<CheckBox IsChecked="{Binding EnableEncounters}" Content="Enable Encounters" Margin="3" />
<CheckBox IsChecked="{Binding EnableSpiders}" Content="Enable Spiders" Margin="3" />
<CheckBox IsChecked="{Binding EnableWolfs}" Content="Enable Wolves" Margin="3" />
<CheckBox IsChecked="{Binding CargoShipsEnabled}" Content="Enable Cargo Ships" Margin="3" />
</StackPanel>
</Expander>
<Expander Header="Environment">
<StackPanel Margin="10,0,0,0">
<StackPanel Orientation="Horizontal" ToolTip="Increases physics precision at the cost of performance.">
<TextBox Text="{Binding PhysicsIterations}" Margin="3" Width="70" />
<Label Content="Physics Iterations" />
</StackPanel>
<StackPanel Orientation="Horizontal">
<TextBox Text="{Binding MaxFloatingObjects}" Margin="3" Width="70" />
<Label Content="Max Floating Objects" />
</StackPanel>
<CheckBox IsChecked="{Binding RealisticSound}" Content="Enable Realistic Sound"
Margin="3" />
<CheckBox IsChecked="{Binding EnableOxygenPressurization}" Content="Enable Airtightness" Margin="3" />
<CheckBox IsChecked="{Binding EnableOxygen}" Content="Enable Oxygen" Margin="3" />
<CheckBox IsChecked="{Binding DestructibleBlocks}"
Content="Enable Destructible Blocks" Margin="3" />
<CheckBox IsChecked="{Binding EnableToolShake}" Content="Enable Tool Shake" Margin="3" />
<CheckBox IsChecked="{Binding EnableVoxelDestruction}" Content="Enable Voxel Destruction"
Margin="3" />
<CheckBox IsChecked="{Binding EnableSunRotation}" Content="Enable Sun Rotation" Margin="3" />
<StackPanel Orientation="Horizontal">
<TextBox Text="{Binding SunRotationIntervalMinutes}" Margin="3" Width="70" />
<Label Content="Sun Rotation Interval (mins)" />
</StackPanel>
<CheckBox IsChecked="{Binding EnableFlora}" Content="Enable Flora" Margin="3" />
<StackPanel Orientation="Horizontal">
<TextBox Text="{Binding FloraDensity}" Margin="3" Width="70" />
<Label Content="Flora Density" />
</StackPanel>
<StackPanel Orientation="Horizontal">
<TextBox Text="{Binding FloraDensityMultiplier}" Margin="3" Width="70" />
<Label Content="Flora Density Multiplier" />
</StackPanel>
<StackPanel Orientation="Horizontal">
<TextBox Text="{Binding ViewDistance}" Margin="3" Width="70" />
<Label Content="View Distance (meters)" />
</StackPanel>
<StackPanel Orientation="Horizontal">
<TextBox Text="{Binding WorldSizeKm}" Margin="3" Width="70" />
<Label Content="World Size (km)" />
</StackPanel>
<StackPanel Orientation="Horizontal">
<ComboBox SelectedItem="{Binding EnvironmentHostility}"
ItemsSource="{Binding EnvironmentHostilityValues}" Margin="3" Width="100"
DockPanel.Dock="Left" />
<Label Content="Environment Hostility" />
</StackPanel>
<StackPanel Orientation="Horizontal">
<TextBox Text="{Binding ProceduralDensity}" Margin="3" Width="70" />
<Label Content="Procedural Density" />
</StackPanel>
<StackPanel Orientation="Horizontal">
<TextBox Text="{Binding ProceduralSeed}" Margin="3" Width="70" />
<Label Content="Procedural Seed" />
</StackPanel>
</StackPanel>
</Expander>
<Expander Header="Players">
<StackPanel Margin="10,0,0,0">
<StackPanel Orientation="Horizontal">
<TextBox Text="{Binding MaxPlayers}" Margin="3" Width="70" />
<Label Content="Max Players" />
</StackPanel>
<CheckBox IsChecked="{Binding Enable3rdPersonView}" Content="Enable 3rd Person Camera"
Margin="3" />
<CheckBox IsChecked="{Binding EnableJetpack}" Content="Enable Jetpack" Margin="3" />
<CheckBox IsChecked="{Binding AutoHealing}" Content="Auto Healing" Margin="3" />
<CheckBox IsChecked="{Binding EnableCopyPaste}" Content="Enable Copy/Paste" Margin="3" />
<CheckBox IsChecked="{Binding ShowPlayerNamesOnHud}" Content="Show Player Names on HUD"
Margin="3" />
<StackPanel Orientation="Horizontal">
<TextBox Text="{Binding SpawnShipTimeMultiplier}" Margin="3" Width="70" />
<Label Content="Respawn Time Multiplier" />
</StackPanel>
<CheckBox IsChecked="{Binding ResetOwnership}" Content="Reset Ownership" Margin="3" />
<CheckBox IsChecked="{Binding SpawnWithTools}" Content="Spawn With Tools" Margin="3" />
</StackPanel>
</Expander>
<Expander Header="Miscellaneous">
<StackPanel Margin="10,0,0,0">
<StackPanel Orientation="Horizontal">
<TextBox Text="{Binding AutoSaveInMinutes}" Margin="3" Width="70" />
<Label Content="Autosave Interval (minutes)" />
</StackPanel>
<CheckBox IsChecked="{Binding EnableConvertToStation}" Content="Enable Convert to Station"
Margin="3" />
<CheckBox IsChecked="{Binding EnableRemoteBlockRemoval}"
Content="Enable Remote Ownership Removal" Margin="3" />
<CheckBox IsChecked="{Binding EnableRespawnShips}" Content="Enable Respawn Ships"
Margin="3" />
<CheckBox IsChecked="{Binding EnableScripterRole}" Content="Enable Scripter Role"
Margin="3" />
<CheckBox IsChecked="{Binding EnableSpectator}" Content="Enable Spectator Camera"
Margin="3" />
<CheckBox IsChecked="{Binding RespawnShipDelete}" Content="Remove Respawn Ships on Logoff"
Margin="3" />
<CheckBox IsChecked="{Binding ThrusterDamage}" Content="Enable Thruster Damage"
Margin="3" />
<CheckBox IsChecked="{Binding WeaponsEnabled}" Content="Enable Weapons" Margin="3" />
<CheckBox IsChecked="{Binding EnableIngameScripts}" Content="Enable Ingame Scripts"
Margin="3" />
<StackPanel Orientation="Horizontal">
<ComboBox SelectedItem="{Binding GameMode}" ItemsSource="{Binding GameModeValues}"
Margin="3" Width="100" DockPanel.Dock="Left" />
<Label Content="Game Mode" />
</StackPanel>
<StackPanel Orientation="Horizontal">
<TextBox Text="{Binding MaxBackupSaves}" Margin="3" Width="70" />
<Label Content="Max Backup Saves" />
</StackPanel>
</StackPanel>
</Expander>
</StackPanel>
</UserControl>

View File

@@ -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
{
/// <summary>
/// Interaction logic for SessionSettingsView.xaml
/// </summary>
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));
}
}
}

View File

@@ -49,9 +49,6 @@
<ColumnDefinition Width="Auto"/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Label Grid.Column="0" Content="Instance Path: " Margin="3" />
<TextBox Grid.Column="1" x:Name="InstancePathBox" Margin="3" Height="20"
LostKeyboardFocus="InstancePathBox_OnLostKeyboardFocus" />
</Grid>
<views:ConfigControl Grid.Row="1" x:Name="ConfigControl" Margin="3" DockPanel.Dock="Bottom" IsEnabled="{Binding IsRunning, Converter={StaticResource InverseBool}}"/>
</Grid>

View File

@@ -59,7 +59,7 @@ namespace Torch.Server
_config = config;
Dispatcher.Invoke(() =>
{
InstancePathBox.Text = config.InstancePath;
//InstancePathBox.Text = config.InstancePath;
});
}

View File

@@ -0,0 +1,38 @@
<Window x:Class="Torch.Server.WorldGeneratorDialog"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:Torch.Server"
xmlns:views="clr-namespace:Torch.Server.Views"
mc:Ignorable="d"
Title="WorldGeneratorDialog" Height="300" Width="700">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="250"/>
<ColumnDefinition Width="440"/>
</Grid.ColumnDefinitions>
<ListView Grid.Column="0" x:Name="PremadeCheckpoints" ScrollViewer.CanContentScroll="False" HorizontalContentAlignment="Center" Margin="3">
<ListView.ItemTemplate>
<DataTemplate DataType="local:PremadeCheckpointItem">
<StackPanel HorizontalAlignment="Center">
<Label Content="{Binding Name}" HorizontalAlignment="Center"/>
<Image Stretch="Uniform" MaxHeight="100" HorizontalAlignment="Center">
<Image.Source>
<BitmapImage UriSource="{Binding Icon}"/>
</Image.Source>
</Image>
</StackPanel>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
<StackPanel Grid.Column="1" Margin="3">
<StackPanel Orientation="Horizontal">
<Label Content="World Name: "/>
<TextBox x:Name="WorldName" Width="300" Margin="3"/>
</StackPanel>
<views:SessionSettingsView/>
<Button Content="Create World" Click="ButtonBase_OnClick"/>
</StackPanel>
</Grid>
</Window>

View File

@@ -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
{
/// <summary>
/// Interaction logic for WorldGeneratorDialog.xaml
/// </summary>
public partial class WorldGeneratorDialog : Window
{
private InstanceManager _instanceManager;
private List<PremadeCheckpointItem> _checkpoints = new List<PremadeCheckpointItem>();
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; }
}
}

View File

@@ -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

View File

@@ -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)

View File

@@ -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}";

View File

@@ -50,7 +50,7 @@ namespace Torch
protected virtual void SetValue<T>(ref T backingField, T value, [CallerMemberName] string propName = "")
{
if (backingField.Equals(value))
if (backingField != null && backingField.Equals(value))
return;
backingField = value;