1
0
Fork 0

Fix sign line length

This commit is contained in:
Wuzzy 2017-07-25 00:06:06 +02:00
parent 7fe3cae934
commit 7ba83734e2
1 changed files with 4 additions and 4 deletions

View File

@ -19,7 +19,7 @@ else
end end
-- CONSTANTS -- CONSTANTS
local SIGN_WITH = 110 local SIGN_WIDTH = 110
local SIGN_PADDING = 8 local SIGN_PADDING = 8
local LINE_LENGTH = 16 local LINE_LENGTH = 16
@ -56,7 +56,7 @@ local create_lines = function(text)
local line_num = 1 local line_num = 1
local tab = {} local tab = {}
for _,word in ipairs(string_to_word_array(text)) do for _,word in ipairs(string_to_word_array(text)) do
if string.len(line)+string.len(word) < LINE_LENGTH and word ~= "|" then if string.len(line)+string.len(word) <= LINE_LENGTH and word ~= "|" then
if line ~= "" then if line ~= "" then
line = line.." "..word line = line.." "..word
else else
@ -105,7 +105,7 @@ local generate_line = function(s, ypos)
width = width - 1 width = width - 1
local texture = "" local texture = ""
local xpos = math.floor((SIGN_WITH - 2 * SIGN_PADDING - width) / 2 + SIGN_PADDING) local xpos = math.floor((SIGN_WIDTH - 2 * SIGN_PADDING - width) / 2 + SIGN_PADDING)
for i = 1, #parsed do for i = 1, #parsed do
texture = texture..":"..xpos..","..ypos.."="..parsed[i]..".png" texture = texture..":"..xpos..","..ypos.."="..parsed[i]..".png"
xpos = xpos + CHAR_WIDTH + 1 xpos = xpos + CHAR_WIDTH + 1
@ -114,7 +114,7 @@ local generate_line = function(s, ypos)
end end
local generate_texture = function(lines) local generate_texture = function(lines)
local texture = "[combine:"..SIGN_WITH.."x"..SIGN_WITH local texture = "[combine:"..SIGN_WIDTH.."x"..SIGN_WIDTH
local ypos = 12 local ypos = 12
for i = 1, #lines do for i = 1, #lines do
texture = texture..generate_line(lines[i], ypos) texture = texture..generate_line(lines[i], ypos)