Paintings_Lib/register.lua

142 lines
4.9 KiB
Lua

-- define global variables for the node names and textures
paintings_name = {}
paintings_texture = {}
-- define the node registration function
function paintings_lib.register_painting1x1(name, texture)
local node_name = "paintings_lib:1x1_"..name
paintings_name["1x1"] = paintings_name["1x1"] or {}
paintings_name["1x1"][name] = node_name
paintings_texture[node_name] = texture
-- register the node
minetest.register_node(node_name, {
description = name.." Painting",
drawtype = "mesh",
mesh = "paintings_lib_1x1"..".obj",
selection_box = {type = "fixed", fixed = {-0.5, -0.5, 0.4375, 0.5, 0.5, 0.5}},
collision_box = {type = "fixed", fixed = {-0.5, -0.5, 0.4375, 0.5, 0.5, 0.5}},
tiles = {texture},
paramtype2 = "facedir",
walkable = false,
sunlight_propagates = true,
groups = {choppy = 3, oddly_breakable_by_hand = 3},
sounds = default.node_sound_wood_defaults(),
})
end
-- define the node registration function
function paintings_lib.register_painting1x2(name, texture)
local node_name = "paintings_lib:1x2_"..name
paintings_name["1x2"] = paintings_name["1x2"] or {}
paintings_name["1x2"][name] = node_name
paintings_texture[node_name] = texture
-- register the node
minetest.register_node(node_name, {
description = name.." Painting",
drawtype = "mesh",
mesh = "paintings_lib_1x2"..".obj",
selection_box = {type = "fixed", fixed = {-0.5, -1.5, 0.4375, 0.5, 0.5, 0.5}},
collision_box = {type = "fixed", fixed = {-0.5, -1.5, 0.4375, 0.5, 0.5, 0.5}},
tiles = {texture},
paramtype2 = "facedir",
walkable = false,
sunlight_propagates = true,
groups = {choppy = 3, oddly_breakable_by_hand = 3},
sounds = default.node_sound_wood_defaults(),
})
end
-- define the node registration function
function paintings_lib.register_painting2x1(name, texture)
local node_name = "paintings_lib:2x1_"..name
paintings_name["2x1"] = paintings_name["2x1"] or {}
paintings_name["2x1"][name] = node_name
paintings_texture[node_name] = texture
-- register the node
minetest.register_node(node_name, {
description = name.." Painting",
drawtype = "mesh",
mesh = "paintings_lib_2x1"..".obj",
selection_box = {type = "fixed", fixed = {-0.5, -0.5, 0.4375, 1.5, 0.5, 0.5}},
collision_box = {type = "fixed", fixed = {-0.5, -0.5, 0.4375, 1.5, 0.5, 0.5}},
tiles = {texture},
paramtype2 = "facedir",
walkable = false,
sunlight_propagates = true,
groups = {choppy = 3, oddly_breakable_by_hand = 3},
sounds = default.node_sound_wood_defaults(),
})
end
-- define the node registration function
function paintings_lib.register_painting2x2(name, texture)
local node_name = "paintings_lib:2x2_"..name
paintings_name["2x2"] = paintings_name["2x2"] or {}
paintings_name["2x2"][name] = node_name
paintings_texture[node_name] = texture
-- register the node
minetest.register_node(node_name, {
description = name.." Painting",
drawtype = "mesh",
mesh = "paintings_lib_2x2"..".obj",
selection_box = {type = "fixed", fixed = {-0.5, -1.5, 0.4375, 1.5, 0.5, 0.5}},
collision_box = {type = "fixed", fixed = {-0.5, -1.5, 0.4375, 1.5, 0.5, 0.5}},
tiles = {texture},
paramtype2 = "facedir",
walkable = false,
sunlight_propagates = true,
groups = {choppy = 3, oddly_breakable_by_hand = 3},
sounds = default.node_sound_wood_defaults(),
})
end
-- define the node registration function
function paintings_lib.register_painting3x2(name, texture)
local node_name = "paintings_lib:3x2_"..name
paintings_name["3x2"] = paintings_name["3x2"] or {}
paintings_name["3x2"][name] = node_name
paintings_texture[node_name] = texture
-- register the node
minetest.register_node(node_name, {
description = name.." Painting",
drawtype = "mesh",
mesh = "paintings_lib_3x2"..".obj",
selection_box = {type = "fixed", fixed = {-1.5, -1.5, 0.4375, 1.5, 0.5, 0.5}},
collision_box = {type = "fixed", fixed = {-1.5, -1.5, 0.4375, 1.5, 0.5, 0.5}},
tiles = {texture},
paramtype2 = "facedir",
walkable = false,
sunlight_propagates = true,
groups = {choppy = 3, oddly_breakable_by_hand = 3},
sounds = default.node_sound_wood_defaults(),
})
end
-- define the node registration function
function paintings_lib.register_painting3x3(name, texture)
local node_name = "paintings_lib:3x3_"..name
paintings_name["3x3"] = paintings_name["3x3"] or {}
paintings_name["3x3"][name] = node_name
paintings_texture[node_name] = texture
-- register the node
minetest.register_node(node_name, {
description = name.." Painting",
drawtype = "mesh",
mesh = "paintings_lib_3x3"..".obj",
selection_box = {type = "fixed", fixed = {-1.5, -1.5, 0.4375, 1.5, 1.5, 0.5}},
collision_box = {type = "fixed", fixed = {-1.5, -1.5, 0.4375, 1.5, 1.5, 0.5}},
tiles = {texture},
paramtype2 = "facedir",
walkable = false,
sunlight_propagates = true,
groups = {choppy = 3, oddly_breakable_by_hand = 3},
sounds = default.node_sound_wood_defaults(),
})
end