diff --git a/mods/PLAYER/mcl_sprint/init.lua b/mods/PLAYER/mcl_sprint/init.lua index 805c370cfe..5d1b8fe54f 100644 --- a/mods/PLAYER/mcl_sprint/init.lua +++ b/mods/PLAYER/mcl_sprint/init.lua @@ -158,18 +158,22 @@ local function wall_collide(pos,player) near = {x=pos.x, y=pos.y, z=pos.z} -- - if pos.x > 0 then - detect_walls["left"] = {x=pos.x,y=pos.y,z=pos.z-1} - detect_walls["right"] = {x=pos.x,y=pos.y,z=pos.z+1} - elseif pos.z < 0 then - detect_walls["left"] = {x=pos.x+1,y=pos.y,z=pos.z} - detect_walls["right"] = {x=pos.x-1,y=pos.y,z=pos.z+1} - elseif pos.x < 0 then - detect_walls["left"] = {x=pos.x,y=pos.y,z=pos.z+1} - detect_walls["right"] = {x=pos.x,y=pos.y,z=pos.z-1} - elseif pos.z > 0 then + if facing_dir.x > 0 and facing_dir.z > 0 then detect_walls["left"] = {x=pos.x+1,y=pos.y,z=pos.z} detect_walls["right"] = {x=pos.x-1,y=pos.y,z=pos.z} + print(" great x great z") + elseif facing_dir.z < 0 then + detect_walls["left"] = {x=pos.x+1,y=pos.y,z=pos.z} + detect_walls["right"] = {x=pos.x-1,y=pos.y,z=pos.z} + print("less z") + elseif facing_dir.x < 0 then + detect_walls["left"] = {x=pos.x,y=pos.y,z=pos.z+1} + detect_walls["right"] = {x=pos.x,y=pos.y,z=pos.z-1} + print("less x") + elseif facing_dir.z > 0 then + detect_walls["left"] = {x=pos.x+1,y=pos.y,z=pos.z} + detect_walls["right"] = {x=pos.x-1,y=pos.y,z=pos.z} + print("great z") end print(facing_dir.x.." "..facing_dir.z) --local near = minetest.find_node_near(pos, 1) @@ -194,10 +198,15 @@ local function wall_collide(pos,player) local wall_left = vector.distance(pos,detect_walls["left"]) local wall_right = vector.distance(pos,detect_walls["right"]) - --local wall_sides = if wall_front < too_close and block_front ~= "air" then + return false + + elseif wall_left < too_close and block_left ~= "air" then + print(true) return true - elseif wall_left < too_close and block_left ~= "air" and wall_right < too_close and block_right ~= "air" then + + elseif wall_right < too_close and block_right ~= "air" then + print(true) return true else return false