From 28b6fcf289727ad17aab2cc88c1834e19cb5c695 Mon Sep 17 00:00:00 2001 From: cora Date: Fri, 11 Nov 2022 00:28:31 +0100 Subject: [PATCH] Move detach_child to mount.lua --- mods/ENTITIES/mcl_mobs/api.lua | 14 -------------- mods/ENTITIES/mcl_mobs/mount.lua | 14 +++++++++++++- 2 files changed, 13 insertions(+), 15 deletions(-) diff --git a/mods/ENTITIES/mcl_mobs/api.lua b/mods/ENTITIES/mcl_mobs/api.lua index 4328bd20f..6c654c2bc 100644 --- a/mods/ENTITIES/mcl_mobs/api.lua +++ b/mods/ENTITIES/mcl_mobs/api.lua @@ -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() diff --git a/mods/ENTITIES/mcl_mobs/mount.lua b/mods/ENTITIES/mcl_mobs/mount.lua index 95a145a4b..0307a5fc0 100644 --- a/mods/ENTITIES/mcl_mobs/mount.lua +++ b/mods/ENTITIES/mcl_mobs/mount.lua @@ -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