Skip to content

Commit

Permalink
Fix boats again
Browse files Browse the repository at this point in the history
  • Loading branch information
BlockMen committed Jul 6, 2014
1 parent 584718a commit 5e0c493
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions mods/boats/init.lua
Expand Up @@ -40,6 +40,7 @@ local boat = {
driver = nil,
v = 0,
last_v = 0,
removed = false
}

function boat.on_rightclick(self, clicker)
Expand Down Expand Up @@ -76,9 +77,18 @@ function boat.get_staticdata()
end

function boat.on_punch(self, puncher, time_from_last_punch, tool_capabilities, direction)
if not puncher or not puncher:is_player() or self.removed then
return
end
puncher:set_detach()
self.object:remove()
if puncher and puncher:is_player() and not minetest.setting_getbool("creative_mode") then
default.player_attached[puncher:get_player_name()] = false

self.removed = true
-- delay remove to ensure player is detached
minetest.after(0.1,function()
self.object:remove()
end)
if not minetest.setting_getbool("creative_mode") then
puncher:get_inventory():add_item("main", "boats:boat")
end
end
Expand Down

0 comments on commit 5e0c493

Please sign in to comment.