Added _00E_EquipControl, implemented torch reequipping fallback

This commit is contained in:
Eddoursul 2024-02-13 09:33:32 +01:00
parent 9146903b39
commit 1cfacfadfc
7 changed files with 70 additions and 10 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -2267,6 +2267,7 @@ scripts\ski_settingsmanager.pex
scripts\ski_widgetbase.pex scripts\ski_widgetbase.pex
scripts\ski_widgetmanager.pex scripts\ski_widgetmanager.pex
scripts\_00e_torchcontrol.pex scripts\_00e_torchcontrol.pex
scripts\_00e_equipcontrol.pex
scripts\_00e_digcontrol.pex scripts\_00e_digcontrol.pex
scripts\tif__000a5ebd.pex scripts\tif__000a5ebd.pex
scripts\tif__000a5ebe.pex scripts\tif__000a5ebe.pex

View File

@ -35,18 +35,20 @@ bool function Dig()
; Start digging ; Start digging
Game.ForceThirdPerson() Game.ForceThirdPerson()
Form[] equippedTorches = New Form[2] If isFirstPerson ; Give some time for the camera to settle on switch to 3p
Bool torchesUnequipping = _00E_TorchControl.UnequipTorches(equippedTorches)
If PlayerREF.IsWeaponDrawn() ; Sheathe the weapon
PlayerREF.PlayIdle(DefaultSheathe)
Wait(2)
ElseIf isFirstPerson ; Give some time for the camera to settle on switch to 3p
Wait(0.5) Wait(0.5)
ElseIf torchesUnequipping ; Give some time for torch unequip animations to settle endif
Form[] equippedTorches = New Form[2]
bool bUnequippingTorch = _00E_TorchControl.UnequipTorches(equippedTorches)
if bUnequippingTorch
; Give some time for torch unequip animations to settle
Wait(0.25) Wait(0.25)
EndIf endif
_00E_EquipControl.SheatheWeapon(PlayerREF)
Wait(0.5)
Debug.SendAnimationEvent(PlayerREF, "IdleSmelterEnter") Debug.SendAnimationEvent(PlayerREF, "IdleSmelterEnter")
Wait(5.0) Wait(5.0)
@ -54,7 +56,7 @@ bool function Dig()
Debug.SendAnimationEvent(PlayerREF, "IdleForceDefaultState") Debug.SendAnimationEvent(PlayerREF, "IdleForceDefaultState")
_00E_TorchControl.ReequipTorches(equippedTorches) _00E_TorchControl.ReequipTorches(equippedTorches)
Wait(1) Wait(1.0)
Game.SetPlayerAIDriven(false) Game.SetPlayerAIDriven(false)
Game.EnablePlayerControls() Game.EnablePlayerControls()

View File

@ -0,0 +1,32 @@
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

View File

@ -8,8 +8,21 @@ EndFunction
Bool Function UnequipTorches(Form[] equippedTorches) global Bool Function UnequipTorches(Form[] equippedTorches) global
Actor PlayerREF = Game.GetForm(0x14) as Actor Actor PlayerREF = Game.GetForm(0x14) as Actor
if ! SKSE.GetVersion()
if PlayerREF.GetEquippedItemType(0) == 11 || PlayerREF.GetEquippedItemType(1) == 11
Form torchDefault = Game.GetForm(0x1D4EC)
equippedTorches[0] = torchDefault
PlayerREF.UnequipItem(torchDefault as Light, false, true)
Utility.Wait(0.1)
return true
endif
return false
endif
Bool unequipping = False Bool unequipping = False
Int iHand = 0 Int iHand = 0
While iHand < equippedTorches.Length While iHand < equippedTorches.Length
If PlayerREF.GetEquippedItemType(iHand) == 11 ; A torch is in the hand? If PlayerREF.GetEquippedItemType(iHand) == 11 ; A torch is in the hand?
Form torch = PlayerREF.GetEquippedObject(iHand) Form torch = PlayerREF.GetEquippedObject(iHand)
@ -28,6 +41,18 @@ EndFunction
Function ReequipTorches(Form[] equippedTorches) global Function ReequipTorches(Form[] equippedTorches) global
Actor PlayerREF = Game.GetForm(0x14) as Actor Actor PlayerREF = Game.GetForm(0x14) as Actor
if ! SKSE.GetVersion()
if equippedTorches[0] || equippedTorches[1]
equippedTorches[0] = None
equippedTorches[1] = None
if PlayerREF.GetItemCount(Game.GetForm(0x1D4EC)) > 0
Debug.SendAnimationEvent(PlayerREF, "equipTorch")
endif
endif
return
endif
Int iHand = 0 Int iHand = 0
While iHand < equippedTorches.Length While iHand < equippedTorches.Length
Form torch = equippedTorches[iHand] Form torch = equippedTorches[iHand]