protected override void OnSyncChanged(bool synced) { base.OnSyncChanged(synced); AdvancedFiltrationAssets.Options.DeconstructToolSync = synced; POptions.WriteSettings(AdvancedFiltrationAssets.Options); }
public override void ConfigureBuildingTemplate(GameObject go, Tag prefab_tag) { SoundEventVolumeCache.instance.AddVolume("storagelocker_kanim", "StorageLocker_Hit_metallic_low", NOISE_POLLUTION.NOISY.TIER1); Prioritizable.AddRef(go); var storage = go.AddOrGet <Storage>(); storage.showInUI = true; storage.allowItemRemoval = true; storage.showDescriptor = true; storage.storageFilters = STORAGEFILTERS.NOT_EDIBLE_SOLIDS; storage.storageFullMargin = STORAGE.STORAGE_LOCKER_FILLED_MARGIN; storage.fetchCategory = Storage.FetchCategory.GeneralStorage; storage.allowSublimation = false; go.AddOrGet <CopyBuildingSettings>().copyGroupTag = GameTags.StorageLocker; go.AddOrGet <StorageLocker>(); var config = POptions.ReadSettings <StoragePodOptions>(); if (config == null) { POptions.WriteSettings(new StoragePodOptions()); config = new StoragePodOptions(); } go.GetComponent <Storage>().capacityKg = config.podCapacity; }
/// <summary> /// Scrubs the config of mods that Steam got around to actually updating. /// </summary> private static void DoScrubConfig() { var settings = ModUpdateInfo.Settings; var existing = settings?.ModUpdates; var manager = Global.Instance.modManager; if (existing != null && manager != null) { // Anything that is up to date gets purged var remove = HashSetPool <ModUpdateData, ModUpdateHandler> .Allocate(); foreach (var info in existing) { ulong id = info.ID; if (CheckMod(manager, id)) { remove.Add(info); } if (info.Status == ModUpdateStatus.PendingUpdate) { // Purge the temporary zip ExtensionMethods.RemoveOldDownload(ModUpdateHandler.GetDownloadPath( id)); info.Status = ModUpdateStatus.UpdatedByThisMod; } } // Remove the obsolete entries foreach (var info in remove) { existing.Remove(info); } remove.Recycle(); POptions.WriteSettings(settings); } }
protected override void OnSyncChanged(bool synced) { base.OnSyncChanged(synced); BlueprintsAssets.Options.SnapshotToolSync = synced; POptions.WriteSettings(BlueprintsAssets.Options); }
/// <summary> /// Disables the check for "is Debug Not Included the first mod?". /// </summary> private static void DisableFirstModCheck() { var instance = DebugNotIncludedOptions.Instance; instance.SkipFirstModCheck = true; POptions.WriteSettings(instance); }
public override void OnLoad(Harmony harmony) { PUtil.InitLibrary(); Options = new POptions(); Settings = POptions.ReadSettings <ModSettings>(); if (Settings == null) { Settings = new ModSettings(); POptions.WriteSettings(Settings); } Options.RegisterOptions(this, typeof(ModSettings)); base.OnLoad(harmony); }
public override void OnLoad(Harmony harmony) { #if DEBUG Harmony.DEBUG = true; #endif base.OnLoad(harmony); new POptions().RegisterOptions(this, typeof(ModConfig)); PUtil.InitLibrary(false); ModConfig f_config = POptions.ReadSettings <ModConfig>(); if (f_config == null) { POptions.WriteSettings(config); } else { config = f_config; } mod_loc = mod.relative_root; }
/// <summary> /// Updates the settings for the specified mod ID. /// </summary> /// <param name="id">The Steam mod ID to update.</param> /// <param name="lastUpdated">The new last updated date.</param> internal static void UpdateConfigFor(ulong id, System.DateTime lastUpdated) { lock (DETAILS) { var settings = ModUpdateInfo.Settings; if (settings.ModUpdates == null) { settings = new ModUpdateInfo(); } var info = ModUpdateInfo.FindModInConfig(id); // Now tracked by this mod if (info == null) { info = new ModUpdateData(id, lastUpdated); settings.ModUpdates.Add(info); } else { info.LastUpdated = lastUpdated.Ticks; } info.Status = ModUpdateStatus.PendingUpdate; POptions.WriteSettings(settings); } }