Ejemplo n.º 1
0
 public override void OnLoad(Harmony harmony)
 {
     base.OnLoad(harmony);
     PUtil.InitLibrary();
     new POptions().RegisterOptions(this, typeof(Settings));
     Settings.Init(POptions.ReadSettings <Settings>());
 }
Ejemplo n.º 2
0
            /// <summary>
            /// Applied after the constructor runs.
            /// </summary>
            internal static void Postfix(MutatedWorldData __instance)
            {
                var world     = __instance.world;
                var subworlds = __instance.subworlds;

                if (world.name == WORLD_NAME)
                {
                    var options = POptions.ReadSettings <Challenge100KOptions>();
                    if (options != null && options.RemoveGeysers)
                    {
#if DEBUG
                        PUtil.LogDebug("Hard mode: removing geysers");
#endif
                        world.worldTemplateRules?.Clear();
                        // Remove the POI geysers too
                        if (subworlds != null)
                        {
                            foreach (var subworld in subworlds)
                            {
                                subworld.Value.subworldTemplateRules?.Clear();
                            }
                        }
                    }
                }
            }
Ejemplo n.º 3
0
 public override void OnLoad(Harmony harmony)
 {
     base.OnLoad(harmony);
     PUtil.InitLibrary();
     Options = POptions.ReadSettings <Options>() ?? new Options();
     new POptions().RegisterOptions(this, typeof(Options));
 }
Ejemplo n.º 4
0
            public static void Postfix(PlayerController __instance)
            {
                List <InterfaceTool> interfaceTools = new List <InterfaceTool>(__instance.tools);

                GameObject createBlueprintTool = new GameObject(BlueprintsAssets.BLUEPRINTS_CREATE_TOOLNAME, typeof(CreateBlueprintTool));

                createBlueprintTool.transform.SetParent(__instance.gameObject.transform);
                createBlueprintTool.gameObject.SetActive(true);
                createBlueprintTool.gameObject.SetActive(false);

                interfaceTools.Add(createBlueprintTool.GetComponent <InterfaceTool>());

                GameObject useBlueprintTool = new GameObject(BlueprintsAssets.BLUEPRINTS_USE_TOOLNAME, typeof(UseBlueprintTool));

                useBlueprintTool.transform.SetParent(__instance.gameObject.transform);
                useBlueprintTool.gameObject.SetActive(true);
                useBlueprintTool.gameObject.SetActive(false);

                interfaceTools.Add(useBlueprintTool.GetComponent <InterfaceTool>());

                GameObject snapshotTool = new GameObject(BlueprintsAssets.BLUEPRINTS_SNAPSHOT_TOOLNAME, typeof(SnapshotTool));

                snapshotTool.transform.SetParent(__instance.gameObject.transform);
                snapshotTool.gameObject.SetActive(true);
                snapshotTool.gameObject.SetActive(false);

                interfaceTools.Add(snapshotTool.GetComponent <InterfaceTool>());

                __instance.tools = interfaceTools.ToArray();

                BlueprintsAssets.Options = POptions.ReadSettings <BlueprintsOptions>() ?? new BlueprintsOptions();
                CreateBlueprintTool.Instance.OverlaySynced = BlueprintsAssets.Options.CreateBlueprintToolSync;
                SnapshotTool.Instance.OverlaySynced        = BlueprintsAssets.Options.SnapshotToolSync;
            }
Ejemplo n.º 5
0
        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>
 /// Applied before OnPrefabInit runs.
 /// </summary>
 internal static void Prefix()
 {
     options = POptions.ReadSettings <DeselectMaterialsOptions>() ??
               new DeselectMaterialsOptions();
     PUtil.LogDebug("DeselectNewMaterials settings: Ignore Food = {0}".F(options.
                                                                         IgnoreFoodBoxes));
 }
Ejemplo n.º 7
0
        public override void OnLoad(Harmony harmony)
        {
            base.OnLoad(harmony);
            new POptions().RegisterOptions(this, typeof(Always3InterestsSettings));


            // Init PLib and settings
            PUtil.InitLibrary();

            Settings = POptions.ReadSettings <Always3InterestsSettings>();
            if (Settings == null)
            {
                Settings = new Always3InterestsSettings();
            }

            int[] customAttributes = new int[] {
                Settings.pointsWhen1Interest,
                Settings.pointsWhen2Interest,
                Settings.pointsWhen3Interest,
                Settings.pointsWhenMoreThan3Interest,
                Settings.pointsWhenMoreThan3Interest,
                Settings.pointsWhenMoreThan3Interest,
                Settings.pointsWhenMoreThan3Interest,
                Settings.pointsWhenMoreThan3Interest,
                Settings.pointsWhenMoreThan3Interest,
                Settings.pointsWhenMoreThan3Interest,
                Settings.pointsWhenMoreThan3Interest
            };

            Traverse.Create <DUPLICANTSTATS>().Field <int[]>("APTITUDE_ATTRIBUTE_BONUSES").Value = customAttributes;
        }
Ejemplo n.º 8
0
 /// <summary>
 /// Applied after OnPrefabInit runs.
 /// </summary>
 /// <param name="__instance">The current instance.</param>
 internal static void Postfix(PlayerController __instance)
 {
     Options = POptions.ReadSettings <SweepByTypeOptions>();
     PToolMode.RegisterTool <FilteredClearTool>(__instance);
     PUtil.LogDebug("Created FilteredClearTool with icons " + ((Options?.
                                                                DisableIcons == true) ? "disabled" : "enabled"));
 }
Ejemplo n.º 9
0
 public static void OnLoad()
 {
     PUtil.InitLibrary();
     PLocalization.Register();
     VLib.Register();
     POptions.RegisterOptions(typeof(Settings));
     Settings.Init(POptions.ReadSettings <Settings>());
 }
Ejemplo n.º 10
0
 internal static void OnStartGame()
 {
     options = POptions.ReadSettings <EfficientFetchOptions>() ??
               new EfficientFetchOptions();
     PUtil.LogDebug("EfficientFetch starting: Min Ratio={0:D}%".F(options.
                                                                  MinimumAmountPercent));
     EfficientFetchManager.CreateInstance(options.GetMinimumRatio());
 }
Ejemplo n.º 11
0
 public static void ReadSettings()
 {
     // read the option each time the game is loaded - so we don't need to restart all the game
     Settings = POptions.ReadSettings <SpeedOptions>();
     if (Settings == null)
     {
         Settings = new SpeedOptions();
     }
 }
Ejemplo n.º 12
0
        internal static void OnStartGame()
        {
            Options = AIImprovementsOptionsInstance.Create(POptions.ReadSettings <
                                                               AIImprovementsOptions>() ?? new AIImprovementsOptions());
#if DEBUG
            PUtil.LogDebug("Creating AllMinionsLocationHistory");
#endif
            AllMinionsLocationHistory.InitInstance();
        }
			/// <summary>
			/// Applied after LoadBuildings runs.
			/// </summary>
			internal static void Postfix() {
				// Settings need to be read at this time
				Options = POptions.ReadSettings<DecorReimaginedOptions>() ??
					new DecorReimaginedOptions();
				PUtil.LogDebug("DecorReimaginedOptions settings: Hard Mode = {0}".F(Options.
					HardMode));
				PUtil.LogDebug("Loading decor database");
				DecorTuning.ApplyDatabase(Options);
			}
Ejemplo n.º 14
0
        public static void ReloadOptions()
        {
            var newOptions = POptions.ReadSettings <ToastControlOptions>();

            if (newOptions != null)
            {
                PUtil.LogDebug("Reloaded options for Popup Control");
                Options = newOptions;
            }
        }
Ejemplo n.º 15
0
        /// <summary>
        /// Register Options on mod load
        /// </summary>
        public override void OnLoad(Harmony harmony)
        {
            harmony.PatchAll();

            // Registering for the config screen
            new POptions().RegisterOptions(this, typeof(DefaultOffSwitchSettings));

            // Read Settings
            Options = POptions.ReadSettings <DefaultOffSwitchSettings>() ?? new DefaultOffSwitchSettings();
        }
Ejemplo n.º 16
0
        public static void ReadSettings()
        {
            Debug.Log("Loading settings");

            Settings = POptions.ReadSettings <Always3InterestsSettings>();
            if (Settings == null)
            {
                Settings = new Always3InterestsSettings();
            }
        }
Ejemplo n.º 17
0
        public override void OnLoad(Harmony harmony)
        {
            harmony.PatchAll();

            // Registering for the config screen
            new POptions().RegisterOptions(this, typeof(FixedOreScrubberModSettings));

            // Read Settings
            Options = POptions.ReadSettings <FixedOreScrubberModSettings>() ?? new FixedOreScrubberModSettings();
        }
Ejemplo n.º 18
0
        /// <summary>
        /// Loads the settings for this mod.
        /// </summary>
        internal static void LoadSettings()
        {
            var s = POptions.ReadSettings <ModUpdateInfo>();

            if (s == null || string.IsNullOrEmpty(s.VersionSavedOn))
            {
                s = new ModUpdateInfo();
            }
            s.VersionSavedOn = ModVersion.FILE_VERSION;
            Settings         = s;
        }
Ejemplo n.º 19
0
        public static AdvancedStartConfig GetConfig()
        {
            var options = POptions.ReadSettings <AdvancedStartOptions>();

            if (options == null)
            {
                return(new AdvancedStartOptions().GetProfile());
            }

            return(options.GetProfile());
        }
Ejemplo n.º 20
0
        internal static void LoadSettings()
        {
            var newOptions = POptions.ReadSettings <DeselectMaterialsOptions>();

            if (newOptions != null)
            {
                Options = newOptions;
            }
            PUtil.LogDebug("DeselectNewMaterials settings: Ignore Food = {0}".F(Options.
                                                                                IgnoreFoodBoxes));
        }
Ejemplo n.º 21
0
            /// <summary>
            /// Applied after OnSpawn runs.
            /// </summary>
            internal static void Postfix(Game __instance)
            {
                // Reload options
                var newOptions = POptions.ReadSettings <MoreAchievementsOptions>();

                if (newOptions != null)
                {
                    Options = newOptions;
                }
                __instance.gameObject.AddOrGet <AchievementStateComponent>();
            }
Ejemplo n.º 22
0
            /// <summary>
            /// Applied after OnPrefabInit runs.
            /// </summary>
            /// <param name="__instance">The current game.</param>
            internal static void Postfix(Game __instance)
            {
                __instance.gameObject.AddOrGet <ClaustrophobiaChecker>();
                var newOptions = POptions.ReadSettings <ClaustrophobiaOptions>();

                if (newOptions != null)
                {
                    Options = newOptions;
                }
                PUtil.LogDebug("Claustrophobia Options: Strict Mode = {0}, Threshold = {1:D}".
                               F(Options.StrictConfined, Options.StuckThreshold));
            }
Ejemplo n.º 23
0
        internal static void OnStartGame()
        {
            var colorOptions = POptions.ReadSettings <OldPipeColorOptions>() ??
                               new OldPipeColorOptions();
            // 0 is the default
            var options = GlobalAssets.Instance.colorSetOptions[0];

            options.conduitInsulated = colorOptions.InsulatedColor;
            options.conduitNormal    = colorOptions.NormalColor;
            options.conduitRadiant   = colorOptions.RadiantColor;
            options.RefreshLookup();
        }
Ejemplo n.º 24
0
        public static void Postfix(ref BuildingCellVisualizerResources __instance)
        {
            SwapFlowColourAssets.Options = POptions.ReadSettings <SwapFlowColourOptions>() ?? new SwapFlowColourOptions();

            if (SwapFlowColourAssets.Options.RedBlue)
            {
                RedBlue(__instance);
            }
            else
            {
                SwapFlowColour(__instance);
            }
        }
Ejemplo n.º 25
0
            public static void Prefix()
            {
                var newOptions = POptions.ReadSettings <FluidShippingOptions>();

                if (newOptions != null)
                {
                    Options = newOptions;
                }

                BottleInserterConfig.Setup();
                CanisterInserterConfig.Setup();
                BottleFillerConfig.Setup();
            }
Ejemplo n.º 26
0
        public static void OnLoad(string modPath)
        {
            OnLoadPatch.modPath = modPath;

            // Init PLib and settings
            PUtil.InitLibrary();
            POptions.RegisterOptions(typeof(EmptyWorldsOptions));

            Settings = POptions.ReadSettings <EmptyWorldsOptions>();
            if (Settings == null)
            {
                Settings = new EmptyWorldsOptions();
            }
        }
Ejemplo n.º 27
0
        public override void OnLoad(Harmony harmony)
        {
            base.OnLoad(harmony);
            new POptions().RegisterOptions(this, typeof(EmptyWorldsOptions));

            // Init PLib and settings
            PUtil.InitLibrary();

            Settings = POptions.ReadSettings <EmptyWorldsOptions>();
            if (Settings == null)
            {
                Settings = new EmptyWorldsOptions();
            }
            new PLocalization().Register();
        }
Ejemplo n.º 28
0
        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);
        }
Ejemplo n.º 29
0
 public ClaustrophobiaChecker()
 {
     checkNextFrame = new List <GameObject>(8);
     minionCache    = new List <GameObject>(64);
     minionPacer    = 0;
     // PooledDictionary is useless since this dictionary is created once per load
     statusCache = new Dictionary <GameObject, EntrapmentStatus>(64);
     // Read config
     options = POptions.ReadSettings <ClaustrophobiaOptions>();
     if (options == null)
     {
         options = new ClaustrophobiaOptions();
     }
     PUtil.LogDebug("Claustrophobia Options: Strict Mode = {0}".F(options.
                                                                  StrictConfined));
 }
Ejemplo n.º 30
0
        internal static void SetupTooltips()
        {
            var options = POptions.ReadSettings <ThermalTooltipsOptions>() ??
                          new ThermalTooltipsOptions();

            // Check for DisplayAllTemps
            if (PPatchTools.GetTypeSafe("DisplayAllTemps.State", "DisplayAllTemps") !=
                null)
            {
                // Let Display All Temps take over display (ironically setting AllUnits
                // to FALSE) since it patches GetFormattedTemperature
                PUtil.LogDebug("DisplayAllTemps compatibility activated");
                options.AllUnits = false;
            }
            TooltipInstance = new ExtendedThermalTooltip(options, bicCompat);
            PUtil.LogDebug("Created ExtendedThermalTooltip");
        }