Move detach_child to mount.lua

This commit is contained in:
cora 2022-11-11 00:28:31 +01:00
parent 80490b4c11
commit 28b6fcf289
2 changed files with 13 additions and 15 deletions

View file

@ -117,20 +117,6 @@ local node_ok = function(pos, fallback)
return minetest.registered_nodes[fallback]
end
local mob_detach_child = function(self, child)
if self.detach_child then
if self.detach_child(self, child) then
return
end
end
if self.driver == child then
self.driver = nil
end
end
-- get entity staticdata
function mob_class:get_staticdata()

View file

@ -1,4 +1,5 @@
local math, vector, minetest, mcl_mobs = math, vector, minetest, mcl_mobs
local mob_class = mcl_mobs.mob_class
-- lib_mount by Blert2112 (edited by TenPlus1)
local enable_crash = false
@ -446,3 +447,14 @@ function mcl_mobs.fly(entity, dtime, speed, shoots, arrow, moving_anim, stand_an
mcl_mobs:set_animation(entity, moving_anim)
end
end
function mob_class:on_detach_child(child)
if self.detach_child then
if self.detach_child(self, child) then
return
end
end
if self.driver == child then
self.driver = nil
end
end