Improved performance when a lot of effects are on screen

This commit is contained in:
Wofsauge committed 2021-06-14 19:22:03 +02:00
1 parent 31712d3f46
commit 042be37766
2 files changed
+10 -2

No files matched your search

+3
View File
@@ -166,6 +166,9 @@ end
function EID:addEntity(id, variant, subtype, entityName, description, language)
subtype = subtype or nil
language = language or "en_us"
if id == EntityType.ENTITY_EFFECT then
EID.effectList[variant] = true
end
EID.descriptions[language].custom[id .. "." .. variant .. "." .. subtype] = {
subtype,
entityName,
+7 -2
View File
@@ -24,6 +24,7 @@ EID.lastDescriptionEntity = nil
EID.lineHeight = 11
EID.sacrificeCounter = {}
EID.itemConfig = Isaac.GetItemConfig()
EID.effectList = {["76"] = true}
-- Sprite inits
EID.IconSprite = Sprite()
@@ -501,8 +502,12 @@ local function onRender(t)
EID.lastDescriptionEntity = nil
EID.lastDist = 10000
local searchGroups = {}
searchGroups[1] = Isaac.FindByType(EntityType.ENTITY_EFFECT, -1, -1, true, false)
searchGroups[2] = Isaac.FindInRadius(EID.player.Position, tonumber(EID.Config["MaxDistance"])*40, searchPartitions)
table.insert(searchGroups, Isaac.FindInRadius(EID.player.Position, tonumber(EID.Config["MaxDistance"])*40, searchPartitions))
for k,_ in pairs(EID.effectList) do
table.insert(searchGroups, Isaac.FindByType(EntityType.ENTITY_EFFECT, k, -1, true, false))
end
for _, entitySearch in ipairs(searchGroups) do
for i, entity in ipairs(entitySearch) do
if EID:hasDescription(entity) and entity.FrameCount > 0 then