From cff8ee1aaefb6b140bd52e69134167d67a2b23ea Mon Sep 17 00:00:00 2001 From: crabman77 Date: Sun, 19 Feb 2017 18:45:33 +0100 Subject: [PATCH] fix bug if detach player whithout set entity.driver=nil --- mods/mobs/api.lua | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/mods/mobs/api.lua b/mods/mobs/api.lua index 212998fb..a2c68d07 100755 --- a/mods/mobs/api.lua +++ b/mods/mobs/api.lua @@ -1859,7 +1859,14 @@ minetest.register_entity(name, { dir = dir or {x = 0, y = 0, z = 0} -- weapon wear - hitter:set_detach() --MFF (crabman|27/7/2015) anti usebug, immortal if attached + local attach = hitter:get_attach() + if attach and attach:get_luaentity() then + local luaentity = attach:get_luaentity() + if luaentity.driver then + luaentity.driver = nil + end + hitter:set_detach() --MFF (crabman|27/7/2015) anti usebug, immortal if attached + end local weapon = hitter:get_wielded_item() local punch_interval = 1.4