Bind Taming ability to K key instead of E
This commit is contained in:
parent
225b7115bc
commit
ff9fc4db2d
2 changed files with 36 additions and 32 deletions
|
|
@ -459,42 +459,11 @@ namespace RacesOfValheim
|
|||
|
||||
if (canTame)
|
||||
{
|
||||
__result += "\n[<color=yellow><b></b></color>] Tame";
|
||||
__result += "\n[<color=yellow><b>K</b></color>] 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<Character>()?.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<Character>()?.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
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue