From 401382106f40205bd616fa9c5be9d1ae432102ed Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Sat, 22 Feb 2020 20:47:25 +0100 Subject: [PATCH] Fix crash when riding player leaves --- mods/ENTITIES/mcl_mobs/api.lua | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/mods/ENTITIES/mcl_mobs/api.lua b/mods/ENTITIES/mcl_mobs/api.lua index b0152f5c..9ccd43a0 100644 --- a/mods/ENTITIES/mcl_mobs/api.lua +++ b/mods/ENTITIES/mcl_mobs/api.lua @@ -2791,6 +2791,13 @@ local mob_punch = function(self, hitter, tflp, tool_capabilities, dir) end end +local mob_detach_child = function(self, child) + + if self.driver == child then + self.driver = nil + end + +end -- get entity staticdata local mob_staticdata = function(self) @@ -3362,6 +3369,8 @@ minetest.register_entity(name, { on_grown = def.on_grown, + on_detach_child = mob_detach_child, + on_activate = function(self, staticdata, dtime) return mob_activate(self, staticdata, def, dtime) end,