Skip to content
Snippets Groups Projects
Commit 32649add authored by DarkGod's avatar DarkGod
Browse files

Chats now support the addon+xx syntax

parent 274ec6db
No related branches found
No related tags found
No related merge requests found
......@@ -35,7 +35,7 @@ function _M:init(name, npc, player, data)
if not data.player then data.player = player end
if not data.npc then data.npc = npc end
local f, err = loadfile("/data/chats/"..name..".lua")
local f, err = loadfile(self:getChatFile(name))
if not f and err then error(err) end
setfenv(f, setmetatable({
newChat = function(c) self:addChat(c) end,
......@@ -45,6 +45,14 @@ function _M:init(name, npc, player, data)
self:triggerHook{"Chat:load", data=data}
end
function _M:getChatFile(file)
local _, _, addon, rfile = file:find("^([^+]+)%+(.+)$")
if addon and rfile then
return "/data-"..addon.."/chats/"..rfile..".lua"
end
return "/data/chats/"..file..".lua"
end
--- Switch the NPC talking
function _M:switchNPC(npc)
local old = self.npc
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment