Fixed new method to add entity descriptions
This commit is contained in:
1 parent
eb3b4182a2
commit
e32b32d46e
3 files changed
+11
-12
No files matched your search
+4
-5
@@ -110,8 +110,6 @@ function EID:addEntity(id, variant, subtype, entityName, description, language)
|
|||||||
subtype = subtype or nil
|
subtype = subtype or nil
|
||||||
language = language or "en_us"
|
language = language or "en_us"
|
||||||
EID.descriptions[language].custom[id .. "." .. variant .. "." .. subtype] = {
|
EID.descriptions[language].custom[id .. "." .. variant .. "." .. subtype] = {
|
||||||
id,
|
|
||||||
variant,
|
|
||||||
subtype,
|
subtype,
|
||||||
entityName,
|
entityName,
|
||||||
description
|
description
|
||||||
@@ -322,7 +320,7 @@ end
|
|||||||
-- tries to get the ingame name of an item based on its ID
|
-- tries to get the ingame name of an item based on its ID
|
||||||
function EID:getObjectName(Type, Variant, SubType)
|
function EID:getObjectName(Type, Variant, SubType)
|
||||||
local tableEntry = EID:getDescriptionData(Type, Variant, SubType)
|
local tableEntry = EID:getDescriptionData(Type, Variant, SubType)
|
||||||
if tableEntry == nil then return "" end
|
if tableEntry == nil then return Type.."."..Variant.."."..SubType end
|
||||||
local tableName = EID:getTableName(Type, Variant)
|
local tableName = EID:getTableName(Type, Variant)
|
||||||
local name = nil
|
local name = nil
|
||||||
if tableEntry[2] ~= nil and tableEntry[2] ~= "" then
|
if tableEntry[2] ~= nil and tableEntry[2] ~= "" then
|
||||||
@@ -342,9 +340,9 @@ function EID:getObjectName(Type, Variant, SubType)
|
|||||||
elseif tableName == "dice" then
|
elseif tableName == "dice" then
|
||||||
return EID:getDescriptionTable("diceHeader")
|
return EID:getDescriptionTable("diceHeader")
|
||||||
elseif tableName == "custom" then
|
elseif tableName == "custom" then
|
||||||
return name or SubType
|
return name or Type.."."..Variant.."."..SubType
|
||||||
end
|
end
|
||||||
return ""
|
return Type.."."..Variant.."."..SubType
|
||||||
end
|
end
|
||||||
|
|
||||||
-- check if an entity is part of the describable entities
|
-- check if an entity is part of the describable entities
|
||||||
@@ -352,6 +350,7 @@ function EID:hasDescription(entity)
|
|||||||
local isAllowed = false
|
local isAllowed = false
|
||||||
if EID.Config["EnableEntityDescriptions"] then
|
if EID.Config["EnableEntityDescriptions"] then
|
||||||
isAllowed = __eidEntityDescriptions[entity.Type .. "." .. entity.Variant .. "." .. entity.SubType] ~= nil
|
isAllowed = __eidEntityDescriptions[entity.Type .. "." .. entity.Variant .. "." .. entity.SubType] ~= nil
|
||||||
|
isAllowed = isAllowed or EID:getDescriptionData(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
|
end
|
||||||
isAllowed = isAllowed or (entity.Variant == PickupVariant.PICKUP_COLLECTIBLE and EID.Config["DisplayItemInfo"])
|
isAllowed = isAllowed or (entity.Variant == PickupVariant.PICKUP_COLLECTIBLE and EID.Config["DisplayItemInfo"])
|
||||||
|
|||||||
+4
-4
@@ -48,7 +48,7 @@ EID:addCollectible(2, "New override Method", "new Name", "ru") -- maximal method
|
|||||||
EID:addTrinket(2, "New override Method") -- minimal method
|
EID:addTrinket(2, "New override Method") -- minimal method
|
||||||
EID:addCard(2, "New override Method", "new Name") -- card
|
EID:addCard(2, "New override Method", "new Name") -- card
|
||||||
EID:addPill(2, "New override Method", "new Name") -- pilleffect 2 "Balls of steel"
|
EID:addPill(2, "New override Method", "new Name") -- pilleffect 2 "Balls of steel"
|
||||||
EID:addEntity(5, 10, 2, "Custom Name", "Custom description") -- Entity
|
EID:addEntity(5, 10, 2, "Custom Name", "New Custom description") -- Entity
|
||||||
|
|
||||||
------ Test: adding custom transformation icon ------
|
------ Test: adding custom transformation icon ------
|
||||||
local dummySprite = Sprite()
|
local dummySprite = Sprite()
|
||||||
@@ -99,15 +99,15 @@ EID:addColor("ColorBlackBlink", nil, function(color)
|
|||||||
|
|
||||||
|
|
||||||
local function onDebugRender(t)
|
local function onDebugRender(t)
|
||||||
for i,v in ipairs(Isaac.FindByType(5,10,2,true,false)) do
|
for i,v in ipairs(Isaac.FindByType(5,10,3,true,false)) do
|
||||||
if v:GetData()["EID_Description"] == nil then
|
if v:GetData()["EID_Description"] == nil then
|
||||||
v:GetData()["EID_Description"] = "Test specific description#Init seed: ".. v.InitSeed
|
v:GetData()["EID_Description"] = "Test specific description#Init seed: ".. v.InitSeed
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
for i,v in ipairs(Isaac.FindByType(5,10,3,true,false)) do
|
for i,v in ipairs(Isaac.FindByType(5,10,4,true,false)) do
|
||||||
if v:GetData()["EID_Description"] == nil then
|
if v:GetData()["EID_Description"] == nil then
|
||||||
local descTable = {
|
local descTable = {
|
||||||
["Name"] = "Some Item with seed ".. v.InitSeed ,
|
--["Name"] = "Some Item with seed ".. v.InitSeed ,
|
||||||
["Description"] = "Test specific description#Init seed: ".. v.InitSeed,
|
["Description"] = "Test specific description#Init seed: ".. v.InitSeed,
|
||||||
["Transformation"] = "1,2"
|
["Transformation"] = "1,2"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -353,9 +353,9 @@ local function onRender(t)
|
|||||||
local desc = closest:GetData()["EID_Description"]
|
local desc = closest:GetData()["EID_Description"]
|
||||||
local origDesc = EID:getDescriptionObj(closest.Type, closest.Variant, closest.SubType)
|
local origDesc = EID:getDescriptionObj(closest.Type, closest.Variant, closest.SubType)
|
||||||
if type(desc) == "table" then
|
if type(desc) == "table" then
|
||||||
origDesc.Description = desc.Description
|
origDesc.Description = desc.Description or origDesc.Description
|
||||||
origDesc.Name = desc.Name
|
origDesc.Name = desc.Name or origDesc.Name
|
||||||
origDesc.Transformation = desc.Transformation
|
origDesc.Transformation = desc.Transformation or origDesc.Transformation
|
||||||
else
|
else
|
||||||
origDesc.Description = desc
|
origDesc.Description = desc
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in new issue
Block a user