2012-07-24 07:30:08 +02:00
|
|
|
function init()
|
2013-01-27 10:44:15 +01:00
|
|
|
connect(g_game, {
|
|
|
|
onGameStart = online,
|
|
|
|
onGameEnd = offline
|
|
|
|
})
|
|
|
|
if g_game.isOnline() then online() end
|
2012-07-15 13:49:28 +02:00
|
|
|
end
|
|
|
|
|
2012-07-24 07:30:08 +02:00
|
|
|
function terminate()
|
2013-01-27 10:44:15 +01:00
|
|
|
disconnect(g_game, {
|
|
|
|
onGameStart = online,
|
|
|
|
onGameEnd = offline
|
|
|
|
})
|
2013-02-01 05:32:15 +01:00
|
|
|
offline()
|
2013-01-27 10:44:15 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
function online()
|
|
|
|
if g_game.getFeature(GamePlayerMounts) then
|
|
|
|
g_keyboard.bindKeyDown('Ctrl+R', toggleMount)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
function offline()
|
|
|
|
if g_game.getFeature(GamePlayerMounts) then
|
|
|
|
g_keyboard.unbindKeyDown('Ctrl+R')
|
|
|
|
end
|
2012-07-15 13:49:28 +02:00
|
|
|
end
|
|
|
|
|
2012-07-24 07:30:08 +02:00
|
|
|
function toggleMount()
|
2012-08-20 14:28:19 +02:00
|
|
|
local player = g_game.getLocalPlayer()
|
|
|
|
if player then
|
|
|
|
player:toggleMount()
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
function mount()
|
|
|
|
local player = g_game.getLocalPlayer()
|
|
|
|
if player then
|
|
|
|
player:mount()
|
2012-07-26 13:18:49 +02:00
|
|
|
end
|
2012-07-15 13:49:28 +02:00
|
|
|
end
|
|
|
|
|
2012-07-24 07:30:08 +02:00
|
|
|
function dismount()
|
2012-08-20 14:28:19 +02:00
|
|
|
local player = g_game.getLocalPlayer()
|
|
|
|
if player then
|
|
|
|
player:dismount()
|
2012-07-26 13:18:49 +02:00
|
|
|
end
|
2012-07-15 16:28:15 +02:00
|
|
|
end
|