mirror of
https://github.com/ErikasKontenis/SabrehavenServer.git
synced 2025-10-13 22:34:53 +02:00
Resolve "Merge the best from 7.40 branch"
This commit is contained in:
48
SabrehavenOTClient/modules/game_playermount/playermount.lua
Normal file
48
SabrehavenOTClient/modules/game_playermount/playermount.lua
Normal file
@@ -0,0 +1,48 @@
|
||||
function init()
|
||||
connect(g_game, {
|
||||
onGameStart = online,
|
||||
onGameEnd = offline
|
||||
})
|
||||
if g_game.isOnline() then online() end
|
||||
end
|
||||
|
||||
function terminate()
|
||||
disconnect(g_game, {
|
||||
onGameStart = online,
|
||||
onGameEnd = offline
|
||||
})
|
||||
offline()
|
||||
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
|
||||
end
|
||||
|
||||
function toggleMount()
|
||||
local player = g_game.getLocalPlayer()
|
||||
if player then
|
||||
player:toggleMount()
|
||||
end
|
||||
end
|
||||
|
||||
function mount()
|
||||
local player = g_game.getLocalPlayer()
|
||||
if player then
|
||||
player:mount()
|
||||
end
|
||||
end
|
||||
|
||||
function dismount()
|
||||
local player = g_game.getLocalPlayer()
|
||||
if player then
|
||||
player:dismount()
|
||||
end
|
||||
end
|
@@ -0,0 +1,9 @@
|
||||
Module
|
||||
name: game_playermount
|
||||
description: Manage player mounts
|
||||
author: BeniS
|
||||
website: https://github.com/edubart/otclient
|
||||
sandboxed: true
|
||||
scripts: [ playermount ]
|
||||
@onLoad: init()
|
||||
@onUnload: terminate()
|
Reference in New Issue
Block a user