Locked FullAuto to guns only (fixed bug where bow would not aim and fire)
This commit is contained in:
1 parent
24f854f80c
commit
1f50cad86e
1 file changed
+9
-25
+9
-25
@@ -26,27 +26,13 @@ public class FullAuto : SonsMod
|
|||||||
public FullAuto()
|
public FullAuto()
|
||||||
{
|
{
|
||||||
HarmonyPatchAll = true;
|
HarmonyPatchAll = true;
|
||||||
OnUpdateCallback = OnUpdate;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnSdkInitialized()
|
protected override void OnSdkInitialized()
|
||||||
{
|
{
|
||||||
_configPath = Path.Combine(LoaderEnvironment.UserDataDirectory, "FullAuto.txt");
|
_configPath = Path.Combine(LoaderEnvironment.UserDataDirectory, "FullAuto.txt");
|
||||||
Load();
|
Load();
|
||||||
RLog.Msg($"FullAuto loaded. Enabled: {Enabled}, RPM: {Rpm}. F10 toggles, console: fullauto");
|
RLog.Msg($"FullAuto loaded. Enabled: {Enabled}, RPM: {Rpm}. Guns only. Console: fullauto");
|
||||||
}
|
|
||||||
|
|
||||||
private void OnUpdate()
|
|
||||||
{
|
|
||||||
if (!GameState.IsPlayerControllable)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (Input.GetKeyDown(KeyCode.F10))
|
|
||||||
{
|
|
||||||
Enabled = !Enabled;
|
|
||||||
Save();
|
|
||||||
Announce();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[DebugCommand("fullauto")]
|
[DebugCommand("fullauto")]
|
||||||
@@ -153,13 +139,12 @@ internal static class CheckFireInputPatch
|
|||||||
{
|
{
|
||||||
private const int MaxShotsPerFrame = 4;
|
private const int MaxShotsPerFrame = 4;
|
||||||
|
|
||||||
private static readonly HashSet<string> Excluded = new()
|
private static readonly HashSet<string> Guns = new()
|
||||||
{
|
{
|
||||||
"GrenadeWeaponController",
|
"CompactPistolWeaponController",
|
||||||
"MolotovWeaponController",
|
"RevolverWeaponController",
|
||||||
"TimeBombWeaponController",
|
"ShotgunWeaponController",
|
||||||
"SmallRockWeaponController",
|
"RifleAnimatorController"
|
||||||
"RopeGunController"
|
|
||||||
};
|
};
|
||||||
|
|
||||||
private static readonly Dictionary<IntPtr, bool> Allowed = new();
|
private static readonly Dictionary<IntPtr, bool> Allowed = new();
|
||||||
@@ -245,11 +230,10 @@ internal static class CheckFireInputPatch
|
|||||||
if (Allowed.TryGetValue(ptr, out var allowed))
|
if (Allowed.TryGetValue(ptr, out var allowed))
|
||||||
return allowed;
|
return allowed;
|
||||||
|
|
||||||
allowed = !Excluded.Contains(controller.GetIl2CppType().Name);
|
var name = controller.GetIl2CppType().Name;
|
||||||
|
allowed = Guns.Contains(name);
|
||||||
Allowed[ptr] = allowed;
|
Allowed[ptr] = allowed;
|
||||||
|
RLog.Msg($"FullAuto {name}: {(allowed ? "full-auto" : "ignored")}");
|
||||||
return allowed;
|
return allowed;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Reference in new issue
Block a user