RGON: Added EID descriptions on Main menu collection page
This commit is contained in:
1 parent
1ca60623c0
commit
09e84c34c7
1 file changed
+45
@@ -24,6 +24,7 @@ function EID:GetEntityXMLName(Type, Variant, SubType)
|
|||||||
return xmlEntry and xmlEntry.name or EID.XMLEntityNames[Type .. "." .. Variant] or
|
return xmlEntry and xmlEntry.name or EID.XMLEntityNames[Type .. "." .. Variant] or
|
||||||
EID.XMLEntityNames[Type .. "." .. Variant .. "." .. SubType]
|
EID.XMLEntityNames[Type .. "." .. Variant .. "." .. SubType]
|
||||||
end
|
end
|
||||||
|
|
||||||
-- takes a string like "5.100.69"
|
-- takes a string like "5.100.69"
|
||||||
function EID:GetEntityXMLNameByString(str)
|
function EID:GetEntityXMLNameByString(str)
|
||||||
local sep = {}
|
local sep = {}
|
||||||
@@ -36,3 +37,47 @@ end
|
|||||||
-- Render EID above hud, if REPENTOGON is installed
|
-- Render EID above hud, if REPENTOGON is installed
|
||||||
EID:RemoveCallback(ModCallbacks.MC_POST_RENDER, EID.OnRender)
|
EID:RemoveCallback(ModCallbacks.MC_POST_RENDER, EID.OnRender)
|
||||||
EID:AddCallback(ModCallbacks.MC_HUD_RENDER, EID.OnRender)
|
EID:AddCallback(ModCallbacks.MC_HUD_RENDER, EID.OnRender)
|
||||||
|
|
||||||
|
|
||||||
|
-- render descriptions for items on the collection page
|
||||||
|
|
||||||
|
local oldPosInitFunc = EID.PositionLocalMode
|
||||||
|
function EID:PositionLocalMode(entity)
|
||||||
|
oldPosInitFunc(entity)
|
||||||
|
-- custom description position when describing collectionpage entries
|
||||||
|
if MenuManager:GetActiveMenu() == MainMenuType.COLLECTION then
|
||||||
|
EID.CurrentScaleType = "MainMenu"
|
||||||
|
EID.UsedPosition = Vector(10, 10)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local skipItemIDs = {}
|
||||||
|
function EID:OnMenuRender()
|
||||||
|
if MenuManager:GetActiveMenu() == MainMenuType.COLLECTION then
|
||||||
|
if #skipItemIDs == 0 then -- build list of items not listed in the collectionpage
|
||||||
|
local itemConfig = Isaac.GetItemConfig()
|
||||||
|
for i = 1, EID:GetMaxCollectibleID(), 1 do
|
||||||
|
if itemConfig:GetCollectible(i) == nil or itemConfig:GetCollectible(i).Hidden then
|
||||||
|
table.insert(skipItemIDs, i)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local selectedPage = CollectionMenu.GetSelectedPage()
|
||||||
|
local CollectibleId = selectedPage * (20 * 6) + CollectionMenu.GetSelectedElement() + 1
|
||||||
|
for _, id in ipairs(skipItemIDs) do -- some items dont exist, so we need to "skip" those when counting
|
||||||
|
if id < CollectibleId then
|
||||||
|
CollectibleId = CollectibleId + 1
|
||||||
|
end
|
||||||
|
end
|
||||||
|
local demoDescObj = EID:getDescriptionObj(5, 100, CollectibleId)
|
||||||
|
if not Isaac.GetPersistentGameData():IsItemInCollection(CollectibleId) then
|
||||||
|
EID:renderQuestionMark(nil)
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
EID:printDescription(demoDescObj, nil)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
EID:AddCallback(ModCallbacks.MC_MAIN_MENU_RENDER, EID.OnMenuRender)
|
||||||
Reference in new issue
Block a user