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
|
|
@ -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<Tameable>();
|
||||
if (tameable != null)
|
||||
{
|
||||
Character c = tameable.GetComponent<Character>();
|
||||
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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue