Added GridEntity Description feature; Reworked sacrifice spike descriptions
This commit is contained in:
1 parent
81efabf913
commit
d2ecc50c56
4 files changed
+95
-83
No files matched your search
+30
-3
@@ -458,6 +458,8 @@ function EID:getAdjustedSubtype(Type, Variant, SubType)
|
|||||||
if SubType > 32768 then
|
if SubType > 32768 then
|
||||||
return SubType - 32768
|
return SubType - 32768
|
||||||
end
|
end
|
||||||
|
elseif tableName == "sacrifice" then
|
||||||
|
return math.min(#EID.descriptions["en_us"].sacrifice, SubType)
|
||||||
elseif tableName == "pills" or tableName == "horsepills" then
|
elseif tableName == "pills" or tableName == "horsepills" then
|
||||||
-- The effect of a pill varies depending on what player is looking at it in co-op
|
-- The effect of a pill varies depending on what player is looking at it in co-op
|
||||||
-- EID.pillPlayer is a way to recheck a pill for what different players will turn it into
|
-- EID.pillPlayer is a way to recheck a pill for what different players will turn it into
|
||||||
@@ -543,7 +545,7 @@ function EID:getObjectName(Type, Variant, SubType)
|
|||||||
local adjustedSubtype = EID:getAdjustedSubtype(Type, Variant, SubType)
|
local adjustedSubtype = EID:getAdjustedSubtype(Type, Variant, SubType)
|
||||||
return EID:getPillName(adjustedSubtype, tableName == "horsepills")
|
return EID:getPillName(adjustedSubtype, tableName == "horsepills")
|
||||||
elseif tableName == "sacrifice" then
|
elseif tableName == "sacrifice" then
|
||||||
return EID:getDescriptionEntry("sacrificeHeader")
|
return EID:getDescriptionEntry("sacrificeHeader").." ("..SubType.."/"..#EID.descriptions["en_us"].sacrifice..")"
|
||||||
elseif tableName == "dice" then
|
elseif tableName == "dice" then
|
||||||
return EID:getDescriptionEntry("diceHeader").." ("..SubType..")"
|
return EID:getDescriptionEntry("diceHeader").." ("..SubType..")"
|
||||||
elseif tableName == "custom" then
|
elseif tableName == "custom" then
|
||||||
@@ -589,6 +591,16 @@ 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)
|
||||||
|
if entity and EID:IsGridEntity(entity) then
|
||||||
|
if entity and EID.GridEntityWhitelist[entity:GetType()] then
|
||||||
|
for _, func in ipairs(EID.GridEntityWhitelist[entity:GetType()]) do
|
||||||
|
if func(entity) then
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return false
|
||||||
|
end
|
||||||
local isAllowed = false
|
local isAllowed = false
|
||||||
local entityString = entity.Type .. "." .. entity.Variant .. "." .. entity.SubType
|
local entityString = entity.Type .. "." .. entity.Variant .. "." .. entity.SubType
|
||||||
|
|
||||||
@@ -1355,7 +1367,7 @@ function EID:getScreenSize()
|
|||||||
end
|
end
|
||||||
|
|
||||||
function EID:getEntityData(entity, str)
|
function EID:getEntityData(entity, str)
|
||||||
if entity ~= nil and entity:GetData() ~= nil then
|
if entity ~= nil and not EID:IsGridEntity(entity) and entity:GetData() ~= nil then
|
||||||
return entity:GetData()[str]
|
return entity:GetData()[str]
|
||||||
end
|
end
|
||||||
return nil
|
return nil
|
||||||
@@ -1632,7 +1644,6 @@ local hadQueuedItem = {}
|
|||||||
function EID:evaluateQueuedItems()
|
function EID:evaluateQueuedItems()
|
||||||
--initialize the interactions table for all players if it isn't already
|
--initialize the interactions table for all players if it isn't already
|
||||||
for i = 0, game:GetNumPlayers() - 1 do
|
for i = 0, game:GetNumPlayers() - 1 do
|
||||||
local player = Isaac.GetPlayer(i)
|
|
||||||
if not EID.PlayerItemInteractions[i] then
|
if not EID.PlayerItemInteractions[i] then
|
||||||
EID.PlayerItemInteractions[i] = {LastTouch = 0, actives = {}, pills = {}, altActives = {}, altPills = {}, pickupHistory = {}}
|
EID.PlayerItemInteractions[i] = {LastTouch = 0, actives = {}, pills = {}, altActives = {}, altPills = {}, pickupHistory = {}}
|
||||||
end
|
end
|
||||||
@@ -1736,7 +1747,18 @@ function EID:AddPickupToHistory(pickupType, effectID, player, useFlags)
|
|||||||
table.insert(historyTable, 1, {pickupType, player:GetPlayerType(), effectID, REPENTANCE and player:HasCollectible(700)})
|
table.insert(historyTable, 1, {pickupType, player:GetPlayerType(), effectID, REPENTANCE and player:HasCollectible(700)})
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Render a sprite of an entity
|
||||||
|
function EID:RenderEntity(entity, sprite, position)
|
||||||
|
if entity.Type == 5 and entity.Variant == 100 then
|
||||||
|
sprite:RenderLayer(1, position, nullVector, nullVector)
|
||||||
|
elseif entity.Type == 6 and entity.Variant == 16 then -- Crane Game
|
||||||
|
sprite:RenderLayer(2, position, nullVector, nullVector)
|
||||||
|
else
|
||||||
|
sprite:Render(position, nullVector, nullVector)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Tries to get the Vanilla transformations of modded items based on Tags
|
||||||
function EID:GetTransformationsOfModdedItems()
|
function EID:GetTransformationsOfModdedItems()
|
||||||
if not REPENTANCE then return end
|
if not REPENTANCE then return end
|
||||||
local numCollectibles = EID:GetMaxCollectibleID()
|
local numCollectibles = EID:GetMaxCollectibleID()
|
||||||
@@ -1744,3 +1766,8 @@ function EID:GetTransformationsOfModdedItems()
|
|||||||
EID:tryAutodetectTransformationsCollectible(i)
|
EID:tryAutodetectTransformationsCollectible(i)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Returns true if a given entity is a grid entity
|
||||||
|
function EID:IsGridEntity(entity)
|
||||||
|
return entity.Type == nil
|
||||||
|
end
|
||||||
@@ -21,6 +21,22 @@ EID.effectList = {
|
|||||||
["161"] = true,
|
["161"] = true,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
-- Grid entity types to be detected by EID
|
||||||
|
-- Add functions to the list to further filter the entries
|
||||||
|
EID.GridEntityWhitelist = {
|
||||||
|
[GridEntityType.GRID_SPIKES] = {
|
||||||
|
function(gridEntity)
|
||||||
|
return Game():GetRoom():GetType() == RoomType.ROOM_SACRIFICE and
|
||||||
|
EID.Config["DisplaySacrificeInfo"]
|
||||||
|
end,
|
||||||
|
function(gridEntity)
|
||||||
|
return REPENTANCE and EID.Config["DisplaySanguineInfo"] and
|
||||||
|
Game():GetRoom():GetType() == RoomType.ROOM_DEVIL and
|
||||||
|
EID:PlayersHaveCollectible(CollectibleType.COLLECTIBLE_SANGUINE_BOND)
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
--maps the Player transformation from the enum PlayerForm to the internal transformation table
|
--maps the Player transformation from the enum PlayerForm to the internal transformation table
|
||||||
-- Possible usages: EID.TRANSFORMATION[ PlayerForm.PLAYERFORM_MUSHROOM ]
|
-- Possible usages: EID.TRANSFORMATION[ PlayerForm.PLAYERFORM_MUSHROOM ]
|
||||||
-- EID.TRANSFORMATION.MUSHROOM
|
-- EID.TRANSFORMATION.MUSHROOM
|
||||||
|
|||||||
+1
-1
@@ -217,8 +217,8 @@ end
|
|||||||
-- Handle Sacrifice room payout
|
-- Handle Sacrifice room payout
|
||||||
local function SacrificeRoomCallback(descObj)
|
local function SacrificeRoomCallback(descObj)
|
||||||
local curCounter = descObj.ObjSubType or 1
|
local curCounter = descObj.ObjSubType or 1
|
||||||
descObj.Name = descObj.Name.." ("..curCounter.."/12)"
|
|
||||||
if curCounter <= 2 then
|
if curCounter <= 2 then
|
||||||
|
--Remove B1 Bomb drop info when not on B1
|
||||||
if game:GetLevel():GetAbsoluteStage() > 1 then
|
if game:GetLevel():GetAbsoluteStage() > 1 then
|
||||||
local splitPoint = string.find(descObj.Description, '#', 1)
|
local splitPoint = string.find(descObj.Description, '#', 1)
|
||||||
descObj.Description = descObj.Description:sub(1,splitPoint-1)
|
descObj.Description = descObj.Description:sub(1,splitPoint-1)
|
||||||
|
|||||||
@@ -29,20 +29,18 @@ EID.isDisplayingPermanent = false
|
|||||||
EID.permanentDisplayTextObj = nil
|
EID.permanentDisplayTextObj = nil
|
||||||
EID.lastDescriptionEntity = nil
|
EID.lastDescriptionEntity = nil
|
||||||
EID.lineHeight = 11
|
EID.lineHeight = 11
|
||||||
EID.sacrificeCounter = {}
|
|
||||||
local spikePos = Vector(320, 280)
|
|
||||||
EID.itemConfig = Isaac.GetItemConfig()
|
EID.itemConfig = Isaac.GetItemConfig()
|
||||||
EID.itemUnlockStates = {}
|
EID.itemUnlockStates = {}
|
||||||
EID.CraneItemType = {}
|
EID.CraneItemType = {}
|
||||||
EID.absorbedItems = {}
|
EID.absorbedItems = {}
|
||||||
EID.CollectedItems = {}
|
EID.CollectedItems = {}
|
||||||
EID.IgnoredEntities = {}
|
EID.IgnoredEntities = {}
|
||||||
|
EID.CurrentRoomGridEntities = {}
|
||||||
EID.UnidentifyablePillEffects = {} -- List of pilleffects that are always unidentifyable
|
EID.UnidentifyablePillEffects = {} -- List of pilleffects that are always unidentifyable
|
||||||
local pathsChecked = {}
|
local pathsChecked = {}
|
||||||
local altPathItemChecked = {}
|
local altPathItemChecked = {}
|
||||||
local alwaysUseLocalMode = false -- set to true after drawing a non-local mode description this frame
|
local alwaysUseLocalMode = false -- set to true after drawing a non-local mode description this frame
|
||||||
EID.ForceRefreshCache = false -- set to true to force-refresh descriptions, currently used for potential transformation text changes
|
EID.ForceRefreshCache = false -- set to true to force-refresh descriptions, currently used for potential transformation text changes
|
||||||
local preHourglassStatus = {}
|
|
||||||
EID.holdTabPlayer = 0
|
EID.holdTabPlayer = 0
|
||||||
EID.holdTabCounter = 0
|
EID.holdTabCounter = 0
|
||||||
EID.DInfinityState = {}
|
EID.DInfinityState = {}
|
||||||
@@ -174,10 +172,9 @@ if not success then
|
|||||||
end
|
end
|
||||||
|
|
||||||
---------------------------------------------------------------------------
|
---------------------------------------------------------------------------
|
||||||
-------------Handle Sacrifice Room & Resetting Floor Trackers--------------
|
-------------Handle Resetting Floor Trackers--------------
|
||||||
function EID:onNewFloor()
|
function EID:onNewFloor()
|
||||||
pathsChecked = {}
|
pathsChecked = {}
|
||||||
EID.sacrificeCounter = {}
|
|
||||||
if REPENTANCE then
|
if REPENTANCE then
|
||||||
EID.BoC.RoomQueries = {}
|
EID.BoC.RoomQueries = {}
|
||||||
EID.BoC.FloorQuery = {}
|
EID.BoC.FloorQuery = {}
|
||||||
@@ -188,19 +185,6 @@ function EID:onNewFloor()
|
|||||||
end
|
end
|
||||||
EID:AddCallback(ModCallbacks.MC_POST_NEW_LEVEL, EID.onNewFloor)
|
EID:AddCallback(ModCallbacks.MC_POST_NEW_LEVEL, EID.onNewFloor)
|
||||||
|
|
||||||
function EID:onSacrificeDamage(_, _, flags, source)
|
|
||||||
if EID.Config["DisplaySacrificeInfo"] and game:GetRoom():GetType() == RoomType.ROOM_SACRIFICE and source.Type == 0 and flags & DamageFlag.DAMAGE_SPIKES == DamageFlag.DAMAGE_SPIKES then
|
|
||||||
local curRoomIndex = game:GetLevel():GetCurrentRoomDesc().ListIndex
|
|
||||||
if EID.sacrificeCounter[curRoomIndex] == nil then
|
|
||||||
EID.sacrificeCounter[curRoomIndex] = 1
|
|
||||||
end
|
|
||||||
if EID.sacrificeCounter[curRoomIndex] < 12 then
|
|
||||||
EID.sacrificeCounter[curRoomIndex] = EID.sacrificeCounter[curRoomIndex] + 1
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
EID:AddCallback(ModCallbacks.MC_ENTITY_TAKE_DMG, EID.onSacrificeDamage, EntityType.ENTITY_PLAYER)
|
|
||||||
|
|
||||||
---------------------------------------------------------------------------
|
---------------------------------------------------------------------------
|
||||||
------------------------Handle ALT FLOOR CHOICE----------------------------
|
------------------------Handle ALT FLOOR CHOICE----------------------------
|
||||||
|
|
||||||
@@ -771,18 +755,16 @@ end
|
|||||||
function EID:onNewRoom()
|
function EID:onNewRoom()
|
||||||
EID.RecentlyTouchedItems = {}
|
EID.RecentlyTouchedItems = {}
|
||||||
|
|
||||||
local curRoomIndex = game:GetLevel():GetCurrentRoomDesc().ListIndex
|
EID.CurrentRoomGridEntities = {}
|
||||||
preHourglassStatus = {}
|
local room = game:GetRoom()
|
||||||
|
for i = 1, room:GetGridSize(), 1 do
|
||||||
preHourglassStatus.SacrificeCounter = EID.sacrificeCounter[curRoomIndex]
|
local gridEntity = room:GetGridEntity(i)
|
||||||
|
if gridEntity and EID:hasDescription(gridEntity) then
|
||||||
|
EID.CurrentRoomGridEntities[i] = gridEntity
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
EID:AddCallback(ModCallbacks.MC_POST_NEW_ROOM, EID.onNewRoom)
|
EID:AddCallback(ModCallbacks.MC_POST_NEW_ROOM, EID.onNewRoom)
|
||||||
|
|
||||||
function EID:WatchForGlowingHourglass()
|
|
||||||
local curRoomIndex = game:GetLevel():GetCurrentRoomDesc().ListIndex
|
|
||||||
EID.sacrificeCounter[curRoomIndex] = preHourglassStatus.SacrificeCounter
|
|
||||||
end
|
|
||||||
EID:AddCallback(ModCallbacks.MC_PRE_USE_ITEM, EID.WatchForGlowingHourglass, CollectibleType.COLLECTIBLE_GLOWING_HOUR_GLASS)
|
|
||||||
---------------------------------------------------------------------------
|
---------------------------------------------------------------------------
|
||||||
---------------------------Handle Rendering--------------------------------
|
---------------------------Handle Rendering--------------------------------
|
||||||
|
|
||||||
@@ -839,11 +821,11 @@ function EID:renderIndicator(entity, playerNum)
|
|||||||
ArrowOffset = Vector(0, -62)
|
ArrowOffset = Vector(0, -62)
|
||||||
end
|
end
|
||||||
local arrowPos = Isaac.WorldToScreen(entity.Position + ArrowOffset)
|
local arrowPos = Isaac.WorldToScreen(entity.Position + ArrowOffset)
|
||||||
if entity:GetData() and entity:GetData()["EID_RenderOffset"] then
|
if not EID:IsGridEntity(entity) and entity:GetData() and entity:GetData()["EID_RenderOffset"] then
|
||||||
entityPos = entityPos + entity:GetData()["EID_RenderOffset"]
|
entityPos = entityPos + entity:GetData()["EID_RenderOffset"]
|
||||||
end
|
end
|
||||||
-- Move highlights a bit to fit onto the alt Item layout of Flip / Tainted Laz
|
-- Move highlights a bit to fit onto the alt Item layout of Flip / Tainted Laz
|
||||||
if REPENTANCE then
|
if REPENTANCE and not EID:IsGridEntity(entity) then
|
||||||
if entity.Variant == 100 and EID.player:HasCollectible(CollectibleType.COLLECTIBLE_FLIP) and EID:getEntityData(entity, "EID_FlipItemID") then
|
if entity.Variant == 100 and EID.player:HasCollectible(CollectibleType.COLLECTIBLE_FLIP) and EID:getEntityData(entity, "EID_FlipItemID") then
|
||||||
entityPos = entityPos + Vector(2.5,2.5)
|
entityPos = entityPos + Vector(2.5,2.5)
|
||||||
elseif entity.Type == 6 and entity.Variant == 16 then
|
elseif entity.Type == 6 and entity.Variant == 16 then
|
||||||
@@ -866,16 +848,17 @@ function EID:renderIndicator(entity, playerNum)
|
|||||||
ArrowSprite:RenderLayer(playerNum-1, arrowPos, nullVector, nullVector)
|
ArrowSprite:RenderLayer(playerNum-1, arrowPos, nullVector, nullVector)
|
||||||
else
|
else
|
||||||
local colorMult = {1,1,1}
|
local colorMult = {1,1,1}
|
||||||
|
local framecount = entity.FrameCount or game:GetFrameCount()
|
||||||
if EID.isMultiplayer then colorMult = playerRGB[playerNum] end
|
if EID.isMultiplayer then colorMult = playerRGB[playerNum] end
|
||||||
if EID.Config["Indicator"] == "blink" then
|
if EID.Config["Indicator"] == "blink" then
|
||||||
local c = 255 - math.floor(255 * ((entity.FrameCount % 40) / 40))
|
local c = 255 - math.floor(255 * ((framecount % 40) / 40))
|
||||||
local r, g, b = math.floor(c*colorMult[1]), math.floor(c*colorMult[2]), math.floor(c*colorMult[3])
|
local r, g, b = math.floor(c*colorMult[1]), math.floor(c*colorMult[2]), math.floor(c*colorMult[3])
|
||||||
sprite.Color = Color(1, 1, 1, 1, r/repDiv, g/repDiv, b/repDiv)
|
sprite.Color = Color(1, 1, 1, 1, r/repDiv, g/repDiv, b/repDiv)
|
||||||
EID:renderEntity(entity, sprite, entityPos)
|
EID:RenderEntity(entity, sprite, entityPos)
|
||||||
sprite.Color = Color(1, 1, 1, 1, 0, 0, 0)
|
sprite.Color = Color(1, 1, 1, 1, 0, 0, 0)
|
||||||
else
|
else
|
||||||
if EID.Config["Indicator"] == "highlight" then
|
if EID.Config["Indicator"] == "highlight" then
|
||||||
local c = 255 - math.floor(255 * ((entity.FrameCount % 40) / 40))
|
local c = 255 - math.floor(255 * ((framecount % 40) / 40))
|
||||||
local r, g, b = math.floor(c*colorMult[1]), math.floor(c*colorMult[2]), math.floor(c*colorMult[3])
|
local r, g, b = math.floor(c*colorMult[1]), math.floor(c*colorMult[2]), math.floor(c*colorMult[3])
|
||||||
sprite.Color = Color(1, 1, 1, 1, r/repDiv, g/repDiv, b/repDiv)
|
sprite.Color = Color(1, 1, 1, 1, r/repDiv, g/repDiv, b/repDiv)
|
||||||
elseif EID.Config["Indicator"] == "border" then
|
elseif EID.Config["Indicator"] == "border" then
|
||||||
@@ -883,12 +866,12 @@ function EID:renderIndicator(entity, playerNum)
|
|||||||
local r, g, b = math.floor(c*colorMult[1]), math.floor(c*colorMult[2]), math.floor(c*colorMult[3])
|
local r, g, b = math.floor(c*colorMult[1]), math.floor(c*colorMult[2]), math.floor(c*colorMult[3])
|
||||||
sprite.Color = Color(1, 1, 1, 1, r/repDiv, g/repDiv, b/repDiv)
|
sprite.Color = Color(1, 1, 1, 1, r/repDiv, g/repDiv, b/repDiv)
|
||||||
end
|
end
|
||||||
EID:renderEntity(entity, sprite, entityPos + Vector(0, 1))
|
EID:RenderEntity(entity, sprite, entityPos + Vector(0, 1))
|
||||||
EID:renderEntity(entity, sprite, entityPos + Vector(0, -1))
|
EID:RenderEntity(entity, sprite, entityPos + Vector(0, -1))
|
||||||
EID:renderEntity(entity, sprite, entityPos + Vector(1, 0))
|
EID:RenderEntity(entity, sprite, entityPos + Vector(1, 0))
|
||||||
EID:renderEntity(entity, sprite, entityPos + Vector(-1, 0))
|
EID:RenderEntity(entity, sprite, entityPos + Vector(-1, 0))
|
||||||
sprite.Color = Color(1, 1, 1, 1, 0, 0, 0)
|
sprite.Color = Color(1, 1, 1, 1, 0, 0, 0)
|
||||||
EID:renderEntity(entity, sprite, entityPos)
|
EID:RenderEntity(entity, sprite, entityPos)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if EID.isMirrorRoom then
|
if EID.isMirrorRoom then
|
||||||
@@ -909,9 +892,6 @@ function EID:PositionLocalMode(entity)
|
|||||||
local screenCenter = EID:getScreenSize()/2
|
local screenCenter = EID:getScreenSize()/2
|
||||||
EID.UsedPosition.X = EID.UsedPosition.X - (EID.UsedPosition-screenCenter).X * 2
|
EID.UsedPosition.X = EID.UsedPosition.X - (EID.UsedPosition-screenCenter).X * 2
|
||||||
end
|
end
|
||||||
if entity:ToPickup() and entity:ToPickup():IsShopItem() then
|
|
||||||
EID:alterTextPos(Isaac.WorldToScreen(entity.Position + textPosOffset))
|
|
||||||
end
|
|
||||||
else
|
else
|
||||||
EID.Scale = EID.Config["Size"]
|
EID.Scale = EID.Config["Size"]
|
||||||
EID.CurrentScaleType = "Size"
|
EID.CurrentScaleType = "Size"
|
||||||
@@ -919,17 +899,6 @@ function EID:PositionLocalMode(entity)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function EID:renderEntity(entity, sprite, position)
|
|
||||||
if entity.Type == 5 and entity.Variant == 100 then
|
|
||||||
sprite:RenderLayer(1, position, nullVector, nullVector)
|
|
||||||
elseif entity.Type == 6 and entity.Variant == 16 then -- Crane Game
|
|
||||||
sprite:RenderLayer(2, position, nullVector, nullVector)
|
|
||||||
else
|
|
||||||
sprite:Render(position, nullVector, nullVector)
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
|
||||||
|
|
||||||
function EID:renderHUDLocationIndicators()
|
function EID:renderHUDLocationIndicators()
|
||||||
local mousePos = Isaac.WorldToRenderPosition(Input.GetMousePosition(true)) * 2
|
local mousePos = Isaac.WorldToRenderPosition(Input.GetMousePosition(true)) * 2
|
||||||
Isaac.RenderScaledText("Mouse pos X:"..mousePos.X.." Y:"..mousePos.Y, 100, 10, 0.5, 0.5, 1 ,1 ,1 ,1 )
|
Isaac.RenderScaledText("Mouse pos X:"..mousePos.X.." Y:"..mousePos.Y, 100, 10, 0.5, 0.5, 1 ,1 ,1 ,1 )
|
||||||
@@ -1315,10 +1284,8 @@ local function onRender(t)
|
|||||||
playerSearch = EID.players
|
playerSearch = EID.players
|
||||||
end
|
end
|
||||||
|
|
||||||
local playerNearSacrificeSpikes = false
|
|
||||||
|
|
||||||
-- Check for descriptions to print per player
|
-- Check for descriptions to print per player
|
||||||
for i,player in ipairs(playerSearch) do
|
for _,player in ipairs(playerSearch) do
|
||||||
local displayedDesc = false
|
local displayedDesc = false
|
||||||
|
|
||||||
-- Check if this player has the Bag of Crafting
|
-- Check if this player has the Bag of Crafting
|
||||||
@@ -1345,7 +1312,7 @@ local function onRender(t)
|
|||||||
end
|
end
|
||||||
|
|
||||||
for _, entitySearch in ipairs(searchGroups) do
|
for _, entitySearch in ipairs(searchGroups) do
|
||||||
for i, entity in ipairs(entitySearch) do
|
for _, entity in ipairs(entitySearch) do
|
||||||
if EID:hasDescription(entity) and entity.FrameCount > 0 and not EID.entitiesToPrint[GetPtrHash(entity)] then
|
if EID:hasDescription(entity) and entity.FrameCount > 0 and not EID.entitiesToPrint[GetPtrHash(entity)] then
|
||||||
table.insert(inRangeEntities, entity)
|
table.insert(inRangeEntities, entity)
|
||||||
local diff = entity.Position:__sub(sourcePos)
|
local diff = entity.Position:__sub(sourcePos)
|
||||||
@@ -1360,11 +1327,16 @@ local function onRender(t)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
-- Test if the player is closer to the center of the room (Sacrifice/Sanguine Spikes) than any other entity
|
|
||||||
-- If there's more Grid Positions we want to check in the future, this could for example be generalized to a gridPosToCheck table which sets closeToGridPos flags
|
for _, gridEntity in pairs(EID.CurrentRoomGridEntities) do
|
||||||
local spikeDiff = spikePos:__sub(sourcePos)
|
if EID:hasDescription(gridEntity) then
|
||||||
if EID.lastDist ~= 10000 and spikeDiff:Length() < EID.lastDist then
|
table.insert(inRangeEntities, gridEntity)
|
||||||
playerNearSacrificeSpikes = true
|
local diff = gridEntity.Position:__sub(sourcePos)
|
||||||
|
if diff:Length() < EID.lastDist then
|
||||||
|
EID.lastDescriptionEntity = gridEntity
|
||||||
|
EID.lastDist = diff:Length()
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if EID.Config["DisplayAllNearby"] then
|
if EID.Config["DisplayAllNearby"] then
|
||||||
@@ -1381,7 +1353,7 @@ local function onRender(t)
|
|||||||
end
|
end
|
||||||
|
|
||||||
for _,closest in ipairs(inRangeEntities) do
|
for _,closest in ipairs(inRangeEntities) do
|
||||||
|
if not EID:IsGridEntity(closest) then
|
||||||
--Handle GetData Entities (specific)
|
--Handle GetData Entities (specific)
|
||||||
if EID.Config["EnableEntityDescriptions"] and EID:getEntityData(closest, "EID_Description") then
|
if EID.Config["EnableEntityDescriptions"] and EID:getEntityData(closest, "EID_Description") then
|
||||||
local desc = EID:getEntityData(closest, "EID_Description")
|
local desc = EID:getEntityData(closest, "EID_Description")
|
||||||
@@ -1465,10 +1437,6 @@ local function onRender(t)
|
|||||||
|
|
||||||
elseif closest.Variant == PickupVariant.PICKUP_TAROTCARD then
|
elseif closest.Variant == PickupVariant.PICKUP_TAROTCARD then
|
||||||
--Handle Cards & Runes
|
--Handle Cards & Runes
|
||||||
if (not EID.Config["DisplayObstructedCardInfo"] or not EID.Config["DisplayObstructedSoulstoneInfo"]) and closest.FrameCount < 3 then
|
|
||||||
-- small delay when having obstruction enabled & entering the room to prevent spoilers
|
|
||||||
--return
|
|
||||||
end
|
|
||||||
if EID:getEntityData(closest, "EID_DontHide") ~= true then
|
if EID:getEntityData(closest, "EID_DontHide") ~= true then
|
||||||
local isSoulstone = closest.SubType >= 81 and closest.SubType <= 97
|
local isSoulstone = closest.SubType >= 81 and closest.SubType <= 97
|
||||||
local hideinShop = closest:ToPickup():IsShopItem() and ((not isSoulstone and not EID.Config["DisplayCardInfoShop"]) or (isSoulstone and not EID.Config["DisplaySoulstoneInfoShop"]))
|
local hideinShop = closest:ToPickup():IsShopItem() and ((not isSoulstone and not EID.Config["DisplayCardInfoShop"]) or (isSoulstone and not EID.Config["DisplaySoulstoneInfoShop"]))
|
||||||
@@ -1514,22 +1482,23 @@ local function onRender(t)
|
|||||||
EID:addDescriptionToPrint(descriptionEntry)
|
EID:addDescriptionToPrint(descriptionEntry)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
else -- Grid entities
|
||||||
|
local room = game:GetRoom()
|
||||||
|
if closest:GetType() == GridEntityType.GRID_SPIKES then
|
||||||
|
if room:GetType() == RoomType.ROOM_SACRIFICE and EID.Config["DisplaySacrificeInfo"] then
|
||||||
|
local desc = EID:getDescriptionObj(-999, -1, closest.VarData + 1, closest)
|
||||||
|
EID:addDescriptionToPrint(desc)
|
||||||
|
elseif REPENTANCE and EID.Config["DisplaySanguineInfo"] and room:GetType() == RoomType.ROOM_DEVIL and
|
||||||
|
EID:PlayersHaveCollectible(CollectibleType.COLLECTIBLE_SANGUINE_BOND) then
|
||||||
|
local desc = EID:getDescriptionObj(5, 100, 692, closest, false)
|
||||||
|
desc.Description = EID:trimSanguineDesc(desc)
|
||||||
|
if desc.Description ~= "" then
|
||||||
|
EID:addDescriptionToPrint(desc)
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- if no entities to display, or we're close to the spikes, display Sacrifice Room information
|
|
||||||
-- it will be last priority for the main spot if DisplayAllNearby is on and we aren't near them
|
|
||||||
if (#EID.descriptionsToPrint == 0 or playerNearSacrificeSpikes) or EID.Config["DisplayAllNearby"] then
|
|
||||||
if game:GetRoom():GetType() == RoomType.ROOM_SACRIFICE and EID.Config["DisplaySacrificeInfo"] then
|
|
||||||
local curRoomIndex = game:GetLevel():GetCurrentRoomDesc().ListIndex
|
|
||||||
local curCounter = EID.sacrificeCounter[curRoomIndex] or 1
|
|
||||||
local sacrificeDesc = EID:getDescriptionObj(-999, -1, curCounter)
|
|
||||||
EID:addDescriptionToPrint(sacrificeDesc, playerNearSacrificeSpikes and 1 or nil)
|
|
||||||
elseif REPENTANCE and EID.Config["DisplaySanguineInfo"] and game:GetRoom():GetType() == RoomType.ROOM_DEVIL and EID:PlayersHaveCollectible(CollectibleType.COLLECTIBLE_SANGUINE_BOND) then
|
|
||||||
local sanguineDesc = EID:getDescriptionObj(5, 100, 692, nil, false)
|
|
||||||
sanguineDesc.Description = EID:trimSanguineDesc(sanguineDesc)
|
|
||||||
if sanguineDesc.Description ~= "" then EID:addDescriptionToPrint(sanguineDesc, playerNearSacrificeSpikes and 1 or nil) end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user