1
0
mirror of https://github.com/SmallJoker/boost_cart.git synced 2025-06-30 23:40:21 +02:00

Use minetest.raillike_group, do not connect rails with other raillike

This commit is contained in:
SmallJoker
2017-07-01 10:45:15 +02:00
parent b80d3aed4c
commit af25c5411b
2 changed files with 12 additions and 3 deletions

View File

@ -83,7 +83,8 @@ end
function cart_entity:on_punch(puncher, time_from_last_punch, tool_capabilities, direction)
local pos = self.object:getpos()
if not self.railtype then
local vel = self.object:getvelocity()
if not self.railtype or vector.equals(vel, {x=0, y=0, z=0}) then
local node = minetest.get_node(pos).name
self.railtype = minetest.get_item_group(node, "connect_to_raillike")
end
@ -122,7 +123,7 @@ function cart_entity:on_punch(puncher, time_from_last_punch, tool_capabilities,
return
end
local vel = self.object:getvelocity()
-- Driver punches to accelerate the cart
if puncher:get_player_name() == self.driver then
if math.abs(vel.x + vel.z) > boost_cart.punch_speed_max then
return