Remove dip into the ground that occured when gravity caused the cart to reverse directions

This commit is contained in:
teknomunk 2024-03-09 16:06:11 +00:00
parent b45c179732
commit 29c1aa61d4
1 changed files with 6 additions and 7 deletions

View File

@ -522,14 +522,13 @@ local function register_entity(entity_id, mesh, textures, drop, on_rightclick, o
if DEBUG then
print("Gravity flipped direction")
end
staticdata.velocity = staticdata.velocity * -1
-- Update direction
local next_dir,_ = mcl_minecarts:get_rail_direction(pos + staticdata.dir, staticdata.dir * -1, nil, nil, staticdata.railtype)
if DEBUG and next_dir ~= staticdata.dir then
print( "Changing direction from "..tostring(staticdata.dir).." to "..tostring(next_dir))
end
staticdata.dir = next_dir
-- Complete moving thru this block into the next, reverse direction, and put us back at the same position we were at
staticdata.velocity = staticdata.velocity * -1
staticdata.dir = -staticdata.dir
pos = pos + staticdata.dir
staticdata.distance = 1 - staticdata.distance
staticdata.connected_at = pos
update_cart_orientation(self,staticdata)
end