Skip to content

Commit 5e0c493

Browse files
committedJul 6, 2014
Fix boats again
1 parent 584718a commit 5e0c493

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed
 

‎mods/boats/init.lua

+12-2
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ local boat = {
4040
driver = nil,
4141
v = 0,
4242
last_v = 0,
43+
removed = false
4344
}
4445

4546
function boat.on_rightclick(self, clicker)
@@ -76,9 +77,18 @@ function boat.get_staticdata()
7677
end
7778

7879
function boat.on_punch(self, puncher, time_from_last_punch, tool_capabilities, direction)
80+
if not puncher or not puncher:is_player() or self.removed then
81+
return
82+
end
7983
puncher:set_detach()
80-
self.object:remove()
81-
if puncher and puncher:is_player() and not minetest.setting_getbool("creative_mode") then
84+
default.player_attached[puncher:get_player_name()] = false
85+
86+
self.removed = true
87+
-- delay remove to ensure player is detached
88+
minetest.after(0.1,function()
89+
self.object:remove()
90+
end)
91+
if not minetest.setting_getbool("creative_mode") then
8292
puncher:get_inventory():add_item("main", "boats:boat")
8393
end
8494
end

0 commit comments

Comments
 (0)
Please sign in to comment.