Add spaces around operators in boat mod code, fix a problem with boat staticdata, fix a crash that can occur with boat going over unknown nodes.

This commit is contained in:
Novatux 2014-07-09 09:47:51 +02:00
parent 955f3cf310
commit c993e14084

View File

@ -72,8 +72,8 @@ function boat.on_activate(self, staticdata, dtime_s)
self.last_v = self.v
end
function boat.get_staticdata()
return tostring(v)
function boat.get_staticdata(self)
return tostring(self.v)
end
function boat.on_punch(self, puncher, time_from_last_punch, tool_capabilities, direction)
@ -139,7 +139,8 @@ function boat.on_step(self, dtime)
local new_velo = {x = 0, y = 0, z = 0}
local new_acce = {x = 0, y = 0, z = 0}
if not is_water(p) then
if minetest.registered_nodes[minetest.env:get_node(p).name].walkable then
local nodedef = minetest.registered_nodes[minetest.get_node(p).name]
if (not nodedef) or nodedef.walkable then
self.v = 0
end
new_acce = {x = 0, y = -10, z = 0}