public override bool IsSerialized() { if (MyAPIGateway.Multiplayer.IsServer) { if (Modulator.Storage != null) { ModState.SaveState(); ModSet.SaveSettings(); } } return(false); }
private void UpdateStates() { if (_tock60 || _firstRun) { if (Modulator.CustomData != ModulatorComp.ModulationPassword) { ModulatorComp.ModulationPassword = Modulator.CustomData; ModSet.SaveSettings(); if (Session.Enforced.Debug == 3) { Log.Line("Updating modulator password"); } } } }
private void StorageSetup() { if (ModSet == null) { ModSet = new ModulatorSettings(Modulator); } if (ModState == null) { ModState = new ModulatorState(Modulator); } ModState.StorageInit(); ModSet.LoadSettings(); ModState.LoadState(); }
private void SaveAndSendAll() { _firstSync = true; if (!_isServer) { return; } ModSet.SaveSettings(); ModState.SaveState(); ModSet.NetworkUpdate(); ModState.NetworkUpdate(); if (Session.Enforced.Debug >= 3) { Log.Line($"SaveAndSendAll: ModualtorId [{Modulator.EntityId}]"); } }
private void Timing() { if (_tock60 && !_isDedicated && MyAPIGateway.Gui.GetCurrentScreen == MyTerminalPageEnum.ControlPanel && Session.Instance.LastTerminalId == Modulator.EntityId) { Modulator.RefreshCustomInfo(); MyCube.UpdateTerminal(); } if (_tock33) { if (SettingsUpdated) { SettingsUpdated = false; ModSet.SaveSettings(); ModState.SaveState(); if (Session.Enforced.Debug == 3) { Log.Line($"SettingsUpdated: server:{_isServer} - ModulatorId [{Modulator.EntityId}]"); } } } else if (_tock34) { if (ClientUiUpdate) { ClientUiUpdate = false; MyCube.UpdateTerminal(); Modulator.RefreshCustomInfo(); if (!_isServer) { ModSet.NetworkUpdate(); } } } if (_isDedicated || (_subDelayed && _tick > _subTick + 9)) { if (Session.Enforced.Debug == 3) { Log.Line($"Delayed tick: {_tick} - hierarchytick: {_subTick}"); } _subDelayed = false; HierarchyChanged(); } }
private void Timing() { if (_tock60 && !_isDedicated) { TerminalRefresh(); } if (_tock33) { if (SettingsUpdated) { SettingsUpdated = false; ModSet.SaveSettings(); ModState.SaveState(); if (Session.Enforced.Debug == 3) { Log.Line($"SettingsUpdated: server:{_isServer} - ModulatorId [{Modulator.EntityId}]"); } } } else if (_tock34) { if (ClientUiUpdate) { ClientUiUpdate = false; MyCube.UpdateTerminal(); Modulator.RefreshCustomInfo(); if (!_isServer) { ModSet.NetworkUpdate(); } } } if (_isDedicated || (_subDelayed && _tick > _subTick + 9)) { if (Session.Enforced.Debug == 3) { Log.Line($"Delayed tick: {_tick} - hierarchytick: {_subTick}"); } _subDelayed = false; HierarchyChanged(); } }
private void UpdateStates() { if (ShieldComp?.GetSubGrids != null && !ShieldComp.GetSubGrids.Equals(ModulatorComp.GetSubGrids)) { ModulatorComp.GetSubGrids = ShieldComp.GetSubGrids; } if (_tock60 || _firstRun) { if (Modulator.CustomData != ModulatorComp.ModulationPassword) { ModulatorComp.ModulationPassword = Modulator.CustomData; ModSet.SaveSettings(); if (Session.Enforced.Debug == 3) { Log.Line("Updating modulator password"); } } } }
private void StorageSetup() { if (ModSet == null) { ModSet = new ModulatorSettings(Modulator); } if (ModState == null) { ModState = new ModulatorState(Modulator); } ModState.StorageInit(); ModSet.LoadSettings(); ModState.LoadState(); if (MyAPIGateway.Multiplayer.IsServer) { ModState.State.Backup = false; ModState.State.Online = false; ModState.State.Link = false; } }
/// <summary> /// Allows a user to load a new mod set. /// </summary> public async void LoadModSet() { var dialog = new VistaOpenFileDialog { Title = _xamlLoadModSetTitle.Get(), Filter = Constants.WpfJsonFormat, AddExtension = true, DefaultExt = ".json" }; if ((bool)dialog.ShowDialog()) { ModSet.FromFile(dialog.FileName).ToApplicationConfig(ApplicationTuple.Config); ApplicationTuple.SaveAsync(); // Check for mod updates/dependencies. if (Update.CheckMissingDependencies(out var missingDependencies)) { try { await Update.DownloadNuGetPackagesAsync(missingDependencies, false, false); } catch (Exception) { } } CheckModCompatibility(); OnLoadModSet(); } }
/// <summary> /// Allows a user to load a new mod set. /// </summary> public async void LoadModSet() { var dialog = new VistaOpenFileDialog { Title = Resources.LoadModSetDialogTitle.Get(), Filter = Constants.DialogJsonFilter, AddExtension = true, DefaultExt = ".json" }; if ((bool)dialog.ShowDialog() !) { ModSet.FromFile(dialog.FileName).ToApplicationConfig(ApplicationTuple.Config); await ApplicationTuple.SaveAsync(); // Check for mod updates/dependencies. var deps = Update.CheckMissingDependencies(); if (!deps.AllAvailable) { try { await Update.ResolveMissingPackagesAsync(); } catch (Exception) { /* ignored */ } } EnforceModCompatibility(); OnLoadModSet(); } }