123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164 |
- local function on_construct(pos)
- local meta = minetest.get_meta(pos)
- meta:set_string('formspec', 'field[text;;${text}]')
- meta:set_string('infotext', '')
- end
- local function on_receive_fields(pos, formname, fields, sender)
- local meta = minetest.get_meta(pos)
- local name = sender:get_player_name()
- if not minetest.is_protected(pos, name) or minetest.check_player_privs(name, { server = true }) then
- if not fields.text then return end
- meta:set_string('text', fields.text)
- meta:set_string('infotext', fields.text)
- end
- end
- minetest.register_node('furniture:traffic_sign_address_1', {
- description = 'Street Sign (Single)',
- drawtype = 'mesh',
- mesh = 'furniture_street_sign_address_1.obj',
- tiles = {'furniture_traffic_sign_post.png', 'furniture_traffic_sign_streets.png'},
- paramtype = 'light',
- paramtype2 = 'facedir',
- selection_box = {
- type = 'fixed',
- fixed = {{-.0625, -1, -.0625, .0625, 1.5, .0625}, --post
- {-.5, 1.25, -.0625, .5, 1.4375, -.03125}}},
- collision_box = {
- type = 'fixed',
- fixed = {-.0625, -1, -.0625, .0625, 1.5, .0625}},
- groups = {breakable=1},
- on_construct = on_construct,
- on_receive_fields = on_receive_fields
- })
- minetest.register_node('furniture:traffic_sign_address_2', {
- description = 'Street Sign (Double)',
- drawtype = 'mesh',
- mesh = 'furniture_street_sign_address_2.obj',
- tiles = {'furniture_traffic_sign_post.png', 'furniture_traffic_sign_streets.png'},
- paramtype = 'light',
- paramtype2 = 'facedir',
- selection_box = {
- type = 'fixed',
- fixed = {{-.0625, -1, -.0625, .0625, 1.5, .0625},
- {-.5, 1.25, -.0625, .5, 1.4375, -.03125}}},
- collision_box = {
- type = 'fixed',
- fixed = {-.0625, -1, -.0625, .0625, 1.5, .0625}},
- groups = {breakable=1},
- on_construct = on_construct,
- after_place_node = function(pos, placer)
- local node = minetest.get_node(pos)
- local above_pos = {x=pos.x, y=pos.y+1, z=pos.z}
- minetest.set_node(above_pos, {name = 'furniture:traffic_sign_address_hidden', param2 = node.param2})
- end,
- on_receive_fields = on_receive_fields,
- on_destruct = function(pos)
- local above_pos = {x=pos.x, y=pos.y+1, z=pos.z}
- minetest.remove_node(above_pos)
- end,
- })
- minetest.register_node('furniture:traffic_sign_address_hidden', {
- drawtype = 'airlike',
- paramtype2 = 'facedir',
- selection_box = {
- type = 'fixed',
- fixed = {.0625, .0625, -.5, .03125, .25, .5}},
- drop = 'furniture:traffic_sign_address_2',
- groups = {breakable=1, not_in_creative_inventory=1},
- on_construct = on_construct,
- on_receive_fields = on_receive_fields,
- on_destruct = function(pos)
- local below_pos = {x=pos.x, y=pos.y-1, z=pos.z}
- minetest.remove_node(below_pos)
- end,
- })
- minetest.register_node('furniture:traffic_sign_stop', {
- description = 'Stop Sign',
- drawtype = 'mesh',
- mesh = 'furniture_traffic_sign_stop.obj',
- tiles = {'furniture_traffic_sign_post.png', 'furniture_traffic_sign_stop.png'},
- paramtype = 'light',
- paramtype2 = 'facedir',
- selection_box = {
- type = 'fixed',
- fixed = {{-.0625, -1, -.0625, .0625, 1.5, .0625},
- {-.5, .5, -.0625, .5, 1.5, -.03125}}},
- collision_box = {
- type = 'fixed',
- fixed = {-.0625, -1, -.0625, .0625, 1.5, .0625}},
- groups = {breakable=1},
- })
- minetest.register_node('furniture:traffic_sign_speed_55', {
- description = 'Speed Limit 55',
- drawtype = 'mesh',
- mesh = 'furniture_traffic_sign_speed.obj',
- tiles = {'furniture_traffic_sign_post.png', 'furniture_traffic_sign_speed_55.png'},
- paramtype = 'light',
- paramtype2 = 'facedir',
- selection_box = {
- type = 'fixed',
- fixed = {{-.0625, -1, -.0625, .0625, 1.5, .0625},
- {-.5, .5, -.0625, .5, 1.5, -.03125}}},
- collision_box = {
- type = 'fixed',
- fixed = {-.0625, -1, -.0625, .0625, 1.5, .0625}},
- groups = {breakable=1},
- })
- minetest.register_node('furniture:traffic_sign_no_parking', {
- description = 'No Parking',
- drawtype = 'mesh',
- mesh = 'furniture_traffic_sign_speed.obj',
- tiles = {'furniture_traffic_sign_post.png', 'furniture_traffic_sign_no_parking.png'},
- paramtype = 'light',
- paramtype2 = 'facedir',
- selection_box = {
- type = 'fixed',
- fixed = {{-.0625, -1, -.0625, .0625, 1.5, .0625},
- {-.5, .5, -.0625, .5, 1.5, -.03125}}},
- collision_box = {
- type = 'fixed',
- fixed = {-.0625, -1, -.0625, .0625, 1.5, .0625}},
- groups = {breakable=1},
- })
- minetest.register_node('furniture:traffic_sign_one_way', {
- description = 'One Way',
- drawtype = 'mesh',
- mesh = 'furniture_traffic_sign_speed.obj',
- tiles = {'furniture_traffic_sign_post.png', 'furniture_traffic_sign_one_way.png'},
- paramtype = 'light',
- paramtype2 = 'facedir',
- selection_box = {
- type = 'fixed',
- fixed = {{-.0625, -1, -.0625, .0625, 1.5, .0625},
- {-.5, .5, -.0625, .5, 1.5, -.03125}}},
- collision_box = {
- type = 'fixed',
- fixed = {-.0625, -1, -.0625, .0625, 1.5, .0625}},
- groups = {breakable=1},
- })
- minetest.register_node('furniture:traffic_sign_slow', {
- description = 'One Way',
- drawtype = 'mesh',
- mesh = 'furniture_traffic_sign_warning.obj',
- tiles = {'furniture_traffic_sign_post.png', 'furniture_traffic_sign_slow.png'},
- paramtype = 'light',
- paramtype2 = 'facedir',
- selection_box = {
- type = 'fixed',
- fixed = {{-.0625, -1, -.0625, .0625, 1.5, .0625},
- {-.5, .5, -.0625, .5, 1.5, -.03125}}},
- collision_box = {
- type = 'fixed',
- fixed = {-.0625, -1, -.0625, .0625, 1.5, .0625}},
- groups = {breakable=1},
- })
|