Last updated | 5 months ago |
Total downloads | 128 |
Total rating | 0 |
Categories | Modpacks |
Dependency string | TeamNuK3d-NuK3Modpack-1.0.0 |
Dependants | 0 other packages depend on this package |
This mod requires the following mods to function
BepInEx-BepInExPack
BepInEx pack for Mono Unity games. Preconfigured and ready to use.
Preferred version: 5.4.2100tinyhoot-ShipLoot
Reliably shows the total value of all scrap in your ship.
Preferred version: 1.0.0Evaisa-HookGenPatcher
Generates MonoMod.RuntimeDetour.HookGen's MMHOOK file during the BepInEx preloader phase.
Preferred version: 0.0.5OrtonLongGaming-FreddyBracken
Replaces the Bracken (Flowerman) with Freddy Fazbear. Works in v45!
Preferred version: 1.0.6FlipMods-BetterStamina
Makes stamina consumption/regen a bit better. All values can be tweaked in config, and will sync with the host.
Preferred version: 1.3.2RugbugRedfern-Skinwalkers
The monsters have learned how to mimic the voices of your friends.
Preferred version: 4.0.1Spyci-CozyImprovements
Enhance the experience inside the ship to create a more immersive, cozy, and accessible environment. v47 compatible.
Preferred version: 1.2.2bigmcnugget-VanillaContentExpansion
Vanilla Friendly Additions. 50 new scrap items
Preferred version: 0.1.8FlipMods-ReservedItemSlotCore
The core mod for all ReservedItemSlot mods. Adds functionality for all ReservedItemSlot mods.
Preferred version: 1.8.17FlipMods-ReservedFlashlightSlot
Gives a free, dedicated Flashlight slot on the right side of your screen. Can be toggled with [F] to activate the Flashlight at anytime.
Preferred version: 1.6.3FlipMods-ReservedWalkieSlot
Gives a free, dedicated Walkie slot on the right side of your screen. You can press [X] to activate and speak into the Walkie at anytime.
Preferred version: 1.6.2jaspercreations-Scopophobia
Adds the Shy Guy (SCP-096) to Lethal Company. Fully custom animations and behavior. Model from SCP: Containment Breach.
Preferred version: 1.1.1anormaltwig-LateCompany
A mod to allow players to join after the game starts.
Preferred version: 1.0.11notnotnotswipez-MoreCompany
A stable lobby player count expansion mod. With cosmetics!
Preferred version: 1.8.1x753-Mimics
Adds a dangerous new monster to the game. Can you figure out what's real or will you be devoured?
Preferred version: 2.4.1MegaPiggy-BuyableShotgunShells
Adds shotgun shells to the store for 20 credits (Configurable)
Preferred version: 1.1.0MegaPiggy-BuyableShotgun
Adds shotguns to the store for 700 credits (Configurable)
Preferred version: 1.1.0Hypick-BetterShotgun
[v49] Improves the vanilla shotgun and its ammo, adding features such as infinite ammo, viewing the number of loaded ammo, selling in the store, spawning on moons and in gifts (Fully configurable)
Preferred version: 1.4.7FlipMods-ReservedWeaponSlot
Gives a dedicated Weapon slot on the right side of your screen that can optionally be purchased! This slot accepts all weapons, and even weapons from popular mods! Includes a Reserved ammo slot on the left side of the screen. (optional)
Preferred version: 1.1.3WhiteSpike-Interactive_Terminal_API
API focused on making interactable UI in the terminal
Preferred version: 1.1.2malco-Lategame_Upgrades
V3.7.2! - Alternative upgrade/item modes, Contracts Interactive UI and more!
Preferred version: 3.7.2Rune580-LethalCompany_InputUtils
API/Library for creating Unity InputActions with in-game re-binding support. Provides an alternative UI that allows for supporting mods to have in-game re-bindable keybinds.
Preferred version: 0.7.7README
LethalCompany InputUtils
Utilities for creating InputActions and having them be accessible in-game. InputActions created through this mod are accessible in-game via the keybinds menu added in update v45.
For feature requests or issues head over to my repo
General Users
This mod is just a dependency for other mods, it doesn't add content, but it allows mods to add keybinds.
Where are my bind overrides stored?
Depends on the version of InputUtils:
- >= 0.4.1
BepInEx/config/controls
- <= 0.4.0
BepInEx/controls
Recommended Install
Use a Mod manager. I won't provide support if a mod manager wasn't used, a mod manager makes it far easier to debug issues since users can just share a modpack code.
Developer Quick-Start
This Api/Mod is still in beta, please keep in mind that stuff may change. Feedback is appreciated.
Download the latest release from either the Thunderstore or the Releases. Extract the zip and add a reference to the dll file of the mod in Visual Studio or Rider.
Initializing Your Binds
- Create a subclass of
LcInputActions
- An instance of this class will contain all
InputAction
s your mod wishes to bind inputs for - Name the class appropriately
- An instance of this class will contain all
- Create InputActions using Attributes and/or at Runtime
public class MyExampleInputClass : LcInputActions
{
[InputAction("<Keyboard>/g", Name = "Explode")]
public InputAction ExplodeKey { get; set; }
[InputAction("<Keyboard>/h", Name = "Another")]
public InputAction AnotherKey { get; set; }
}
Using Attributes
- Create instance properties for all desired
InputActions
- Annotate the instance properties with the
[InputAction(...)]
annotation
[!IMPORTANT]
For actions to be registered to the API, Properties MUST be annotated with[InputAction(...)]
[InputAction("YourkbmPath", Name = "", GamepadPath = "", KbmInteractions = "", GamepadInteractions = "", ActionID = "", ActionType = InputActionType...)]
Required Parameters
kbmPath
: The default bind for Keyboard and Mouse devices
Optional Parameters
-
Name
: The Displayed text in the game keybinds menu -
GamepadPath
: The default bind for Gamepad devices -
KbmInteractions
: Sets the interactions of the kbm binding. See Interactions Docs -
GamepadInteractions
: Sets the interactions of the gamepad binding. See Interactions Docs -
ActionID
: Overrides the generated actionId (Generally you don't want to change this) -
ActionType
: Determines the behavior with which the action triggers. See ActionType Docs
So your Attribute could be written like this:
[InputAction("<Keyboard>/minus", Name = "Explode")]
public InputAction ExplodeKey { get; set; }
Or with any combination of optional parameters:
[InputAction("<Keyboard>/minus", Name = "Explode", GamepadPath = "<Gamepad>/Button North", KbmInteractions = "hold(duration = 5)")]
public InputAction ExplodeKey { get; set; }
[!NOTE] In this case above the Hold Interaction is being used. This keybind triggers after being held for 5 seconds. See Interactions Docs
At Runtime
- Override Method
void CreateInputActions(in InputActionMapBuilder builder)
- Use the builder to create InputActions
- Reference InputAction by calling
Asset["actionId"]
in your class
[!IMPORTANT] Make sure you call
Finish()
after you're done creating each InputAction.
Here's an example usage of the runtime api
public class MyExampleInputClass : LcInputActions
{
public static readonly MyExampleInputClass Instance = new();
public InputAction ExplodeKey => Asset["explodekey"];
public override void CreateInputActions(in InputActionMapBuilder builder)
{
builder.NewActionBinding()
.WithActionId("explodekey")
.WithActionType(InputActionType.Button)
.WithKbmPath("<Keyboard>/j")
.WithBindingName("Explode")
.Finish();
}
}
Referencing Your Binds
To use your InputActions class, you need to instantiate it.
[!IMPORTANT] Do not create more than one instance of your InputActions class. If your class is instantiated more than once, your InputActions are unlikely to work as intended.
The easiest (opinionated) way to do so would be to have a static instance in your plugin class.
[BepInPlugin(...)]
[BepInDependency("com.rune580.LethalCompanyInputUtils", BepInDependency.DependencyFlags.HardDependency)]
public class MyExamplePlugin : BaseUnityPlugin
{
internal static MyExampleInputClass InputActionsInstance = new MyExampleInputClass();
}
You could also opt for instantiating the instance in the InputActions class (Singleton-style).
public class MyExampleInputClass : LcInputActions
{
public static MyExampleInputClass Instance = new();
[InputAction("explodekey", "<Keyboard>/j", "<Gamepad>/Button North", Name = "Explode")]
public InputAction ExplodeKey { get; set; }
}
[!IMPORTANT]
But How Do I Get My Binds String?
You may have noticed that
<keyboard>/yourKey
can be a little confusing for the special buttons. So try this:
- First, arbitrarily set the value to some regular value or just an empty string
- Then, load up your mod and change the keybind to the desired key
- After, look in your
.../BepInEx/controls/YOURMODID.json
file- Find the
{"action":"myaction","origPath":"","path":"<Keyboard>/f8"}]}
- Last, copy that
path:""
from the far right i.e."<Keyboard>/f8"
Using Your Binds
You could then simply reference the instance anywhere you need to have your actions at.
public class MyOtherClassOrMonoBehavior
{
public void DoSomething()
{
MyExamplePlugin.InputActionsInstance.ExplodeKey ...
}
}
or
public class MyOtherClassOrMonoBehavior
{
public void DoSomething()
{
MyExampleInputClass.Instance.ExplodeKey ...
}
}
Best Practices
It is common to see tutorials call InputAction.ReadValue<>()
or InputAction.triggered
from mono-behaviour Update()
functions.
public class MyOtherClassOrMonoBehavior
{
public void Update()
{
DoSomething();
}
public void DoSomething()
{
if (!MyExamplePlugin.InputActionsInstance.ExplodeKey.triggered) return;
//Your executing code here
}
}
This approach is sufficient for 'continuous' actions, e.g. movement.
For 'discrete' actions, it's more appropriate to create event listeners that accept an InputAction.CallbackContext
and subscribe to InputAction.performed
.
public class MyOtherClassOrMonoBehavior
{
public void Awake()
{
SetupKeybindCallbacks();
}
// Name this whatever you like. It needs to be called exactly once, so
public void SetupKeybindCallbacks()
{
MyExamplePlugin.InputActionsInstance.ExplodeKey.performed += OnExplodeKeyPressed;
}
public void OnExplodeKeyPressed(InputAction.CallbackContext explodeConext)
{
if (!explodeConext.performed) return;
// Add more context checks if desired
// Your executing code here
}
}
Using InputUtils as an Optional or Soft Dependency
First make sure to add the [BepInDependency(...)]
attribute to your mods Plugin class, mark it as a SoftDependency
.
If you already have the attribute set as a HardDependency
make sure to replace that.
[BepInPlugin(...)]
[BepInDependency("com.rune580.LethalCompanyInputUtils", BepInDependency.DependencyFlags.SoftDependency)]
public class MyExamplePlugin : BaseUnityPlugin
Create your InputActions class as you would following the guide above. Make a class specifically for when the mod is loaded
internal static class InputUtilsCompat
{
public static bool Enabled =>
BepInEx.Bootstrap.Chainloader.PluginInfos.ContainsKey("com.rune580.LethalCompanyInputUtils");
public static InputAction ExplodeKey =>
MyExampleInputClass.Instance.ExplodeKey;
}
Finally whenever you reference stuff from InputUtilsCompat
, make sure to check its Enabled
Property first.
if (InputUtilsCompat.Enabled)
InputUtilsCompat.ExplodeKey...
Reference Best Practices for details on how to best use the InputAction
[!IMPORTANT]
If your mod uses NetcodePatcher you may need to do additional steps.
This only applies to mods that use InputUtils as a soft-dependency
Please check their Readme for more info. However for a possible fix, replace
var types = Assembly.GetExecutingAssembly().GetTypes();
with
IEnumerable<Type> types; try { types = Assembly.GetExecutingAssembly().GetTypes(); } catch (ReflectionTypeLoadException e) { types = e.Types.Where(t => t != null); }
Next Steps
Check out Unity's documentation for their InputSystem
Build Instructions
Build Script Args
--target=TARGET
- Valid targets:
- Build (default)
- FetchRefs
- Deploy (requires a valid
GAME_DIR
env var) - BuildThunderstore
- BuildNuGet
- Valid targets:
--configuration=MSBUILDCONFIGURATION
- Valid configurations:
- Debug (default)
- Release
- Valid configurations:
Check Build/Build.cs
for the source code of the build script.
Linux
Clone and enter the repo.
git clone https://github.com/Rune580/LethalCompanyInputUtils && cd LethalCompanyInputUtils
Copy and rename .env.example
to .env
.
cp .env.example .env
Edit .env
to fit your needs, a valid installation of Lethal Company is required unless USE_STUBBED_LIBS
is set.
Run ./build.sh to run the default build task.
./build.sh
Windows
Clone the repo.
git clone https://github.com/Rune580/LethalCompanyInputUtils
Enter the cloned repo.
cd LethalCompanyInputUtils
Copy and rename .env.example
to .env
.
cp .env.example .env
Edit .env
to fit your needs, a valid installation of Lethal Company is required unless USE_STUBBED_LIBS
is set.
Run ./build.ps1 to run the default build task.
.\build.ps1
Contact
Discord: @rune
Github: Rune580
Contributors
Thanks to the following contributers:
- @Boxofbiscuits97 for reworking most of the documentation.
- @Lordfirespeed for housekeeping and additional documentation cleanup.