mirror of
https://git.minetest.land/VoxeLibre/VoxeLibre.git
synced 2025-01-09 00:29:33 +01:00
Fix cart placement so that furnace minecarts will always try to start moving in the direction the player was facing when the cart was placed
This commit is contained in:
parent
7bf2e08baa
commit
290e2e9753
1 changed files with 7 additions and 3 deletions
|
@ -389,8 +389,12 @@ function mod.place_minecart(itemstack, pointed_thing, placer)
|
|||
return
|
||||
end
|
||||
|
||||
local look_4dir = math.round(placer:get_look_horizontal() * TWO_OVER_PI) % 4
|
||||
local look_dir = core.fourdir_to_dir(look_4dir)
|
||||
look_dir.x = -look_dir.x
|
||||
|
||||
local spawn_pos = pointed_thing.above
|
||||
local cart_dir = vector.new(1,0,0)
|
||||
local cart_dir = look_dir
|
||||
|
||||
local railpos, node
|
||||
if mcl_minecarts.is_rail(pointed_thing.under) then
|
||||
|
@ -403,8 +407,8 @@ function mod.place_minecart(itemstack, pointed_thing, placer)
|
|||
node = minetest.get_node(railpos)
|
||||
|
||||
-- Try two orientations, and select the second if the first is at an angle
|
||||
cart_dir1 = mcl_minecarts.get_rail_direction(railpos, vector.new( 1,0,0))
|
||||
cart_dir2 = mcl_minecarts.get_rail_direction(railpos, vector.new(-1,0,0))
|
||||
cart_dir1 = mcl_minecarts.get_rail_direction(railpos, look_dir)
|
||||
cart_dir2 = mcl_minecarts.get_rail_direction(railpos, -look_dir)
|
||||
if vector.length(cart_dir1) <= 1 then
|
||||
cart_dir = cart_dir1
|
||||
else
|
||||
|
|
Loading…
Reference in a new issue