summaryrefslogtreecommitdiff
path: root/street_signs
diff options
context:
space:
mode:
Diffstat (limited to 'street_signs')
-rw-r--r--street_signs/init.lua147
-rw-r--r--street_signs/models/street_signs_basic_top_only.obj196
-rw-r--r--street_signs/models/street_signs_basic_top_only_entity.obj45
3 files changed, 362 insertions, 26 deletions
diff --git a/street_signs/init.lua b/street_signs/init.lua
index b2237d9..e679d18 100644
--- a/street_signs/init.lua
+++ b/street_signs/init.lua
@@ -29,25 +29,6 @@ street_signs.modpath = minetest.get_modpath("street_signs")
local DEFAULT_TEXT_SCALE = {x=10, y=10}
-street_signs.standard_sign_model = {
- nodebox = {
- type = "fixed",
- fixed = {
- { -1/32, 23/16, -1/32, 1/32, 24/16, 1/32 },
- { -1/32, 18/16, -8/16, 1/32, 23/16, 8/16 },
- { -1/32, 17/16, -1/32, 1/32, 18/16, 1/32 },
- { -8/16, 12/16, -1/32, 8/16, 17/16, 1/32 },
- { -1/16, -8/16, -1/16, 1/16, 12/16, 1/16 },
- }
- },
- yaw = {
- 0,
- math.pi / -2,
- math.pi,
- math.pi / 2,
- }
-}
-
-- infinite stacks
if not minetest.settings:get_bool("creative_mode") then
@@ -386,10 +367,13 @@ street_signs.update_sign = function(pos, fields)
-- if there is no entity
local signnode = minetest.get_node(pos)
local signname = signnode.name
- local text = minetest.add_entity(pos, "street_signs:text")
- local yaw = street_signs.standard_sign_model.yaw[minetest.get_node(pos).param2 + 1]
- if not yaw then return end
- text:setyaw(yaw)
+ local def = minetest.registered_items[signname]
+ local obj = minetest.add_entity(pos, "street_signs:text")
+ if not def.entity_info then return end
+ obj:setyaw(def.entity_info.yaw[signnode.param2 + 1])
+ obj:set_properties({
+ mesh = def.entity_info.mesh,
+ })
end
function street_signs.receive_fields(pos, formname, fields, sender)
@@ -408,14 +392,25 @@ function street_signs.receive_fields(pos, formname, fields, sender)
end
end
+local cbox = {
+ type = "fixed",
+ fixed = {
+ { -1/32, 23/16, -1/32, 1/32, 24/16, 1/32 },
+ { -1/32, 18/16, -8/16, 1/32, 23/16, 8/16 },
+ { -1/32, 17/16, -1/32, 1/32, 18/16, 1/32 },
+ { -8/16, 12/16, -1/32, 8/16, 17/16, 1/32 },
+ { -1/16, -8/16, -1/16, 1/16, 12/16, 1/16 },
+ }
+}
+
minetest.register_node("street_signs:sign_basic", {
description = "Basic street name sign",
paramtype = "light",
sunlight_propagates = true,
paramtype2 = "facedir",
drawtype = "mesh",
- node_box = street_signs.standard_sign_model.nodebox,
- selection_box = street_signs.standard_sign_model.nodebox,
+ node_box = cbox,
+ selection_box = cbox,
mesh = "street_signs_basic.obj",
tiles = { "street_signs_basic.png" },
groups = {choppy=2, dig_immediate=2},
@@ -432,6 +427,62 @@ minetest.register_node("street_signs:sign_basic", {
on_punch = function(pos, node, puncher)
street_signs.update_sign(pos)
end,
+ entity_info = {
+ mesh = "street_signs_basic_entity.obj",
+ yaw = {
+ 0,
+ math.pi / -2,
+ math.pi,
+ math.pi / 2,
+ }
+ }
+})
+
+cbox = {
+ type = "fixed",
+ fixed = {
+ { -1/32, 7/16, -1/32, 1/32, 8/16, 1/32 },
+ { -1/32, 2/16, -8/16, 1/32, 7/16, 8/16 },
+ { -1/32, 1/16, -1/32, 1/32, 2/16, 1/32 },
+ { -8/16, -4/16, -1/32, 8/16, 1/16, 1/32 },
+ { -1/16, -8/16, -1/16, 1/16, -4/16, 1/16 },
+
+ }
+}
+
+minetest.register_node("street_signs:sign_basic_top_only", {
+ description = "Basic street name sign, top only",
+ paramtype = "light",
+ sunlight_propagates = true,
+ paramtype2 = "facedir",
+ drawtype = "mesh",
+ node_box = cbox,
+ selection_box = cbox,
+ mesh = "street_signs_basic_top_only.obj",
+ tiles = { "street_signs_basic.png" },
+ groups = {choppy=2, dig_immediate=2},
+ default_color = "f",
+ on_construct = function(pos)
+ street_signs.construct_sign(pos)
+ end,
+ on_destruct = function(pos)
+ street_signs.destruct_sign(pos)
+ end,
+ on_receive_fields = function(pos, formname, fields, sender)
+ street_signs.receive_fields(pos, formname, fields, sender)
+ end,
+ on_punch = function(pos, node, puncher)
+ street_signs.update_sign(pos)
+ end,
+ entity_info = {
+ mesh = "street_signs_basic_top_only_entity.obj",
+ yaw = {
+ 0,
+ math.pi / -2,
+ math.pi,
+ math.pi / 2,
+ }
+ }
})
local signs_text_on_activate
@@ -439,10 +490,16 @@ local signs_text_on_activate
signs_text_on_activate = function(self)
local pos = self.object:getpos()
local meta = minetest.get_meta(pos)
+ local signnode = minetest.get_node(pos)
+ local signname = signnode.name
+ local def = minetest.registered_items[signname]
local text = meta:get_string("text")
- if text and minetest.registered_nodes[minetest.get_node(pos).name] then
+ if text and def and def.entity_info then
text = trim_input(text)
set_obj_text(self.object, text, nil, pos)
+ self.object:set_properties({
+ mesh = def.entity_info.mesh,
+ })
end
end
@@ -487,6 +544,44 @@ if minetest.get_modpath("signs_lib") then
})
end
+
+minetest.register_craft({
+ output = "street_signs:sign_basic_top_only",
+ recipe = {
+ { "dye:green", "default:sign_wall_steel", "dye:green" },
+ { "dye:white", "default:steel_ingot", "" },
+
+ }
+})
+
+minetest.register_craft({
+ output = "street_signs:sign_basic_top_only",
+ recipe = {
+ { "dye:green", "default:sign_wall_steel", "dye:green" },
+ { "", "default:steel_ingot", "dye:white" },
+ }
+})
+
+if minetest.get_modpath("signs_lib") then
+ minetest.register_craft({
+ output = "street_signs:sign_basic_top_only",
+ recipe = {
+ { "signs:sign_wall_green" },
+ { "default:steel_ingot" },
+ }
+ })
+end
+
+minetest.register_craft({
+ output = "street_signs:sign_basic",
+ recipe = {
+ { "street_signs:sign_basic_top_only" },
+ { "default:steel_ingot" }
+ }
+})
+
+
+
-- restore signs' text after /clearobjects and the like, the next time
-- a block is reloaded by the server.
diff --git a/street_signs/models/street_signs_basic_top_only.obj b/street_signs/models/street_signs_basic_top_only.obj
new file mode 100644
index 0000000..73db1ba
--- /dev/null
+++ b/street_signs/models/street_signs_basic_top_only.obj
@@ -0,0 +1,196 @@
+# Blender v2.79 (sub 0) OBJ File: 'street signs basic.blend'
+# www.blender.org
+o Cube
+v 0.062500 -0.250000 -0.062500
+v 0.062500 -0.250000 0.062500
+v -0.062500 -0.250000 -0.062500
+v -0.062500 -0.250000 0.062500
+v 0.031250 0.437500 -0.500000
+v 0.031250 0.437500 0.500000
+v -0.031250 0.437500 -0.500000
+v -0.031250 0.437500 0.500000
+v 0.031250 0.125000 -0.500000
+v 0.031250 0.125000 0.500000
+v -0.031250 0.125000 0.500000
+v -0.031250 0.125000 -0.500000
+v 0.500000 0.062500 -0.031250
+v 0.500000 0.062500 0.031250
+v -0.500000 0.062500 0.031250
+v -0.500000 0.062500 -0.031250
+v 0.500000 -0.250000 -0.031250
+v 0.500000 -0.250000 0.031250
+v -0.500000 -0.250000 0.031250
+v -0.500000 -0.250000 -0.031250
+v 0.031250 0.062500 -0.031250
+v 0.031250 0.062500 0.031250
+v -0.031250 0.062500 -0.031250
+v -0.031250 0.062500 0.031250
+v 0.031250 0.125000 -0.031250
+v 0.031250 0.125000 0.031250
+v -0.031250 0.125000 0.031250
+v -0.031250 0.125000 -0.031250
+v 0.031250 0.437500 -0.031250
+v 0.031250 0.437500 0.031250
+v -0.031250 0.437500 -0.031250
+v -0.031250 0.437500 0.031250
+v 0.031250 0.500000 -0.031250
+v 0.031250 0.500000 0.031250
+v -0.031250 0.500000 0.031250
+v -0.031250 0.500000 -0.031250
+v -0.062500 -0.500000 0.062500
+v 0.062500 -0.500000 0.062500
+v -0.062500 -0.500000 -0.062500
+v 0.062500 -0.500000 -0.062500
+vt 0.281250 0.593750
+vt 0.156250 0.593750
+vt 0.156250 0.531250
+vt 0.281250 0.531250
+vt 0.781250 0.093750
+vt 0.718750 0.093750
+vt 0.718750 0.593750
+vt 0.781250 0.593750
+vt 0.781250 0.093750
+vt 0.781250 0.593750
+vt 0.718750 0.593750
+vt 0.718750 0.093750
+vt 1.000000 0.968750
+vt 1.000000 0.812500
+vt 0.000000 0.812500
+vt 0.000000 0.968750
+vt 0.000000 0.968750
+vt 0.000000 0.812500
+vt 1.000000 0.812500
+vt 1.000000 0.968750
+vt 0.968750 0.593750
+vt 0.968750 0.437500
+vt 0.906250 0.437500
+vt 0.906250 0.593750
+vt 0.906250 0.593750
+vt 0.906250 0.437500
+vt 0.968750 0.437500
+vt 0.968750 0.593750
+vt 0.718750 0.093750
+vt 0.718750 0.593750
+vt 0.781250 0.593750
+vt 0.781250 0.093750
+vt 0.718750 0.093750
+vt 0.781250 0.093750
+vt 0.781250 0.593750
+vt 0.718750 0.593750
+vt 1.000000 0.781250
+vt 1.000000 0.625000
+vt 0.000000 0.625000
+vt 0.000000 0.781250
+vt 0.000000 0.781250
+vt 0.000000 0.625000
+vt 1.000000 0.625000
+vt 1.000000 0.781250
+vt 0.968750 0.593750
+vt 0.968750 0.437500
+vt 0.906250 0.437500
+vt 0.906250 0.593750
+vt 0.906250 0.593750
+vt 0.906250 0.437500
+vt 0.968750 0.437500
+vt 0.968750 0.593750
+vt 0.000000 0.000000
+vt 1.000000 0.000000
+vt 1.000000 1.000000
+vt 0.000000 1.000000
+vt 0.000000 0.000000
+vt 1.000000 0.000000
+vt 1.000000 1.000000
+vt 0.000000 1.000000
+vt 0.531250 0.781250
+vt 0.468750 0.781250
+vt 0.468750 0.812500
+vt 0.531250 0.812500
+vt 0.468750 0.781250
+vt 0.531250 0.781250
+vt 0.531250 0.812500
+vt 0.468750 0.812500
+vt 0.468750 0.781250
+vt 0.468750 0.812500
+vt 0.531250 0.781250
+vt 0.531250 0.812500
+vt 0.000000 0.000000
+vt 1.000000 0.000000
+vt 1.000000 1.000000
+vt 0.000000 1.000000
+vt 0.218750 0.468750
+vt 0.156250 0.468750
+vt 0.156250 0.437500
+vt 0.218750 0.437500
+vt 0.531250 0.968750
+vt 0.468750 0.968750
+vt 0.468750 1.000000
+vt 0.531250 1.000000
+vt 0.468750 0.968750
+vt 0.531250 0.968750
+vt 0.531250 1.000000
+vt 0.468750 1.000000
+vt 0.531250 0.968750
+vt 0.468750 0.968750
+vt 0.468750 1.000000
+vt 0.468750 0.968750
+vt 0.531250 0.968750
+vt 0.531250 1.000000
+vt 0.000000 0.000000
+vt 0.000000 0.000000
+vt 0.000000 0.000000
+vt 0.000000 0.000000
+vt 0.562500 0.500000
+vt 0.437500 0.500000
+vt 0.437500 0.625000
+vt 0.562500 0.625000
+vt 0.437500 0.500000
+vt 0.562500 0.500000
+vt 0.562500 0.625000
+vt 0.437500 0.625000
+vt 0.562500 0.500000
+vt 0.562500 0.625000
+vt 0.437500 0.500000
+vt 0.437500 0.625000
+vn 0.0000 1.0000 0.0000
+vn 0.0000 -1.0000 0.0000
+vn -1.0000 0.0000 0.0000
+vn 1.0000 0.0000 0.0000
+vn 0.0000 0.0000 -1.0000
+vn 0.0000 0.0000 1.0000
+g Cube_Cube_top
+s off
+f 4/1/1 2/2/1 1/3/1 3/4/1
+f 8/5/1 6/6/1 5/7/1 7/8/1
+f 11/9/2 12/10/2 9/11/2 10/12/2
+f 7/13/3 12/14/3 11/15/3 8/16/3
+f 6/17/4 10/18/4 9/19/4 5/20/4
+f 5/21/5 9/22/5 12/23/5 7/24/5
+f 8/25/6 11/26/6 10/27/6 6/28/6
+f 15/29/1 14/30/1 13/31/1 16/32/1
+f 19/33/2 20/34/2 17/35/2 18/36/2
+f 13/37/5 17/38/5 20/39/5 16/40/5
+f 15/41/6 19/42/6 18/43/6 14/44/6
+f 16/45/3 20/46/3 19/47/3 15/48/3
+f 14/49/4 18/50/4 17/51/4 13/52/4
+f 24/53/2 23/54/2 21/55/2 22/56/2
+f 27/57/1 26/58/1 25/59/1 28/60/1
+f 23/61/3 24/62/3 27/63/3 28/64/3
+f 22/65/4 21/66/4 25/67/4 26/68/4
+f 21/66/5 23/69/5 28/70/5 25/67/5
+f 24/62/6 22/71/6 26/72/6 27/63/6
+f 32/73/2 31/74/2 29/75/2 30/76/2
+f 35/77/1 34/78/1 33/79/1 36/80/1
+f 31/81/3 32/82/3 35/83/3 36/84/3
+f 30/85/4 29/86/4 33/87/4 34/88/4
+f 29/89/5 31/90/5 36/91/5 33/87/5
+f 32/92/6 30/93/6 34/94/6 35/83/6
+g Cube_Cube_top_NONE
+f 37/95/2 39/96/2 40/97/2 38/98/2
+g Cube_Cube_right
+f 39/99/3 37/100/3 4/101/3 3/102/3
+g Cube_Cube_left
+f 38/103/4 40/104/4 1/105/4 2/106/4
+g Cube_Cube_back
+f 37/100/6 38/107/6 2/108/6 4/101/6
+g Cube_Cube_front
+f 40/104/5 39/109/5 3/110/5 1/105/5
diff --git a/street_signs/models/street_signs_basic_top_only_entity.obj b/street_signs/models/street_signs_basic_top_only_entity.obj
new file mode 100644
index 0000000..522676e
--- /dev/null
+++ b/street_signs/models/street_signs_basic_top_only_entity.obj
@@ -0,0 +1,45 @@
+# Blender v2.79 (sub 0) OBJ File: 'street signs entity.blend'
+# www.blender.org
+o Cube
+v 0.039063 0.437500 -0.500000
+v 0.039063 0.437500 0.500000
+v -0.039063 0.437500 -0.500000
+v -0.039063 0.437500 0.500000
+v 0.039063 0.125000 -0.500000
+v 0.039063 0.125000 0.500000
+v -0.039063 0.125000 0.500000
+v -0.039063 0.125000 -0.500000
+v 0.500000 0.062500 -0.039063
+v 0.500000 0.062500 0.039063
+v -0.500000 0.062500 0.039063
+v -0.500000 0.062500 -0.039063
+v 0.500000 -0.250000 -0.039063
+v 0.500000 -0.250000 0.039063
+v -0.500000 -0.250000 0.039063
+v -0.500000 -0.250000 -0.039063
+vt 0.000000 1.000000
+vt 0.000000 0.750000
+vt 1.000000 0.750000
+vt 1.000000 1.000000
+vt -0.000000 0.750000
+vt -0.000000 0.500000
+vt 1.000000 0.500000
+vt 1.000000 0.750000
+vt 0.000000 0.500000
+vt 0.000000 0.250000
+vt 1.000000 0.250000
+vt 1.000000 0.500000
+vt -0.000000 0.250000
+vt -0.000000 0.000000
+vt 1.000000 0.000000
+vt 1.000000 0.250000
+vn -1.0000 0.0000 0.0000
+vn 1.0000 0.0000 0.0000
+vn 0.0000 0.0000 -1.0000
+vn 0.0000 0.0000 1.0000
+g Cube_Cube_top
+s off
+f 3/1/1 8/2/1 7/3/1 4/4/1
+f 2/5/2 6/6/2 5/7/2 1/8/2
+f 9/9/3 13/10/3 16/11/3 12/12/3
+f 11/13/4 15/14/4 14/15/4 10/16/4