Skip to content
Snippets Groups Projects
Commit 0b9e99e2 authored by DarkGod's avatar DarkGod
Browse files

"blarp, this is my commit message". For HousePet, with love

parent 90fc5bd2
No related branches found
No related tags found
No related merge requests found
......@@ -44,6 +44,7 @@ function _M:init(name, npc, player, data)
local f, err = loadfile(self:getChatFile(name))
if not f and err then error(err) end
setfenv(f, setmetatable({
setDialogWidth = function(w) self.force_dialog_width = w end,
newChat = function(c) self:addChat(c) end,
}, {__index=data}))
self.default_id = f()
......@@ -99,7 +100,7 @@ function _M:invoke(id)
if self.npc.onChat then self.npc:onChat() end
if self.player.onChat then self.player:onChat() end
local d = engine.dialogs.Chat.new(self, id or self.default_id)
local d = engine.dialogs.Chat.new(self, id or self.default_id, self.force_dialog_width or 500)
game:registerDialog(d)
return d
end
......
......@@ -30,12 +30,13 @@ module(..., package.seeall, class.inherit(Dialog))
show_portraits = false
function _M:init(chat, id)
function _M:init(chat, id, width)
self.force_width = width
self.cur_id = id
self.chat = chat
self.npc = chat.npc
self.player = chat.player
Dialog.init(self, self.npc.name, 500, 400)
Dialog.init(self, self.npc.name, width or 500, 400)
local xoff = 0
if self.show_portraits then
......@@ -109,7 +110,7 @@ function _M:use(item, a)
end
function _M:regen()
local d = new(self.chat, self.cur_id)
local d = new(self.chat, self.cur_id, self.force_width)
d.__showup = false
game:replaceDialog(self, d)
self.next_dialog = d
......
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