Carontee

IsWalkable function

Feb 13th, 2016
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.57 KB | None | 0 0
  1. function isWalkable(pos, creature, proj, pz)-- by Nord
  2.     if getTileThingByPos({x = pos.x, y = pos.y, z = pos.z, stackpos = 0}).itemid == 0 then return false end
  3.     if getTopCreature(pos).uid > 0 and creature then return false end
  4.     if getTileInfo(pos).protection and pz then return false, true end
  5.     local n = not proj and 3 or 2
  6.     for i = 0, 255 do
  7.         pos.stackpos = i
  8.         local tile = getTileThingByPos(pos)
  9.         if tile.itemid ~= 0 and not isCreature(tile.uid) then
  10.             if hasProperty(tile.uid, n) or hasProperty(tile.uid, 7) then
  11.                 return false
  12.             end
  13.         end
  14.     end
  15.     return true
  16. end
Advertisement
Add Comment
Please, Sign In to add comment