Version 1.3 - auto reconnect, better bot (with sound), animated mounts, bug fixes

This commit is contained in:
OTCv8
2019-11-11 17:10:03 +01:00
parent d78af570ea
commit 1072671986
48 changed files with 458 additions and 154 deletions

View File

@@ -84,7 +84,7 @@ context.onContainerOpen = function(callback)
return context.callback("onContainerOpen", callback)
end
-- onContainerUpdateItem -- callback = function(container)
-- onContainerClose -- callback = function(container)
context.onContainerClose = function(callback)
return context.callback("onContainerClose", callback)
end

View File

@@ -0,0 +1,31 @@
local context = G.botContext
context.getSoundChannel = function()
if not g_sounds then
return
end
return g_sounds.getChannel(SoundChannels.Bot)
end
context.playSound = function(file)
local botSoundChannel = context.getSoundChannel()
if not botSoundChannel then
return
end
botSoundChannel:setEnabled(true)
botSoundChannel:stop(0)
botSoundChannel:play(file, 0, 0)
return botSoundChannel
end
context.stopSound = function()
local botSoundChannel = context.getSoundChannel()
if not botSoundChannel then
return
end
botSoundChannel:stop()
end
context.playAlarm = function()
return context.playSound("/sounds/alarm.ogg")
end

View File

@@ -2,3 +2,9 @@ local context = G.botContext
context.encode = function(data) return json.encode(data) end
context.decode = function(text) local status, result = pcall(function() return json.decode(text) end) if status then return result end return {} end
context.displayGeneralBox = function(title, message, buttons, onEnterCallback, onEscapeCallback)
local box = displayGeneralBox(title, message, buttons, onEnterCallback, onEscapeCallback)
box.botWidget = true
return box
end