Small fixes in the BoC Search feature

This commit is contained in:
Wofsauge committed 2024-05-31 22:57:29 +02:00
1 parent 08799daa47
commit c89cf4740b
3 files changed
+12 -8

No files matched your search

+1
View File
@@ -30,3 +30,4 @@ If you enjoy this mod and want to help on it, check it out on GitHub: https://gi
- biobak for creating a lot of inline icons and other improvements - biobak for creating a lot of inline icons and other improvements
- [eyeguy](https://twitter.com/eyeguyart) for creating the astonishing transformation icons - [eyeguy](https://twitter.com/eyeguyart) for creating the astonishing transformation icons
- [adc](https://steamcommunity.com/id/whytefang/) for creating an awesome new language pack and providing ideas for new functionalities - [adc](https://steamcommunity.com/id/whytefang/) for creating an awesome new language pack and providing ideas for new functionalities
- [CreepSore](https://github.com/CreepSore) for creating the bag of crafting search feature
+2 -1
View File
@@ -1151,6 +1151,7 @@ EID.descriptions[languageCode].spindownError = "Item disappears"
EID.descriptions[languageCode].CraftingBagContent = "Bag:" EID.descriptions[languageCode].CraftingBagContent = "Bag:"
EID.descriptions[languageCode].CraftingRoomContent = "Room:" EID.descriptions[languageCode].CraftingRoomContent = "Room:"
EID.descriptions[languageCode].CraftingFloorContent = "Floor:" EID.descriptions[languageCode].CraftingFloorContent = "Floor:"
EID.descriptions[languageCode].CraftingSearch = "Search:"
EID.descriptions[languageCode].CraftingBagQuality = "Bag Quality:" EID.descriptions[languageCode].CraftingBagQuality = "Bag Quality:"
EID.descriptions[languageCode].CraftingBestQuality = "Best Quality:" EID.descriptions[languageCode].CraftingBestQuality = "Best Quality:"
@@ -1159,7 +1160,7 @@ EID.descriptions[languageCode].CraftingHideKey = "Hide:"
EID.descriptions[languageCode].CraftingPreviewKey = "Preview:" EID.descriptions[languageCode].CraftingPreviewKey = "Preview:"
EID.descriptions[languageCode].CraftingPreviewBackup = "{{Warning}} If this item's locked, it will turn into" EID.descriptions[languageCode].CraftingPreviewBackup = "{{Warning}} If this item's locked, it will turn into"
EID.descriptions[languageCode].CraftingResults = "(Scroll: Hold {{CONFIG_BoC_Toggle}} + {{ButtonY}} {{ButtonA}}, Lock: {{ButtonX}}, Refresh: {{ButtonB}}, Reset Bag: Hold {{ButtonRB}})" EID.descriptions[languageCode].CraftingResults = "(Scroll: Hold {{CONFIG_BoC_Toggle}} + {{ButtonY}} {{ButtonA}}, Lock: {{ButtonX}}, Refresh: {{ButtonB}}, Reset Bag: Hold {{ButtonRB}}, Search: {{ButtonEnter}})"
EID.descriptions[languageCode].BlankCardCharge = "Blank Card charge:" EID.descriptions[languageCode].BlankCardCharge = "Blank Card charge:"
EID.descriptions[languageCode].BlankCardEffect = "Blank Card effect:" EID.descriptions[languageCode].BlankCardEffect = "Blank Card effect:"
+9 -7
View File
@@ -1,6 +1,7 @@
-- Valid values: -- Valid values:
-- 0 -> Reset search query after search -- 0 -> Reset search query after search
EID.BoCSLockMode = 0 EID.BoCSLockMode = 0
local game = Game()
local locked = false local locked = false
local indexCharMapping = " ??????'????,-./0123456789?;?????abcdefghijklmnopqrstuvwxyz" local indexCharMapping = " ??????'????,-./0123456789?;?????abcdefghijklmnopqrstuvwxyz"
@@ -54,6 +55,7 @@ function EID:BoCSSetSearchInputEnabled(newState, force)
if EID.BoCSLockMode == 0 and EID:BoCSGetLocked() and force ~= true then if EID.BoCSLockMode == 0 and EID:BoCSGetLocked() and force ~= true then
return return
end end
newState = newState and EID.Config["BagOfCraftingDisplayRecipesMode"] == "Recipe List"
searchInputEnabled = newState searchInputEnabled = newState
if newState then if newState then
@@ -130,7 +132,7 @@ local function handleSearchInput()
return return
end end
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, EID.bagPlayer.ControllerIndex, true) and (
@@ -161,7 +163,7 @@ end
--- Handles any input done related to Bag of Crafting search --- Handles any input done related to Bag of Crafting search
function EID:BoCSHandleInput() function EID:BoCSHandleInput()
if Game():IsPaused() then if game:IsPaused() then
return return
end end
@@ -183,13 +185,13 @@ function EID:BoCSGetSearchLine()
return nil return nil
end end
local result = "" local result = "{{MagnifyingLens}} "
if searchInputEnabled then if searchInputEnabled then
result = "{{ColorGreen}}" result = result .. "{{ColorLime}}"
end end
local searchDescription = EID:getDescriptionEntry("CraftingSearch")
result = result .. "Search: " .. searchValue result = result .. searchDescription .. " " .. searchValue
if EID.BoCSLockMode == 0 and EID:BoCSGetLocked() then if EID.BoCSLockMode == 0 and EID:BoCSGetLocked() then
result = result .. "{{Trinket159}}" result = result .. "{{Trinket159}}"
@@ -320,7 +322,7 @@ function EID:BoCSHookInput()
end end
--- Blocks all input actions triggered by the games bindings itself --- Blocks all input actions triggered by the games bindings itself
function EID:BoCSBlockInputAction(entity, inputHook, buttonAction) function EID:BoCSBlockInputAction(_, inputHook, _)
local bagPlayer = nil local bagPlayer = nil
if EID.isRepentance then if EID.isRepentance then
local hasBag, player = EID:PlayersHaveCollectible(710) local hasBag, player = EID:PlayersHaveCollectible(710)