12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576 |
- minetest.register_node('furniture:lectern', {
- _doc_items_crafting = 'This is crafted in the Woodworking Station.',
- description = 'Lectern',
- drawtype = 'mesh',
- mesh = 'furniture_lectern.obj',
- tiles = {'furniture_lectern.png',},
- overlay_tiles = {{name='furniture_lectern_overlay.png', color='white'}},
- sounds = default.node_sound_wood_defaults(),
- paramtype2 = 'colorfacedir',
- palette = 'furniture_stain_palette.png',
- paramtype = 'light',
- selection_box = {
- type = 'fixed',
- fixed = {-.3, -.5, -.3, .3, .5, .3},
- },
- collision_box = {
- type = 'fixed',
- fixed = {-.3, -.5, -.3, .3, .5, .3},
- },
- groups = {oddly_breakable_by_hand = 2, choppy=3, stainable=1},
- after_place_node = function(pos, placer)
- local meta = minetest.get_meta(pos)
- meta:set_string('owner', placer:get_player_name())
- meta:set_string('infotext', '')
- meta:set_string('title', '')
- meta:set_string('content', '')
- 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 content = meta:get_string('content')
- if owner == name then
- meta:set_string('formspec', furniture.lectern_edit_sign(title, content))
- else
- meta:set_string('formspec', furniture.lectern_view_sign(title, content))
- 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('content', fields.content)
- minetest.log("action", (player_name or "").." wrote \""..fields.title.."\" to lectern at "..minetest.pos_to_string(pos))
- end
- end,
- })
- minetest.register_node('furniture:lectern_encyclopedia', {
- description = 'Lectern with Encyclopedia',
- drawtype = 'mesh',
- mesh = 'furniture_lectern.obj',
- tiles = {'furniture_lectern.png',},
- overlay_tiles = {{name='furniture_lectern_encylopedia_overlay.png', color='white'}},
- sounds = default.node_sound_wood_defaults(),
- paramtype2 = 'colorfacedir',
- palette = 'furniture_stain_palette.png',
- paramtype = 'light',
- selection_box = {
- type = 'fixed',
- fixed = {-.3, -.5, -.3, .3, .5, .3},
- },
- collision_box = {
- type = 'fixed',
- fixed = {-.3, -.5, -.3, .3, .5, .3},
- },
- groups = {oddly_breakable_by_hand = 2, choppy=3, stainable=1},
- on_rightclick = function(pos, node, clicker)
- doc.mark_all_entries_as_revealed(clicker:get_player_name())
- doc.show_doc(clicker:get_player_name())
- end,
- })
|