Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Pause VRIK and play vanilla animation when summoning creatures #432

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions ValheimVRMod/Scripts/MagicWeaponManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ namespace ValheimVRMod.Scripts {
class MagicWeaponManager {

private static readonly HashSet<string> SWING_LAUNCH_MAGIC_STAFF_NAMES = new HashSet<string>(new string[] { "$item_stafffireball" });

private static bool IsMagicWeaponEquipped { get { return EquipScript.getLeft() == EquipType.Magic || EquipScript.getRight() == EquipType.Magic; } }
// Right-handed weapons in vanilla game is treated as domininant hand weapon in VHVR.
private static bool IsDominantHandWeapon { get { return EquipScript.getRight() == EquipType.Magic; } }
Expand Down Expand Up @@ -42,6 +43,12 @@ public static bool AttemptingAttack {
}
}

public static bool IsSummoning(Player player)
{
var attack = player.m_currentAttack;
return player.InAttack() && attack != null && attack.m_attackAnimation.Contains("summon");
}

public static bool ShouldSkipAttackAnimation()
{
return UseSwingForCurrentAttack();
Expand Down
1 change: 1 addition & 0 deletions ValheimVRMod/VRCore/VRPlayer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -845,6 +845,7 @@ private void updateVrik()
!player.InDodge() &&
!player.IsStaggering() &&
!player.IsSleeping() &&
!MagicWeaponManager.IsSummoning(player) &&
validVrikAnimatorState(player.GetComponentInChildren<Animator>());
LeftHandQuickMenu.instance.UpdateWristBar();
RightHandQuickMenu.instance.UpdateWristBar();
Expand Down