diff --git a/modules/01-afk/afk.lua b/modules/01-afk/afk.lua index 1caa860..196fa66 100644 --- a/modules/01-afk/afk.lua +++ b/modules/01-afk/afk.lua @@ -19,7 +19,9 @@ function AfkModule.getPanel() return Panel end function AfkModule.setPanel(panel) Panel = panel end function AfkModule.init() - g_sounds.preload('alert.ogg') + if g_sounds then + g_sounds.preload('alert.ogg') + end dofile('alertlist.lua') AlertList.init() diff --git a/modules/01-afk/events/creaturealert.lua b/modules/01-afk/events/creaturealert.lua index 07bb0a3..c2865dd 100644 --- a/modules/01-afk/events/creaturealert.lua +++ b/modules/01-afk/events/creaturealert.lua @@ -6,7 +6,10 @@ AfkModule.CreatureAlert = {} CreatureAlert = AfkModule.CreatureAlert -local alertSoundChannel = g_sounds.getChannel(1) +local alertSoundChannel = nil +if g_sounds then + alertSoundChannel = g_sounds.getChannel(1) +end function CreatureAlert.Event(event) local blackList = AlertList.getBlackList() @@ -19,7 +22,7 @@ function CreatureAlert.Event(event) creatures = g_map.getSpectators(player:getPosition(), false) local alert = false - if AlertList.getBlackOrWhite() then + if AlertList.getBlackOrWhite() then -- black for k, v in pairs (creatures) do if v ~= player and AlertList.isBlackListed(v:getName()) then @@ -27,7 +30,7 @@ function CreatureAlert.Event(event) break end end - else + else -- white for k, v in pairs (creatures) do if v ~= player and not AlertList.isWhiteListed(v:getName()) then @@ -51,5 +54,7 @@ function CreatureAlert.alert() end function CreatureAlert.stopAlert() - alertSoundChannel:stop() -end \ No newline at end of file + if alertSoundChannel then + alertSoundChannel:stop() + end +end