Skip to content

Commit

Permalink
Merge pull request #84 from Leidtier/add-restart-mantella-exe-mcm-entry
Browse files Browse the repository at this point in the history
Added `Restart Mantella.exe` MCM entry
  • Loading branch information
art-from-the-machine authored Aug 19, 2024
2 parents ba9bedb + 15c319e commit a00b20d
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 1 deletion.
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

0 comments on commit a00b20d

Please sign in to comment.