Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Added Restart Mantella.exe MCM entry #84

Merged
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
1 change: 1 addition & 0 deletions Scripts/Source/MantellaMCM.psc
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ int property oid_NPCAngerToggle auto ;gia
int property oid_NPCPackageToggle auto

int property oid_debugNPCSelectMode auto
int property oid_restartMantellaExe Auto
int property oid_httpPort auto

string property PAGE_GENERAL = "General" auto
Expand Down
4 changes: 4 additions & 0 deletions Scripts/Source/MantellaMCM_AdvancedSettings.psc
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ endfunction

function LeftColumn(MantellaMCM mcm, MantellaRepository Repository) global
mcm.AddHeaderOption("Debug")
mcm.oid_restartMantellaExe = mcm.AddTextOption("Restart Mantella.exe", "")
mcm.oid_debugNPCselectMode = mcm.AddToggleOption("NPC Debug Select Mode", Repository.NPCdebugSelectModeEnabled)
endfunction

Expand Down Expand Up @@ -53,5 +54,8 @@ function OptionUpdate(MantellaMCM mcm, int optionID, MantellaRepository Reposito
if optionID == mcm.oid_debugNPCselectMode
Repository.NPCdebugSelectModeEnabled =! Repository.NPCdebugSelectModeEnabled
mcm.SetToggleOptionValue(mcm.oid_debugNPCselectMode, Repository.NPCdebugSelectModeEnabled)
elseif optionID == mcm.oid_restartMantellaExe
Repository.restartMantellaExe()
Debug.MessageBox("Restarting Mantella.exe... This can take a moment.")
endIf
endfunction
18 changes: 17 additions & 1 deletion Scripts/Source/MantellaRepository.psc
Original file line number Diff line number Diff line change
Expand Up @@ -98,14 +98,21 @@ bool property NPCPackage auto Conditional
bool property NPCDialogue auto ;gia

bool property NPCdebugSelectModeEnabled auto

; bool restartMantellaExe = False
int property HttpPort auto


event OnInit()
assignDefaultSettings(0, true)
endEvent

; event OnUpdate()
; If (restartMantellaExe)
; restartMantellaExe = false
; MantellaLauncher.LaunchMantellaExe()
; EndIf
; endEvent

; lastVersion is the previous MCM version number defined in 'MantellaMCM.psc' before the new update is applied.
; Whenever a new repository value OR a new MCM setting is added, up the MCM version number returned by `ManatellaMCM.GetVersion()`
; and add the corresponding default value here in a block corresponding to the version number like the examples below
Expand Down Expand Up @@ -244,6 +251,15 @@ bool Function IsVR()
return Debug.GetVersionNumber() == "1.4.15.0"
EndFunction

bool function restartMantellaExe()
; restartMantellaExe = true
; RegisterForSingleUpdate(1)
MantellaLauncher.LaunchMantellaExe()
;Note: If you need to debug this call to the SKSE plugin, you need to call it from the commented out single update above instead
; or the VS debugger will crash (due to being called from the MCM thread?).
; Check the corresponding commented out OnUpdate at the beginning of the script.
EndFunction

Event OnKeyDown(int KeyCode)
;this function was previously in MantellaListener Script back in Mantella 0.9.2
;this ensures the right key is pressed and only activated while not in menu mode
Expand Down