GithubHelp home page GithubHelp logo

ainavt / lethalconfig Goto Github PK

View Code? Open in Web Editor NEW
14.0 1.0 5.0 2.97 MB

A mod configuration menu for Lethal Company

Home Page: https://thunderstore.io/c/lethal-company/p/AinaVT/LethalConfig/

License: GNU General Public License v3.0

C# 51.59% ShaderLab 41.24% HLSL 7.17%
lethal-company modding

lethalconfig's Introduction

LethalConfig Icon

LethalConfig

LethalConfig is a mod configuration menu that allows players to edit their configs from within the game. It also provides a simple API for developers to customize their mod and config entries.

Inspired by Rune580's RiskOfOptions

Summary

Supported Types

Currently, LethalConfig allows developers to add the following types of interfaces for ConfigEntry's:

Component Value Type ConfigItem Type
Integer Slider int IntSliderConfigItem
Integer Input Field int IntInputFieldConfigItem
Float Slider float FloatSliderConfigItem
Float Step Slider float FloatStepSliderConfigItem
Float Input Field float FloatInputFieldConfigItem
Text Input Field string TextInputFieldConfigItem
Enum Dropdown Enum EnumDropDownConfigItem<>
Boolean Checkbox Enum BoolCheckBoxConfigItem
Generic Button - GenericButtonConfigItem

LethalConfig Menu Example
An example of the LethalConfig menu and its element types

Usage

Automatic generation

As of 1.1.0, LethalConfig automatically generates mod entries and detect all ConfigEntry's declared by said mods, and tries its best to generate the correct UI components.

It'll assign a default mod icon and will have a disclaimer in the mod's and config's descriptions about them being automatically generated and that they may require a restart, as there's no way for LethalConfig to tell if a setting will take effect immediately or not.

Unless you're a mod developer that wants to customize their mod icon and description, manually setup the UI components (e.g. use a slider instead of a number text field), or mark settings as non-restart required, you don't need to do anything else other than installing the mod.

Some types may not have a UI component developed for it yet. In these cases, LethalConfig will ignore the ConfigEntry. More types will be covered over time.

Setting up

To start using LethalConfig on your mod, add a reference on your project to the LethalConfig's dll file. You can get the dll by downloading the LethalConfig mod on Thunderstore.

To access the API, simply use the LethalConfig namespace or import it on your source file:

using LethalConfig;

It is also recommended to add a BepInDependency attribute to your plugin to hint BepInEx that your mod has a dependency to it:

[BepInPlugin(PluginInfo.Guid, PluginInfo.Name, PluginInfo.Version)]
[BepInDependency("ainavt.lc.lethalconfig")]
public class MyVeryCoolPlugin: BaseUnityPlugin {
    ...
}

Adding a ConfigItem

With everything setup, you should now have access to the main LethalConfigManager and are able to add any of the available components you want.

First, you create your ConfigEntry from BepInEx like you would normally:

var configEntry = Config.Bind("General", "Example", 0, "This is an example component!");

With your ConfigEntry in hand, you can now create and register a new item to the menu by using the following method:

var exampleSlider = new IntSliderConfigItem(configEntry, new IntSliderOptions 
{
    Min = 0,
    Max = 100
});
LethalConfigManager.AddConfigItem(exampleSlider);

And that's it, you now have created your first component! Slider example

LethalConfig automatically picks up some of your mod info, and it automatically creates sections based on the section of the provided ConfigEntry, so you do not have to worry about any extra setup in terms of layout.

ConfigItem restart requirement

By default, all items will be set to require a restart if changed. This will give a warning to the player once they apply the settings.

If you want your items to not be flagged as restart required, simply flag the constructor of the config items, either through the bool constructor overload or passing it inside the item's specific options:

// Using the slider options object
var exampleSlider = new IntSliderConfigItem(configEntry, new IntSliderOptions 
{
    RequiresRestart = false,
    Min = 0,
    Max = 100
});

// Using the bool constructor overload
var exampleSlider = new IntSliderConfigItem(configEntry, requiresRestart: false);

ConfigItem CanModifyCallback

By default all items can be modified at runtime without restriction. This may not be desirable for some mods as they might need to conditionally disallow modifications.

Mods can use the CanModifyCallback of the constructor of the config items.

var exampleCheckbox = new BoolCheckBoxConfigItem(configEntry, new BaseOptions
{
    CanModifyCallback = CheckboxCanModifyCallback
});

// This gets called everytime the config entry gets displayed in the UI.
private static CanModifyResult CheckboxCanModifyCallback()
{
    // Return true if the entry can be modified.
    // Return false if it should be modified.
    // When returning false You should also include a message for the reason
    // that the config entry cannot be modified.
    return (false, "Example reason");
    // you can also return only a bool, or CanModifyResult.True()/CanModifyResult.False(reason)
}

Disabling/Skipping Automatic Generation

You can skip automatic generation per ConfigEntry, Config section, or for your entire mod.

var configEntry = Config.Bind("General", "Example", 0, "This is an example component!");
var skippedConfigEntry = Config.Bind("Skip This Section", "Example 2", 0, "This is an example component!");

// skips automatic generation for the ConfigEntry.
LethalConfigManager.SkipAutoGenFor(configEntry);

// skips automatic generation for the Config section "Skip This Section".
LethalConfigManager.SkipAutoGenFor("Skip This Section");

// skips automatic generation for the calling mod.
LethalConfigManager.SkipAutoGen();

Listening to setting changes

Note that players will most likely expect settings to take effect immediately if not prompted to restart. If you need to listen to changes to values of your configuration, ConfigEntry provides a mechanism for that:

configEntry.SettingChanged += (obj, args) =>
{
    logSource.LogInfo($"Slider value changed to {configEntry.Value}");
};

Generic buttons

You can use a GenericButtonConfigItem if you want to create a button item to run code when its clicked. You can use it to open custom menus for your mod or run some logic through a callback.

This item is not tied to any ConfigEntry, so you're expected to pass the section, name, and description of the item.

LethalConfigManager.AddConfigItem(new GenericButtonConfigItem("Section", "ItemName", "Description", "ButtonText", () => 
{
    // Code you want to run when the button is clicked goes here.
}));

Overriding display properties of items

Sometimes you may want to show configs in a different category, with a different name, or different description, without changing the underlying ConfigEntry instance.

LethalConfig allows you to modify these properties visually so that it shows whatever name, section and description you want.

var boolCheckBox = Config.Bind("Example", "Bool Checkbox", false, "This is a bool checkbox.");
var configItem = new BoolCheckBoxConfigItem(boolCheckBox, new BoolCheckBoxOptions
{
    Section = "General",
    Name = "Enable something",
    Description = "Does something interesting"
});

In the above example, the item will be displayed under the "General" section, with the "Enable something" name, and mousing over the item will show the new description. These are all visual changes, and the underlying entry is unnafected, making it possible to adjust names without having BepInEx create an entire new config for you.

Customizing mod's icon and description

LethalConfig automatically attempts to load your mod's icon and description from your Thunderstore manifest, but also allows you to override them.

To override your mod's icon in its entry, simply call LethalConfigManager.SetModIcon passing an instance of UnityEngine.Sprite. A sprite can be loaded from an AssetBundle.

var aVeryCoolIconAsset = assetBundle.LoadAsset<Sprite>("path/to/asset.png")
LethalConfigManager.SetModIcon(aVeryCoolIconAsset);

To override your mod's description, simply call LethalConfigManager.SetModDescription passing a string.

LethalConfigManager.SetModDescription("Very cool mod description!");

Building LethalConfig

If you want to contribute and/or need to build LethalConfig yourself, just open the project and import Lethal Company using the included ThunderKit. To do so, follow these steps to setup your project:

  • Clone the repository and open the project with Unity 2022.3.9f1.
    • If Unity asks if you want to open in Safe Mode at any point, click to ignore.
  • On the ThunderKit window that opened, go to ThunderKit Settings, set your game path and executable to your Lethal Company folder and exe file.
    • If the ThunderKit window didn't automatically open, you can find it on Tools > ThunderKit > Settings.
  • ThunderKit will prompt you to restart the project a couple of times. After the restarts, the project should be setup!

With the project setup, simply select the Publish pipeline and the LethalConfigManifest at the top of the project, then click execute. After it's done, it should generate a zip file under the ThunderKit/Staging folder containing the mod.

Pipeline and Manifest

Pipeline and Manifest

Issues and Suggestions

If you have an issue with LethalConfig, or want to suggest a feature, feel free to open an issue at the GitHub repository.

Alternatively, you can also leave your suggestions and issues on the LethalConfig post under the Mod Releases forum in the Unofficial Lethal Company Discord Server.

lethalconfig's People

Contributors

ainavt avatar chrisfeline avatar ferusgrim avatar rune580 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

lethalconfig's Issues

[Tweak] My eyes blead!

Can you please for the love of god make the setting menu background black OR add an option to make it black.
I juts can't look at for too long or my eyes will start hurting.

Enum dropdown

Currently, we use the built-in TMP_Dropdown component for the enum dropdown. However, it's very limiting, and will not be able to support things like multi-select dropdowns (useful for enum marked as flags).

Probably will need to make a new dropdown component from scratch.

Expose BaseConfigItem#ChangeToDefault or implement own 'Reset All' button

I was in the process of creating a 'Reset All' config button:

        RegistryButtonEntry("Actions", "Reset All", "Reset all settings to default", () =>
        {
            foreach (var item in _configItems) item.ChangeToDefault();
        });

However, BaseConfigItem#ChangeToDefault is an internal method.

I would suggest exposing this, but then it also may make more sense to just implement your own version of a 'Reset All' button, but I am unaware of your plans, so. 😄

Easier way to remove restart requirement message

I want to remove the restart requirement from most of the entries in my own mod, but the only way I can see to do so is by creating each entry manually. The auto generated entries work perfectly fine, but then it prompts for a restart when the vast majority of my config options work dynamically. Is there some way that we can batch remove the restart requirement, or tell the config generator to generate the config with that requirement disabled by default? It's just a pain to add more config options and then also have to add it into LethalConfig, effectively having to configure it twice

Cannot see other plugins, only LethalConfigs own. And with an error.

Hey there! I am facing an issue with this plugin. It worked when I first tried it just fine, but when I installed couple of plugins more, and now it's not working. And I do not know how to troubleshoot this issue by myself. It is most likely a mod conflict. I decided to post this here anyway just in case. Here is the error that pops in instantly when the game gets in to the menu.

[Info   :   BepInEx] Loading [LethalConfig 1.3.4]
[Info   :ainavt.lc.lethalconfig] Finished loading assets.
[Info   :ainavt.lc.lethalconfig] Registered config "LethalConfig/Example/Int Slider"
[Info   :ainavt.lc.lethalconfig] Registered config "LethalConfig/Example/Float Slider"
[Info   :ainavt.lc.lethalconfig] Registered config "LethalConfig/Example/Float Step Slider"
[Info   :ainavt.lc.lethalconfig] Registered config "LethalConfig/Example/Bool Checkbox"
[Info   :ainavt.lc.lethalconfig] Registered config "LethalConfig/Example/Enum Dropdown"
[Info   :ainavt.lc.lethalconfig] Registered config "LethalConfig/Example/Text Input"
[Info   :ainavt.lc.lethalconfig] Registered config "LethalConfig.ConfigItems.GenericButtonConfigItem"
[Info   :ainavt.lc.lethalconfig] Registered config "LethalConfig/Example/Int Input"
[Info   :ainavt.lc.lethalconfig] Registered config "LethalConfig/Example/Float Input"
[Info   :ainavt.lc.lethalconfig] LethalConfig loaded!
[Info   :ainavt.lc.lethalconfig] Injecting mod config menu into main menu...
[Info   :ainavt.lc.lethalconfig] Injecting mod config menu into main menu...
[Info   :ainavt.lc.lethalconfig] 22 mods loaded: ainavt.lc.lethalconfig;com.elitemastereric.coroner;com.github.mattymatty.LobbyControl;com.rune580.LethalCompanyInputUtils;ControlCompany.ControlCompany;ControlCompanySpoof;discount.alert;FlipMods.LetMeLookDown;FlipMods.TooManyEmotes;gamendegamer.lethaladmin;HDLethalCompany;HoldScanButton;ItemQuickSwitchMod;KoderTech.BoomboxController;Matsuura.HealthMetrics;Miodec.HideChat;NicholaScott.BepInEx.RuntimeNetcodeRPCValidator;MoreEmotes;SpectateEnemy;toemmsen.ChatCommands;twig.latecompany;Zaggy1024.OpenBodyCams

[Error  : Unity Log] NullReferenceException: Object reference not set to an instance of an object
Stack trace:
LethalConfig.AutoConfig.AutoConfigGenerator.AutoGenerateConfigs () (at D:/UnityProjects/LethalConfig/Assets/Scripts/AutoConfig/AutoConfigGenerator.cs:31)
LethalConfig.LethalConfigManager.AutoGenerateMissingConfigsIfNeeded () (at D:/UnityProjects/LethalConfig/Assets/Scripts/LethalConfigManager.cs:26)
LethalConfig.MonoBehaviours.ConfigMenu.Awake () (at D:/UnityProjects/LethalConfig/Assets/Scripts/MonoBehaviours/ConfigMenu.cs:16)
UnityEngine.Object:Instantiate(GameObject)
LethalConfig.Settings.MenusUtils:InjectMenu(Transform, Transform, GameObject) (at D:/UnityProjects/LethalConfig/Assets/Scripts/Utils/MenusUtils.cs:21)
LethalConfig.Patches.MenuManagerPatches:InjectToMainMenu() (at D:/UnityProjects/LethalConfig/Assets/Scripts/Patches/MenuManagerPatches.cs:40)
LethalConfig.Patches.<DelayedMainMenuInjection>d__1:MoveNext() (at D:/UnityProjects/LethalConfig/Assets/Scripts/Patches/MenuManagerPatches.cs:27)
UnityEngine.SetupCoroutine:InvokeMoveNext(IEnumerator, IntPtr)

If this post is made wrong, just delete it. I just started using GH for this post.

Compatibility with AdvancedCompany

There is a compatibility issue with AdvancedCompany.
The LethalConfig objects does not get injected into the quick menu when AdvancedCompany is present. This causes the button for LethalConfig to not be present in the quick menu, and also causes an error when trying to click "Resume" on the quick menu (or pressing escape), not closing it.

Error occurred when opening the game using the mod

[Info : BepInEx] Loading [Custom Emotes API 1.1.8]
[Error : Unity Log] MissingMethodException: Method not found: void LethalConfig.ConfigItems.Options.FloatSliderOptions.set_Min(single)
Stack trace:
EmotesAPI.Settings.RunAll () (at <45c46f6215af4fed84ced0846465b5b0>:0)
EmotesAPI.CustomEmotesAPI.Awake () (at <45c46f6215af4fed84ced0846465b5b0>:0)
UnityEngine.GameObject:AddComponent(Type)
BepInEx.Bootstrap.Chainloader:Start()
UnityEngine.Rendering.HighDefinition.HDRenderPipelineAsset:OnEnable()

After I copy the error, I saw it might related to another mod/plugin. But its good to know about it

Also opened an issue in LethalEmotes

[Suggestion] "Compatibility" with Emblem - Color Menu

Emblem is a very good mod that allows you to change the colors of the Menus, among other things.
I would like Lethal Config to also have the option to change colors because it happens that the Menus have one color (for example green) and when you open Lethal Config it has another color. Causing it to look... weird.
image
image

[Suggestion] Remove Button

sir, can you add the Turn On/Off [True/False], the Button Mod Settings in cfg? because i dont like have so many button on Main Menu and I'm Scared when my friend change everything and make no Sync game.

I cannot see the names and values of some of the mods

[Info :ainavt.lc.lethalconfig] 160 mods loaded: .LCMaxSoundsFix;1.Waga.JigglePhysicsPlugin;5Bit.VoiceHUD;Acromata.TwoHanded;ainavt.lc.lethalconfig;atomic.terminalapi;AUniqueName.AlwaysShowClock;bgn.pizzatowerescapemusic;Boniato.Ganimedes;BoomBox.BoomBoxNoPower;BoomboxSyncFix;Chaos.CustomPostProcessingAPI;Chaos.LCCutscene;Chaos.Diversity;cobster.exitdoor;ColtG5.CreepyBrackens;com.elitemastereric.CleanerLogs;com.elitemastereric.coroner;com.elitemastereric.slimetamingfix;com.fumiko.CullFactory;me.swipez.melonloader.morecompany;com.github.lethalmods.lethalexpansioncore;com.github.tinyhoot.ShipLoot;com.github.zehsteam.Hitmarker;evaisa.lethallib;com.rune580.LethalCompanyInputUtils;com.malco.lethalcompany.moreshipupgrades;com.steven.lethalcompany.boomboxmusic;com.zealsprince.locker;Cubly.ColourfulFlashlights;DannyVD.mods.LethalCompany.MonitorLabels;SpectateEnemy;DeadAndBored;DeathAnnounce;dev.kittenji.NavMeshInCompany;discount.alert;doggosuki.Huntdown;DoubleJump.DoubleJump;Dreamweave.CompanyBuildingEnhancements;droneenemy;e3s1.BetterLadders;Electric.IsThisTheWayICame;enemyalert;ENZDS.LockDoorsMod;Ex.MaskStun;FlipMods.FasterItemDropship;FlipMods.HotbarPlus;FlipMods.ObjectVolumeController;FlipMods.ReservedItemSlotCore;FlipMods.ReservedFlashlightSlot;FlipMods.ReservedSprayPaintSlot;FlipMods.ReservedWeaponSlot;FlipMods.TooManyEmotes;flowerwater.watermarkremover;Flowprojects.AoTGiants;GameTranslator;gravydevsupreme.xunity.autotranslator;gravydevsupreme.xunity.resourceredirector;HamCheese.CleanUpCompany;HDLethalCompany;Hexnet.lethalcompany.suitsaver;imabatby.lethallevelloader;ImmortalSnail;ImoutoSama.ScarletMansion;impulse.BetterTotalScrap;Invertigo.JetpackHandling;io.github.CSync;JetpacksCarryBigItems;JigglePhysicsPlugin;KawaiiBone.Remnants;Kittenji.DontTouchMe;Kittenji.HerobrineMod;Kittenji.LaserPointerDetonator;kuba6000.LC_MimicFixMod;lauriichan.friendpatches;LCBetterSaves;LCMOD.MasterKey;lekakid.lcsignaltranslatoraligner;LethalExpansion;LethalNetworkAPI;LethalPosters;LethalPresents;LethalSnapProject;Linkoid.Dissonance.LagFix;MaskedEnemyRework;MCStronghold;me.loaforc.facilitymeltdown;MegaPiggy.BuyableShotgunShells;MentalHospital;Mhz.MoreHead;MiffyL.KillItWithShovel;monke.lc.jumpdelay;NicholaScott.BepInEx.RuntimeNetcodeRPCValidator;MoreEmotes;MoreInteriors;mrgrm7.LethalCasino;MV.NicerTeleporters;nomnom.turret-key;Nyxchrono-DoorBreach;OpJosMod.SaferJetpack;OuterDoorButtons;Ovchinikov.KillableEnemies.Main;Piggy.LCOffice;PingDisplay;PloufJPEG.CompanyCreatures;quackandcheese.togglemute;rafl.BonkHitSfxFixed;rainbow137-NewYearJester;rattenbonkers.TVLoader;rileyzzz.Skibidi;RugbugRedfern.SkinwalkerMod;scin.BrackenPlush;scin.bunkspidPlushie;scin.CoilheadPlushie;scin.ComedymaskPlush;scin.Hoarding-BugPlushPlush;scin.JesterPlushie;scin.TragedymaskPlush;ScoopysVarietyMod;Scopophobia;SCPCBDunGen;ShaosilGaming.GeneralImprovements;ShootableMouthDogs;ShowAmmoCount;SilasMeyer.EnemyLoot;skidz.PoolRooms;SleeplessKyru.SnapRotateFurniture;snake.tech.LCHazardsOutside;SomePriceMod;Spantle.ThrowEverything;Stoneman.LethalProgression;stormytuna.RouteRandom;sugarlo.bepinex.bepinexplugins.chopchopfruit;sugarlo.bepinex.bepinexplugins.flameflamefruit;sugarlo.bepinex.bepinexplugins.gumgumfruit;sugarlo.bepinex.bepinexplugins.opopfruit;sugarlo.bepinex.bepinexplugins.smilefruit;sugarlo.bepinex.bepinexplugins.smokesmokefruit;sunnobunno.YippeeMod;suskitech.LCAlwaysHearActiveWalkie;taffyko.BetterSprayPaint;taffyko.NameplateTweaks;taffyko.NiceChat;TalkingHeads;TheCosmicJesterOfTheVoid.LCGoldenShovelMod;Theronguard.EmergencyDice;TitaniumTurbine.EnemySpawner;tolstj.turretAlwaysLaser;twig.latecompany;veri.lc.shipwindow;viviko.BetterDecorPlacement;viviko.BunkbedRevive;WeatherMultipliers;WeatherTweaks;x753.Mimics;x753.More_Suits;Zaggy1024.NutcrackerFixes;Zaggy1024.OpenBodyCams;Zaggy1024.PathfindingLagFix;Zeus.JustJump
[Warning:ainavt.lc.lethalconfig] No UI component found for config of type Double (Ganimedes/Mp3.AudioVolume/Volume)
[Warning:ainavt.lc.lethalconfig] No UI component found for config of type Color (More Ship Upgrades/Night Vision/Night Vision Color)
[Warning:ainavt.lc.lethalconfig] No UI component found for config of type Color (MonitorLabels/2. Colours/targetLabelColour)
[Warning:ainavt.lc.lethalconfig] No UI component found for config of type Color (MonitorLabels/2. Colours/otherLabelColour)
[Warning:ainavt.lc.lethalconfig] No UI component found for config of type Color (MonitorLabels/2. Colours/deadLabelColour)
[Warning:ainavt.lc.lethalconfig] No UI component found for config of type Color (MonitorLabels/2. Colours/radarBoosterLabelColour)
[Warning:ainavt.lc.lethalconfig] No UI component found for config of type Color (MonitorLabels/2. Colours/enemyLabelColour)
[Warning:ainavt.lc.lethalconfig] No UI component found for config of type Color (MonitorLabels/2. Colours/deadEnemyLabelColour)
[Warning:ainavt.lc.lethalconfig] No UI component found for config of type Color (MonitorLabels/2. Colours/scrapLabelColour)
[Warning:ainavt.lc.lethalconfig] No UI component found for config of type Color (MonitorLabels/2. Colours/highValueScrapLabelColour)
[Warning:ainavt.lc.lethalconfig] No UI component found for config of type Color (MonitorLabels/2. Colours/carriedScrapLabelColour)
[Warning:ainavt.lc.lethalconfig] No UI component found for config of type Color (MonitorLabels/2. Colours/inShipScrapLabelColour)
[Warning:ainavt.lc.lethalconfig] No UI component found for config of type Vector2 (MonitorLabels/4. Label Offsets/radarTargetLabelOffset)
[Warning:ainavt.lc.lethalconfig] No UI component found for config of type Vector2 (MonitorLabels/4. Label Offsets/enemyLabelOffset)
[Warning:ainavt.lc.lethalconfig] No UI component found for config of type Vector2 (MonitorLabels/4. Label Offsets/scrapLabelOffset)
[Info :ainavt.lc.lethalconfig] Generated 84 mod entries.
[Info :ainavt.lc.lethalconfig] Generated 1108 configs, of which 1034 were missing and registered.

[Suggestion] User specific configs

For some configs (like keybinds or api tokens) it makes more sense to be in "%appdata%\LocalLow\ZeekerssRBLX\Lethal Company" instead of the normal config folder. Support for them in LethalConfig would be great.

[Suggestion] Adding a delegate for OnValueChanged on Options allowing actions on those values

I know it's not very clear. You'd think "just use ConfigEntry.OnChanged" but it will work in some cases.
I couldn't find any better name for the suggestion to be honest.
Here is an example use case.

class Config
{
  public enum ExampleEnum
  {
    ChoiceOne,
    ChoiceTwo,
    ChoiceThree,
  }

  public static ConfigEntry<ExampleEnum> ExEnumValue;
  public static ConfigEntry<int> ExEnumValueChild;

  public Config(ConfigFile cfg)
  {
    ExEnumValue = cfg.Bind("general", "testEnum", ExampleEnum.ChoiceOne, "eeee");
    ExEnumValueChild = cfg.Bind("general", "testValue", 0, "aaaa");

    var enumOption = new EnumDropDownConfigItem<ExampleEnum>(ExEnumValue, new EnumDropDownOptions
    {
      RequiresRestart = false
    });

    var intOption = new IntSliderConfigItem(ExEnumValueChild, new IntSliderOptions
    {
      Min = 0,
      Max = 12,
      OnValueChanged += (changedOption, thisOption) =>
      {
        if(changedOption is not ConfigEntry<ExampleEnum>)
          return;
  
        var enumChangedOpt = changedOption as ConfigEntry<ExampleEnum>;        

        switch(enumChangedOpt.Value)
        {
          case ExampleEnum.ChoiceTwo:
            thisOption.Max = 6;
          break;
          case ExampleEnum.ChoiceThree:
            thisOption.Max = 1;
          break;
          default:
            thisOption.Max = 12;
          break;
        }
      },
      RequiresRestart = false
    });
  }
}

That's quite complex but basically it would allow to change other options limits and datas when another option of the menu is triggered.

I'm not good at all to explain, but if you want more precise explanations, I'm always open.

Input of type KeyBind

Lots of mods are using key bindings to define behavior. It will be easier if by using this library, the user clicks on the input it will assign the right key bind code.

WDYT?

configs of some mods do not appear in the lethal config menu

hi there. I have many mods, and among them there are mods that used to appear in the lethal config settings menu, but now they don’t. I saw a similar issue, but it was two months ago, and it says that you will fix this with the release of the update. I have the latest version, and in the menu I have two of your mods plus reactor meltdown, and other mods like better stamina are simply missing. I tried deleting all the configs, tried reinstalling your mod, installing the old version - it didn’t help.
LogOutput.log

Feature requests to enable search

I want to implement a search feature in my config. However, there are a couple of obstacles in this library currently:

  • No generic text input field
  • Can't hide config items. It would be nice to get access to the actual GameObjects for this
    • Alternatively, just being able to rebind configs or reorder them would suffice

I'm considering making a PR with these features, but it will probably require some restructuring. Maybe someone more actively involved would want to do it instead.

I can't add my music

Custom_Boombox_Music generated folder Boombox_Music will be reset on each boot

Exception when getting types for certain assemblies

When searching for the BepInPlugin for some assemblies, calling GetTypes() sometimes throws an exception if the assembly in question requires loading another assembly, most likely a soft dependency. This interrupts the process of building the UI, and only shows the items up to that assembly.

Example of this happening is using TooManyEmotes without InputUtils: trying to get the types for TooManyEmotes throws an exception because it attempts to load InputUtils when it's not there.

Cannot create multiple GenericButtonConfigItems

When creating a GenericButtonConfigItem, the first one registers fine, but the second is discarded as a duplicate.

[Info   :ainavt.lc.lethalconfig] Registered config "LethalConfig.ConfigItems.GenericButtonConfigItem"
[Warning:ainavt.lc.lethalconfig] Ignoring duplicated config "LethalConfig.ConfigItems.GenericButtonConfigItem"
        LethalConfigManager.AddConfigItem(new GenericButtonConfigItem("Actions", "Reset",
            "Reset all settings to their default values", "Reset", () =>
            {
                // Toggle logic
            }));

        LethalConfigManager.AddConfigItem(new GenericButtonConfigItem("Actions", "Toggle", "Manually toggle the plugin", "Toggle", LessBrightHarmonyPatch.ToggleLight));

There is no way I can see to differentiate these two items, other than the section and name, yet the second is not being identified as a separate item.

I'm sure I'm missing something, but I'm at a loss. :)

[Suggestion] LethalConfig does not appear to utilize AcceptableValueLists

I notice that automatic config entires are generated with sliders when there is an AcceptableValueRange provided with the config entry, which is great.

However, some mods (I'll mention my own GeneralImprovements) provide an AcceptableValueList instead, with specific values in mind. For example, the 12 ship monitor entries have very specific string values that they can accept. r2modman shows them, as well as the config file itself, so it would be wonderful if it was implemented (perhaps as a dropdown?) in LethalConfig, because many people have been confused as to what values those entries accept if they do not check the config file.

How to change the logo in config?

Hello!

Have a question, how to change the logo of your mod inside the game?

There the image is a question mark, I don’t really understand how this can be done.

[Suggestion] Add some mechanism for appending custom ui game objects when the generic button is clicked

One of the stated use cases for the generic button is "use it to open custom menus for your mod," but it provides no access to the game's gui. I don't see another way of injecting a menu into the scene on the button press besides rewriting the hooks already present in this mod, which seems like unnecessary and error-prone duplicated work for anyone with this use case. I'd recommend modifying the current generic button delegate or adding a new menu button class that takes a different type of delegate, and in either case having the delegate return a rect transform or a game object that lethalconfig will then add to the canvas along with some canned means of removing or hiding it once the configuration is finished.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.