Adds fail check to bag of crafting to prevent calculations when modded items are enabled
This commit is contained in:
1 parent
fe7891aa74
commit
d2bf2bc4b9
2 files changed
+32
No files matched your search
@@ -670,4 +670,5 @@ EID.descriptions["en_us"].horsepills={
|
||||
EID.descriptions["en_us"].CraftingBagContent = "Pickups in bag:"
|
||||
EID.descriptions["en_us"].CraftingRoomContent = "Pickups in room:"
|
||||
EID.descriptions["en_us"].CraftingResults = "Results:#(Scroll: Hold TAB + Shoot △/▽)"
|
||||
EID.descriptions["en_us"].CraftingBagModError = "!!! {{ColorRed}}ERROR:#{{ColorRed}}This feature currently does not support games with modded items installed"
|
||||
|
||||
@@ -517,6 +517,34 @@ local function toggleControls(value)
|
||||
end
|
||||
end
|
||||
|
||||
local function GetMaxCollectibleID()
|
||||
local id = CollectibleType.NUM_COLLECTIBLES-1
|
||||
local step = 16
|
||||
while step > 0 do
|
||||
if Isaac.GetItemConfig():GetCollectible(id+step) ~= nil then
|
||||
id = id + step
|
||||
else
|
||||
step = step // 2
|
||||
end
|
||||
end
|
||||
|
||||
return id
|
||||
end
|
||||
local maxItemID = nil
|
||||
|
||||
local function detectModdedItems()
|
||||
if maxItemID == nil then
|
||||
maxItemID = GetMaxCollectibleID()
|
||||
end
|
||||
if maxItemID > CollectibleType.NUM_COLLECTIBLES then
|
||||
local customDescObj = EID:getDescriptionObj(5, 100, 710)
|
||||
customDescObj.Description = EID.descriptions["en_us"].CraftingBagModError
|
||||
EID:printDescription(customDescObj)
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
function EID:handleBagOfCraftingRendering()
|
||||
trackBagHolding()
|
||||
detectBagContentShift()
|
||||
@@ -527,6 +555,9 @@ function EID:handleBagOfCraftingRendering()
|
||||
if EID.Config["DisplayBagOfCrafting"] == "hold" and not string.find(EID.player:GetSprite():GetAnimation(), "PickupWalk") then
|
||||
return false
|
||||
end
|
||||
if detectModdedItems() then
|
||||
return false
|
||||
end
|
||||
|
||||
local results = {}
|
||||
local floorItems = {}
|
||||
|
||||
Reference in new issue
Block a user