diff options
author | the lemons <citrons@mondecitronne.com> | 2022-08-28 00:15:24 -0500 |
---|---|---|
committer | the lemons <citrons@mondecitronne.com> | 2022-08-28 00:20:00 -0500 |
commit | 56ea4768c6decc07df7fd9025561835ac8be9d64 (patch) | |
tree | f51b5e694881128f62154275c4ede279a543461c | |
parent | a96780e04d22c916921be996a6b99487efc4e569 (diff) |
obj:remove: error on dependency problem
-rw-r--r-- | world.lua | 10 |
1 files changed, 8 insertions, 2 deletions
@@ -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) |