Allow different railtypes

This commit is contained in:
SmallJoker 2015-03-15 13:03:35 +01:00
parent eb610a5e9c
commit 670f961d35
2 changed files with 10 additions and 1 deletions

View File

@ -27,7 +27,15 @@ function boost_cart:is_rail(pos)
local vi = area:indexp(pos) local vi = area:indexp(pos)
node = minetest.get_name_from_content_id(data[vi]) node = minetest.get_name_from_content_id(data[vi])
end end
return minetest.get_item_group(node, "rail") ~= 0 if minetest.get_item_group(node, "rail") == 0 then
return false
end
local group = minetest.get_item_group(node, "connect_to_raillike")
if self.railtype == nil then
self.railtype = group
return true
end
return group == self.railtype
end end
function boost_cart:check_front_up_down(pos, dir, onlyDown) function boost_cart:check_front_up_down(pos, dir, onlyDown)

View File

@ -30,6 +30,7 @@ boost_cart.cart = {
old_dir = {x=0, y=0, z=0}, old_dir = {x=0, y=0, z=0},
old_pos = nil, old_pos = nil,
old_switch = nil, old_switch = nil,
railtype = nil,
attached_items = {} attached_items = {}
} }