Fixed BoC search feature blocking controller inputs; Added configurable key for search feature toggle
This commit is contained in:
1 parent
f358080666
commit
cf27dfea20
3 files changed
+22
-16
No files matched your search
@@ -424,6 +424,10 @@ EID.UserConfig = {
|
|||||||
-- Of note are Controller.STICK_LEFT and Controller.STICK_RIGHT (pushing the sticks in), which aren't used in-game with default controls
|
-- Of note are Controller.STICK_LEFT and Controller.STICK_RIGHT (pushing the sticks in), which aren't used in-game with default controls
|
||||||
-- Default = none (-1)
|
-- Default = none (-1)
|
||||||
["CraftingResultButton"] = -1,
|
["CraftingResultButton"] = -1,
|
||||||
|
-- Set the keybinding to toggle the search feature on and off
|
||||||
|
-- Look into the AB+ or Repentance documentation for the key names here: https://wofsauge.github.io/IsaacDocs/rep/enums/Keyboard.html
|
||||||
|
-- Default = Keyboard.KEY_ENTER
|
||||||
|
["CraftingSearchKey"] = Keyboard.KEY_ENTER,
|
||||||
|
|
||||||
|
|
||||||
---------- Save Game Options ------------
|
---------- Save Game Options ------------
|
||||||
@@ -603,6 +607,7 @@ EID.DefaultConfig = {
|
|||||||
["CraftingHideButton"] = -1,
|
["CraftingHideButton"] = -1,
|
||||||
["CraftingResultKey"] = Keyboard.KEY_F4,
|
["CraftingResultKey"] = Keyboard.KEY_F4,
|
||||||
["CraftingResultButton"] = -1,
|
["CraftingResultButton"] = -1,
|
||||||
|
["CraftingSearchKey"] = Keyboard.KEY_ENTER,
|
||||||
|
|
||||||
["ItemReminderEnabled"] = true,
|
["ItemReminderEnabled"] = true,
|
||||||
["ItemReminderDisplayMode"] = "All",
|
["ItemReminderDisplayMode"] = "All",
|
||||||
|
|||||||
@@ -126,7 +126,7 @@ local function handleSearchInput()
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
if Input.IsButtonTriggered(Keyboard.KEY_ESCAPE, EID.bagPlayer.ControllerIndex, true) then
|
if Input.IsButtonTriggered(Keyboard.KEY_ESCAPE, 0, true) then
|
||||||
EID:BoCSSetSearchInputEnabled(false)
|
EID:BoCSSetSearchInputEnabled(false)
|
||||||
EID:BoCSSetSearchValue("")
|
EID:BoCSSetSearchValue("")
|
||||||
return
|
return
|
||||||
@@ -140,9 +140,9 @@ local function handleSearchInput()
|
|||||||
-- enum values are integers
|
-- enum values are integers
|
||||||
for i=Keyboard.KEY_SPACE,Keyboard.KEY_RIGHT_BRACKET do
|
for i=Keyboard.KEY_SPACE,Keyboard.KEY_RIGHT_BRACKET do
|
||||||
index = index + 1
|
index = index + 1
|
||||||
if Input.IsButtonTriggered(i, EID.bagPlayer.ControllerIndex, true) then
|
if Input.IsButtonTriggered(i, 0, true) then
|
||||||
local toAppend = indexCharMapping:sub(index, index)
|
local toAppend = indexCharMapping:sub(index, index)
|
||||||
local isShiftPressed = (Input.IsButtonPressed(Keyboard.KEY_LEFT_SHIFT, EID.bagPlayer.ControllerIndex, true) or Input.IsButtonPressed(Keyboard.KEY_RIGHT_SHIFT, EID.bagPlayer.ControllerIndex, true))
|
local isShiftPressed = (Input.IsButtonPressed(Keyboard.KEY_LEFT_SHIFT, 0, true) or Input.IsButtonPressed(Keyboard.KEY_RIGHT_SHIFT, 0, true))
|
||||||
if isShiftPressed then toAppend = shiftCharMapping:sub(index, index) end
|
if isShiftPressed then toAppend = shiftCharMapping:sub(index, index) end
|
||||||
|
|
||||||
newValue = newValue .. toAppend
|
newValue = newValue .. toAppend
|
||||||
@@ -157,7 +157,7 @@ local function handleSearchInput()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if Input.IsButtonTriggered(Keyboard.KEY_BACKSPACE, EID.bagPlayer.ControllerIndex, true) then
|
if Input.IsButtonTriggered(Keyboard.KEY_BACKSPACE, 0, true) then
|
||||||
lastBackspaceTrigger = 0
|
lastBackspaceTrigger = 0
|
||||||
backspaceStep = 0
|
backspaceStep = 0
|
||||||
return
|
return
|
||||||
@@ -166,7 +166,7 @@ local function handleSearchInput()
|
|||||||
local currentFrame = game:GetFrameCount()
|
local currentFrame = game:GetFrameCount()
|
||||||
-- 30 Frames = 1 second
|
-- 30 Frames = 1 second
|
||||||
-- 15 = 500ms
|
-- 15 = 500ms
|
||||||
if Input.IsButtonPressed(Keyboard.KEY_BACKSPACE, EID.bagPlayer.ControllerIndex, true) and (
|
if Input.IsButtonPressed(Keyboard.KEY_BACKSPACE, 0, true) and (
|
||||||
backspaceStep == 0
|
backspaceStep == 0
|
||||||
or
|
or
|
||||||
(backspaceStep == 1 and currentFrame - lastBackspaceTrigger >= 15) -- we delay the second deletion a little bit more
|
(backspaceStep == 1 and currentFrame - lastBackspaceTrigger >= 15) -- we delay the second deletion a little bit more
|
||||||
@@ -174,9 +174,9 @@ local function handleSearchInput()
|
|||||||
(backspaceStep >= 2 and currentFrame - lastBackspaceTrigger >= 1)
|
(backspaceStep >= 2 and currentFrame - lastBackspaceTrigger >= 1)
|
||||||
) then
|
) then
|
||||||
local isControlPressed = (
|
local isControlPressed = (
|
||||||
Input.IsButtonPressed(Keyboard.KEY_LEFT_CONTROL, EID.bagPlayer.ControllerIndex, true)
|
Input.IsButtonPressed(Keyboard.KEY_LEFT_CONTROL, 0, true)
|
||||||
or
|
or
|
||||||
Input.IsButtonPressed(Keyboard.KEY_RIGHT_CONTROL, EID.bagPlayer.ControllerIndex, true)
|
Input.IsButtonPressed(Keyboard.KEY_RIGHT_CONTROL, 0, true)
|
||||||
)
|
)
|
||||||
|
|
||||||
if isControlPressed then
|
if isControlPressed then
|
||||||
@@ -207,15 +207,13 @@ function EID:BoCSHandleInput()
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- Clear the previous search when Enter is pressed
|
-- Clear the previous search when Enter is pressed
|
||||||
-- TODO: make this a modifiable hotkey
|
if Input.IsButtonTriggered(EID.Config["CraftingSearchKey"], 0, true) then
|
||||||
if Input.IsButtonTriggered(Keyboard.KEY_ENTER, EID.bagPlayer.ControllerIndex, true) then
|
|
||||||
if not searchInputEnabled then EID:BoCSSetSearchValue("") end
|
if not searchInputEnabled then EID:BoCSSetSearchValue("") end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Start a new search when Enter is pressed
|
-- Start a new search when Enter is pressed
|
||||||
-- TODO: make this a modifiable hotkey
|
|
||||||
-- by default, both are Enter, but for instance clearing could be Backspace and then you could modify a search term with Enter
|
-- by default, both are Enter, but for instance clearing could be Backspace and then you could modify a search term with Enter
|
||||||
if Input.IsButtonTriggered(Keyboard.KEY_ENTER, EID.bagPlayer.ControllerIndex, true) then
|
if Input.IsButtonTriggered(EID.Config["CraftingSearchKey"], 0, true) then
|
||||||
EID:BoCSSetSearchInputEnabled(not searchInputEnabled)
|
EID:BoCSSetSearchInputEnabled(not searchInputEnabled)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
@@ -262,7 +260,7 @@ function EID:BoCSHookInputIsButtonTriggered()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if bagPlayer == nil or controller ~= bagPlayer.ControllerIndex then
|
if bagPlayer == nil or controller ~= 0 then -- only execute for keyboard
|
||||||
return oldInputIsButtonTriggered(key, controller)
|
return oldInputIsButtonTriggered(key, controller)
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -286,7 +284,7 @@ function EID:BoCSHookInputIsButtonPressed()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if bagPlayer == nil or controller ~= bagPlayer.ControllerIndex then
|
if bagPlayer == nil or controller ~= 0 then -- only execute for keyboard
|
||||||
return oldInputIsButtonPressed(key, controller)
|
return oldInputIsButtonPressed(key, controller)
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -310,7 +308,7 @@ function EID:BoCSHookInputIsActionPressed()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if bagPlayer == nil or controller ~= bagPlayer.ControllerIndex then
|
if bagPlayer == nil or controller ~= 0 then -- only execute for keyboard
|
||||||
return oldInputIsActionPressed(key, controller)
|
return oldInputIsActionPressed(key, controller)
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -334,8 +332,8 @@ function EID:BoCSHookInputIsActionTriggered()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if bagPlayer == nil or controller ~= bagPlayer.ControllerIndex then
|
if bagPlayer == nil or controller ~= 0 then
|
||||||
return oldInputIsActionTriggered(key, controller)
|
return oldInputIsActionTriggered(key, controller) -- only execute for keyboard
|
||||||
end
|
end
|
||||||
|
|
||||||
return false
|
return false
|
||||||
|
|||||||
@@ -688,6 +688,9 @@ if MCMLoaded then
|
|||||||
EID:AddHotkeySetting("Crafting",
|
EID:AddHotkeySetting("Crafting",
|
||||||
"CraftingResultButton", "Result Toggle (Controller)",
|
"CraftingResultButton", "Result Toggle (Controller)",
|
||||||
"Press this button to toggle the description of the item ready to be crafted (Left Stick or Right Stick recommended; most other buttons will not work)", true)
|
"Press this button to toggle the description of the item ready to be crafted (Left Stick or Right Stick recommended; most other buttons will not work)", true)
|
||||||
|
EID:AddHotkeySetting("Crafting",
|
||||||
|
"CraftingSearchKey", "Search Toggle (Keyboard only)",
|
||||||
|
"Press this key to toggle the search feature", false)
|
||||||
|
|
||||||
MCM.AddSpace("EID", "Crafting")
|
MCM.AddSpace("EID", "Crafting")
|
||||||
--------Clear bag---------
|
--------Clear bag---------
|
||||||
|
|||||||
Reference in new issue
Block a user