Skip to content

Commit

Permalink
asset manager: check if assets are dead
Browse files Browse the repository at this point in the history
Check if assets are dead and remove them.
  • Loading branch information
jtoppins committed Feb 18, 2021
1 parent ab93241 commit 07f24fd
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/dct/assets/AssetManager.lua
Original file line number Diff line number Diff line change
Expand Up @@ -173,10 +173,17 @@ function AssetManager:getTargets(requestingside, assettypelist)
end

function AssetManager:update()
local deletionq = {}
for _, asset in pairs(self._assetset) do
if type(asset.update) == "function" then
asset:update()
end
if asset:isDead() then
deletionq[asset.name] = true
end
end
for name, _ in pairs(deletionq) do
self:remove(self:getAsset(name))
end
return self.updaterate
end
Expand Down

0 comments on commit 07f24fd

Please sign in to comment.