#41 Add recursive component removing on druid:remove

This commit is contained in:
Insality
2020-05-08 00:12:48 +03:00
parent bb565432f3
commit 92f95f77d1
2 changed files with 24 additions and 0 deletions

View File

@@ -170,6 +170,14 @@ end
function Druid.remove(self, component)
local all_components = self.components[const.ALL]
-- Recursive remove all children of component
for i = 1, #all_components do
local inst = all_components[i]
if inst:is_child_of(component) then
self:remove(inst)
end
end
for i = #all_components, 1, -1 do
if all_components[i] == component then
if component.on_remove then