Add controller hotkey display support
This commit is contained in:
1 parent
15657e0b27
commit
ffe82599f6
1 file changed
+25
-7
+25
-7
@@ -715,23 +715,41 @@ for key,num in pairs(Keyboard) do
|
|||||||
keyString = string.gsub(keyString, "_", " ")
|
keyString = string.gsub(keyString, "_", " ")
|
||||||
HotkeyToString[num] = keyString
|
HotkeyToString[num] = keyString
|
||||||
end
|
end
|
||||||
|
--convert controller enum to buttons
|
||||||
|
local ControllerToString = { [0] = "{{ButtonDLeft}}", "{{ButtonDRight}}", "{{ButtonDUp}}", "{{ButtonDDown}}",
|
||||||
|
"{{ButtonA}}", "{{ButtonB}}", "{{ButtonX}}", "{{ButtonY}}", "{{ButtonLB}}", "{{ButtonLT}}", "{{ButtonLStick}}",
|
||||||
|
"{{ButtonRB}}", "{{ButtonRT}}", "{{ButtonRStick}}", "{{ButtonSelect}}", "{{ButtonMenu}}" }
|
||||||
|
|
||||||
local function getHotkeyString()
|
local function getHotkeyString()
|
||||||
local hotkeyString = ""
|
local hotkeyString = ""
|
||||||
local hideDesc = EID:getDescriptionEntry("CraftingHideKey")
|
local hideDesc = EID:getDescriptionEntry("CraftingHideKey")
|
||||||
local previewDesc = EID:getDescriptionEntry("CraftingPreviewKey")
|
local previewDesc = EID:getDescriptionEntry("CraftingPreviewKey")
|
||||||
--we have a binding for a keyboard hide key
|
|
||||||
if HotkeyToString[EID.Config["CraftingHideKey"]] then
|
local controllerEnabled = EID.player.ControllerIndex > 0
|
||||||
hotkeyString = hideDesc .. " " .. HotkeyToString[EID.Config["CraftingHideKey"]]
|
local hideKey = HotkeyToString[EID.Config["CraftingHideKey"]]
|
||||||
|
local hideButton = controllerEnabled and ControllerToString[EID.Config["CraftingHideButton"]]
|
||||||
|
local previewKey = HotkeyToString[EID.Config["CraftingResultKey"]]
|
||||||
|
local previewButton = controllerEnabled and ControllerToString[EID.Config["CraftingResultButton"]]
|
||||||
|
|
||||||
|
if hideKey or hideButton then hotkeyString = hideDesc .. " " end
|
||||||
|
if hideKey and hideButton then
|
||||||
|
hotkeyString = hotkeyString .. hideKey .. "/" .. hideButton
|
||||||
|
else
|
||||||
|
hotkeyString = hotkeyString .. (hideKey or hideButton)
|
||||||
end
|
end
|
||||||
--we have a binding for a keyboard preview toggle key, and a full bag, and aren't on Preview Only mode
|
|
||||||
if #EID.BagItems >= 8 and EID.Config["BagOfCraftingDisplayMode"] ~= "Preview Only" and HotkeyToString[EID.Config["CraftingResultKey"]] then
|
if #EID.BagItems >= 8 and EID.Config["BagOfCraftingDisplayMode"] ~= "Preview Only" then
|
||||||
if hotkeyString ~= "" then hotkeyString = hotkeyString .. ", " end
|
if previewKey or previewButton then hotkeyString = hotkeyString .. ", " .. previewDesc .. " " end
|
||||||
hotkeyString = hotkeyString .. previewDesc .. " " .. HotkeyToString[EID.Config["CraftingResultKey"]]
|
if previewKey and previewButton then
|
||||||
|
hotkeyString = hotkeyString .. previewKey .. "/" .. previewButton
|
||||||
|
else
|
||||||
|
hotkeyString = hotkeyString .. (previewKey or previewButton)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
if hotkeyString ~= "" then
|
if hotkeyString ~= "" then
|
||||||
hotkeyString = "!!! " .. hotkeyString .. "#"
|
hotkeyString = "!!! " .. hotkeyString .. "#"
|
||||||
end
|
end
|
||||||
|
|
||||||
return hotkeyString
|
return hotkeyString
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user