Update CARM SUI-Inv and add SUI-Rads

This commit is contained in:
davidh
2022-05-11 03:16:11 -05:00
parent d742e5fad1
commit d9f4c8bd13
48 changed files with 5225 additions and 95 deletions

View File

@@ -25,7 +25,7 @@
------------------------------------------
-- Set the SpiffUI lib version
local SPIFFUI_VERSION = 1 --<<< DO NOT CHANGE UNLESS YOU KNOW WHAT YOU'RE DOING
local SPIFFUI_VERSION = 2 --<<< DO NOT CHANGE UNLESS YOU KNOW WHAT YOU'RE DOING
if SpiffUI then
if SpiffUI.Version >= SPIFFUI_VERSION then
return -- Don't do anything else
@@ -155,6 +155,7 @@ SpiffUI.preCheck = function()
end
local function keyDown(key)
--print("Pressed: " .. getKeyName(key) .. " | " .. key)
local player = SpiffUI.preCheck(key)
if not player then return end
for _,bind in ipairs(SpiffUI.KeyBinds) do
@@ -488,13 +489,14 @@ function SpiffUI:ModOptions()
end
end
-- Due to SpiffUI being loaded as one of the first mods, it will be one of the first to Boot
---- We don't want that, we want this to be last. So, this makes sure of that.
-- At first I had this run only once, but apparently when there's only 1 mod this breaks
---- So, OnPostBoot is added to run things last
SpiffUI.firstBoot = function()
Events.OnGameBoot.Add(function()
SpiffUI:OnGameBoot()
SpiffUI:OnPostBoot()
end)
Events.OnGameBoot.Remove(SpiffUI.firstBoot)
--Events.OnGameBoot.Remove(SpiffUI.firstBoot)
SpiffUI:OnGameBoot()
end
function SpiffUI:OnGameBoot()
@@ -513,7 +515,7 @@ function SpiffUI:OnGameBoot()
for i = 1, #keyBinding do
if keyBinding[i].value == name then
table.remove(keyBinding, i)
print("Removed Keybind: " .. name)
--print("Removed Keybind: " .. name)
found = true
break
end
@@ -524,7 +526,7 @@ function SpiffUI:OnGameBoot()
for i,bind in ipairs(SpiffUI.KeyBinds) do
if bind.name == name then
table.remove(SpiffUI.KeyBinds, i)
print("Removed SpiffUI Keybind: " .. name)
--print("Removed SpiffUI Keybind: " .. name)
break
end
end
@@ -547,6 +549,21 @@ function SpiffUI:OnGameBoot()
end
function SpiffUI:OnPostBoot()
-- Let's Remove some keys possibly added by mods
for name,_ in pairs(SpiffUI.KeyDisables) do
local found = false
for i = 1, #keyBinding do
if keyBinding[i].value == name then
table.remove(keyBinding, i)
--print("Removed Keybind: " .. name)
found = true
break
end
end
end
end
function SpiffUI:OnCreatePlayer(id)
for _,j in ipairs(SpiffUI) do
local mod = SpiffUI[j]

View File

@@ -131,18 +131,18 @@ function ISInventoryPage:update()
self.inventory:getParent():setHighlightColor(getCore():getObjectHighlitedColor());
self.coloredInv = self.inventory;
end
if not self.isCollapsed and self.inventoryPane.inventory:getType() == "floor" and self.inventoryPane.inventory:getItems():isEmpty() then
if self.autoHide and self.holdOpen and not self.prevMouse then
self:Collapse(true, "No Floor Items")
end
end
end
------------------------------------------
self.collapseCounter = 0
self.wasVisible = not self.isCollapsed
if not self.onCharacter and not self.isCollapsed and self.inventoryPane.inventory:getType() == "floor" and self.inventoryPane.inventory:getItems():isEmpty() then
if self.autoHide and self.holdOpen and not self.prevMouse and not spiff.config.mouseHide then
self:Collapse(true, "No Floor Items")
end
end
if not self.isCollapsed then
-- When we stop dragging, set panel to close after next mouseout or click, or set to tie with our friend
if not self.fVisible and (not ISMouseDrag.dragging or #ISMouseDrag.dragging == 0) and self.fromDrag then
@@ -173,7 +173,7 @@ function ISInventoryPage:update()
--- prevmouse is to not have this happen immediately, we need a tick for other logic to kick in on state change
--- holdOpen should prevent the window from closing if we click on an object
--- We do this here so we can check the mouse location with our buffer
if not self.fVisible and self.autoHide and not self.prevMouse and not self.holdOpen and not self.fromDrag and not self.toDrag and not self.wasDrag and not self:isMouseInBuffer() then
if not self.fVisible and not spiff.config.mouseHide and self.autoHide and not self.prevMouse and not self.holdOpen and not self.fromDrag and not self.toDrag and not self.wasDrag and not self:isMouseInBuffer() then
self:Collapse(true, "Autohide")
end
@@ -463,6 +463,7 @@ function ISInventoryPage:InitSUI()
self.wasDrag = false
self.wasVisible = false
--self.mouseHide = spiff.config.mouseHide
end
function ISInventoryPage:SUIReset()

View File

@@ -7,7 +7,8 @@ SpiffUI = SpiffUI or {}
local spiff = SpiffUI:Register("inventory")
spiff.config = {
enabled = true
enabled = true,
mouseHide = false
}
local function SpiffUIBoot()
@@ -16,6 +17,7 @@ local function SpiffUIBoot()
local options = data.settings.options
-- Set options
spiff.config.enabled = options.enableInv
spiff.config.mouseHide = options.mouseHide
SpiffUI.equippedItem["Inventory"] = not options.hideInv
end
@@ -40,6 +42,12 @@ local function SpiffUIBoot()
OnApplyMainMenu = apply,
OnApplyInGame = applyGame,
},
mouseHide = {
name = "UI_ModOptions_SpiffUI_Inv_mouseHide",
default = false,
OnApplyMainMenu = apply,
OnApplyInGame = apply,
},
},
mod_id = "SpiffUI - Inventory",
mod_shortname = "SpiffUI-Inv",

View File

@@ -23,5 +23,7 @@ UI_EN = {
UI_ModOptions_SpiffUI_Inv_hideInv = "Hide Inventory Button",
UI_ModOptions_SpiffUI_Inv_mouseHide = "Only Autohide on Mouse Click",
UI_optionscreen_binding_SpiffUI_Inv = "Toggle Inventory"
}

View File

@@ -0,0 +1,31 @@
UI_RU = {
-- SpiffUI
UI_Hello_SpiffUI = "Hello SpiffUI!",
UI_Name_SpiffUI = "SpiffUI",
UI_optionscreen_binding_SpiffUI = "SpiffUI"
UI_ModOptions_SpiffUI_applyNewKeybinds = "Установите рекомендуемые сочетания клавиш SpiffUI",
UI_ModOptions_SpiffUI_Modal_applyNewKeybinds = "<CENTRE><SIZE:medium> Установить привязки клавиш SpiffUI <LINE><LINE><LEFT><SIZE:small> Устанавливает следующие сочетания клавиш: <LINE>",
UI_ModOptions_SpiffUI_Modal_aNKChild = " <LINE> %1 для: [%2] ",
UI_ModOptions_SpiffUI_runAllResets = "Запустить полный сброс SpiffUI",
UI_ModOptions_SpiffUI_tooltip_runResets = "Работает только в игре!",
UI_ModOptions_SpiffUI_Modal_runResets = "<CENTRE><SIZE:medium> Сброс SpiffUI <LINE><LINE><LEFT><SIZE:small> Будут сброшены: <LINE>",
-- SpiffUI -- Inventory
UI_Hello_SpiffUI_Inv = "Hello SpiffUI - Инвентарь!",
UI_Name_SpiffUI_Inv = "SpiffUI - Инвентарь",
UI_ModOptions_SpiffUI_Inv_enable = "Включить инвентарь SpiffUI",
UI_ModOptions_SpiffUI_Inv_tooltip_enable = "Примечание. В игре требуется перезагрузка!",
UI_ModOptions_SpiffUI_Inv_hideInv = "Скрыть кнопку инвентаря",
UI_ModOptions_SpiffUI_Inv_mouseHide = "Только автоматическое скрытие по щелчку мыши",
UI_optionscreen_binding_SpiffUI_Inv = "Переключить инвентарь",
}