- if dir.x ~= 0 and pool[minetest.hash_node_position(vector.add(pos,vector.new(dir.x,0,0)))] then
- self.velocity = vector.new(self.velocity.x,0,0)
- self.dir = vector.new(dir.x,0,0)
- self.axis_lock = "x"
- self.object:set_pos(pos)
- direction_snap(self)
- return(true)
- elseif dir.z ~= 0 and pool[minetest.hash_node_position(vector.add(pos,vector.new(0,0,dir.z)))] then
- self.velocity = vector.new(0,0,self.velocity.z)
- self.dir = vector.new(0,0,dir.z)
- self.axis_lock = "z"
- self.object:set_pos(pos)
- direction_snap(self)
- return(true)
+ if self.axis_lock == "x" then
+ if dir.x ~= 0 and pool[minetest.hash_node_position(vector.add(pos,vector.new(dir.x,0,0)))] then
+ self.velocity = vector.new(self.velocity.x,0,0)
+ self.dir = vector.new(dir.x,0,0)
+ self.axis_lock = "x"
+ self.object:set_pos(pos)
+ direction_snap(self)
+ return(true)
+ end