1
0
mirror of https://github.com/veden/Rampant.git synced 2025-09-16 09:16:43 +02:00

added movement case with starting impassable chunk

This commit is contained in:
Aaron Veden
2018-10-19 18:53:05 -07:00
parent 1ecaa2bd82
commit 46c929d84c

View File

@@ -9,7 +9,7 @@ local chunkPropertyUtils = require("ChunkPropertyUtils")
local CHUNK_NORTH_SOUTH = constants.CHUNK_NORTH_SOUTH
local CHUNK_EAST_WEST = constants.CHUNK_EAST_WEST
local CHUNK_IMPASSABLE = constants.CHUNK_IMPASSABLE
local CHUNK_ALL_DIRECTIONS = constants.CHUNK_ALL_DIRECTIONS
-- local PASSABLE = constants.PASSABLE
@@ -115,6 +115,7 @@ function mapUtils.canMoveChunkDirection(map, direction, startChunk, endChunk)
local canMove = false
local startPassable = getPassable(map, startChunk)
local endPassable = getPassable(map, endChunk)
-- print(direction, startPassable, endPassable)
if (startPassable == CHUNK_ALL_DIRECTIONS) then
if ((direction == 1) or (direction == 3) or (direction == 6) or (direction == 8)) then
canMove = (endPassable == CHUNK_ALL_DIRECTIONS)
@@ -135,6 +136,8 @@ function mapUtils.canMoveChunkDirection(map, direction, startChunk, endChunk)
elseif (direction == 4) or (direction == 5) then
canMove = ((endPassable == CHUNK_EAST_WEST) or (endPassable == CHUNK_ALL_DIRECTIONS))
end
else
canMove = (endPassable ~= CHUNK_IMPASSABLE)
end
return canMove
end