Hide disabled interactions, and rev version!
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -31,6 +31,7 @@ bld/
|
|||||||
[Oo]bj/
|
[Oo]bj/
|
||||||
[Ll]og/
|
[Ll]og/
|
||||||
[Ll]ogs/
|
[Ll]ogs/
|
||||||
|
dist/
|
||||||
|
|
||||||
# Visual Studio 2015/2017 cache/options directory
|
# Visual Studio 2015/2017 cache/options directory
|
||||||
.vs/
|
.vs/
|
||||||
|
|||||||
37
Patches/DisabledActionsPatch.cs
Normal file
37
Patches/DisabledActionsPatch.cs
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
using Aki.Reflection.Patching;
|
||||||
|
using HarmonyLib;
|
||||||
|
using System;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Reflection;
|
||||||
|
|
||||||
|
namespace UIFixes
|
||||||
|
{
|
||||||
|
public class DisabledActionsPatch : ModulePatch
|
||||||
|
{
|
||||||
|
protected override MethodBase GetTargetMethod()
|
||||||
|
{
|
||||||
|
Type type = typeof(GetActionsClass);
|
||||||
|
return AccessTools.GetDeclaredMethods(type).FirstOrDefault(x =>
|
||||||
|
{
|
||||||
|
var parameters = x.GetParameters();
|
||||||
|
return x.Name == "GetAvailableActions" && parameters[0].Name == "owner";
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
[PatchPostfix]
|
||||||
|
private static void Postfix(ref ActionsReturnClass __result)
|
||||||
|
{
|
||||||
|
if (Settings.RemoveDisabledActions.Value && __result != null)
|
||||||
|
{
|
||||||
|
for (int i = __result.Actions.Count - 1; i >= 0; i--)
|
||||||
|
{
|
||||||
|
if (__result.Actions[i].Disabled)
|
||||||
|
{
|
||||||
|
Logger.LogInfo(__result.Actions[i].Name);
|
||||||
|
__result.Actions.RemoveAt(i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,14 +1,10 @@
|
|||||||
using Aki.Reflection.Patching;
|
using Aki.Reflection.Patching;
|
||||||
|
using Aki.Reflection.Utils;
|
||||||
|
using EFT.InputSystem;
|
||||||
using EFT.InventoryLogic;
|
using EFT.InventoryLogic;
|
||||||
using EFT.UI.WeaponModding;
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using EFT.InputSystem;
|
|
||||||
using Aki.Reflection.Utils;
|
|
||||||
|
|
||||||
namespace UIFixes
|
namespace UIFixes
|
||||||
{
|
{
|
||||||
@@ -25,7 +21,7 @@ namespace UIFixes
|
|||||||
}
|
}
|
||||||
|
|
||||||
[PatchPostfix]
|
[PatchPostfix]
|
||||||
private static void Postfix(object __instance, EBoundItem boundItem, ref string __result)
|
private static void Postfix(object /*GClass960*/ __instance, EBoundItem boundItem, ref string __result)
|
||||||
{
|
{
|
||||||
switch(boundItem)
|
switch(boundItem)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ namespace UIFixes
|
|||||||
ScrollPatches.Enable();
|
ScrollPatches.Enable();
|
||||||
WeaponZoomPatch.Enable();
|
WeaponZoomPatch.Enable();
|
||||||
new WeaponBindingPatch().Enable();
|
new WeaponBindingPatch().Enable();
|
||||||
|
new DisabledActionsPatch().Enable();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ namespace UIFixes
|
|||||||
public static ConfigEntry<bool> TransferConfirmOnClose { get; set; }
|
public static ConfigEntry<bool> TransferConfirmOnClose { get; set; }
|
||||||
public static ConfigEntry<bool> UseHomeEnd { get; set; }
|
public static ConfigEntry<bool> UseHomeEnd { get; set; }
|
||||||
public static ConfigEntry<bool> RebindPageUpDown { get; set; }
|
public static ConfigEntry<bool> RebindPageUpDown { get; set; }
|
||||||
|
public static ConfigEntry<bool> RemoveDisabledActions { get; set; }
|
||||||
|
|
||||||
public static void Init(ConfigFile config)
|
public static void Init(ConfigFile config)
|
||||||
{
|
{
|
||||||
@@ -17,6 +18,7 @@ namespace UIFixes
|
|||||||
TransferConfirmOnClose = config.Bind<bool>("Transfer Items", "Confirm untransfered items", false, "Whether to pointlessly confirm that you're leaving the item transfer with literally no consequences");
|
TransferConfirmOnClose = config.Bind<bool>("Transfer Items", "Confirm untransfered items", false, "Whether to pointlessly confirm that you're leaving the item transfer with literally no consequences");
|
||||||
UseHomeEnd = config.Bind<bool>("Keybinds", "Add support for Home and End", true, "Home and End will scroll to the top and bottom of lists");
|
UseHomeEnd = config.Bind<bool>("Keybinds", "Add support for Home and End", true, "Home and End will scroll to the top and bottom of lists");
|
||||||
RebindPageUpDown = config.Bind<bool>("Keybinds", "Use normal PageUp and PageDown (requires restart)", true, "Changes PageUp and PageDown to simply page up and down, not scroll all the way to top and bottom");
|
RebindPageUpDown = config.Bind<bool>("Keybinds", "Use normal PageUp and PageDown (requires restart)", true, "Changes PageUp and PageDown to simply page up and down, not scroll all the way to top and bottom");
|
||||||
|
RemoveDisabledActions = config.Bind<bool>("In Raid", "Hide unimplemented actions", false, "Hides actions you can't actually do, like \"Bang and Clear\", etc from locked doors and other interactable objects");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
<TargetFramework>net471</TargetFramework>
|
<TargetFramework>net471</TargetFramework>
|
||||||
<AssemblyName>Tyfon.UIFixes</AssemblyName>
|
<AssemblyName>Tyfon.UIFixes</AssemblyName>
|
||||||
<Description>SPT UI Fixes</Description>
|
<Description>SPT UI Fixes</Description>
|
||||||
<Version>1.0.0</Version>
|
<Version>1.1.0</Version>
|
||||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||||
<LangVersion>latest</LangVersion>
|
<LangVersion>latest</LangVersion>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|||||||
Reference in New Issue
Block a user