diff --git a/eid_bagofcrafting.lua b/eid_bagofcrafting.lua index ba3bfa9e..3a4c289d 100644 --- a/eid_bagofcrafting.lua +++ b/eid_bagofcrafting.lua @@ -664,6 +664,7 @@ local refreshPosition = 0 local bagOfCraftingRefreshes = 0 local downHeld = 0 local upHeld = 0 +local resetBagCounter = 0 local craftingIsHidden = false local showCraftingResult = false @@ -1020,7 +1021,7 @@ function EID:handleBagOfCraftingRendering() local resultDesc = EID:getDescriptionEntry("CraftingResults") EID:appendToDescription(customDescObj, resultDesc) if Input.IsActionPressed(EID.Config["BagOfCraftingToggleKey"], EID.player.ControllerIndex) then - EID.player:SetShootingCooldown(2) + EID.player.ControlsCooldown = 2 if Input.IsActionTriggered(ButtonAction.ACTION_SHOOTDOWN, EID.player.ControllerIndex) then bagOfCraftingOffset = math.min(numResults-(numResults%EID.Config["BagOfCraftingResults"]), bagOfCraftingOffset + EID.Config["BagOfCraftingResults"]) downHeld = Isaac.GetTime() @@ -1045,6 +1046,16 @@ function EID:handleBagOfCraftingRendering() bagOfCraftingOffset = math.max(0, bagOfCraftingOffset - EID.Config["BagOfCraftingResults"]) upHeld = Isaac.GetTime() - 700 end + --reset bag contents when holding Use Pill/Card + if Input.IsActionPressed(ButtonAction.ACTION_PILLCARD, EID.player.ControllerIndex) then + resetBagCounter = resetBagCounter + 1 + if resetBagCounter > 120 then + EID.BagItems = {} + resetBagCounter = 0 + end + else + resetBagCounter = 0 + end end --fix bug with being allowed to go to an empty page if recipe count = multiple of page size (or if we refresh on last page) if (bagOfCraftingOffset >= numResults) then bagOfCraftingOffset = bagOfCraftingOffset - EID.Config["BagOfCraftingResults"] end