diff --git a/characters b/characters index a99fe57..83d6505 100644 --- a/characters +++ b/characters @@ -1,111 +1,111 @@ A _a_ -4 +7 B _b_ -4 +5 C _c_ -3 +6 D _d_ -4 +6 E _e_ -3 +5 F _f_ -3 +5 G _g_ -4 +6 H _h_ -4 +6 I _i_ -3 +1 J _j_ 4 K _k_ -4 +5 L _l_ -3 +4 M _m_ -5 +7 N _n_ -4 +6 O _o_ -4 +6 P _p_ -4 +5 Q _q_ -4 +7 R _r_ -4 +5 S _s_ -4 +5 T _t_ -3 +5 U _u_ -4 +6 V _v_ -4 +7 W _w_ -5 +9 X _x_ -4 +5 Y _y_ -4 +7 Z _z_ -3 +5 a _a -4 +5 b _b -4 +5 c _c -3 +4 d _d -4 +5 e _e 4 f _f -3 +4 g _g -4 +5 h _h -4 +5 i _i 1 j _j -2 +1 k _k 4 @@ -114,19 +114,19 @@ _l 1 m _m -5 +7 n _n -4 +5 o _o -4 +5 p _p -4 +5 q _q -4 +5 r _r 3 @@ -141,13 +141,13 @@ _u 4 v _v -4 +5 w _w -5 +7 x _x -3 +5 y _y 4 diff --git a/init.lua b/init.lua index a097df3..9d2254f 100644 --- a/init.lua +++ b/init.lua @@ -3,7 +3,6 @@ -- load characters map local chars_file = io.open(minetest.get_modpath("signs").."/characters", "r") local charmap = {} -local charwidth = {} local max_chars = 16 if not chars_file then print("[signs] E: character map file not found") @@ -14,14 +13,11 @@ else break end local img = chars_file:read("*l") - local width = chars_file:read("*n") chars_file:read("*l") charmap[char] = img - charwidth[img] = width end end ---local metas = {"line1", "line2", "line3", "line4", "line5", "line6", "line7"} local signs = { {delta = {x = 0, y = 0, z = 0.399}, yaw = 0}, {delta = {x = 0.399, y = 0, z = 0}, yaw = math.pi / -2}, @@ -96,7 +92,6 @@ minetest.register_node(":default:sign_wall", { node_box = {type = "fixed", fixed = {-0.45, -0.15, 0.4, 0.45, 0.45, 0.498}}, selection_box = {type = "fixed", fixed = {-0.45, -0.15, 0.4, 0.45, 0.45, 0.498}}, tiles = {"signs_top.png", "signs_bottom.png", "signs_side.png", "signs_side.png", "signs_back.png", "signs_front.png"}, - walkable = false, groups = sign_groups, on_place = function(itemstack, placer, pointed_thing) @@ -166,7 +161,6 @@ minetest.register_node("signs:sign_yard", { }}, selection_box = {type = "fixed", fixed = {-0.45, -0.15, -0.049, 0.45, 0.45, 0.049}}, tiles = {"signs_top.png", "signs_bottom.png", "signs_side.png", "signs_side.png", "signs_back.png", "signs_front.png"}, - walkable = false, groups = {choppy=2, dig_immediate=2}, drop = "default:sign_wall", @@ -196,8 +190,15 @@ minetest.register_entity("signs:text", { end }) -local sign_width = 110 -local sign_padding = 8 +-- CONSTANTS +local SIGN_WITH = 110 +local SIGN_PADDING = 8 + +local LINE_LENGTH = 16 +local NUMBER_OF_LINES = 4 + +local LINE_HEIGHT = 14 +local CHAR_WIDTH = 5 string_to_array = function(str) local tab = {} @@ -222,9 +223,6 @@ string_to_word_array = function(str) return tab end -LINE_LENGTH = 16 -NUMBER_OF_LINES = 7 - create_lines = function(text) local line = "" local line_num = 1 @@ -254,11 +252,11 @@ create_lines = function(text) end generate_texture = function(lines) - local texture = "[combine:"..sign_width.."x"..sign_width + local texture = "[combine:"..SIGN_WITH.."x"..SIGN_WITH local ypos = 12 for i = 1, #lines do texture = texture..generate_line(lines[i], ypos) - ypos = ypos + 8 + ypos = ypos + LINE_HEIGHT end return texture end @@ -281,7 +279,7 @@ generate_line = function(s, ypos) i = i + 1 end if file ~= nil then - width = width + charwidth[file] + 1 + width = width + CHAR_WIDTH table.insert(parsed, file) chars = chars + 1 end @@ -289,10 +287,10 @@ generate_line = function(s, ypos) width = width - 1 local texture = "" - local xpos = math.floor((sign_width - 2 * sign_padding - width) / 2 + sign_padding) + local xpos = math.floor((SIGN_WITH - 2 * SIGN_PADDING - width) / 2 + SIGN_PADDING) for i = 1, #parsed do texture = texture..":"..xpos..","..ypos.."="..parsed[i]..".png" - xpos = xpos + charwidth[parsed[i]] + 1 + xpos = xpos + CHAR_WIDTH + 1 end return texture end diff --git a/textures/_0.png b/textures/_0.png index 1104165..b030879 100644 Binary files a/textures/_0.png and b/textures/_0.png differ diff --git a/textures/_1.png b/textures/_1.png index 4bc8a91..ae28369 100644 Binary files a/textures/_1.png and b/textures/_1.png differ diff --git a/textures/_2.png b/textures/_2.png index 0959c99..7375c68 100644 Binary files a/textures/_2.png and b/textures/_2.png differ diff --git a/textures/_3.png b/textures/_3.png index 0dba157..d724811 100644 Binary files a/textures/_3.png and b/textures/_3.png differ diff --git a/textures/_4.png b/textures/_4.png index 10aba56..0fff433 100644 Binary files a/textures/_4.png and b/textures/_4.png differ diff --git a/textures/_5.png b/textures/_5.png index efe54cb..43010df 100644 Binary files a/textures/_5.png and b/textures/_5.png differ diff --git a/textures/_6.png b/textures/_6.png index 11337ee..1eba38c 100644 Binary files a/textures/_6.png and b/textures/_6.png differ diff --git a/textures/_7.png b/textures/_7.png index 6de8a3f..dbcd2d1 100644 Binary files a/textures/_7.png and b/textures/_7.png differ diff --git a/textures/_8.png b/textures/_8.png index 4d2035c..edf6ef5 100644 Binary files a/textures/_8.png and b/textures/_8.png differ diff --git a/textures/_9.png b/textures/_9.png index 4ea1e3d..c276c11 100644 Binary files a/textures/_9.png and b/textures/_9.png differ diff --git a/textures/_a.png b/textures/_a.png index 711ba8e..8f3f59c 100644 Binary files a/textures/_a.png and b/textures/_a.png differ diff --git a/textures/_a_.png b/textures/_a_.png index 2fa6a94..4da193c 100644 Binary files a/textures/_a_.png and b/textures/_a_.png differ diff --git a/textures/_ap.png b/textures/_ap.png index 9b8b799..5dd3325 100644 Binary files a/textures/_ap.png and b/textures/_ap.png differ diff --git a/textures/_as.png b/textures/_as.png index 23a74e9..3c7a25a 100644 Binary files a/textures/_as.png and b/textures/_as.png differ diff --git a/textures/_at.png b/textures/_at.png index 92731dc..4f9841c 100644 Binary files a/textures/_at.png and b/textures/_at.png differ diff --git a/textures/_b.png b/textures/_b.png index 9d5b20b..baf4eaa 100644 Binary files a/textures/_b.png and b/textures/_b.png differ diff --git a/textures/_b_.png b/textures/_b_.png index f876e40..b00a378 100644 Binary files a/textures/_b_.png and b/textures/_b_.png differ diff --git a/textures/_bl.png b/textures/_bl.png index ccbe1eb..546ca4e 100644 Binary files a/textures/_bl.png and b/textures/_bl.png differ diff --git a/textures/_br.png b/textures/_br.png index 7b43e15..5700fa6 100644 Binary files a/textures/_br.png and b/textures/_br.png differ diff --git a/textures/_c.png b/textures/_c.png index 49199c9..eedd639 100644 Binary files a/textures/_c.png and b/textures/_c.png differ diff --git a/textures/_c_.png b/textures/_c_.png index 4dde893..cab6518 100644 Binary files a/textures/_c_.png and b/textures/_c_.png differ diff --git a/textures/_ca.png b/textures/_ca.png index a1ebcd7..d359c88 100644 Binary files a/textures/_ca.png and b/textures/_ca.png differ diff --git a/textures/_cl.png b/textures/_cl.png index d515ee8..55396b9 100644 Binary files a/textures/_cl.png and b/textures/_cl.png differ diff --git a/textures/_cm.png b/textures/_cm.png index a0c2b2a..28beedf 100644 Binary files a/textures/_cm.png and b/textures/_cm.png differ diff --git a/textures/_cr.png b/textures/_cr.png index c337cb5..ac466a9 100644 Binary files a/textures/_cr.png and b/textures/_cr.png differ diff --git a/textures/_d.png b/textures/_d.png index 1822281..a5f0699 100644 Binary files a/textures/_d.png and b/textures/_d.png differ diff --git a/textures/_d_.png b/textures/_d_.png index afbb371..9a0e3ed 100644 Binary files a/textures/_d_.png and b/textures/_d_.png differ diff --git a/textures/_dl.png b/textures/_dl.png index d2d1653..72184ad 100644 Binary files a/textures/_dl.png and b/textures/_dl.png differ diff --git a/textures/_dt.png b/textures/_dt.png index fd22682..61c1e4a 100644 Binary files a/textures/_dt.png and b/textures/_dt.png differ diff --git a/textures/_dv.png b/textures/_dv.png index 2c5c8ee..996d7cd 100644 Binary files a/textures/_dv.png and b/textures/_dv.png differ diff --git a/textures/_e.png b/textures/_e.png index 9070823..29e32e6 100644 Binary files a/textures/_e.png and b/textures/_e.png differ diff --git a/textures/_e_.png b/textures/_e_.png index 839e92f..c7f19c1 100644 Binary files a/textures/_e_.png and b/textures/_e_.png differ diff --git a/textures/_eq.png b/textures/_eq.png index 3522f35..daf8424 100644 Binary files a/textures/_eq.png and b/textures/_eq.png differ diff --git a/textures/_ex.png b/textures/_ex.png index 4d1cb03..b5da8e9 100644 Binary files a/textures/_ex.png and b/textures/_ex.png differ diff --git a/textures/_f.png b/textures/_f.png index da6d3c3..6835912 100644 Binary files a/textures/_f.png and b/textures/_f.png differ diff --git a/textures/_f_.png b/textures/_f_.png index c807755..3698ed2 100644 Binary files a/textures/_f_.png and b/textures/_f_.png differ diff --git a/textures/_g.png b/textures/_g.png index 8f4731c..5a85cde 100644 Binary files a/textures/_g.png and b/textures/_g.png differ diff --git a/textures/_g_.png b/textures/_g_.png index 9f6a7e6..cc7bbc5 100644 Binary files a/textures/_g_.png and b/textures/_g_.png differ diff --git a/textures/_gt.png b/textures/_gt.png index 8941846..f30855a 100644 Binary files a/textures/_gt.png and b/textures/_gt.png differ diff --git a/textures/_h.png b/textures/_h.png index c8d17b4..1a66a9e 100644 Binary files a/textures/_h.png and b/textures/_h.png differ diff --git a/textures/_h_.png b/textures/_h_.png index 333a31c..87beafc 100644 Binary files a/textures/_h_.png and b/textures/_h_.png differ diff --git a/textures/_ha.png b/textures/_ha.png new file mode 100644 index 0000000..4618ced Binary files /dev/null and b/textures/_ha.png differ diff --git a/textures/_i.png b/textures/_i.png index a2e3ecc..f001142 100644 Binary files a/textures/_i.png and b/textures/_i.png differ diff --git a/textures/_i_.png b/textures/_i_.png index 1a21779..fc658b8 100644 Binary files a/textures/_i_.png and b/textures/_i_.png differ diff --git a/textures/_j.png b/textures/_j.png index 22d3531..87d2f26 100644 Binary files a/textures/_j.png and b/textures/_j.png differ diff --git a/textures/_j_.png b/textures/_j_.png index e39e34a..c0d9ac2 100644 Binary files a/textures/_j_.png and b/textures/_j_.png differ diff --git a/textures/_k.png b/textures/_k.png index 9a74cdd..34f9336 100644 Binary files a/textures/_k.png and b/textures/_k.png differ diff --git a/textures/_k_.png b/textures/_k_.png index 21fe99e..86b623d 100644 Binary files a/textures/_k_.png and b/textures/_k_.png differ diff --git a/textures/_l.png b/textures/_l.png index 5a15f0b..defe7ec 100644 Binary files a/textures/_l.png and b/textures/_l.png differ diff --git a/textures/_l_.png b/textures/_l_.png index 8a6c5e5..3fe1de2 100644 Binary files a/textures/_l_.png and b/textures/_l_.png differ diff --git a/textures/_lt.png b/textures/_lt.png index 0eb25f6..ec7219d 100644 Binary files a/textures/_lt.png and b/textures/_lt.png differ diff --git a/textures/_m.png b/textures/_m.png index f3c06ee..e0fe039 100644 Binary files a/textures/_m.png and b/textures/_m.png differ diff --git a/textures/_m_.png b/textures/_m_.png index edae09c..9164da6 100644 Binary files a/textures/_m_.png and b/textures/_m_.png differ diff --git a/textures/_mn.png b/textures/_mn.png index f366db1..935a2fe 100644 Binary files a/textures/_mn.png and b/textures/_mn.png differ diff --git a/textures/_n.png b/textures/_n.png index dbcfe7e..ac10fd9 100644 Binary files a/textures/_n.png and b/textures/_n.png differ diff --git a/textures/_n_.png b/textures/_n_.png index 03ea788..d4355c1 100644 Binary files a/textures/_n_.png and b/textures/_n_.png differ diff --git a/textures/_o.png b/textures/_o.png index 0a2c5bb..080e99d 100644 Binary files a/textures/_o.png and b/textures/_o.png differ diff --git a/textures/_o_.png b/textures/_o_.png index 53bc5cf..2d19051 100644 Binary files a/textures/_o_.png and b/textures/_o_.png differ diff --git a/textures/_p.png b/textures/_p.png index 78b2876..3050959 100644 Binary files a/textures/_p.png and b/textures/_p.png differ diff --git a/textures/_p_.png b/textures/_p_.png index f0db495..0cca011 100644 Binary files a/textures/_p_.png and b/textures/_p_.png differ diff --git a/textures/_pr.png b/textures/_pr.png index 75f2c8e..b835141 100644 Binary files a/textures/_pr.png and b/textures/_pr.png differ diff --git a/textures/_ps.png b/textures/_ps.png index 7c5a875..1f4b5c1 100644 Binary files a/textures/_ps.png and b/textures/_ps.png differ diff --git a/textures/_q.png b/textures/_q.png index 06d5727..945b6cf 100644 Binary files a/textures/_q.png and b/textures/_q.png differ diff --git a/textures/_q_.png b/textures/_q_.png index ee0110d..f3bf455 100644 Binary files a/textures/_q_.png and b/textures/_q_.png differ diff --git a/textures/_qo.png b/textures/_qo.png index e753d48..5d261e3 100644 Binary files a/textures/_qo.png and b/textures/_qo.png differ diff --git a/textures/_qu.png b/textures/_qu.png index fb156c2..5eb597a 100644 Binary files a/textures/_qu.png and b/textures/_qu.png differ diff --git a/textures/_r.png b/textures/_r.png index b9b0ac9..39e9fce 100644 Binary files a/textures/_r.png and b/textures/_r.png differ diff --git a/textures/_r_.png b/textures/_r_.png index 126abdc..6c71c1e 100644 Binary files a/textures/_r_.png and b/textures/_r_.png differ diff --git a/textures/_re.png b/textures/_re.png index 42ed81e..1614837 100644 Binary files a/textures/_re.png and b/textures/_re.png differ diff --git a/textures/_s.png b/textures/_s.png index 75d4f5f..a0ada1a 100644 Binary files a/textures/_s.png and b/textures/_s.png differ diff --git a/textures/_s_.png b/textures/_s_.png index 54b0139..9b018bb 100644 Binary files a/textures/_s_.png and b/textures/_s_.png differ diff --git a/textures/_sl.png b/textures/_sl.png index 3170edf..08c9547 100644 Binary files a/textures/_sl.png and b/textures/_sl.png differ diff --git a/textures/_sm.png b/textures/_sm.png index f2922e1..385c64f 100644 Binary files a/textures/_sm.png and b/textures/_sm.png differ diff --git a/textures/_sp.png b/textures/_sp.png index 3fde935..4f38a35 100644 Binary files a/textures/_sp.png and b/textures/_sp.png differ diff --git a/textures/_sr.png b/textures/_sr.png index 7bcb3bc..bc9c0a2 100644 Binary files a/textures/_sr.png and b/textures/_sr.png differ diff --git a/textures/_t.png b/textures/_t.png index 0e29c7a..c55731a 100644 Binary files a/textures/_t.png and b/textures/_t.png differ diff --git a/textures/_t_.png b/textures/_t_.png index 18081ca..773e666 100644 Binary files a/textures/_t_.png and b/textures/_t_.png differ diff --git a/textures/_tl.png b/textures/_tl.png index e1dc618..059fe68 100644 Binary files a/textures/_tl.png and b/textures/_tl.png differ diff --git a/textures/_u.png b/textures/_u.png index d6c9bac..98bf8e6 100644 Binary files a/textures/_u.png and b/textures/_u.png differ diff --git a/textures/_u_.png b/textures/_u_.png index 4e9dbfe..35ce915 100644 Binary files a/textures/_u_.png and b/textures/_u_.png differ diff --git a/textures/_un.png b/textures/_un.png index db35915..01f547a 100644 Binary files a/textures/_un.png and b/textures/_un.png differ diff --git a/textures/_v.png b/textures/_v.png index d6d37ad..b692d11 100644 Binary files a/textures/_v.png and b/textures/_v.png differ diff --git a/textures/_v_.png b/textures/_v_.png index 2267335..8049771 100644 Binary files a/textures/_v_.png and b/textures/_v_.png differ diff --git a/textures/_vb.png b/textures/_vb.png index 8d5e594..7fed7dc 100644 Binary files a/textures/_vb.png and b/textures/_vb.png differ diff --git a/textures/_w.png b/textures/_w.png index 2701e2f..6a58b07 100644 Binary files a/textures/_w.png and b/textures/_w.png differ diff --git a/textures/_w_.png b/textures/_w_.png index 757b124..64904de 100644 Binary files a/textures/_w_.png and b/textures/_w_.png differ diff --git a/textures/_x.png b/textures/_x.png index 90a4393..b769e13 100644 Binary files a/textures/_x.png and b/textures/_x.png differ diff --git a/textures/_x_.png b/textures/_x_.png index 8fb3408..2f6d067 100644 Binary files a/textures/_x_.png and b/textures/_x_.png differ diff --git a/textures/_y.png b/textures/_y.png index 774a89d..777b55e 100644 Binary files a/textures/_y.png and b/textures/_y.png differ diff --git a/textures/_y_.png b/textures/_y_.png index 33d7a08..0c40de9 100644 Binary files a/textures/_y_.png and b/textures/_y_.png differ diff --git a/textures/_z.png b/textures/_z.png index 7ff4e60..ae010fe 100644 Binary files a/textures/_z.png and b/textures/_z.png differ diff --git a/textures/_z_.png b/textures/_z_.png index 36798f1..1c3e053 100644 Binary files a/textures/_z_.png and b/textures/_z_.png differ diff --git a/textures/signs_sign.png b/textures/signs_sign.png new file mode 100644 index 0000000..bd1fc7a Binary files /dev/null and b/textures/signs_sign.png differ