diff --git a/mods/ENTITIES/mcl_minecarts/carts.lua b/mods/ENTITIES/mcl_minecarts/carts.lua index 3f5085b6d..39770ebc5 100644 --- a/mods/ENTITIES/mcl_minecarts/carts.lua +++ b/mods/ENTITIES/mcl_minecarts/carts.lua @@ -296,6 +296,7 @@ function DEFAULT_CART_DEF:on_step(dtime) if staticdata.seq and self._seq < staticdata.seq then --print("removing cart #"..staticdata.uuid.." with sequence number mismatch") self.object:remove() + self._removed = true return end diff --git a/mods/ENTITIES/mcl_minecarts/functions.lua b/mods/ENTITIES/mcl_minecarts/functions.lua index caac7daf8..20ece5f9c 100644 --- a/mods/ENTITIES/mcl_minecarts/functions.lua +++ b/mods/ENTITIES/mcl_minecarts/functions.lua @@ -2,7 +2,7 @@ local vector = vector local mod = mcl_minecarts local table_merge = mcl_util.table_merge -function get_path(base, first, ...) +local function get_path(base, first, ...) if not first then return base end if not base then return end return get_path(base[first], ...) @@ -311,11 +311,10 @@ end local function get_rail_direction_inner(pos, dir) -- Handle new track types that have track-specific direction handler local node = minetest.get_node(pos) - local node_def = minetest.registered_nodes[node.name] - local get_next_dir = get_path(node_def,"_mcl_minecarts","get_next_dir") + local get_next_dir = get_path(minetest.registered_nodes,node.name,"_mcl_minecarts","get_next_dir") if not get_next_dir then return dir end - dir = node_def._mcl_minecarts.get_next_dir(pos, dir, node) + dir = get_next_dir(pos, dir, node) -- Handle reversing if there is a solid block in the next position local next_pos = vector.add(pos, dir) @@ -367,13 +366,15 @@ function mcl_minecarts.get_rail_direction(self, pos_, dir) local new_dir = get_rail_direction_inner(pos, dir) + if new_dir.y ~= 0 then return new_dir end + -- Check four 45 degree movement local next_rails_dir = get_rail_direction_inner(vector.add(pos, new_dir), new_dir) - if vector.equals(next_rails_dir, dir) and not vector.equals(new_dir, next_rails_dir) then + if dir.y == 0 and vector.equals(next_rails_dir, dir) and not vector.equals(new_dir, next_rails_dir) then return vector.add(new_dir, next_rails_dir) - else - return new_dir end + + return new_dir end function mod.update_cart_orientation(self) local staticdata = self._staticdata diff --git a/mods/ENTITIES/mcl_minecarts/movement.lua b/mods/ENTITIES/mcl_minecarts/movement.lua index fc9b4279b..bebdb778f 100644 --- a/mods/ENTITIES/mcl_minecarts/movement.lua +++ b/mods/ENTITIES/mcl_minecarts/movement.lua @@ -539,6 +539,11 @@ function submod.do_detached_movement(self, dtime) self.object:set_acceleration(accel) end + -- Reset pitch + local rot = self.object:get_rotation() + rot.y = 0 + self.object:set_rotation(rot) + local away = vector_away_from_players(self, staticdata) if away then local v = self.object:get_velocity()