+
+local bookshelf_formspec =
+ "size[8,7;]" ..
+ default.gui_bg ..
+ default.gui_bg_img ..
+ default.gui_slots ..
+ "list[context;books;0,0.3;8,2;]" ..
+ "list[current_player;main;0,2.85;8,1;]" ..
+ "list[current_player;main;0,4.08;8,3;8]" ..
+ "listring[context;books]" ..
+ "listring[current_player;main]" ..
+ default.get_hotbar_bg(0,2.85)
+
+minetest.register_node("default:bookshelf", {
+ description = "Bookshelf",
+ tiles = {"default_wood.png", "default_wood.png", "default_bookshelf.png"},
+ is_ground_content = false,
+ groups = {choppy = 3, oddly_breakable_by_hand = 2, flammable = 3},
+ sounds = default.node_sound_wood_defaults(),
+
+ on_construct = function(pos)
+ local meta = minetest.get_meta(pos)
+ meta:set_string("formspec", bookshelf_formspec)
+ local inv = meta:get_inventory()
+ inv:set_size("books", 8 * 2)
+ end,
+ can_dig = function(pos,player)
+ local inv = minetest.get_meta(pos):get_inventory()
+ return inv:is_empty("books")
+ end,
+ allow_metadata_inventory_put = function(pos, listname, index, stack)
+ if minetest.get_item_group(stack:get_name(), "book") ~= 0 then
+ return stack:get_count()
+ end
+ return 0
+ end,
+ on_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player)
+ minetest.log("action", player:get_player_name() ..
+ " moves stuff in bookshelf at " .. minetest.pos_to_string(pos))
+ end,
+ on_metadata_inventory_put = function(pos, listname, index, stack, player)
+ minetest.log("action", player:get_player_name() ..
+ " moves stuff to bookshelf at " .. minetest.pos_to_string(pos))
+ end,
+ on_metadata_inventory_take = function(pos, listname, index, stack, player)
+ minetest.log("action", player:get_player_name() ..
+ " takes stuff from bookshelf at " .. minetest.pos_to_string(pos))
+ end,
+})
+
+local function register_sign(material, desc, def)
+ minetest.register_node("default:sign_wall_" .. material, {
+ description = desc .. " Sign",
+ drawtype = "nodebox",
+ tiles = {"default_sign_wall_" .. material .. ".png"},
+ inventory_image = "default_sign_" .. material .. ".png",
+ wield_image = "default_sign_" .. material .. ".png",
+ paramtype = "light",
+ paramtype2 = "wallmounted",
+ sunlight_propagates = true,
+ is_ground_content = false,
+ walkable = false,
+ node_box = {
+ type = "wallmounted",
+ wall_top = {-0.4375, 0.4375, -0.3125, 0.4375, 0.5, 0.3125},
+ wall_bottom = {-0.4375, -0.5, -0.3125, 0.4375, -0.4375, 0.3125},
+ wall_side = {-0.5, -0.3125, -0.4375, -0.4375, 0.3125, 0.4375},
+ },
+ groups = def.groups,
+ legacy_wallmounted = true,
+ sounds = def.sounds,
+
+ on_construct = function(pos)
+ --local n = minetest.get_node(pos)
+ local meta = minetest.get_meta(pos)
+ meta:set_string("formspec", "field[text;;${text}]")
+ meta:set_string("infotext", "\"\"")
+ end,
+ on_receive_fields = function(pos, formname, fields, sender)
+ --print("Sign at "..minetest.pos_to_string(pos).." got "..dump(fields))
+ local player_name = sender:get_player_name()
+ if minetest.is_protected(pos, player_name) then
+ minetest.record_protection_violation(pos, player_name)
+ return
+ end
+ local meta = minetest.get_meta(pos)
+ if not fields.text then return end
+ minetest.log("action", (player_name or "") .. " wrote \"" ..
+ fields.text .. "\" to sign at " .. minetest.pos_to_string(pos))
+ meta:set_string("text", fields.text)
+ meta:set_string("infotext", '"' .. fields.text .. '"')
+ end,
+ })
+end
+
+register_sign("wood", "Wooden", {
+ sounds = default.node_sound_wood_defaults(),
+ groups = {choppy = 2, attached_node = 1, flammable = 2, oddly_breakable_by_hand = 3}
+})
+
+register_sign("steel", "Steel", {
+ sounds = default.node_sound_defaults(),
+ groups = {cracky = 2, attached_node = 1}
+})
+
+minetest.register_node("default:ladder_wood", {
+ description = "Wooden Ladder",
+ drawtype = "signlike",
+ tiles = {"default_ladder_wood.png"},
+ inventory_image = "default_ladder_wood.png",
+ wield_image = "default_ladder_wood.png",
+ paramtype = "light",
+ paramtype2 = "wallmounted",
+ sunlight_propagates = true,
+ walkable = false,
+ climbable = true,
+ is_ground_content = false,
+ selection_box = {
+ type = "wallmounted",
+ --wall_top = = <default>
+ --wall_bottom = = <default>
+ --wall_side = = <default>
+ },
+ groups = {choppy = 2, oddly_breakable_by_hand = 3, flammable = 2},
+ legacy_wallmounted = true,
+ sounds = default.node_sound_wood_defaults(),
+})
+
+minetest.register_node("default:ladder_steel", {
+ description = "Steel Ladder",
+ drawtype = "signlike",
+ tiles = {"default_ladder_steel.png"},
+ inventory_image = "default_ladder_steel.png",
+ wield_image = "default_ladder_steel.png",
+ paramtype = "light",
+ paramtype2 = "wallmounted",
+ sunlight_propagates = true,
+ walkable = false,
+ climbable = true,
+ is_ground_content = false,
+ selection_box = {
+ type = "wallmounted",
+ --wall_top = = <default>
+ --wall_bottom = = <default>
+ --wall_side = = <default>
+ },
+ groups = {cracky = 2},
+ sounds = default.node_sound_stone_defaults(),
+})
+
+default.register_fence("default:fence_wood", {
+ description = "Wooden Fence",
+ texture = "default_fence_wood.png",
+ material = "default:wood",
+ groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 2},
+ sounds = default.node_sound_wood_defaults()
+})
+
+default.register_fence("default:fence_acacia_wood", {
+ description = "Acacia Fence",
+ texture = "default_fence_acacia_wood.png",
+ material = "default:acacia_wood",
+ groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 2},
+ sounds = default.node_sound_wood_defaults()
+})
+
+default.register_fence("default:fence_junglewood", {
+ description = "Junglewood Fence",
+ texture = "default_fence_junglewood.png",
+ material = "default:junglewood",
+ groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 2},
+ sounds = default.node_sound_wood_defaults()
+})
+
+default.register_fence("default:fence_pine_wood", {
+ description = "Pine Fence",
+ texture = "default_fence_pine_wood.png",
+ material = "default:pine_wood",
+ groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 2},
+ sounds = default.node_sound_wood_defaults()
+})
+
+default.register_fence("default:fence_aspen_wood", {
+ description = "Aspen Fence",
+ texture = "default_fence_aspen_wood.png",
+ material = "default:aspen_wood",
+ groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 2},
+ sounds = default.node_sound_wood_defaults()
+})
+
+minetest.register_node("default:glass", {
+ description = "Glass",
+ drawtype = "glasslike_framed_optional",
+ tiles = {"default_glass.png", "default_glass_detail.png"},
+ paramtype = "light",
+ sunlight_propagates = true,
+ is_ground_content = false,
+ groups = {cracky = 3, oddly_breakable_by_hand = 3},
+ sounds = default.node_sound_glass_defaults(),
+})
+
+minetest.register_node("default:obsidian_glass", {
+ description = "Obsidian Glass",
+ drawtype = "glasslike_framed_optional",
+ tiles = {"default_obsidian_glass.png", "default_obsidian_glass_detail.png"},
+ paramtype = "light",
+ is_ground_content = false,
+ sunlight_propagates = true,
+ sounds = default.node_sound_glass_defaults(),
+ groups = {cracky = 3},
+})
+
+
+minetest.register_node("default:rail", {
+ description = "Rail",
+ drawtype = "raillike",
+ tiles = {"default_rail.png", "default_rail_curved.png",
+ "default_rail_t_junction.png", "default_rail_crossing.png"},
+ inventory_image = "default_rail.png",
+ wield_image = "default_rail.png",
+ paramtype = "light",
+ sunlight_propagates = true,
+ walkable = false,
+ is_ground_content = false,
+ selection_box = {
+ type = "fixed",
+ -- but how to specify the dimensions for curved and sideways rails?
+ fixed = {-1/2, -1/2, -1/2, 1/2, -1/2+1/16, 1/2},
+ },
+ groups = {bendy = 2, dig_immediate = 2, attached_node = 1,
+ connect_to_raillike = minetest.raillike_group("rail")},
+})
+
+
+minetest.register_node("default:brick", {
+ description = "Brick Block",
+ tiles = {"default_brick.png"},
+ is_ground_content = false,
+ groups = {cracky = 3},
+ sounds = default.node_sound_stone_defaults(),
+})
+
+
+minetest.register_node("default:meselamp", {
+ description = "Mese Lamp",
+ drawtype = "glasslike",
+ tiles = {"default_meselamp.png"},
+ paramtype = "light",
+ sunlight_propagates = true,
+ is_ground_content = false,
+ groups = {cracky = 3, oddly_breakable_by_hand = 3},
+ sounds = default.node_sound_glass_defaults(),
+ light_source = default.LIGHT_MAX,
+})
+
+--
+-- Misc
+--
+
+minetest.register_node("default:cloud", {
+ description = "Cloud",
+ tiles = {"default_cloud.png"},
+ is_ground_content = false,
+ sounds = default.node_sound_defaults(),
+ groups = {not_in_creative_inventory = 1},
+})
+
+minetest.register_node("default:nyancat", {
+ description = "Nyan Cat",
+ tiles = {"default_nc_side.png", "default_nc_side.png", "default_nc_side.png",
+ "default_nc_side.png", "default_nc_back.png", "default_nc_front.png"},
+ paramtype2 = "facedir",
+ groups = {cracky = 2},
+ is_ground_content = false,
+ legacy_facedir_simple = true,
+ sounds = default.node_sound_defaults(),
+})
+
+minetest.register_node("default:nyancat_rainbow", {
+ description = "Nyan Cat Rainbow",
+ tiles = {
+ "default_nc_rb.png^[transformR90", "default_nc_rb.png^[transformR90",
+ "default_nc_rb.png", "default_nc_rb.png"
+ },
+ paramtype2 = "facedir",
+ groups = {cracky = 2},
+ is_ground_content = false,
+ sounds = default.node_sound_defaults(),