Fixed option to disable certain object descriptions and improved dice-room effect detection

This commit is contained in:
Wofsauge committed 2020-12-05 17:16:28 +01:00
1 parent c015c5a265
commit 896e028d5a
2 files changed
+17 -19

No files matched your search

+12 -8
View File
@@ -174,7 +174,7 @@ function EID:getIDVariantString(typeName)
elseif typeName == "card" or typeName == "cards" then return "5.300" elseif typeName == "card" or typeName == "cards" then return "5.300"
elseif typeName == "pill" or typeName == "pills" then return "5.70" elseif typeName == "pill" or typeName == "pills" then return "5.70"
elseif typeName == "sacrifice" then return "-999.-1" elseif typeName == "sacrifice" then return "-999.-1"
elseif typeName == "dice" then return "-999.-2" elseif typeName == "dice" then return "1000.76"
end end
return nil return nil
end end
@@ -187,7 +187,7 @@ function EID:getTableName(Type, Variant)
elseif idString == "5.300" then return "cards" elseif idString == "5.300" then return "cards"
elseif idString == "5.70" then return "pills" elseif idString == "5.70" then return "pills"
elseif idString == "-999.-1" then return "sacrifice" elseif idString == "-999.-1" then return "sacrifice"
elseif idString == "-999.-2" then return "dice" elseif idString == "1000.76" then return "dice"
else return "custom" else return "custom"
end end
end end
@@ -395,16 +395,20 @@ 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
if EID.Config["EnableEntityDescriptions"] then if EID.Config["EnableEntityDescriptions"] and EID:getTableName(entity.Type, entity.Variant) == "custom" 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 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"]) if entity.Type == EntityType.ENTITY_PICKUP then
isAllowed = isAllowed or (entity.Variant == PickupVariant.PICKUP_TRINKET and EID.Config["DisplayTrinketInfo"]) isAllowed = isAllowed or (entity.Variant == PickupVariant.PICKUP_COLLECTIBLE and EID.Config["DisplayItemInfo"])
isAllowed = isAllowed or (entity.Variant == PickupVariant.PICKUP_TAROTCARD and EID.Config["DisplayCardInfo"]) isAllowed = isAllowed or (entity.Variant == PickupVariant.PICKUP_TRINKET and EID.Config["DisplayTrinketInfo"])
isAllowed = isAllowed or (entity.Variant == PickupVariant.PICKUP_PILL and EID.Config["DisplayPillInfo"]) isAllowed = isAllowed or (entity.Variant == PickupVariant.PICKUP_TAROTCARD and EID.Config["DisplayCardInfo"])
return entity.Type == EntityType.ENTITY_PICKUP and isAllowed and entity.SubType > 0 isAllowed = isAllowed or (entity.Variant == PickupVariant.PICKUP_PILL and EID.Config["DisplayPillInfo"])
return isAllowed and entity.SubType > 0
end
isAllowed = isAllowed or (entity.Type == 1000 and entity.Variant == EffectVariant.DICE_FLOOR and EID.Config["DisplayDiceInfo"])
return isAllowed
end end
-- Replaces shorthand-representations of a character with the internal reference -- Replaces shorthand-representations of a character with the internal reference
+5 -11
View File
@@ -313,13 +313,8 @@ local function onRender(t)
end end
local closest = nil local closest = nil
local closestDice = nil
local dist = 10000 local dist = 10000
for i, entity in ipairs(Isaac.GetRoomEntities()) do for i, entity in ipairs(Isaac.GetRoomEntities()) do
if Game():GetRoom():GetType() == RoomType.ROOM_DICE and entity.Type == 1000 and entity.Variant == 76 then
closestDice = entity
end
if EID:hasDescription(entity) then if EID:hasDescription(entity) then
local diff = entity.Position:__sub(player.Position) local diff = entity.Position:__sub(player.Position)
if diff:Length() < dist then if diff:Length() < dist then
@@ -333,12 +328,6 @@ local function onRender(t)
if Game():GetRoom():GetType() == RoomType.ROOM_SACRIFICE and EID.Config["DisplaySacrificeInfo"] then if Game():GetRoom():GetType() == RoomType.ROOM_SACRIFICE and EID.Config["DisplaySacrificeInfo"] then
EID:printDescription(EID:getDescriptionObj(-999, -1, EID.sacrificeCounter)) EID:printDescription(EID:getDescriptionObj(-999, -1, EID.sacrificeCounter))
end end
if
Game():GetRoom():GetType() == RoomType.ROOM_DICE and EID.Config["DisplayDiceInfo"] and type(closestDice) ~= type(nil)
then
EID:printDescription(EID:getDescriptionObj(-999, -2, closestDice.SubType + 1))
EID:renderIndicator(closestDice)
end
return return
end end
@@ -365,6 +354,11 @@ local function onRender(t)
EID:printDescription(origDesc) EID:printDescription(origDesc)
return return
end end
if closest.Type == 1000 and closest.Variant == 76 then
EID:printDescription(EID:getDescriptionObj(closest.Type, closest.Variant, closest.SubType+1))
return
end
if closest.Variant == PickupVariant.PICKUP_TRINKET then if closest.Variant == PickupVariant.PICKUP_TRINKET then
--Handle Trinkets --Handle Trinkets