Added gamelib for Position functions.

This commit is contained in:
BenDol 2014-06-01 18:11:52 +12:00
parent 0ad45d6826
commit a7d7667491
2 changed files with 22 additions and 0 deletions

View File

@ -12,6 +12,7 @@ Module
dofile 'protocol' dofile 'protocol'
dofile 'protocollogin' dofile 'protocollogin'
dofile 'protocolgame' dofile 'protocolgame'
dofile 'position'
dofile 'game' dofile 'game'
dofile 'creature' dofile 'creature'

View File

@ -0,0 +1,21 @@
Position = {}
function Position.equals(pos1, pos2)
return pos1.x == pos2.x and pos1.y == pos2.y and pos1.z == pos2.z
end
function Position.greaterThan(pos1, pos2, orEqualTo)
if orEqualTo then
return pos1.x >= pos2.x or pos1.y >= pos2.y or pos1.z >= pos2.z
else
return pos1.x > pos2.x or pos1.y > pos2.y or pos1.z > pos2.z
end
end
function Position.lessThan(pos1, pos2, orEqualTo)
if orEqualTo then
return pos1.x <= pos2.x or pos1.y <= pos2.y or pos1.z <= pos2.z
else
return pos1.x < pos2.x or pos1.y < pos2.y or pos1.z < pos2.z
end
end