Signs mod almost finished

master
Ilya Zhuravlev 2012-08-08 00:27:41 +04:00
parent 947da2602b
commit 2e90ac3c5c
42 changed files with 254 additions and 32 deletions

View File

@ -76,6 +76,204 @@ _y_
Z
_z_
3
a
_a
4
b
_b
4
c
_c
3
d
_d
4
e
_e
4
f
_f
3
g
_g
4
h
_h
4
i
_i
1
j
_j
2
k
_k
4
l
_l
1
m
_m
5
n
_n
4
o
_o
4
p
_p
4
q
_q
4
r
_r
3
s
_s
4
t
_t
3
u
_u
4
v
_v
4
w
_w
5
x
_x
3
y
_y
4
z
_z
4
_sp
2
0
_0
4
1
_1
2
2
_2
4
3
_3
4
4
_4
4
5
_5
4
6
_6
4
7
_7
4
8
_8
4
9
_9
4
(
_bl
2
)
_br
2
{
_cl
2
}
_cr
2
[
_sl
2
]
_sr
2
'
_ap
1
!
_ex
1
?
_qu
4
@
_at
5
#
_hs
5
$
_dl
4
%
_pr
5
^
_ca
3
&
_am
5
*
_as
3
_
_un
4
+
_ps
3
-
_mn
3
=
_eq
3
;
_sm
1
,
_cm
2
"
_qo
3
/
_dv
5
~
_tl
4
<
_lt
3
>
_gt
3
\
_re
5
|
_vb
1
.
_dt
1

View File

@ -24,17 +24,55 @@ end
print(dump(charmap))
local metas = {"line1", "line2", "line3", "line4", "line5", "line6", "line7"}
local signs = {
["2"] = {nodebox = {0.4, -0.15, -0.45, 0.498, 0.45, 0.45}, delta = {x = 0.399, y = 0, z = 0}, yaw = math.pi / -2},
["3"] = {nodebox = {-0.498, -0.15, -0.45, -0.4, 0.45, 0.45}, delta = {x = -0.399, y = 0, z = 0}, yaw = math.pi / 2},
["4"] = {nodebox = {-0.45, -0.15, 0.4, 0.45, 0.45, 0.498}, delta = {x = 0, y = 0, z = 0.399}, yaw = 0},
["5"] = {nodebox = {-0.45, -0.15, -0.498, 0.45, 0.45, -0.4}, delta = {x = 0, y = 0, z = -0.399}, yaw = math.pi},
}
for param2 in pairs(signs) do
local definition = signs[param2]
minetest.register_node("signs:sign_"..param2, {
drawtype = "nodebox",
drop = "signs:sign",
tiles = {"default_wood.png"},
node_box = {type = "fixed", fixed = definition.nodebox},
selection_box = {type = "fixed", fixed = definition.nodebox},
sunlight_propagates = true,
paramtype = "light",
walkable = false,
on_construct = function(pos)
local meta = minetest.env:get_meta(pos)
meta:set_string("formspec", "size[7,8]"..
"field[1,0;6,3;line1;;${line1}]"..
"field[1,1;6,3;line2;;${line2}]"..
"field[1,2;6,3;line3;;${line3}]"..
"field[1,3;6,3;line4;;${line4}]"..
"field[1,4;6,3;line5;;${line5}]"..
"field[1,5;6,3;line6;;${line6}]"..
"field[1,6;6,3;line7;;${line7}]")
end,
on_receive_fields = function(pos, formname, fields, sender)
local meta = minetest.env:get_meta(pos)
local text = {}
for i = 1, #metas do
table.insert(text, fields[metas[i]])
meta:set_string(metas[i], fields[metas[i]])
end
local object = minetest.env:get_objects_inside_radius(pos, 0.5)[1]
object:set_properties({textures={generate_texture(text)}})
end,
})
end
minetest.register_node("signs:sign", {
description = "Sign",
drawtype = "nodebox",
inventory_image = "default_sign_wall.png",
wield_image = "default_sign_wall.png",
stack_max = 1,
tiles = {"default_wood.png"},
node_box = {type = "fixed", fixed = {-0.498, -0.15, -0.45, -0.4, 0.45, 0.45}},
selection_box = {type = "fixed", fixed = {-0.498, -0.15, -0.45, -0.4, 0.45, 0.45}},
sunlight_propagates = true,
paramtype = "light",
node_placement_prediction = "",
on_place = function(itemstack, placer, pointed_thing)
local above = pointed_thing.above
@ -43,36 +81,22 @@ minetest.register_node("signs:sign", {
y = under.y - above.y,
z = under.z - above.z}
minetest.env:add_node(above, {name="signs:sign"})
print(minetest.dir_to_wallmounted(dir))
local wdir = minetest.dir_to_wallmounted(dir)
local text = minetest.env:add_entity({x=above.x-0.399, y=above.y, z=above.z}, "signs:text")
text:setyaw(math.pi/2)
if wdir < 2 then
--top/bottom not implemented =(
minetest.env:add_item(above, "signs:sign")
else
minetest.env:add_node(above, {name="signs:sign_"..wdir})
local text = minetest.env:add_entity({x = above.x + signs[wdir..""].delta.x,
y = above.y + signs[wdir..""].delta.y,
z = above.z + signs[wdir..""].delta.z}, "signs:text")
text:setyaw(signs[wdir..""].yaw)
end
return ItemStack("")
end,
on_construct = function(pos)
local meta = minetest.env:get_meta(pos)
meta:set_string("formspec", "size[7,8]"..
"field[1,0;6,3;line1;;${line1}]"..
"field[1,1;6,3;line2;;${line2}]"..
"field[1,2;6,3;line3;;${line3}]"..
"field[1,3;6,3;line4;;${line4}]"..
"field[1,4;6,3;line5;;${line5}]"..
"field[1,5;6,3;line6;;${line6}]"..
"field[1,6;6,3;line7;;${line7}]")
end,
on_receive_fields = function(pos, formname, fields, sender)
local meta = minetest.env:get_meta(pos)
local text = {}
for i = 1, #metas do
table.insert(text, fields[metas[i]])
meta:set_string(metas[i], fields[metas[i]])
end
local object = minetest.env:get_objects_inside_radius(pos, 0.5)[1]
object:set_properties({textures={generate_texture(text)}})
end,
})
minetest.register_entity("signs:text", {

BIN
signs/textures/_0.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 151 B

BIN
signs/textures/_1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 144 B

BIN
signs/textures/_2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 156 B

BIN
signs/textures/_3.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 154 B

BIN
signs/textures/_4.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 152 B

BIN
signs/textures/_5.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 153 B

BIN
signs/textures/_6.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 157 B

BIN
signs/textures/_7.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 150 B

BIN
signs/textures/_8.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 144 B

BIN
signs/textures/_9.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 155 B

BIN
signs/textures/_am.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 156 B

BIN
signs/textures/_ap.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 128 B

BIN
signs/textures/_as.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 150 B

BIN
signs/textures/_at.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 159 B

BIN
signs/textures/_bl.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 145 B

BIN
signs/textures/_br.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 146 B

BIN
signs/textures/_ca.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 149 B

BIN
signs/textures/_cl.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 151 B

BIN
signs/textures/_cm.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 145 B

BIN
signs/textures/_cr.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 151 B

BIN
signs/textures/_dl.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 160 B

BIN
signs/textures/_dt.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 128 B

BIN
signs/textures/_dv.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 152 B

BIN
signs/textures/_eq.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 139 B

BIN
signs/textures/_ex.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 142 B

BIN
signs/textures/_gt.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 147 B

BIN
signs/textures/_hs.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 144 B

BIN
signs/textures/_lt.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 150 B

BIN
signs/textures/_mn.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 142 B

BIN
signs/textures/_pr.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 156 B

BIN
signs/textures/_ps.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 152 B

BIN
signs/textures/_qo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 140 B

BIN
signs/textures/_qu.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 156 B

BIN
signs/textures/_re.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 158 B

BIN
signs/textures/_sl.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 143 B

BIN
signs/textures/_sm.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 141 B

BIN
signs/textures/_sr.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 147 B

BIN
signs/textures/_tl.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 150 B

BIN
signs/textures/_un.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 142 B

BIN
signs/textures/_vb.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 135 B