Skip to content

Commit a88576a

Browse files
Rui914paramat
Rui914
authored andcommittedOct 29, 2015
Boats: Check player attached object
1 parent 6f6d46d commit a88576a

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed
 

Diff for: ‎mods/boats/init.lua

+9-2
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,14 @@ function boat.on_rightclick(self, clicker)
6262
clicker:setpos(pos)
6363
end)
6464
elseif not self.driver then
65+
local attach = clicker:get_attach()
66+
if attach and attach:get_luaentity() then
67+
local luaentity = attach:get_luaentity()
68+
if luaentity.driver then
69+
luaentity.driver = nil
70+
end
71+
clicker:set_detach()
72+
end
6573
self.driver = clicker
6674
clicker:set_attach(self.object, "",
6775
{x = 0, y = 11, z = -3}, {x = 0, y = 0, z = 0})
@@ -88,8 +96,7 @@ function boat.get_staticdata(self)
8896
end
8997

9098

91-
function boat.on_punch(self, puncher, time_from_last_punch,
92-
tool_capabilities, direction)
99+
function boat.on_punch(self, puncher)
93100
if not puncher or not puncher:is_player() or self.removed then
94101
return
95102
end

0 commit comments

Comments
 (0)
Please sign in to comment.