diff --git a/CREDITS.md b/CREDITS.md index db0e3128..49b4c210 100644 --- a/CREDITS.md +++ b/CREDITS.md @@ -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 - [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 +- [CreepSore](https://github.com/CreepSore) for creating the bag of crafting search feature diff --git a/descriptions/rep/en_us.lua b/descriptions/rep/en_us.lua index 139368d0..f1239a0a 100644 --- a/descriptions/rep/en_us.lua +++ b/descriptions/rep/en_us.lua @@ -1151,6 +1151,7 @@ EID.descriptions[languageCode].spindownError = "Item disappears" EID.descriptions[languageCode].CraftingBagContent = "Bag:" EID.descriptions[languageCode].CraftingRoomContent = "Room:" EID.descriptions[languageCode].CraftingFloorContent = "Floor:" +EID.descriptions[languageCode].CraftingSearch = "Search:" EID.descriptions[languageCode].CraftingBagQuality = "Bag Quality:" EID.descriptions[languageCode].CraftingBestQuality = "Best Quality:" @@ -1159,7 +1160,7 @@ EID.descriptions[languageCode].CraftingHideKey = "Hide:" EID.descriptions[languageCode].CraftingPreviewKey = "Preview:" 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].BlankCardEffect = "Blank Card effect:" diff --git a/eid_bagofcrafting_search.lua b/eid_bagofcrafting_search.lua index 085a5613..169fa7c8 100644 --- a/eid_bagofcrafting_search.lua +++ b/eid_bagofcrafting_search.lua @@ -1,6 +1,7 @@ -- Valid values: -- 0 -> Reset search query after search EID.BoCSLockMode = 0 +local game = Game() local locked = false local indexCharMapping = " ??????'????,-./0123456789?;?????abcdefghijklmnopqrstuvwxyz" @@ -54,6 +55,7 @@ function EID:BoCSSetSearchInputEnabled(newState, force) if EID.BoCSLockMode == 0 and EID:BoCSGetLocked() and force ~= true then return end + newState = newState and EID.Config["BagOfCraftingDisplayRecipesMode"] == "Recipe List" searchInputEnabled = newState if newState then @@ -130,7 +132,7 @@ local function handleSearchInput() return end - local currentFrame = Game():GetFrameCount() + local currentFrame = game:GetFrameCount() -- 30 Frames = 1 second -- 15 = 500ms 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 function EID:BoCSHandleInput() - if Game():IsPaused() then + if game:IsPaused() then return end @@ -183,13 +185,13 @@ function EID:BoCSGetSearchLine() return nil end - local result = "" + local result = "{{MagnifyingLens}} " if searchInputEnabled then - result = "{{ColorGreen}}" + result = result .. "{{ColorLime}}" end - - result = result .. "Search: " .. searchValue + local searchDescription = EID:getDescriptionEntry("CraftingSearch") + result = result .. searchDescription .. " " .. searchValue if EID.BoCSLockMode == 0 and EID:BoCSGetLocked() then result = result .. "{{Trinket159}}" @@ -320,7 +322,7 @@ function EID:BoCSHookInput() end --- Blocks all input actions triggered by the games bindings itself -function EID:BoCSBlockInputAction(entity, inputHook, buttonAction) +function EID:BoCSBlockInputAction(_, inputHook, _) local bagPlayer = nil if EID.isRepentance then local hasBag, player = EID:PlayersHaveCollectible(710)