summaryrefslogtreecommitdiff
path: root/world.lua
diff options
context:
space:
mode:
Diffstat (limited to 'world.lua')
-rw-r--r--world.lua10
1 files changed, 8 insertions, 2 deletions
diff --git a/world.lua b/world.lua
index ec35d07..e32938d 100644
--- a/world.lua
+++ b/world.lua
@@ -64,8 +64,14 @@ end
function obj_proto:remove(ct)
local c = assert(self:get(ct))
- self.world:unreg_component(c)
- if c.disable then c:disable() end
+ for oc in obj:all_components() do
+ for d in ipairs(oc.deps) do
+ assert(d[1] ~= ct, "dependency")
+ end
+ end
+ self.world:unreg_component(c)
+ if c.disable then c:disable() end
+ if c.remove then c:remove() end
end
function obj_proto:require(ct, instance)