Scriptname _00E_EquipControl Hidden

bool function SheatheWeapon(Actor actorRef = None, bool bWaitForAnimation = true) global

	if actorRef == None
		actorRef = Game.GetForm(0x14) as Actor
	endif
	
	if ! actorRef.IsWeaponDrawn()
		return false
	endif
	
	if SKSE.GetVersion()
		actorRef.SheatheWeapon()
	else
		Debug.SendAnimationEvent(actorRef, "Unequip")
	endif
	
	if ! bWaitForAnimation
		return true
	endif
	
	int i = 0
	while i < 25 && actorRef.GetAnimationVariableBool("IsUnequipping")
		Utility.Wait(0.1)
		i += 1
	endwhile
	Utility.Wait(0.1)
	
	return true
	
endfunction