Enable new track with get_next_dir handlers

This commit is contained in:
teknomunk 2024-03-30 22:33:40 +00:00
parent b78c462306
commit 5bf26706fa
1 changed files with 7 additions and 0 deletions

View File

@ -110,6 +110,13 @@ local diagonal_convert = {
function mcl_minecarts:get_rail_direction(pos_, dir, ctrl, old_switch, railtype) function mcl_minecarts:get_rail_direction(pos_, dir, ctrl, old_switch, railtype)
local pos = vector.round(pos_) local pos = vector.round(pos_)
-- Handle new track types that have track-specific direction handler
local node = minetest.get_node(pos)
local node_def = minetest.registered_nodes[node.name]
if node_def and node_def._mcl_minecarts and node_def._mcl_minecarts.get_next_dir then
return node_def._mcl_minecarts.get_next_dir(pos, dir, node)
end
-- Diagonal conversion -- Diagonal conversion
local checks = rail_checks local checks = rail_checks
if dir.x ~= 0 and dir.z ~= 0 then if dir.x ~= 0 and dir.z ~= 0 then