diff --git a/src/nodes/npc.lua b/src/nodes/npc.lua index b5396453c..f6aa3d295 100644 --- a/src/nodes/npc.lua +++ b/src/nodes/npc.lua @@ -77,8 +77,10 @@ function Menu:keypressed( button, player ) elseif item.text == 'inventory' then if self.host.props.inventory then self:instahide() - self.host.props.inventory(self.host, player) - self.dialog = Dialog.new(self.responses[item.text], function() self:show() end) + self.dialog = Dialog.new(self.responses[item.text], function() + self.host.props.inventory(self.host, player) + self:show() + end) else self:hide() self.dialog = Dialog.new(self.host.noinventory, function() self:show() end) diff --git a/src/tooltip.lua b/src/tooltip.lua index 4f7eb46a2..c091a9193 100644 --- a/src/tooltip.lua +++ b/src/tooltip.lua @@ -87,7 +87,7 @@ function Tooltip:draw(x, y, selectedItem, parent) tastytext = fonts.tasty.new(itemStats, textX, textY + (descriptionWrap * lineHeight), textWidth, love.graphics.getFont(), fonts.colors, lineHeight) statWrap = tastytext.lines tastytext:draw() - drawSeparator(textX, textY + (descriptionWrap + statWrap) * lineHeight, textWidth) + drawSeparator(textX, textY + ((descriptionWrap + statWrap) * lineHeight), textWidth) end -- Lastly, insert our item information after everything else diff --git a/src/vendor/tastytext/init.lua b/src/vendor/tastytext/init.lua index 824ab14b4..c18024dae 100755 --- a/src/vendor/tastytext/init.lua +++ b/src/vendor/tastytext/init.lua @@ -234,6 +234,7 @@ function TastyText:_getMetaData() local line_lengths = {} local line_widths = {} local length = 0 + local lines = 1 for i = 1,#self.chunk_array do local chunk = self.chunk_array[i] if chunk.length then @@ -244,7 +245,12 @@ function TastyText:_getMetaData() (line_widths[chunk.line] or 0) + chunk.width end end - return #line_lengths,length,line_lengths,line_widths + -- NOTE: This is a love.js workaround. + -- Returning #line_lengths always results in 0 in love.js for some reason. + for k,v in pairs(line_lengths) do + lines = lines + 1 + end + return lines,length,line_lengths,line_widths end function TastyText:_parseString(str)