Added Scroll and hide features for Bag of crafting
This commit is contained in:
1 parent
10cd31d7cb
commit
94fa9d9456
4 files changed
+70
-15
No files matched your search
@@ -535,5 +535,5 @@ EID.descriptions["en_us"].horsepills={
|
|||||||
}
|
}
|
||||||
|
|
||||||
EID.descriptions["en_us"].CraftingRoomContent = "Pickups in room:"
|
EID.descriptions["en_us"].CraftingRoomContent = "Pickups in room:"
|
||||||
EID.descriptions["en_us"].CraftingResults = "Results:"
|
EID.descriptions["en_us"].CraftingResults = "Results:#(Scroll: Hold TAB + Shoot △/▽)"
|
||||||
|
|
||||||
+7
-1
@@ -123,12 +123,18 @@ EID.DefaultConfig = {
|
|||||||
-- Toggle Display of Diceroom descriptions
|
-- Toggle Display of Diceroom descriptions
|
||||||
-- Default = true
|
-- Default = true
|
||||||
["DisplayDiceInfo"] = true,
|
["DisplayDiceInfo"] = true,
|
||||||
-------------MISC---------------
|
---------Bag of Crafting-----------
|
||||||
|
|
||||||
|
-- Display-modes for Bag of Crafting descriptions
|
||||||
|
-- Options: "always", "hold", "never"
|
||||||
|
-- "always" = Always show Results, "hold" = Show when holding up bag, "never" = Never show results
|
||||||
|
-- Default = "always"
|
||||||
|
["DisplayBagOfCrafting"] = "always",
|
||||||
-- Changes the number of Results shown in the Bag of crafting description
|
-- Changes the number of Results shown in the Bag of crafting description
|
||||||
-- Higher numbers can cause more lag!
|
-- Higher numbers can cause more lag!
|
||||||
-- Default = 7
|
-- Default = 7
|
||||||
["BagOfCraftingResults"] = 7,
|
["BagOfCraftingResults"] = 7,
|
||||||
|
-------------MISC---------------
|
||||||
-- Changes the number of Results shown for the additional Spindown dice description
|
-- Changes the number of Results shown for the additional Spindown dice description
|
||||||
-- Default = 3
|
-- Default = 3
|
||||||
["SpindownDiceResults"] = 3,
|
["SpindownDiceResults"] = 3,
|
||||||
|
|||||||
@@ -332,6 +332,8 @@ end
|
|||||||
|
|
||||||
local randResultCache = {}
|
local randResultCache = {}
|
||||||
|
|
||||||
|
EID.bagOfCraftingOffset = 0
|
||||||
|
|
||||||
local function handleBagOfCraftingRendering()
|
local function handleBagOfCraftingRendering()
|
||||||
local results = {}
|
local results = {}
|
||||||
local bagItems = {} -- TODO: Get content of Bag
|
local bagItems = {} -- TODO: Get content of Bag
|
||||||
@@ -373,11 +375,13 @@ local function handleBagOfCraftingRendering()
|
|||||||
end
|
end
|
||||||
randResultCache[queryString] = calcResults
|
randResultCache[queryString] = calcResults
|
||||||
results = calcResults
|
results = calcResults
|
||||||
|
EID.bagOfCraftingOffset = 0
|
||||||
else
|
else
|
||||||
results = randResultCache[queryString]
|
results = randResultCache[queryString]
|
||||||
end
|
end
|
||||||
|
|
||||||
if #results == 0 then
|
if #results == 0 then
|
||||||
|
EID.bagOfCraftingOffset = 0
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -386,18 +390,37 @@ local function handleBagOfCraftingRendering()
|
|||||||
local resultDesc = EID.descriptions[EID.Config["Language"]].CraftingResults or EID.descriptions["en_us"].CraftingResults
|
local resultDesc = EID.descriptions[EID.Config["Language"]].CraftingResults or EID.descriptions["en_us"].CraftingResults
|
||||||
customDescObj.Description = roomDesc.."#"..EID:tableToCraftingIconsMerged(floorItems).."#"..resultDesc
|
customDescObj.Description = roomDesc.."#"..EID:tableToCraftingIconsMerged(floorItems).."#"..resultDesc
|
||||||
|
|
||||||
|
if Input.IsActionPressed(ButtonAction.ACTION_MAP, 0) or Input.IsActionPressed(ButtonAction.ACTION_MAP, 1) then
|
||||||
|
if Input.IsActionTriggered(ButtonAction.ACTION_SHOOTDOWN, 0) or Input.IsActionTriggered(ButtonAction.ACTION_SHOOTDOWN, 1) then
|
||||||
|
EID.bagOfCraftingOffset = math.min(#results-(#results%EID.Config["BagOfCraftingResults"]), EID.bagOfCraftingOffset + EID.Config["BagOfCraftingResults"])
|
||||||
|
elseif Input.IsActionTriggered(ButtonAction.ACTION_SHOOTUP, 0) or Input.IsActionTriggered(ButtonAction.ACTION_SHOOTUP, 1) then
|
||||||
|
EID.bagOfCraftingOffset = math.max(0, EID.bagOfCraftingOffset - EID.Config["BagOfCraftingResults"])
|
||||||
|
end
|
||||||
|
Isaac.GetPlayer(0).ControlsEnabled = false
|
||||||
|
else
|
||||||
|
Isaac.GetPlayer(0).ControlsEnabled = true
|
||||||
|
end
|
||||||
|
|
||||||
local resultCount = 0
|
local resultCount = 0
|
||||||
|
local skips = 0
|
||||||
for quality = 4, 0, -1 do -- sort by result quality
|
for quality = 4, 0, -1 do -- sort by result quality
|
||||||
for i, v in ipairs(results) do
|
for i, v in ipairs(results) do
|
||||||
if EID.itemWeightsLookup[v[2]]== quality then
|
if EID.itemWeightsLookup[v[2]]== quality then
|
||||||
customDescObj.Description = customDescObj.Description.."# {{Collectible"..v[2].."}} ="
|
if skips < EID.bagOfCraftingOffset then
|
||||||
customDescObj.Description = customDescObj.Description..EID:tableToCraftingIconsMerged(v[1])
|
skips = skips + 1
|
||||||
resultCount = resultCount + 1
|
if skips == EID.bagOfCraftingOffset then
|
||||||
if resultCount > EID.Config["BagOfCraftingResults"]-1 then
|
customDescObj.Description = customDescObj.Description.."#{{Blank}} ...+"..skips.." more"
|
||||||
if #results > EID.Config["BagOfCraftingResults"] then
|
end
|
||||||
customDescObj.Description = customDescObj.Description.."#{{Blank}} ...+"..(#results-EID.Config["BagOfCraftingResults"]).." more"
|
else
|
||||||
|
customDescObj.Description = customDescObj.Description.."# {{Collectible"..v[2].."}} ="
|
||||||
|
customDescObj.Description = customDescObj.Description..EID:tableToCraftingIconsMerged(v[1])
|
||||||
|
resultCount = resultCount + 1
|
||||||
|
if resultCount > EID.Config["BagOfCraftingResults"]-1 then
|
||||||
|
if #results > EID.Config["BagOfCraftingResults"] then
|
||||||
|
customDescObj.Description = customDescObj.Description.."#{{Blank}} ...+"..(#results-EID.Config["BagOfCraftingResults"]- skips).." more"
|
||||||
|
end
|
||||||
|
break
|
||||||
end
|
end
|
||||||
break
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -440,10 +463,12 @@ local function onRender(t)
|
|||||||
else
|
else
|
||||||
EID:removeTextPosModifier("Tained HUD")
|
EID:removeTextPosModifier("Tained HUD")
|
||||||
end
|
end
|
||||||
if player.SubType == 23 then
|
if player:HasCollectible(710) and EID.Config["DisplayBagOfCrafting"] ~= "never" then
|
||||||
local success = handleBagOfCraftingRendering()
|
if EID.Config["DisplayBagOfCrafting"] == "always" or (EID.Config["DisplayBagOfCrafting"] == "hold" and string.find(player:GetSprite():GetAnimation(), "PickupWalk")) then
|
||||||
if success then
|
local success = handleBagOfCraftingRendering()
|
||||||
return
|
if success then
|
||||||
|
return
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
+26
-2
@@ -450,6 +450,30 @@ if MCMLoaded then
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
MCM.AddSpace("EID", "Display")
|
||||||
|
MCM.AddText("EID", "Display", "Bag of Crafting")
|
||||||
|
|
||||||
|
-- Bag of Crafting Display
|
||||||
|
local bagDisplays = {"always","hold","never"}
|
||||||
|
MCM.AddSetting(
|
||||||
|
"EID",
|
||||||
|
"Display",
|
||||||
|
{
|
||||||
|
Type = ModConfigMenu.OptionType.NUMBER,
|
||||||
|
CurrentSetting = function()
|
||||||
|
return AnIndexOf(bagDisplays, EID.Config["DisplayBagOfCrafting"])
|
||||||
|
end,
|
||||||
|
Minimum = 1,
|
||||||
|
Maximum = 3,
|
||||||
|
Display = function()
|
||||||
|
return "Display mode: " .. EID.Config["DisplayBagOfCrafting"]
|
||||||
|
end,
|
||||||
|
OnChange = function(currentNum)
|
||||||
|
EID.Config["DisplayBagOfCrafting"] = bagDisplays[currentNum]
|
||||||
|
end,
|
||||||
|
Info = {"always = Always show Results, hold = Show when holding up bag, never = Never show results"}
|
||||||
|
}
|
||||||
|
)
|
||||||
-- Bag of Crafting results
|
-- Bag of Crafting results
|
||||||
MCM.AddSetting(
|
MCM.AddSetting(
|
||||||
"EID",
|
"EID",
|
||||||
@@ -460,8 +484,8 @@ if MCMLoaded then
|
|||||||
return AnIndexOf(diceSteps, EID.Config["BagOfCraftingResults"]) - 1
|
return AnIndexOf(diceSteps, EID.Config["BagOfCraftingResults"]) - 1
|
||||||
end,
|
end,
|
||||||
Display = function()
|
Display = function()
|
||||||
return "Crafting bag: $scroll" ..
|
return "Displayed Results: $scroll" ..
|
||||||
AnIndexOf(diceSteps, EID.Config["BagOfCraftingResults"]) - 1 .. " " .. EID.Config["BagOfCraftingResults"] .. " Results"
|
AnIndexOf(diceSteps, EID.Config["BagOfCraftingResults"]) - 1 .. " " .. EID.Config["BagOfCraftingResults"]
|
||||||
end,
|
end,
|
||||||
OnChange = function(currentNum)
|
OnChange = function(currentNum)
|
||||||
EID.Config["BagOfCraftingResults"] = diceSteps[currentNum%#diceSteps + 1]
|
EID.Config["BagOfCraftingResults"] = diceSteps[currentNum%#diceSteps + 1]
|
||||||
|
|||||||
Reference in new issue
Block a user