Bugfixed crash with no driver
parent
9fc7ed8181
commit
b51411fcc3
20
init.lua
20
init.lua
|
@ -50,8 +50,8 @@ function boat.on_rightclick(self, clicker)
|
|||
local name = clicker:get_player_name()
|
||||
if self.driver and clicker == self.driver then
|
||||
self.driver = nil
|
||||
self.v = 0
|
||||
self.v2 = 0
|
||||
--self.v = 0
|
||||
--self.v2 = 0
|
||||
clicker:set_detach()
|
||||
default.player_attached[name] = false
|
||||
default.player_set_animation(clicker, "stand" , 30)
|
||||
|
@ -195,14 +195,18 @@ end
|
|||
|
||||
-- if boat comes to sudden stop then it has crashed, destroy boat and drop 3x wood
|
||||
if self.v2 - self.v >= 3 then
|
||||
print ("VELOCITY ", self.v2 - self.v)
|
||||
local name = self.driver:get_player_name()
|
||||
self.driver:set_detach()
|
||||
self.object:remove()
|
||||
default.player_attached[name] = false
|
||||
default.player_set_animation(self.driver, "stand" , 30)
|
||||
if self.driver then
|
||||
--print ("Crash! with driver")
|
||||
local name = self.driver:get_player_name()
|
||||
self.driver:set_detach()
|
||||
default.player_attached[name] = false
|
||||
default.player_set_animation(self.driver, "stand" , 30)
|
||||
else
|
||||
--print ("Crash! no driver")
|
||||
end
|
||||
|
||||
local pos = self.object:getpos()
|
||||
self.object:remove()
|
||||
minetest.add_item(pos, "default:wood 3")
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue