Skip to content
This repository was archived by the owner on Aug 20, 2020. It is now read-only.

Commit cff8ee1

Browse files
committed
fix bug if detach player whithout set entity.driver=nil
1 parent 6ce526a commit cff8ee1

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

mods/mobs/api.lua

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1859,7 +1859,14 @@ minetest.register_entity(name, {
18591859
dir = dir or {x = 0, y = 0, z = 0}
18601860

18611861
-- weapon wear
1862-
hitter:set_detach() --MFF (crabman|27/7/2015) anti usebug, immortal if attached
1862+
local attach = hitter:get_attach()
1863+
if attach and attach:get_luaentity() then
1864+
local luaentity = attach:get_luaentity()
1865+
if luaentity.driver then
1866+
luaentity.driver = nil
1867+
end
1868+
hitter:set_detach() --MFF (crabman|27/7/2015) anti usebug, immortal if attached
1869+
end
18631870
local weapon = hitter:get_wielded_item()
18641871
local punch_interval = 1.4
18651872

0 commit comments

Comments
 (0)