default:bookshelf
-default:sign_wall
+default:sign_wall_wood
+default:sign_wall_steel
default:ladder_wood
default:ladder_steel
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
-minetest.register_node("default:sign_wall", {
- description = "Sign",
- drawtype = "nodebox",
- tiles = {"default_sign.png"},
- inventory_image = "default_sign_wall.png",
- wield_image = "default_sign_wall.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 = {choppy = 2, dig_immediate = 2, attached_node = 1},
- legacy_wallmounted = true,
- sounds = default.node_sound_defaults(),
-
- 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))
- if minetest.is_protected(pos, sender:get_player_name()) then
- minetest.record_protection_violation(pos, sender:get_player_name())
- return
- end
- local meta = minetest.get_meta(pos)
- if not fields.text then return end
- minetest.log("action", (sender:get_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,
+register_sign("wood", "Wooden", {
+ sounds = default.node_sound_wood_defaults(),
+ groups = {choppy = 2, attached_node = 1, flammable = 2}
})
+register_sign("steel", "Steel", {
+ sounds = default.node_sound_defaults(),
+ groups = {cracky = 2, attached_node = 1}
+})
minetest.register_node("default:ladder_wood", {
description = "Wooden Ladder",