From e38016c63f526b57d4d620f04d0c80a3842ceb54 Mon Sep 17 00:00:00 2001 From: Nicholas Badger Date: Mon, 15 Apr 2024 12:51:18 -0400 Subject: [PATCH] Allow optionally-defined BepInPlugin to support library usage (again) Signed-off-by: Nicholas Badger --- LethalCompanyInputUtils/Api/LcInputActions.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/LethalCompanyInputUtils/Api/LcInputActions.cs b/LethalCompanyInputUtils/Api/LcInputActions.cs index cc03965..cdf330d 100644 --- a/LethalCompanyInputUtils/Api/LcInputActions.cs +++ b/LethalCompanyInputUtils/Api/LcInputActions.cs @@ -35,10 +35,12 @@ public abstract class LcInputActions protected virtual string MapName => GetType().Name; - protected LcInputActions() + protected LcInputActions() : this(Assembly.GetCallingAssembly().GetBepInPlugin()) {} + + protected LcInputActions(BepInPlugin? plugin) { Asset = ScriptableObject.CreateInstance(); - Plugin = Assembly.GetCallingAssembly().GetBepInPlugin() ?? throw new InvalidOperationException(); + Plugin = plugin ?? throw new InvalidOperationException(); var mapBuilder = new InputActionMapBuilder(Id);