public static void OnConfigReload()
        {
            configEnableMod                   = Config.Bind <bool>("Config", "Enable", true, "Enable/disable drone clearing mod.");
            configCollectResourcesFlag        = Config.Bind <bool>("Config", "CollectResources", configCollectResourcesFlag, "Take time to collect resources. If false, clearing will be quicker, but no resources will be collected.").Value;
            configMaxClearingDroneCount       = Config.Bind <uint>("Config", "DroneCountLimit", configMaxClearingDroneCount, "Limit the number of drones that will be used when clearing.").Value;
            configLimitClearingDistance       = Config.Bind <float>("Config", "ClearingDistance", configLimitClearingDistance, "Fraction of mecha build distance to perform clearing.  Min 0.0, Max 1.0").Value;
            configLimitClearingDistance       = Math.Min(configLimitClearingDistance, 1.0f);
            configLimitClearingDistance       = Math.Max(configLimitClearingDistance, 0.0f);
            configEnableClearingWhileDrifting = Config.Bind <bool>("Config", "ClearWhileDrifting", configEnableClearingWhileDrifting, "This flag can be used to enable/disable clearing while drifing over oceans.").Value;
            configEnableClearingWhileFlying   = Config.Bind <bool>("Config", "ClearWhileFlying", configEnableClearingWhileFlying, "This flag can be used to enable/disable clearing while flying.").Value;
            configEnableRecallWhileFlying     = Config.Bind <bool>("Config", "RecallWhileFlying", configEnableRecallWhileFlying, "Enable this feature if you want drones assigned to clearing to be recalled when Icarus is flying. (This setting is only used if configEnableClearingWhileFlying is false.)").Value;
            configReservedInventorySpace      = Config.Bind <uint>("Config", "InventorySpace", configReservedInventorySpace, "Initiate clearing when there are this number of inventory spaces empty.  (Setting has no impact if CollectResources is false.)").Value;
            configReservedPower               = Config.Bind <float>("Config", "PowerReserve", configReservedPower, "Initiate clearing only when there is at least this fraction of Icarus's power remaining.").Value;
            configSpeedScaleFactor            = Config.Bind <float>("Config", "SpeedScale", configSpeedScaleFactor, "Is this mod so great that it feels too much like cheating?  Slow the drones down with this setting.  They normally operate at the same speed as Icarus.  Too slow?  You can cheat too by setting a value greater than 1.").Value;
            configSpeedScaleFactor            = Math.Max(configSpeedScaleFactor, 0.0f);
            configEnableInstantClearing       = Config.Bind <bool>("Config", "DSPCheats_InstantClearing", configEnableInstantClearing, "If the DSP Cheats mod is installed, and Instant-Build is enabled, should this mod work with that one and instantly clear?").Value;
            configEnableDebug                 = Config.Bind <bool>("Config", "EnableDebug", configEnableDebug, "Enabling debug will add more feedback to the BepInEx console.  This includes the reasons why drones are not clearing.").Value;

            configEnableClearingItemTree   = Config.Bind <bool>("Items", "IncludeTrees", configEnableClearingItemTree, "Enabling clearing of trees.").Value;
            configEnableClearingItemStone  = Config.Bind <bool>("Items", "IncludeStone", configEnableClearingItemStone, "Enabling clearing of stones which can block the mecha's movement.  (This includes the space capsule at the start of a new game.)").Value;
            configEnableClearingItemDetail = Config.Bind <bool>("Items", "IncludePebbles", configEnableClearingItemDetail, "Enabling clearing of tiny stones which won't block the mecha's movement.").Value;
            configEnableClearingItemIce    = Config.Bind <bool>("Items", "IncludeIce", configEnableClearingItemIce, "Enabling clearing of ice.").Value;

            configEnableClearingPlanetGeneric = Config.Bind <bool>("Planets", "IncludeGeneric", configEnableClearingPlanetGeneric, "Enable clearing on generic planets.").Value;
            configEnableClearingPlanetVocano  = Config.Bind <bool>("Planets", "IncludeVolcanic", configEnableClearingPlanetVocano, "Enable clearing on volcanic planets.").Value;
            configEnableClearingPlanetOcean   = Config.Bind <bool>("Planets", "IncludeOcean", configEnableClearingPlanetOcean, "Enable clearing on ocean planets.").Value;
            configEnableClearingPlanetDesert  = Config.Bind <bool>("Planets", "IncludeDesert", configEnableClearingPlanetDesert, "Enable clearing on desert planets.").Value;
            configEnableClearingPlanetIce     = Config.Bind <bool>("Planets", "IncludeIce", configEnableClearingPlanetIce, "Enable clearing on ice planets.").Value;

            Logger.LogInfo("Configuration loaded.");
        }
Ejemplo n.º 2
0
        public void Awake()
        {
            Logger = base.Logger;  // "C:\Program Files (x86)\Steam\steamapps\common\Dyson Sphere Program\BepInEx\LogOutput.log"
            configSortLoadScreen = Config.Bind <bool>("Config", "SortLoadScreen", true, "Sort load-game screen list.");
            configSortSaveScreen = Config.Bind <bool>("Config", "SortSaveScreen", true, "Sort save-game screen list.");

            harmony = new Harmony(pluginGuid);
            harmony.PatchAll(typeof(DSPSaveGameSorter));
        }
Ejemplo n.º 3
0
 public void Awake()
 {
     _rewarding = this.Config.Bind("settings", "rewarding", false);
     _punishing = this.Config.Bind("settings", "punishing", true);
     _controller = new Controller();
     _controller.enumerator = _controller.Read();
     StartCoroutine(_controller.enumerator);
     RoR2.GlobalEventManager.onClientDamageNotified += GlobalEventManager_onClientDamageNotified;
 }
Ejemplo n.º 4
0
        public void Awake()
        {
            antiGravitySetting = Config.Bind <float>(
                "NoNanoBombGravity",
                "antiGravityCoefficient",
                1,
                "Changes how much Nano Bomb resists gravity. Mod default is 1, vanilla default is 0.7"
                );

            On.RoR2.AntiGravityForce.FixedUpdate += (orig, self) =>
            {
                self.antiGravityCoefficient = antiGravitySetting.Value;
                orig(self);
            };
        }
Ejemplo n.º 5
0
 private static bool Humanoid_EquipItem(On.Humanoid.orig_EquipItem orig, Humanoid self, ItemDrop.ItemData item, bool triggerEquipEffects)
 {
     try
     {
         if (!self.IsPlayer() || item.m_equiped)
         {
             return(orig(self, item, triggerEquipEffects));
         }
         BepInEx.Configuration.ConfigEntry <int> conf = null;
         foreach (var i in Config.GeneralSettings.Keys)
         {
             if (itemLookup.ContainsKey(item.m_shared.m_name) && i.Key.Equals(itemLookup[item.m_shared.m_name].name))
             {
                 Config.GeneralSettings.TryGetEntry(i, out conf);
             }
         }
         if (conf != null)
         {
             if (Enum.TryParse <Skills.SkillType>(conf.Definition.Section, out Skills.SkillType type))
             {
                 var skill = self.GetSkills().m_skillData[type];
                 Main.log.LogDebug($"Found LevelGate of {conf.Value} for {itemLookup[item.m_shared.m_name].name} checked against player's {type} level: {skill.m_level}");
                 if (conf.Value > skill.m_level)
                 {
                     self.Message(MessageHud.MessageType.Center, $"Your {type} skill prevents you from equipping the {Localization.instance.Localize(item.m_shared.m_name)}. Min skill required: {conf.Value}");
                     return(true);
                 }
             }
         }
         return(orig(self, item, triggerEquipEffects));
     } catch (Exception ex)
     {
         Main.log.LogError(ex);
         return(orig(self, item, triggerEquipEffects));
     }
 }
Ejemplo n.º 6
0
        public void Awake()
        {
            Recycler = Config.Bind <bool>(
                "Normal",
                "Recycler",
                false,
                "True if Enigma can roll this item"
                );
            Lightning = Config.Bind <bool>(
                "Normal",
                "Royal Capacitor",
                true,
                "True if Enigma can roll this item"
                );
            FireBallDash = Config.Bind <bool>(
                "Normal",
                "Volcanic Egg",
                true,
                "True if Enigma can roll this item"
                );
            LunarPotion = Config.Bind <bool>(
                "Lunar",
                "Spinel Tonic",
                true,
                "True if Enigma can roll this item"
                );
            LunarMeteor = Config.Bind <bool>(
                "Lunar",
                "Glowing Meteorite",
                true,
                "True if Enigma can roll this item"
                );
            LunarHellfire = Config.Bind <bool>(
                "Lunar",
                "Helfire Tincture",
                true,
                "True if Enigma can roll this item"
                );
            Custom = Config.Bind <string>(
                "Custom",
                "Custom <Advanced>",
                "",
                "A comma separated list of item m_Name IDs, mod compatible"
                );

            List <string> exceptionList = new List <string>();

            if (!Recycler.Value)
            {
                exceptionList.Add("Recycle");
            }
            if (!Lightning.Value)
            {
                exceptionList.Add("Lightning");
            }
            if (!LunarPotion.Value)
            {
                //The item Tonic is the correct one, LunarPotion is not directly accessed at any point.
                exceptionList.Add("Tonic");
            }
            if (!LunarMeteor.Value)
            {
                exceptionList.Add("Meteor");
            }
            if (!LunarHellfire.Value)
            {
                exceptionList.Add("BurnNearby");
            }
            if (!FireBallDash.Value)
            {
                exceptionList.Add("FireBallDash");
            }
            if (Custom.Value != "")
            {
                exceptionList.AddRange(Custom.Value.Split(','));
                Debug.LogWarning("Custom exceptions enabled");
            }
            Debug.Log("Enigma Exceptions: " + string.Join(",", exceptionList));

            On.RoR2.EquipmentCatalog.RegisterEquipment += (orig, equipmentIndex, equipmentDef) =>
            {
                if (exceptionList.Any(str => str == equipmentDef.name))
                {
                    equipmentDef.enigmaCompatible = false;
                    Debug.LogWarning("Enigma Exception: " + equipmentDef.name);
                }
                ;
                orig(equipmentIndex, equipmentDef);
            };
        }