Skip to content

Commit

Permalink
rebirth allow specifying a list of input contexts to check
Browse files Browse the repository at this point in the history
  • Loading branch information
poco0317 committed Jul 16, 2023
1 parent aae7aae commit a2cfa87
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions Themes/Rebirth/Scripts/10 InputContextManager.lua
Original file line number Diff line number Diff line change
Expand Up @@ -76,13 +76,16 @@ function CONTEXTMAN.RegisterToContextSet(self, screen, group, name)
self.ScreenToContext[screen][group][name] = true
end

-- return if a group exists and is enabled
function CONTEXTMAN.CheckContextSet(self, screen, group)
-- return if a list of groups exists and is enabled
function CONTEXTMAN.CheckContextSet(self, screen, ...)
if self.ContextIgnored then return false end

if self.ScreenToContext[screen] ~= nil then
if self.ScreenToContext[screen][group] ~= nil then
return self.ScreenToContext[screen][group].enabled
local groups = {...}
for _, group in ipairs(groups) do
if self.ScreenToContext[screen][group] ~= nil then
return self.ScreenToContext[screen][group].enabled
end
end
end
return false
Expand Down

0 comments on commit a2cfa87

Please sign in to comment.