From eb3b4182a215b4bc06dd7d4a69381b711328a6bb Mon Sep 17 00:00:00 2001 From: Wofsauge Date: Sun, 29 Nov 2020 18:34:20 +0100 Subject: [PATCH] Added feature to add descriptions using "GetData()" --- eid_api.lua | 2 +- eid_debugging.lua | 18 +++++++++++++++++- main.lua | 17 +++++++++++++---- 3 files changed, 31 insertions(+), 6 deletions(-) diff --git a/eid_api.lua b/eid_api.lua index 1cebccf9..e97cb857 100644 --- a/eid_api.lua +++ b/eid_api.lua @@ -352,7 +352,7 @@ function EID:hasDescription(entity) local isAllowed = false if EID.Config["EnableEntityDescriptions"] then isAllowed = __eidEntityDescriptions[entity.Type .. "." .. entity.Variant .. "." .. entity.SubType] ~= nil - --isAllowed = isAllowed or type(entity:GetData()["EID_Description"]) ~= type(nil) + isAllowed = isAllowed or type(entity:GetData()["EID_Description"]) ~= type(nil) end isAllowed = isAllowed or (entity.Variant == PickupVariant.PICKUP_COLLECTIBLE and EID.Config["DisplayItemInfo"]) isAllowed = isAllowed or (entity.Variant == PickupVariant.PICKUP_TRINKET and EID.Config["DisplayTrinketInfo"]) diff --git a/eid_debugging.lua b/eid_debugging.lua index e4b775a6..9480dd0f 100644 --- a/eid_debugging.lua +++ b/eid_debugging.lua @@ -78,7 +78,7 @@ EID.InlineIcons["Test"] = {"pickups", -1, 9, 9, -1, 0, dummySprite3} --EID.InlineIcons["Card58"] = {"pickups", -1, 9, 9, -1, 0, dummySprite3} -__eidItemDescriptions[2] = "{{Bomb}} Emote {{Key}} Test {{Test}}{{TestIcon}} {{ColorBlackBlink}}description {{SomeInvalidInnerStuff}} cool" -- 5.100.2 = Inner Eye +__eidItemDescriptions[3] = "{{Bomb}} Emote {{Key}} Test {{Test}}{{TestIcon}} {{ColorBlackBlink}}description {{SomeInvalidInnerStuff}} cool" -- 5.100.2 = Inner Eye __eidItemDescriptions[6] = "This item as Inline Icon {{Collectible6}}#And here are others {{Collectible69}} {{Collectible16}} {{Collectible323}} {{Collectible345}} {{Collectible223}}#And some trinket sprites {{Trinket12}} {{Trinket22}} {{Trinket1}} {{Trinket55}} {{Trinket100}} {{Trinket123}}" -- 5.100.2 = Inner Eye @@ -99,6 +99,22 @@ EID:addColor("ColorBlackBlink", nil, function(color) local function onDebugRender(t) + for i,v in ipairs(Isaac.FindByType(5,10,2,true,false)) do + if v:GetData()["EID_Description"] == nil then + v:GetData()["EID_Description"] = "Test specific description#Init seed: ".. v.InitSeed + end + end + for i,v in ipairs(Isaac.FindByType(5,10,3,true,false)) do + if v:GetData()["EID_Description"] == nil then + local descTable = { + ["Name"] = "Some Item with seed ".. v.InitSeed , + ["Description"] = "Test specific description#Init seed: ".. v.InitSeed, + ["Transformation"] = "1,2" + } + v:GetData()["EID_Description"] = descTable + end + end + for i, v in ipairs(charsToDebug) do local pos = EID.getTextPosition() + Vector(0, - 15 + ((i - 1) * 14)) EID:renderString(v, pos, Vector(EID.Config["Scale"], EID.Config["Scale"]), KColor(1, 1, 1, 1, 0, 0, 0)) diff --git a/main.lua b/main.lua index 838098b7..01ddbbbd 100644 --- a/main.lua +++ b/main.lua @@ -348,12 +348,21 @@ local function onRender(t) --Handle Indicators EID:renderIndicator(closest) - --Handle Entities (specific) - --[[ if EID.Config["EnableEntityDescriptions"] and type(closest:GetData()["EID_Description"]) ~= type(nil) then - printTrinketDescription({closest.Type, closest:GetData()["EID_Description"]}, "custom") + --Handle GetData Entities (specific) + if EID.Config["EnableEntityDescriptions"] and type(closest:GetData()["EID_Description"]) ~= type(nil) then + local desc = closest:GetData()["EID_Description"] + local origDesc = EID:getDescriptionObj(closest.Type, closest.Variant, closest.SubType) + if type(desc) == "table" then + origDesc.Description = desc.Description + origDesc.Name = desc.Name + origDesc.Transformation = desc.Transformation + else + origDesc.Description = desc + end + EID:printDescription(origDesc) return end - ]] + if closest.Variant == PickupVariant.PICKUP_TRINKET then --Handle Trinkets EID:printDescription(EID:getDescriptionObj(closest.Type, closest.Variant, closest.SubType))