Compare commits

...

5 Commits

Author SHA1 Message Date
PilzAdam 60fe0c74ea Add bigger font 2012-10-10 20:42:01 +02:00
PilzAdam ca13db71fd Log mod load if log_mod is set to true 2012-10-07 19:46:13 +02:00
PilzAdam fa72ba55df Update signs when punching them 2012-10-05 19:21:35 +02:00
PilzAdam ba79f900a5 Add README 2012-10-05 15:24:04 +02:00
PilzAdam 7d24a4eea0 Another bugfix in returning itemstack 2012-10-05 15:18:54 +02:00
96 changed files with 113 additions and 59 deletions

43
README.txt Normal file
View File

@ -0,0 +1,43 @@
=== SIGNS-MOD for MINETEST-C55===
by xyz
modified by PilzAdam
Introduction:
This mod adds signs to Minetest, wich you can read without pointing at
the sign. The text is integrated into the 3D world.
How to install:
Unzip the archive an place it in minetest-base-directory/mods/minetest/
if you have a windows client or a linux run-in-place client. If you have
a linux system-wide instalation place it in ~/.minetest/mods/minetest/.
If you want to install this mod only in one world create the folder
worldmods/ in your worlddirectory.
For further information or help see:
http://wiki.minetest.com/wiki/Installing_Mods
How to use the mod:
Craft a sign like the default signs and place them. Rightclick it and enter
your text. You can use " | " to create a newline. Hitting enter or
clicking proceed will save the text and add it to the sign.
If the text of a sign disapears just rightclick it and hit enter again.
License:
Sourcecode: WTFPL (see below)
Font: 04b-03 (http://04.jp.org/)
See also:
http://minetest.net/
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2004 Sam Hocevar <sam@hocevar.net>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. You just DO WHAT THE FUCK YOU WANT TO.

View File

@ -1,111 +1,111 @@
A A
_a_ _a_
4 7
B B
_b_ _b_
4 5
C C
_c_ _c_
3 6
D D
_d_ _d_
4 6
E E
_e_ _e_
3 5
F F
_f_ _f_
3 5
G G
_g_ _g_
4 6
H H
_h_ _h_
4 6
I I
_i_ _i_
3 1
J J
_j_ _j_
4 4
K K
_k_ _k_
4 5
L L
_l_ _l_
3 4
M M
_m_ _m_
5 7
N N
_n_ _n_
4 6
O O
_o_ _o_
4 6
P P
_p_ _p_
4 5
Q Q
_q_ _q_
4 7
R R
_r_ _r_
4 5
S S
_s_ _s_
4 5
T T
_t_ _t_
3 5
U U
_u_ _u_
4 6
V V
_v_ _v_
4 7
W W
_w_ _w_
5 9
X X
_x_ _x_
4 5
Y Y
_y_ _y_
4 7
Z Z
_z_ _z_
3 5
a a
_a _a
4 5
b b
_b _b
4 5
c c
_c _c
3 4
d d
_d _d
4 5
e e
_e _e
4 4
f f
_f _f
3 4
g g
_g _g
4 5
h h
_h _h
4 5
i i
_i _i
1 1
j j
_j _j
2 1
k k
_k _k
4 4
@ -114,19 +114,19 @@ _l
1 1
m m
_m _m
5 7
n n
_n _n
4 5
o o
_o _o
4 5
p p
_p _p
4 5
q q
_q _q
4 5
r r
_r _r
3 3
@ -141,13 +141,13 @@ _u
4 4
v v
_v _v
4 5
w w
_w _w
5 7
x x
_x _x
3 5
y y
_y _y
4 4

View File

@ -3,7 +3,6 @@
-- load characters map -- load characters map
local chars_file = io.open(minetest.get_modpath("signs").."/characters", "r") local chars_file = io.open(minetest.get_modpath("signs").."/characters", "r")
local charmap = {} local charmap = {}
local charwidth = {}
local max_chars = 16 local max_chars = 16
if not chars_file then if not chars_file then
print("[signs] E: character map file not found") print("[signs] E: character map file not found")
@ -14,14 +13,11 @@ else
break break
end end
local img = chars_file:read("*l") local img = chars_file:read("*l")
local width = chars_file:read("*n")
chars_file:read("*l") chars_file:read("*l")
charmap[char] = img charmap[char] = img
charwidth[img] = width
end end
end end
--local metas = {"line1", "line2", "line3", "line4", "line5", "line6", "line7"}
local signs = { local signs = {
{delta = {x = 0, y = 0, z = 0.399}, yaw = 0}, {delta = {x = 0, y = 0, z = 0.399}, yaw = 0},
{delta = {x = 0.399, y = 0, z = 0}, yaw = math.pi / -2}, {delta = {x = 0.399, y = 0, z = 0}, yaw = math.pi / -2},
@ -56,7 +52,9 @@ end
local update_sign = function(pos, fields) local update_sign = function(pos, fields)
local meta = minetest.env:get_meta(pos) local meta = minetest.env:get_meta(pos)
meta:set_string("infotext", "") meta:set_string("infotext", "")
meta:set_string("text", fields.text) if fields then
meta:set_string("text", fields.text)
end
local text = meta:get_string("text") local text = meta:get_string("text")
local objects = minetest.env:get_objects_inside_radius(pos, 0.5) local objects = minetest.env:get_objects_inside_radius(pos, 0.5)
for _, v in ipairs(objects) do for _, v in ipairs(objects) do
@ -94,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}}, 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}}, 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"}, tiles = {"signs_top.png", "signs_bottom.png", "signs_side.png", "signs_side.png", "signs_back.png", "signs_front.png"},
walkable = false,
groups = sign_groups, groups = sign_groups,
on_place = function(itemstack, placer, pointed_thing) on_place = function(itemstack, placer, pointed_thing)
@ -121,7 +118,8 @@ minetest.register_node(":default:sign_wall", {
if wdir == 0 then if wdir == 0 then
--how would you add sign to ceiling? --how would you add sign to ceiling?
minetest.env:add_item(above, "default:sign_wall") minetest.env:add_item(above, "default:sign_wall")
return ItemStack("") itemstack:take_item()
return itemstack
elseif wdir == 1 then elseif wdir == 1 then
minetest.env:add_node(above, {name = "signs:sign_yard", param2 = fdir}) minetest.env:add_node(above, {name = "signs:sign_yard", param2 = fdir})
sign_info = signs_yard[fdir + 1] sign_info = signs_yard[fdir + 1]
@ -147,6 +145,9 @@ minetest.register_node(":default:sign_wall", {
on_receive_fields = function(pos, formname, fields, sender) on_receive_fields = function(pos, formname, fields, sender)
update_sign(pos, fields) update_sign(pos, fields)
end, end,
on_punch = function(pos, node, puncher)
update_sign(pos)
end,
}) })
minetest.register_node("signs:sign_yard", { minetest.register_node("signs:sign_yard", {
@ -160,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}}, 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"}, 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}, groups = {choppy=2, dig_immediate=2},
drop = "default:sign_wall", drop = "default:sign_wall",
@ -173,6 +173,9 @@ minetest.register_node("signs:sign_yard", {
on_receive_fields = function(pos, formname, fields, sender) on_receive_fields = function(pos, formname, fields, sender)
update_sign(pos, fields) update_sign(pos, fields)
end, end,
on_punch = function(pos, node, puncher)
update_sign(pos)
end,
}) })
minetest.register_entity("signs:text", { minetest.register_entity("signs:text", {
@ -187,8 +190,15 @@ minetest.register_entity("signs:text", {
end end
}) })
local sign_width = 110 -- CONSTANTS
local sign_padding = 8 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) string_to_array = function(str)
local tab = {} local tab = {}
@ -213,9 +223,6 @@ string_to_word_array = function(str)
return tab return tab
end end
LINE_LENGTH = 16
NUMBER_OF_LINES = 7
create_lines = function(text) create_lines = function(text)
local line = "" local line = ""
local line_num = 1 local line_num = 1
@ -245,11 +252,11 @@ create_lines = function(text)
end end
generate_texture = function(lines) generate_texture = function(lines)
local texture = "[combine:"..sign_width.."x"..sign_width local texture = "[combine:"..SIGN_WITH.."x"..SIGN_WITH
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)
ypos = ypos + 8 ypos = ypos + LINE_HEIGHT
end end
return texture return texture
end end
@ -272,7 +279,7 @@ generate_line = function(s, ypos)
i = i + 1 i = i + 1
end end
if file ~= nil then if file ~= nil then
width = width + charwidth[file] + 1 width = width + CHAR_WIDTH
table.insert(parsed, file) table.insert(parsed, file)
chars = chars + 1 chars = chars + 1
end end
@ -280,10 +287,14 @@ generate_line = function(s, ypos)
width = width - 1 width = width - 1
local texture = "" 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 for i = 1, #parsed do
texture = texture..":"..xpos..","..ypos.."="..parsed[i]..".png" texture = texture..":"..xpos..","..ypos.."="..parsed[i]..".png"
xpos = xpos + charwidth[parsed[i]] + 1 xpos = xpos + CHAR_WIDTH + 1
end end
return texture return texture
end end
if minetest.setting_get("log_mods") then
minetest.log("action", "signs loaded")
end

Binary file not shown.

Before

Width:  |  Height:  |  Size: 151 B

After

Width:  |  Height:  |  Size: 239 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 144 B

After

Width:  |  Height:  |  Size: 238 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 156 B

After

Width:  |  Height:  |  Size: 235 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 154 B

After

Width:  |  Height:  |  Size: 241 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 152 B

After

Width:  |  Height:  |  Size: 240 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 153 B

After

Width:  |  Height:  |  Size: 237 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 157 B

After

Width:  |  Height:  |  Size: 246 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 150 B

After

Width:  |  Height:  |  Size: 243 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 144 B

After

Width:  |  Height:  |  Size: 235 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 155 B

After

Width:  |  Height:  |  Size: 245 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 154 B

After

Width:  |  Height:  |  Size: 238 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 152 B

After

Width:  |  Height:  |  Size: 251 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 128 B

After

Width:  |  Height:  |  Size: 228 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 150 B

After

Width:  |  Height:  |  Size: 238 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 159 B

After

Width:  |  Height:  |  Size: 254 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 153 B

After

Width:  |  Height:  |  Size: 249 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 148 B

After

Width:  |  Height:  |  Size: 240 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 145 B

After

Width:  |  Height:  |  Size: 237 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 146 B

After

Width:  |  Height:  |  Size: 237 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 152 B

After

Width:  |  Height:  |  Size: 236 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 148 B

After

Width:  |  Height:  |  Size: 239 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 149 B

After

Width:  |  Height:  |  Size: 231 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 151 B

After

Width:  |  Height:  |  Size: 233 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 145 B

After

Width:  |  Height:  |  Size: 226 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 151 B

After

Width:  |  Height:  |  Size: 234 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 154 B

After

Width:  |  Height:  |  Size: 243 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 151 B

After

Width:  |  Height:  |  Size: 239 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 160 B

After

Width:  |  Height:  |  Size: 239 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 128 B

After

Width:  |  Height:  |  Size: 224 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 152 B

After

Width:  |  Height:  |  Size: 235 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 150 B

After

Width:  |  Height:  |  Size: 240 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 146 B

After

Width:  |  Height:  |  Size: 242 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 139 B

After

Width:  |  Height:  |  Size: 228 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 142 B

After

Width:  |  Height:  |  Size: 230 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 149 B

After

Width:  |  Height:  |  Size: 244 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 149 B

After

Width:  |  Height:  |  Size: 246 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 160 B

After

Width:  |  Height:  |  Size: 251 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 157 B

After

Width:  |  Height:  |  Size: 243 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 147 B

After

Width:  |  Height:  |  Size: 228 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 152 B

After

Width:  |  Height:  |  Size: 248 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 148 B

After

Width:  |  Height:  |  Size: 252 B

BIN
textures/_ha.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 233 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 139 B

After

Width:  |  Height:  |  Size: 237 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 146 B

After

Width:  |  Height:  |  Size: 239 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 148 B

After

Width:  |  Height:  |  Size: 240 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 157 B

After

Width:  |  Height:  |  Size: 243 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 154 B

After

Width:  |  Height:  |  Size: 247 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 155 B

After

Width:  |  Height:  |  Size: 243 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 135 B

After

Width:  |  Height:  |  Size: 238 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 148 B

After

Width:  |  Height:  |  Size: 242 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 150 B

After

Width:  |  Height:  |  Size: 227 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 150 B

After

Width:  |  Height:  |  Size: 240 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 157 B

After

Width:  |  Height:  |  Size: 244 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 142 B

After

Width:  |  Height:  |  Size: 228 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 152 B

After

Width:  |  Height:  |  Size: 248 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 155 B

After

Width:  |  Height:  |  Size: 252 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 146 B

After

Width:  |  Height:  |  Size: 238 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 151 B

After

Width:  |  Height:  |  Size: 239 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 158 B

After

Width:  |  Height:  |  Size: 250 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 153 B

After

Width:  |  Height:  |  Size: 246 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 156 B

After

Width:  |  Height:  |  Size: 255 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 152 B

After

Width:  |  Height:  |  Size: 235 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 160 B

After

Width:  |  Height:  |  Size: 251 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 157 B

After

Width:  |  Height:  |  Size: 242 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 140 B

After

Width:  |  Height:  |  Size: 232 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 156 B

After

Width:  |  Height:  |  Size: 233 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 150 B

After

Width:  |  Height:  |  Size: 241 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 150 B

After

Width:  |  Height:  |  Size: 248 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 158 B

After

Width:  |  Height:  |  Size: 243 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 156 B

After

Width:  |  Height:  |  Size: 239 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 157 B

After

Width:  |  Height:  |  Size: 243 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 143 B

After

Width:  |  Height:  |  Size: 240 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 141 B

After

Width:  |  Height:  |  Size: 227 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 128 B

After

Width:  |  Height:  |  Size: 215 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 147 B

After

Width:  |  Height:  |  Size: 236 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 147 B

After

Width:  |  Height:  |  Size: 241 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 143 B

After

Width:  |  Height:  |  Size: 249 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 150 B

After

Width:  |  Height:  |  Size: 227 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 150 B

After

Width:  |  Height:  |  Size: 240 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 150 B

After

Width:  |  Height:  |  Size: 252 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 142 B

After

Width:  |  Height:  |  Size: 226 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 150 B

After

Width:  |  Height:  |  Size: 249 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 151 B

After

Width:  |  Height:  |  Size: 246 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 135 B

After

Width:  |  Height:  |  Size: 229 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 142 B

After

Width:  |  Height:  |  Size: 238 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 154 B

After

Width:  |  Height:  |  Size: 247 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 147 B

After

Width:  |  Height:  |  Size: 241 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 149 B

After

Width:  |  Height:  |  Size: 246 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 158 B

After

Width:  |  Height:  |  Size: 246 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 155 B

After

Width:  |  Height:  |  Size: 243 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 154 B

After

Width:  |  Height:  |  Size: 233 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 151 B

After

Width:  |  Height:  |  Size: 235 B

BIN
textures/signs_sign.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB