make tooltip for npc talking more readable when lines are longer
This commit is contained in:
parent
3fa2a77deb
commit
22ce6fb623
@ -136,6 +136,14 @@ yl_speak_up.add_formspec_element_with_tooltip_if = function(formspec, element_ty
|
||||
return
|
||||
end
|
||||
table.insert(formspec, element_type.."["..position..";"..element_name..";"..element_text.."]")
|
||||
|
||||
-- make sure the lines in the mouseover text don't get too long
|
||||
-- each paragraph has to be split seperately so that the old newlines are kept
|
||||
local paragraphs = string.split(tooltip, "\n", true, -1, false)
|
||||
for i, p in ipairs(paragraphs) do
|
||||
paragraphs[i] = minetest.wrap_text(paragraphs[i], 100, false)
|
||||
end
|
||||
tooltip = table.concat(paragraphs, "\n")
|
||||
table.insert(formspec, "tooltip["..tostring(element_name)..";"..tostring(tooltip).."]")
|
||||
end
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user