Skip to content

Commit

Permalink
Merge pull request #128 from Lemonymous/fixes-misc
Browse files Browse the repository at this point in the history
Fixes misc
  • Loading branch information
kartoFlane authored Apr 11, 2022
2 parents a91eecb + c56fad2 commit f290628
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 6 deletions.
2 changes: 1 addition & 1 deletion scripts/mod_loader/modapi/misc.lua
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ function modApi:getModOptions(modId)

if modId == nil then
Assert.ModInitializingOrLoading("Argument #1 must be specified outside of init or load")
modId = mod_loader.currentMod
modId = self.currentMod
end

Assert.True(mod_loader:hasMod(modId), "Mod not found")
Expand Down
15 changes: 11 additions & 4 deletions scripts/mod_loader/modui/mod_configuration.lua
Original file line number Diff line number Diff line change
Expand Up @@ -432,10 +432,6 @@ end

local function buildModConfigContent(scroll)

if currentSelectedOptions == nil then
currentSelectedOptions = buildLightModOptions()
end

openDropdowns = {}

scrollContent = UiBoxLayout()
Expand Down Expand Up @@ -572,3 +568,14 @@ function ConfigureMods()

showModConfig()
end

local function updateCurrentModConfiguration()
currentSelectedOptions = buildLightModOptions()
end

function modApi:getCurrentModConfiguration()
return currentSelectedOptions
end

modApi.events.onModsInitialized:subscribe(updateCurrentModConfiguration)
modApi.events.onProfileChanged:subscribe(updateCurrentModConfiguration)
2 changes: 1 addition & 1 deletion scripts/mod_loader/ui/widgets/base.lua
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ end
element successfully obtained focus.
--]]
function Ui:setfocus()
if not self.visible then return false end
if not self.visible or self.root == nil then return false end

self.root:setfocus(self)
end
Expand Down

0 comments on commit f290628

Please sign in to comment.