- Code: Select all
turtle_formspec_positions[player_name] = pos
must be
- Code: Select all
turtle_formspec_positions[player_name] = new_pos
... but now it works (more or less) as wanted for all directions. And I checked if there is a walkable block. If it is not walkable I allow the movement. It works but I don't know if that is good coding!
- Code: Select all
-- Check new position if empty
local newposchecktable = minetest.get_node(new_pos)
local newposcheck = newposchecktable.name
local walkable = minetest.registered_nodes[newposcheck].walkable
if not walkable then
... [i]move the block[/i]
Next step:
A bigger problem is that up and down is always correct but forward and backward depends on the direction where the turtle looks.
What does not work:
- Code: Select all
local newposchecktable = minetest.get_node(new_pos)
local newposcheck = newposchecktable.name
local direction = dir_to_facedir(minetest.registered_nodes[newposcheck].param2)
- Code: Select all
minetest.registered_nodes[newposcheck].param2
... always give nil as output
And at least ... I want the turtle to turn around to the left and to the right. I think that I have to change the direction like with a screwdriver. I will late have a look at the code of the screwdriver.
Thanks ... Birgit

