Added feature to hide cards an pill descriptions, when they are not accessible

This commit is contained in:
Wofsauge committed 2021-05-20 22:17:14 +02:00
1 parent 0f61012a40
commit 9a45e2e714
5 files changed
+145 -21

No files matched your search

+5
View File
@@ -0,0 +1,5 @@
<entities anm2root="gfx/" version="5">
<entity anm2path="nothing.anm2" baseHP="0" boss="0" champion="0" collisionDamage="0" collisionMass="0" collisionRadius="0" friction="1" id="17" name="EID_PATHCHECKER" numGridCollisionPoints="0" shadowSize="0" stageHP="0" variant="69420" shutdoors="false">
<gibs amount="0" blood="0" bone="0" eye="0" gut="0" large="0" />
</entity>
</entities>
+19
View File
@@ -55,6 +55,10 @@ EID.DefaultConfig = {
-- Hide the descriptions when in battle
-- Default = false
["HideInBattle"] = false,
-- Toggle obstruction based hiding, when the player has flight
-- Default = true
["DisableObstructionOnFlight"] = true,
-------------CURSE-------------
-- Disable informations when the floor has curse of the blind ( ? - Items)
@@ -63,6 +67,7 @@ EID.DefaultConfig = {
-- Disable Item informations for the second Treasure room item on alt paths
-- Default = true
["DisableOnAltPath"] = true,
----------ITEM NAMES-----------
-- Toggle Display of Collectible / Card and Pill names
@@ -83,6 +88,7 @@ EID.DefaultConfig = {
-- Set the color-name of the Itemname description text. Color names can be found& defined in "eid_data.lua"
-- Default = "ColorEIDObjName"
["ItemNameColor"] = "ColorEIDObjName",
-------TRANSFORMATIONS---------
-- Toggle Display of Transformation text
@@ -94,6 +100,7 @@ EID.DefaultConfig = {
-- Set the color-name of the Transformation description text. Color names can be found& defined in "eid_data.lua"
-- Default = "ColorEIDTransform"
["TransformationColor"] = "ColorEIDTransform",
------------CARDS--------------
-- Toggle Display of Card / Rune descriptions
@@ -102,6 +109,10 @@ EID.DefaultConfig = {
-- Toggle Display of Card / Rune descriptions when its a shop item
-- Default = false
["DisplayCardInfoShop"] = false,
-- Toggle Display of Card / Rune descriptions when its not accessable with walking. AKA behind rock, blocks, spikes
-- Default = false
["DisplayObstructedCardInfo"] = false,
------------PILLS--------------
-- Toggle Display of Pill descriptions
@@ -110,19 +121,25 @@ EID.DefaultConfig = {
-- Toggle Display of Pill descriptions when its a shop item
-- Default = true
["DisplayPillInfoShop"] = true,
-- Toggle Display of Pill descriptions when its not accessable with walking. AKA behind rock, blocks, spikes
-- Default = true
["DisplayObstructedPillInfo"] = true,
-- Toggle Display of Pill descriptions that arent known to you yet
-- Default = false
["ShowUnidentifiedPillDescriptions"] = false,
--------Sacrifice Room---------
-- Toggle Display of next Sacrifice room Payout descriptions
-- Default = true
["DisplaySacrificeInfo"] = true,
--------Dice Room---------
-- Toggle Display of Diceroom descriptions
-- Default = true
["DisplayDiceInfo"] = true,
---------Bag of Crafting-----------
-- Display-modes for Bag of Crafting descriptions
@@ -134,7 +151,9 @@ EID.DefaultConfig = {
-- Higher numbers can cause more lag!
-- Default = 7
["BagOfCraftingResults"] = 7,
-------------MISC---------------
-- Changes the number of Results shown for the additional Spindown dice description
-- Default = 3
["SpindownDiceResults"] = 3,
+53 -20
View File
@@ -168,7 +168,6 @@ if REPENTANCE then
EID.lastHidePosition[curRoomIndex] = pickup.Position
end
EID.altPathItemCounter[curRoomIndex] = curCounter + 1
print(EID.altPathItemCounter[curRoomIndex])
end
end
EID:AddCallback(ModCallbacks.MC_POST_PICKUP_UPDATE, EID.onCollectibleInit, PickupVariant.PICKUP_COLLECTIBLE)
@@ -323,7 +322,7 @@ function EID:renderIndicator(entity)
repDiv = 255
end
local sprite = entity:GetSprite()
local entityPos = Game():GetRoom():WorldToScreenPosition(entity.Position)
local entityPos = Isaac.WorldToScreen(entity.Position)
if EID.Config["Indicator"] == "blink" then
local c = 255 - math.floor(255 * ((entity.FrameCount % 40) / 40))
sprite.Color = Color(1, 1, 1, 1, c/repDiv, c/repDiv, c/repDiv)
@@ -352,7 +351,7 @@ function EID:renderIndicator(entity)
if entity.Variant == 100 and not entity:ToPickup():IsShopItem() then
ArrowOffset = Vector(0, -62)
end
ArrowSprite:Render(Game():GetRoom():WorldToScreenPosition(entity.Position + ArrowOffset), nullVector, nullVector)
ArrowSprite:Render(Isaac.WorldToScreen(entity.Position + ArrowOffset), nullVector, nullVector)
end
end
@@ -466,6 +465,51 @@ local function handleBagOfCraftingRendering()
return true
end
---------------------------------------------------------------------------
---------------------------On Update Function------------------------------
EID.lastDescriptionEntity = nil
EID.lastDist = 0
EID.pathCheckerEntity = nil
EID.hasValidWalkingpath = true
function EID:onGameUpdate()
EID.lastDescriptionEntity = nil
EID.lastDist = 10000
local player = Isaac.GetPlayer(0)
for i, entity in ipairs(Isaac.GetRoomEntities()) do
if EID:hasDescription(entity) and entity.FrameCount > 0 then
local diff = entity.Position:__sub(player.Position)
if diff:Length() < EID.lastDist then
EID.lastDescriptionEntity = entity
EID.lastDist = diff:Length()
end
end
end
if not EID.Config["DisplayObstructedCardInfo"] or not EID.Config["DisplayObstructedPillInfo"] then
if EID.lastDescriptionEntity == nil or (EID.Config["DisableObstructionOnFlight"] and player.CanFly) then
if EID.pathCheckerEntity ~= nil then
EID.pathCheckerEntity:Remove()
EID.pathCheckerEntity = nil
EID.hasValidWalkingpath = true
end
return
end
if EID.pathCheckerEntity == nil then
EID.pathCheckerEntity = Isaac.Spawn(17, 69420, 0, player.Position, nullVector, nil) -- Spawns the EID Helper entity
EID.pathCheckerEntity:AddEntityFlags (EntityFlag.FLAG_PERSISTENT)
elseif not EID.pathCheckerEntity:Exists() then
EID.pathCheckerEntity = nil
else
EID.pathCheckerEntity.Position = player.Position
EID.hasValidWalkingpath = EID.pathCheckerEntity:ToNPC().Pathfinder:HasPathToPos ( EID.lastDescriptionEntity.Position, false )
end
end
end
EID:AddCallback(ModCallbacks.MC_POST_UPDATE, EID.onGameUpdate)
---------------------------------------------------------------------------
---------------------------On Render Function------------------------------
@@ -513,30 +557,19 @@ local function onRender(t)
return
end
local closest = nil
local dist = 10000
for i, entity in ipairs(Isaac.GetRoomEntities()) do
if EID:hasDescription(entity) and entity.FrameCount > 0 then
local diff = entity.Position:__sub(player.Position)
if diff:Length() < dist then
closest = entity
dist = diff:Length()
end
end
end
local closest = EID.lastDescriptionEntity
if dist / 40 > tonumber(EID.Config["MaxDistance"]) or not closest.Type == EntityType.ENTITY_PICKUP then
if EID.lastDist / 40 > tonumber(EID.Config["MaxDistance"]) then
if Game():GetRoom():GetType() == RoomType.ROOM_SACRIFICE and EID.Config["DisplaySacrificeInfo"] then
local curRoomIndex = Game():GetLevel():GetCurrentRoomIndex()
EID:printDescription(EID:getDescriptionObj(-999, -1, EID.sacrificeCounter[curRoomIndex] or 1))
end
return
end
if closest == nil then
return
end
EID.lastDescriptionEntity = closest
EID.isDisplaying = true
--Handle Indicators
@@ -617,14 +650,14 @@ local function onRender(t)
EID:printDescription(descriptionObj)
elseif closest.Variant == PickupVariant.PICKUP_TAROTCARD then
--Handle Cards & Runes
if closest:ToPickup():IsShopItem() and not EID.Config["DisplayCardInfoShop"] then
if (closest:ToPickup():IsShopItem() and not EID.Config["DisplayCardInfoShop"]) or (not EID.Config["DisplayObstructedCardInfo"] and not EID.hasValidWalkingpath) then
EID:renderQuestionMark()
return
end
EID:printDescription(EID:getDescriptionObj(closest.Type, closest.Variant, closest.SubType))
elseif closest.Variant == PickupVariant.PICKUP_PILL then
--Handle Pills
if closest:ToPickup():IsShopItem() and not EID.Config["DisplayPillInfoShop"] then
if (closest:ToPickup():IsShopItem() and not EID.Config["DisplayPillInfoShop"]) or (not EID.Config["DisplayObstructedPillInfo"] and not EID.hasValidWalkingpath) then
EID:renderQuestionMark()
return
end
@@ -656,7 +689,7 @@ end
EID:AddCallback(ModCallbacks.MC_POST_RENDER, onRender)
-- only save and load configs when using MCM. Otherwise Config file changes arent calid
-- only save and load configs when using MCM. Otherwise Config file changes arent valid
if EID.MCMLoaded then
local json = require("json")
--------------------------------
+1 -1
View File
@@ -86,7 +86,7 @@ https://moddingofisaac.com/mod/1079/external-item-descriptions
- Jake for the sweet [b]German[/b] language pack
- [url=https://steamcommunity.com/id/whytefang/]adc[/url] for creating an awesome new Languagepack and providing ideas for new functionalities
</description>
<version>3.43</version>
<version>3.44</version>
<visibility>Public</visibility>
<tag id="Lua"/>
<tag id="Items"/>
+67
View File
@@ -381,6 +381,73 @@ if MCMLoaded then
end
}
)
--------Obstruction---------
MCM.AddSpace("EID", "Display")
MCM.AddText("EID", "Display", "Display Infos when obstructed")
MCM.AddSetting(
"EID",
"Display",
{
Type = ModConfigMenu.OptionType.BOOLEAN,
CurrentSetting = function()
return EID.Config["DisableObstructionOnFlight"]
end,
Display = function()
local onOff = "False"
if EID.Config["DisableObstructionOnFlight"] then
onOff = "True"
end
return "Show again when having flight: " .. onOff
end,
OnChange = function(currentBool)
EID.Config["DisableObstructionOnFlight"] = currentBool
end
}
)
MCM.AddSetting(
"EID",
"Display",
{
Type = ModConfigMenu.OptionType.BOOLEAN,
CurrentSetting = function()
return EID.Config["DisplayObstructedCardInfo"]
end,
Display = function()
local onOff = "False"
if EID.Config["DisplayObstructedCardInfo"] then
onOff = "True"
end
return "Card Infos: " .. onOff
end,
OnChange = function(currentBool)
EID.Config["DisplayObstructedCardInfo"] = currentBool
end
}
)
MCM.AddSetting(
"EID",
"Display",
{
Type = ModConfigMenu.OptionType.BOOLEAN,
CurrentSetting = function()
return EID.Config["DisplayObstructedPillInfo"]
end,
Display = function()
local onOff = "False"
if EID.Config["DisplayObstructedPillInfo"] then
onOff = "True"
end
return "Pill Infos: " .. onOff
end,
OnChange = function(currentBool)
EID.Config["DisplayObstructedPillInfo"] = currentBool
end
}
)
MCM.AddSpace("EID", "Display")
MCM.AddText("EID", "Display", "Display Infos in Shops")