Attempt to fix: Cart not working after re-login

This commit is contained in:
SmallJoker 2016-06-20 19:16:57 +02:00
parent d54ca696c5
commit 46c03dd4d1

@ -70,12 +70,11 @@ function boost_cart.cart:on_activate(staticdata, dtime_s)
if string.sub(staticdata, 1, string.len("return")) ~= "return" then if string.sub(staticdata, 1, string.len("return")) ~= "return" then
return return
end end
return local data = minetest.deserialize(staticdata)
--[[local data = minetest.deserialize(staticdata)
if not data or type(data) ~= "table" then if not data or type(data) ~= "table" then
return return
end end
self.railtype = data.railtype]] self.railtype = data.railtype
end end
function boost_cart.cart:get_staticdata() function boost_cart.cart:get_staticdata()
@ -87,7 +86,8 @@ end
function boost_cart.cart:on_punch(puncher, time_from_last_punch, tool_capabilities, direction) function boost_cart.cart:on_punch(puncher, time_from_last_punch, tool_capabilities, direction)
local pos = self.object:getpos() local pos = self.object:getpos()
if not self.railtype then if not self.railtype then
local node = minetest.get_node(vector.floor(pos)).name local bar = vector.floor(vector.add(pos, 0.1))
local node = minetest.get_node(bar).name
self.railtype = minetest.get_item_group(node, "connect_to_raillike") self.railtype = minetest.get_item_group(node, "connect_to_raillike")
end end