Added an MCM option to toggle companion health bars

This commit is contained in:
Eddoursul 2024-01-17 22:25:32 +01:00
parent f4b55f995d
commit f85cf43704
6 changed files with 42 additions and 16 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -10,10 +10,6 @@ endFunction
Event OnPageReset(string page)
If _00E_ConfigMenu_Meditate == None
_00E_ConfigMenu_Meditate = Game.GetFormFromFile(0x00046D98, "Skyrim.esm") as Message
EndIf
; adding options to rebind new key options: 1) Hero menu 2) meditation 3) Phasmalist summon apparition 4) Horseflute
SetCursorFillMode(TOP_TO_BOTTOM)
@ -26,6 +22,7 @@ Event OnPageReset(string page)
AddHeaderOption(_00E_ConfigMenu_GameplayOptions.GetName())
toggleOID_ReadAloudBooks = AddToggleOption(_00E_ConfigMenu_DisableReadAloudBooks.GetName(), _00E_DisableReadAloudBooks.GetValue() != 0)
toggleOID_VideoSkip = AddToggleOption(_00E_ConfigMenu_VideoSkip.GetName(), _00E_VideoSkip.GetValue() != 0)
toggleOID_ActorHealthBars = AddToggleOption(_00E_ConfigMenu_ActorHealthBars.GetName(), _00E_ActorHealthBarsEnabled.GetValue() != 0)
SetCursorPosition(1)
@ -79,6 +76,14 @@ Event OnOptionSelect(int option)
ChangeCheckbox(toggleOID_ReadAloudBooks, _00E_DisableReadAloudBooks)
ElseIf option == toggleOID_VideoSkip
ChangeCheckbox(toggleOID_VideoSkip, _00E_VideoSkip)
elseif option == toggleOID_ActorHealthBars
ChangeCheckbox(toggleOID_ActorHealthBars, _00E_ActorHealthBarsEnabled)
if _00E_ActorHealthBarsEnabled.GetValue()
ActorHealthBarWidget.RegisterEvents()
else
ActorHealthBarWidget.UnregisterEvents()
endif
EndIf
EndEvent
@ -107,6 +112,8 @@ Event OnOptionHighlight(int option)
SetInfoText("$ConfigMenuReadAloudBooksInfo")
ElseIf option == toggleOID_VideoSkip
SetInfoText("$ConfigMenuVideoSkipInfo")
ElseIf option == toggleOID_ActorHealthBars
SetInfoText("$ConfigMenuActorHealthBars")
EndIf
EndEvent
@ -129,9 +136,9 @@ EndFunction
Int iKeyMeditateID
int iKeyID02
int iKeyMountID
;int iMeditateKeycode = 21
int iFSPhasmalistTeleportKeymap = 34
int iFSMountTeleportKeymap = 38
int toggleOID_MenuTutorials
int toggleOID_CraftingTutorials
int toggleOID_SkillTutorials
@ -139,6 +146,7 @@ int toggleOID_QuestTutorials
int toggleOID_OtherTutorials
int toggleOID_ReadAloudBooks
int toggleOID_VideoSkip
int toggleOID_ActorHealthBars
Message Property _00E_ConfigMenu_Keybindings Auto
Message Property _00E_ConfigMenu_OtherOptions Auto
@ -153,6 +161,7 @@ Message Property _00E_ConfigMenu_DisableQuestTutorials Auto
Message Property _00E_ConfigMenu_DisableOtherTutorials Auto
Message Property _00E_ConfigMenu_DisableReadAloudBooks Auto
Message Property _00E_ConfigMenu_VideoSkip Auto
Message Property _00E_ConfigMenu_ActorHealthBars Auto
_FS_Phasmalist_ControlQuest Property controlQuest Auto
_00E_Horseflute_SC Property _00E_HorseFlute_New Auto
@ -164,4 +173,8 @@ GlobalVariable Property _00E_DisableQuestTutorials Auto
GlobalVariable Property _00E_DisableOtherTutorials Auto
GlobalVariable Property _00E_DisableReadAloudBooks Auto
GlobalVariable Property _00E_VideoSkip Auto
GlobalVariable Property _00E_ActorHealthBarsEnabled Auto
_00E_MeditationHotkeyAlias Property PlayerMeditation Auto
_00E_GUI_ActorHealthBar Property ActorHealthBarWidget Auto

View File

@ -111,20 +111,13 @@ endEvent
event OnGameReload()
If Game.GetModByName("SkyUI_SE.esp") == 255
parent.OnGameReload()
If Game.GetModByName("SkyUI_SE.esp") == 255 || _00E_ActorHealthBarsEnabled.GetValue() == 0
return
endif
parent.OnGameReload()
if _currentlyDisplayedActors.length == 0
_currentlyDisplayedActors = new Form[4]
endif
UI.Invoke(HUD_MENU, WidgetRoot + ".removeAllActors")
RegisterForModEvent("Enderal_ShowActorHealth", "AddActors")
RegisterForModEvent("Enderal_HideActorHealth", "RemoveActors")
RegisterEvents()
Utility.Wait(FadeOutDuration / 1000.0 + 1.0)
@ -152,6 +145,24 @@ event OnGameReload()
Endevent
function RegisterEvents()
if _currentlyDisplayedActors.length == 0
_currentlyDisplayedActors = new Form[4]
endif
UI.Invoke(HUD_MENU, WidgetRoot + ".removeAllActors")
RegisterForModEvent("Enderal_ShowActorHealth", "AddActors")
RegisterForModEvent("Enderal_HideActorHealth", "RemoveActors")
endfunction
function UnregisterEvents()
UI.Invoke(HUD_MENU, WidgetRoot + ".removeAllActors")
UnregisterForModEvent("Enderal_ShowActorHealth")
UnregisterForModEvent("Enderal_HideActorHealth")
endfunction
Function UpdateWidgetScale()
UI.InvokeFloat(HUD_MENU, WidgetRoot + ".setScale", _scale * 100.0)
EndFunction
@ -208,3 +219,5 @@ EndFunction
Function RemoveActorRaw(Form aActor)
UI.InvokeForm(HUD_MENU, WidgetRoot + ".removePanelActors", aActor)
EndFunction
GlobalVariable Property _00E_ActorHealthBarsEnabled Auto