Skip to content

Commit

Permalink
feature(live_entity): reset queue & allow more entities per update
Browse files Browse the repository at this point in the history
  • Loading branch information
IllustrisJack committed Apr 12, 2022
1 parent 6f627fb commit 6795e18
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
13 changes: 12 additions & 1 deletion ext/Client/Modules/LiveEntityHandler.lua
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ function LiveEntityHandler:SetVisibility(p_Category, p_Visible)
return
end

if #m_Queue ~= 0 then
m_Queue = {}
end

if m_StoredEntities == nil then
m_StoredEntities = {}
for l_ID, l_Preset in pairs(CLIENT.m_RawPresets) do
Expand Down Expand Up @@ -76,6 +80,8 @@ function LiveEntityHandler:SetVisibility(p_Category, p_Visible)
end

local s_Counter = 0
local s_UpdatedEntites = 0
local s_EntitiesPerUpdate = 10
function LiveEntityHandler:OnUpdateManagerPreSim(p_DeltaTime)
if #m_Queue <= 0 then
return
Expand All @@ -97,9 +103,14 @@ function LiveEntityHandler:OnUpdateManagerPreSim(p_DeltaTime)
end
end
s_Counter = s_Counter + 1
s_UpdatedEntites = s_UpdatedEntites + 1
table.remove(m_Queue, l_Index)
m_Logger:Write('Changed Visibility')
break

if s_UpdatedEntites > s_EntitiesPerUpdate then
s_UpdatedEntites = 0
break
end
end

m_Logger:Write('Still in Queue: ' .. #m_Queue)
Expand Down
1 change: 0 additions & 1 deletion ext/Client/__init__.lua
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,6 @@ function VEManagerClient:SetVisibilityInternal(p_ID, p_Visibility)
self.m_Presets[p_ID]["logic"].visibility = p_Visibility
self.m_Presets[p_ID]["ve"].visibility = p_Visibility


if self.m_RawPresets[p_ID]["LiveEntities"] ~= nil then
if p_Visibility > 0.5 then
LiveEntityHandler:SetVisibility(p_ID, false)
Expand Down

0 comments on commit 6795e18

Please sign in to comment.