123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144 |
- minetest.register_node('hall:stanchion_post', {
- description = 'Stanchion post',
- drawtype = 'mesh',
- mesh = 'hall_stanchion_post.obj',
- tiles = {'default_aspen_wood.png'},
- sounds = default.node_sound_wood_defaults(),
- paramtype2 = 'facedir',
- paramtype = 'light',
- selection_box = {
- type = 'fixed',
- fixed = {-.2, -.5, -.2, .2, .5, .2},
- },
- collision_box = {
- type = 'fixed',
- fixed = {-.2, -.5, -.2, .2, .5, .2},
- },
- groups = {oddly_breakable_by_hand = 2, choppy=3},
- })
- minetest.register_node('hall:stanchion_post_sign', {
- description = 'Stanchion post',
- drawtype = 'mesh',
- mesh = 'hall_stanchion_post_sign.obj',
- tiles = {'default_aspen_wood.png', 'hall_plaque_texture.png'},
- sounds = default.node_sound_wood_defaults(),
- paramtype2 = 'facedir',
- paramtype = 'light',
- selection_box = {
- type = 'fixed',
- fixed = {-.2, -.5, -.2, .2, .5, .2},
- },
- collision_box = {
- type = 'fixed',
- fixed = {-.2, -.5, -.2, .2, .5, .2},
- },
- groups = {oddly_breakable_by_hand = 2, choppy=3},
- after_place_node = function(pos, placer)
- local meta = minetest.get_meta(pos)
- meta:set_string('owner', placer:get_player_name())
- meta:set_string('infotext', 'Empty Sign')
- meta:set_string('title', '')
- meta:set_string('bottom', '')
- meta:set_string('left', '')
- meta:set_string('right', '')
- end,
- on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
- local name = clicker:get_player_name()
- local meta = minetest.get_meta(pos)
- local owner = meta:get_string('owner')
- local title = meta:get_string('title')
- local bottom = meta:get_string('bottom')
- local left = meta:get_string('left')
- local right = meta:get_string('right')
- if owner == name then
- meta:set_string('formspec', hall.edit_sign(title, bottom, left, right))
- else
- meta:set_string('formspec', hall.view_sign(title, bottom, left, right))
- end
- end,
- on_receive_fields = function(pos, formname, fields, sender)
- local meta = minetest.get_meta(pos)
- if fields ['save'] then
- local player_name = sender:get_player_name()
- meta:set_string('infotext', fields.title)
- meta:set_string('title', fields.title)
- meta:set_string('bottom', fields.bottom)
- meta:set_string('left', fields.left)
- meta:set_string('right', fields.right)
- minetest.log("action", (player_name or "").." wrote \""..fields.title.."\" to stanchion at "..minetest.pos_to_string(pos))
- end
- end,
- })
- minetest.register_node('hall:stanchion_rope', {
- description = 'Stanchion rope',
- drawtype = 'mesh',
- mesh = 'hall_stanchion_rope.obj',
- tiles = {'wool.png^[multiply:#1a1a1a'},
- paramtype2 = 'facedir',
- paramtype = 'light',
- selection_box = {
- type = 'fixed',
- fixed = {-.6, -.2, -.2, .6, .4, .2},
- },
- collision_box = {
- type = 'fixed',
- fixed = {-.6, -.2, -.2, .6, .4, .2},
- },
- groups = {oddly_breakable_by_hand = 2, snappy=3},
- })
- minetest.register_node('hall:stanchion_rope_sign', {
- description = 'Stanchion rope',
- drawtype = 'mesh',
- mesh = 'hall_stanchion_rope_sign.obj',
- tiles = {'wool.png^[multiply:#1a1a1a','hall_plaque_texture.png'},
- paramtype2 = 'facedir',
- paramtype = 'light',
- selection_box = {
- type = 'fixed',
- fixed = {-.6, -.2, -.2, .6, .4, .2},
- },
- collision_box = {
- type = 'fixed',
- fixed = {-.6, -.2, -.2, .6, .4, .2},
- },
- groups = {oddly_breakable_by_hand = 2, snappy=3},
- after_place_node = function(pos, placer)
- local meta = minetest.get_meta(pos)
- meta:set_string('owner', placer:get_player_name())
- meta:set_string('infotext', 'Empty Sign')
- meta:set_string('title', '')
- meta:set_string('bottom', '')
- meta:set_string('left', '')
- meta:set_string('right', '')
- end,
- on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
- local name = clicker:get_player_name()
- local meta = minetest.get_meta(pos)
- local owner = meta:get_string('owner')
- local title = meta:get_string('title')
- local bottom = meta:get_string('bottom')
- local left = meta:get_string('left')
- local right = meta:get_string('right')
- if owner == name then
- meta:set_string('formspec', hall.edit_sign(title, bottom, left, right))
- else
- meta:set_string('formspec', hall.view_sign(title, bottom, left, right))
- end
- end,
- on_receive_fields = function(pos, formname, fields, sender)
- local meta = minetest.get_meta(pos)
- if fields ['save'] then
- local player_name = sender:get_player_name()
- meta:set_string('infotext', fields.title)
- meta:set_string('title', fields.title)
- meta:set_string('bottom', fields.bottom)
- meta:set_string('left', fields.left)
- meta:set_string('right', fields.right)
- minetest.log("action", (player_name or "").." wrote \""..fields.title.."\" to stanchion at "..minetest.pos_to_string(pos))
- end
- end,
- })
|