This commit is contained in:
OTCv8
2020-11-16 08:43:23 +01:00
parent a4f9250ddb
commit 2d1cbaae12
141 changed files with 14564 additions and 106 deletions

View File

@@ -70,6 +70,11 @@ context.onTextMessage = function(callback)
return context.callback("onTextMessage", callback)
end
-- onLoginAdvice(callback) -- callback = function(message)
context.onLoginAdvice = function(callback)
return context.callback("onLoginAdvice", callback)
end
-- onAddThing(callback) -- callback = function(tile, thing)
context.onAddThing = function(callback)
return context.callback("onAddThing", callback)
@@ -165,6 +170,10 @@ context.onTurn = function(callback)
return context.callback("onTurn", callback)
end
-- onWalk -- callback = function(creature, oldPos, newPos)
context.onWalk = function(callback)
return context.callback("onWalk", callback)
end
-- CUSTOM CALLBACKS

View File

@@ -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

View File

@@ -159,6 +159,7 @@ context.cancelFollow = g_game.cancelFollow
context.cancelAttackAndFollow = g_game.cancelAttackAndFollow
context.logout = g_game.forceLogout
context.safeLogout = g_game.safeLogout
context.ping = g_game.getPing
modules.game_cooldown.isGroupCooldownIconActive(id)