Signs mod almost finished
198
signs/characters
|
@ -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
|
||||
|
|
|
@ -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", {
|
||||
|
|
After Width: | Height: | Size: 151 B |
After Width: | Height: | Size: 144 B |
After Width: | Height: | Size: 156 B |
After Width: | Height: | Size: 154 B |
After Width: | Height: | Size: 152 B |
After Width: | Height: | Size: 153 B |
After Width: | Height: | Size: 157 B |
After Width: | Height: | Size: 150 B |
After Width: | Height: | Size: 144 B |
After Width: | Height: | Size: 155 B |
After Width: | Height: | Size: 156 B |
After Width: | Height: | Size: 128 B |
After Width: | Height: | Size: 150 B |
After Width: | Height: | Size: 159 B |
After Width: | Height: | Size: 145 B |
After Width: | Height: | Size: 146 B |
After Width: | Height: | Size: 149 B |
After Width: | Height: | Size: 151 B |
After Width: | Height: | Size: 145 B |
After Width: | Height: | Size: 151 B |
After Width: | Height: | Size: 160 B |
After Width: | Height: | Size: 128 B |
After Width: | Height: | Size: 152 B |
After Width: | Height: | Size: 139 B |
After Width: | Height: | Size: 142 B |
After Width: | Height: | Size: 147 B |
After Width: | Height: | Size: 144 B |
After Width: | Height: | Size: 150 B |
After Width: | Height: | Size: 142 B |
After Width: | Height: | Size: 156 B |
After Width: | Height: | Size: 152 B |
After Width: | Height: | Size: 140 B |
After Width: | Height: | Size: 156 B |
After Width: | Height: | Size: 158 B |
After Width: | Height: | Size: 143 B |
After Width: | Height: | Size: 141 B |
After Width: | Height: | Size: 147 B |
After Width: | Height: | Size: 150 B |
After Width: | Height: | Size: 142 B |
After Width: | Height: | Size: 135 B |