Skip to content

Commit

Permalink
Removed redundant line from wiki workflow, fixed none reference in On…
Browse files Browse the repository at this point in the history
…ConfigInit, and made MCM menus disappear if the page count = 0
  • Loading branch information
MrOctopus committed Jun 8, 2022
1 parent b0a6f9a commit b6b8b97
Show file tree
Hide file tree
Showing 9 changed files with 38 additions and 19 deletions.
1 change: 0 additions & 1 deletion .github/workflows/wiki.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ jobs:
if: success()
uses: Andrew-Chen-Wang/github-wiki-action@v2
env:
EXCLUDED_FILES: "ski_configbase.md"
WIKI_DIR: ./nl_mcm/wiki/
GH_TOKEN: ${{ github.token }}
GH_MAIL: ${{ secrets.NL_EMAIL }}
Expand Down
2 changes: 1 addition & 1 deletion main/scripts/source/nl_mcm.psc
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Scriptname nl_mcm extends SKI_ConfigBase
{!!!!!!DO NOT RECOMPILE!!!!!!
@author NeverLost
@version 1.0.5
@version 1.0.6
}

int function GetVersion()
Expand Down
2 changes: 1 addition & 1 deletion main/scripts/source/nl_mcm_globalinfo.psc
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Scriptname nl_mcm_globalinfo
{!!!!!!DO NOT RECOMPILE!!!!!!
@author NeverLost
@version 1.0.5
@version 1.0.6
}

bool function IsInstalled() global
Expand Down
2 changes: 1 addition & 1 deletion main/scripts/source/nl_mcm_module.psc
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Scriptname nl_mcm_module extends Quest
{!!!!!!DO NOT RECOMPILE!!!!!!
@author NeverLost
@version 1.0.5
@version 1.0.6
}

; ------\-------\
Expand Down
2 changes: 1 addition & 1 deletion main/scripts/source/nl_mcm_playerloadalias.psc
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Scriptname nl_mcm_playerloadalias extends ReferenceAlias
{!!!!!!DO NOT RECOMPILE!!!!!!
@author NeverLost
@version 1.0.5
@version 1.0.6
}

event OnInit()
Expand Down
40 changes: 30 additions & 10 deletions main/source/nl_mcm.psc
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Scriptname nl_mcm extends SKI_ConfigBase
{
This documents the important functions in the backbone nl_mcm script.
@author NeverLost
@version 1.0.5
@version 1.0.6
}

int function GetVersion()
Expand Down Expand Up @@ -111,16 +111,16 @@ endproperty
; MCM \ INTERNAL \
;--------------------------------------------------------

; None array pointers
; None array pointer
; workaround for weird Papyrus design choice
string[] _none_string_ptr
int[] _none_int_ptr

; GO ON

nl_mcm_module[] _modules
int[] _pages_z

SKI_ConfigManager _manager
quest _owning_quest

string _key_store
Expand Down Expand Up @@ -231,8 +231,15 @@ event OnGameReload()
_mutex_store = False

if active_modules == 0
Pages = _none_string_ptr
_pages_z = _none_int_ptr
while _manager && _manager.UnregisterMod(self) == -2
endwhile

_initialized = False
_id = 0

Pages = new string[128]
_pages_z = new int[128]
_modules[0] = None
else
Pages = Utility.ResizeStringArray(Pages, active_modules)
_pages_z = Utility.ResizeIntArray(_pages_z, active_modules)
Expand Down Expand Up @@ -269,6 +276,12 @@ event OnConfigClose()

_mutex_modules = true

; Check for empty pages
if _modules[0] == None
_mutex_modules = False
return
endif

nl_mcm_module[] modules_tmp
int len = Pages.Length
int i = 0
Expand Down Expand Up @@ -527,8 +540,15 @@ int function _UnregisterModule(string page_name)
endif

if j == 0
Pages = _none_string_ptr
_pages_z = _none_int_ptr
while _manager && _manager.UnregisterMod(self) == -2
endwhile

_initialized = False
_id = -1

Pages = new string[128]
_pages_z = new int[128]
_modules[0] = None
else
while i < j
int k = i + 1
Expand Down Expand Up @@ -716,13 +736,13 @@ event OnConfigManagerReset(string a_eventName, string a_strArg, float a_numArg,
endEvent

event OnConfigManagerReady(string a_eventName, string a_strArg, float a_numArg, Form a_sender)
SKI_ConfigManager newManager = a_sender as SKI_ConfigManager
_manager = a_sender as SKI_ConfigManager

if newManager == none || _id >= 0
if _manager == none || _id >= 0
return
endif

_id = newManager.RegisterMod(self, ModName)
_id = _manager.RegisterMod(self, ModName)

if _id >= 0
; Unregister to avoid polling events
Expand Down
4 changes: 2 additions & 2 deletions main/source/nl_mcm_globalinfo.psc
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Scriptname nl_mcm_globalinfo
{
This documents useful global functions to check the nl_mcm api version/state.
@author NeverLost
@version 1.0.5
@version 1.0.6
}

bool function IsInstalled() global
Expand All @@ -18,5 +18,5 @@ int function CurrentVersion() global
Get the current version of nl_mcm
@return The current nl_mcm version
}
return 105
return 106
endfunction
2 changes: 1 addition & 1 deletion main/source/nl_mcm_module.psc
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Scriptname nl_mcm_module extends Quest
For the original MCM Api, see [link](https://github.com/schlangster/skyui/wiki/MCM-API-Reference). \
Only STATE api functions are supported as part of the new api.
@author NeverLost
@version 1.0.5
@version 1.0.6
}

; ------\-------\
Expand Down
2 changes: 1 addition & 1 deletion main/source/nl_mcm_playerloadalias.psc
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Scriptname nl_mcm_playerloadalias extends ReferenceAlias
{
@author NeverLost
@version 1.0.5
@version 1.0.6
}

quest _owner
Expand Down

0 comments on commit b6b8b97

Please sign in to comment.