From ff9fc4db2dedb21db3118734c7bf2bd58a39dc62 Mon Sep 17 00:00:00 2001 From: Ferdinando Date: Fri, 31 Jul 2026 09:42:07 +0200 Subject: [PATCH] Bind Taming ability to K key instead of E --- JotunnModStub/Aswid/AswidPatches.cs | 33 +-------------------------- JotunnModStub/Aswid/AswidRace.cs | 35 +++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+), 32 deletions(-) diff --git a/JotunnModStub/Aswid/AswidPatches.cs b/JotunnModStub/Aswid/AswidPatches.cs index 3909259..7318ab6 100644 --- a/JotunnModStub/Aswid/AswidPatches.cs +++ b/JotunnModStub/Aswid/AswidPatches.cs @@ -459,42 +459,11 @@ namespace RacesOfValheim if (canTame) { - __result += "\n[] Tame"; + __result += "\n[K] Tame"; } } } - [HarmonyPatch(typeof(Tameable), "Interact")] - public static class Aswid_TameInteract_Patch - { - public static bool Prefix(Tameable __instance, Humanoid user, bool hold, bool alt) - { - if (hold || alt) return true; - if (user != Player.m_localPlayer || !AswidRace.IsAswid()) return true; - if (__instance.GetComponent()?.IsTamed() == true) return true; - - string prefabName = __instance.gameObject.name.ToLower(); - int state = BossProgressionManager.GetCurrentProgressionState(); - - bool canTame = false; - if (state >= 2 && prefabName.Contains("boar")) canTame = true; - if (state >= 5 && prefabName.Contains("wolf")) canTame = true; - if (state >= 6 && prefabName.Contains("lox")) canTame = true; - if (state >= 8 && prefabName.Contains("asksvin")) canTame = true; - - if (canTame) - { - __instance.GetComponent()?.SetTamed(true); - HarmonyLib.Traverse.Create(__instance).Method("Tame").GetValue(); // attempt to call Tame for VFX if it exists - __instance.Command(user); - user.Message(MessageHud.MessageType.Center, "Tamed!"); - return false; // Skip original interact - } - - return true; - } - } - [HarmonyPatch(typeof(Hud), "UpdateStamina")] public static class Aswid_HideStamina_Patch { diff --git a/JotunnModStub/Aswid/AswidRace.cs b/JotunnModStub/Aswid/AswidRace.cs index 2fbd363..b1e7304 100644 --- a/JotunnModStub/Aswid/AswidRace.cs +++ b/JotunnModStub/Aswid/AswidRace.cs @@ -512,6 +512,11 @@ namespace RacesOfValheim TryCastEclipse(state); return; } + if (Input.GetKeyDown(KeyCode.K)) + { + TryTameHoverObject(state); + return; + } } // Auto revert mist form at sunrise @@ -848,6 +853,36 @@ namespace RacesOfValheim yield return null; } + private void TryTameHoverObject(int state) + { + GameObject hoverObject = Player.m_localPlayer.GetHoverObject(); + if (hoverObject != null) + { + Tameable tameable = hoverObject.GetComponentInParent(); + if (tameable != null) + { + Character c = tameable.GetComponent(); + if (c != null && !c.IsTamed()) + { + string prefabName = c.gameObject.name.ToLower(); + bool canTame = false; + if (state >= 2 && prefabName.Contains("boar")) canTame = true; + if (state >= 5 && prefabName.Contains("wolf")) canTame = true; + if (state >= 6 && prefabName.Contains("lox")) canTame = true; + if (state >= 8 && prefabName.Contains("asksvin")) canTame = true; + + if (canTame) + { + c.SetTamed(true); + HarmonyLib.Traverse.Create(tameable).Method("Tame").GetValue(); // attempt to call Tame for VFX if it exists + tameable.Command(Player.m_localPlayer); + Player.m_localPlayer.Message(MessageHud.MessageType.Center, "Tamed!"); + } + } + } + } + } + private void TryCastEclipse(int state) { if (state < 6) return; // Requires Yagluth