mirror of
https://github.com/OTCv8/otclientv8.git
synced 2025-10-22 23:45:55 +02:00
Version 2.6 - http://otclient.net/showthread.php?tid=552
This commit is contained in:
@@ -238,4 +238,19 @@ context.canShoot = function(pos, distance)
|
||||
return tile:canShoot(distance)
|
||||
end
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
context.isTrapped = function(creature)
|
||||
if not creature then
|
||||
creature = context.player
|
||||
end
|
||||
local pos = creature:getPosition()
|
||||
local dirs = {{-1,1}, {0,1}, {1,1}, {-1, 0}, {1, 0}, {-1, -1}, {0, -1}, {1, -1}}
|
||||
for i=1,#dirs do
|
||||
local tile = g_map.getTile({x=pos.x-dirs[i][1],y=pos.y-dirs[i][2],z=pos.z})
|
||||
if tile and tile:isWalkable(false) then
|
||||
return false
|
||||
end
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
Reference in New Issue
Block a user