Added function to get objectnames by id
This commit is contained in:
1 parent
b0b52a3858
commit
f4efb1b3c5
2 files changed
+30
-21
No files matched your search
+20
-1
@@ -66,7 +66,7 @@ EID.TRANSFORMATION = {
|
|||||||
["SUPERBUM"] = 11
|
["SUPERBUM"] = 11
|
||||||
}
|
}
|
||||||
|
|
||||||
-- List of item Types
|
-- List of item Types
|
||||||
EID.ItemTypeAnm2Names = {
|
EID.ItemTypeAnm2Names = {
|
||||||
"null", -- 1
|
"null", -- 1
|
||||||
"passive", -- 2
|
"passive", -- 2
|
||||||
@@ -110,6 +110,25 @@ function EID:getTransformation(id)
|
|||||||
return str
|
return str
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- tries to get the ingame name of an item based on its ID
|
||||||
|
function EID:getObjectName(objID, objType)
|
||||||
|
if objType == "collectible" then
|
||||||
|
return EID.itemConfig:GetCollectible(objID).Name
|
||||||
|
elseif objType == "trinket" then
|
||||||
|
return EID.itemConfig:GetTrinket(objID).Name
|
||||||
|
elseif objType == "card" then
|
||||||
|
return EID.itemConfig:GetCard(objID).Name
|
||||||
|
elseif objType == "pill" then
|
||||||
|
return EID.itemConfig:GetPillEffect(objID).Name
|
||||||
|
elseif objType == "sacrifice" then
|
||||||
|
return sacrificeDescriptionHeader
|
||||||
|
elseif objType == "dice" then
|
||||||
|
return diceDescriptionHeader
|
||||||
|
elseif objType == "custom" then
|
||||||
|
return objID
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
-- check if an entity is part of the describable entities
|
-- check if an entity is part of the describable entities
|
||||||
function EID:hasDescription(entity)
|
function EID:hasDescription(entity)
|
||||||
local isAllowed = false
|
local isAllowed = false
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
EID = RegisterMod("External Item Descriptions", 1)
|
EID = RegisterMod("External Item Descriptions", 1)
|
||||||
local itemConfig = Isaac.GetItemConfig()
|
EID.itemConfig = Isaac.GetItemConfig()
|
||||||
|
|
||||||
local lineHeight = 11
|
local lineHeight = 11
|
||||||
local isDisplayingText = false
|
local isDisplayingText = false
|
||||||
@@ -75,7 +75,7 @@ end
|
|||||||
function printDescription(desc)
|
function printDescription(desc)
|
||||||
local Description = desc[3]
|
local Description = desc[3]
|
||||||
local padding = posY()
|
local padding = posY()
|
||||||
local itemType = itemConfig:GetCollectible(desc[1]).Type
|
local itemType = EID.itemConfig:GetCollectible(desc[1]).Type
|
||||||
|
|
||||||
--Display ItemType / Charge
|
--Display ItemType / Charge
|
||||||
if EIDConfig["ShowItemType"] and (itemType == 3 or itemType == 4) then
|
if EIDConfig["ShowItemType"] and (itemType == 3 or itemType == 4) then
|
||||||
@@ -92,7 +92,7 @@ function printDescription(desc)
|
|||||||
Vector(0, 0)
|
Vector(0, 0)
|
||||||
)
|
)
|
||||||
if itemType == 3 then -- Display Charge
|
if itemType == 3 then -- Display Charge
|
||||||
IconSprite:Play(itemConfig:GetCollectible(desc[1]).MaxCharges)
|
IconSprite:Play(EID.itemConfig:GetCollectible(desc[1]).MaxCharges)
|
||||||
IconSprite:Update()
|
IconSprite:Update()
|
||||||
IconSprite:Render(
|
IconSprite:Render(
|
||||||
Vector(EIDConfig["XPosition"], padding + offsetY),
|
Vector(EIDConfig["XPosition"], padding + offsetY),
|
||||||
@@ -115,7 +115,7 @@ function printDescription(desc)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
EID:renderString(
|
EID:renderString(
|
||||||
itemConfig:GetCollectible(desc[1]).Name,
|
EID:getObjectName(desc[1], "collectible"),
|
||||||
Vector(EIDConfig["XPosition"] + offset * EIDConfig["Scale"], padding - 4),
|
Vector(EIDConfig["XPosition"] + offset * EIDConfig["Scale"], padding - 4),
|
||||||
Vector(EIDConfig["Scale"], EIDConfig["Scale"]),
|
Vector(EIDConfig["Scale"], EIDConfig["Scale"]),
|
||||||
EID:getNameColor(),
|
EID:getNameColor(),
|
||||||
@@ -161,23 +161,13 @@ function printDescription(desc)
|
|||||||
printBulletPoints(Description, padding)
|
printBulletPoints(Description, padding)
|
||||||
end
|
end
|
||||||
|
|
||||||
function printTrinketDescription(desc, typ)
|
function printTrinketDescription(desc, objType)
|
||||||
local Description = desc[2]
|
local Description = desc[2]
|
||||||
local padding = posY()
|
local padding = posY()
|
||||||
--Display Itemname
|
--Display Itemname
|
||||||
if EIDConfig["ShowItemName"] then
|
if EIDConfig["ShowItemName"] then
|
||||||
local name = ""
|
local name = EID:getObjectName(desc[1], objType)
|
||||||
if typ == "trinket" then
|
if objType == "custom" then
|
||||||
name = itemConfig:GetTrinket(desc[1]).Name
|
|
||||||
elseif typ == "card" then
|
|
||||||
name = itemConfig:GetCard(desc[1]).Name
|
|
||||||
elseif typ == "pill" then
|
|
||||||
name = itemConfig:GetPillEffect(desc[1]).Name
|
|
||||||
elseif typ == "sacrifice" then
|
|
||||||
name = sacrificeDescriptionHeader
|
|
||||||
elseif typ == "dice" then
|
|
||||||
name = diceDescriptionHeader
|
|
||||||
elseif typ == "custom" then
|
|
||||||
name = desc[2][1]
|
name = desc[2][1]
|
||||||
Description = desc[2][2]
|
Description = desc[2][2]
|
||||||
end
|
end
|
||||||
@@ -374,7 +364,7 @@ local function onRender(t)
|
|||||||
"trinket"
|
"trinket"
|
||||||
)
|
)
|
||||||
else
|
else
|
||||||
printTrinketDescription({closest.SubType, itemConfig:GetTrinket(closest.SubType).Description})
|
printTrinketDescription({closest.SubType, EID.itemConfig:GetTrinket(closest.SubType).Description})
|
||||||
end
|
end
|
||||||
elseif closest.Variant == PickupVariant.PICKUP_COLLECTIBLE then
|
elseif closest.Variant == PickupVariant.PICKUP_COLLECTIBLE then
|
||||||
--Handle Cards & Runes
|
--Handle Cards & Runes
|
||||||
@@ -401,7 +391,7 @@ local function onRender(t)
|
|||||||
printDescription(descriptarray[closest.SubType])
|
printDescription(descriptarray[closest.SubType])
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
printDescription({closest.SubType, "", itemConfig:GetCollectible(closest.SubType).Description})
|
printDescription({closest.SubType, "", EID.itemConfig:GetCollectible(closest.SubType).Description})
|
||||||
end
|
end
|
||||||
elseif closest.Variant == PickupVariant.PICKUP_TAROTCARD then
|
elseif closest.Variant == PickupVariant.PICKUP_TAROTCARD then
|
||||||
--Handle Pills
|
--Handle Pills
|
||||||
@@ -426,7 +416,7 @@ local function onRender(t)
|
|||||||
Vector(0, 0)
|
Vector(0, 0)
|
||||||
)
|
)
|
||||||
else
|
else
|
||||||
printTrinketDescription({closest.SubType, itemConfig:GetCard(closest.SubType).Description})
|
printTrinketDescription({closest.SubType, EID.itemConfig:GetCard(closest.SubType).Description})
|
||||||
end
|
end
|
||||||
elseif closest.Variant == PickupVariant.PICKUP_PILL then
|
elseif closest.Variant == PickupVariant.PICKUP_PILL then
|
||||||
if closest:ToPickup():IsShopItem() and not EIDConfig["DisplayPillInfoShop"] then
|
if closest:ToPickup():IsShopItem() and not EIDConfig["DisplayPillInfoShop"] then
|
||||||
|
|||||||
Reference in new issue
Block a user