Paintings_Lib/register.lua

220 lines
8.2 KiB
Lua
Raw Permalink Normal View History

2023-03-30 06:16:50 +02:00
-- define global variables for the node names and textures
paintings_name = {}
paintings_texture = {}
-- define the node registration function
2023-04-03 02:48:29 +02:00
function paintings_lib.register1x1(identifier, display_name, texture)
2023-06-03 01:40:11 +02:00
local node_name = ":paintings_lib:1x1_"..identifier:gsub("%s+", "_")
2023-04-03 02:48:29 +02:00
paintings_name[identifier] = paintings_name[identifier] or {}
paintings_name[identifier]["1x1"] = node_name
2023-03-30 06:16:50 +02:00
paintings_texture[node_name] = texture
-- register the node
minetest.register_node(node_name, {
2023-03-31 03:39:48 +02:00
description = display_name.." Painting",
2023-03-30 06:16:50 +02:00
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},
2023-04-03 04:12:03 +02:00
paramtype = "light",
2023-03-31 03:39:48 +02:00
paramtype2 = "facedir",
walkable = false,
sunlight_propagates = true,
2024-01-05 18:45:19 +01:00
groups = {painting = 1, choppy = 3, oddly_breakable_by_hand = 3},
2023-03-30 06:16:50 +02:00
sounds = default.node_sound_wood_defaults(),
})
end
-- define the node registration function
2023-04-03 02:48:29 +02:00
function paintings_lib.register1x2(identifier, display_name, texture)
2023-06-03 01:40:11 +02:00
local node_name = ":paintings_lib:1x2_"..identifier:gsub("%s+", "_")
2023-04-03 02:48:29 +02:00
paintings_name[identifier] = paintings_name[identifier] or {}
paintings_name[identifier]["1x2"] = node_name
2023-03-30 06:16:50 +02:00
paintings_texture[node_name] = texture
-- register the node
minetest.register_node(node_name, {
2023-03-31 03:39:48 +02:00
description = display_name.." Painting",
2023-03-30 06:16:50 +02:00
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},
2023-04-03 04:12:03 +02:00
paramtype = "light",
2023-03-31 03:39:48 +02:00
paramtype2 = "facedir",
walkable = false,
sunlight_propagates = true,
2024-01-05 18:45:19 +01:00
groups = {painting = 1, choppy = 3, oddly_breakable_by_hand = 3},
2023-03-30 06:16:50 +02:00
sounds = default.node_sound_wood_defaults(),
})
end
-- define the node registration function
2023-04-03 02:48:29 +02:00
function paintings_lib.register2x1(identifier, display_name, texture)
2023-06-03 01:40:11 +02:00
local node_name = ":paintings_lib:2x1_"..identifier:gsub("%s+", "_")
2023-04-03 02:48:29 +02:00
paintings_name[identifier] = paintings_name[identifier] or {}
paintings_name[identifier]["2x1"] = node_name
2023-03-30 06:16:50 +02:00
paintings_texture[node_name] = texture
-- register the node
minetest.register_node(node_name, {
2023-03-31 03:39:48 +02:00
description = display_name.." Painting",
2023-03-30 06:16:50 +02:00
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},
2023-04-03 04:12:03 +02:00
paramtype = "light",
2023-03-31 03:39:48 +02:00
paramtype2 = "facedir",
walkable = false,
sunlight_propagates = true,
2024-01-05 18:45:19 +01:00
groups = {painting = 1, choppy = 3, oddly_breakable_by_hand = 3},
2023-03-30 06:16:50 +02:00
sounds = default.node_sound_wood_defaults(),
})
end
-- define the node registration function
2023-04-03 02:48:29 +02:00
function paintings_lib.register2x2(identifier, display_name, texture)
2023-06-03 01:40:11 +02:00
local node_name = ":paintings_lib:2x2_"..identifier:gsub("%s+", "_")
2023-04-03 02:48:29 +02:00
paintings_name[identifier] = paintings_name[identifier] or {}
paintings_name[identifier]["2x2"] = node_name
2023-03-30 06:16:50 +02:00
paintings_texture[node_name] = texture
-- register the node
minetest.register_node(node_name, {
2023-03-31 03:39:48 +02:00
description = display_name.." Painting",
2023-03-30 06:16:50 +02:00
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},
2023-04-03 04:12:03 +02:00
paramtype = "light",
2023-03-31 03:39:48 +02:00
paramtype2 = "facedir",
walkable = false,
sunlight_propagates = true,
2024-01-05 18:45:19 +01:00
groups = {painting = 1, choppy = 3, oddly_breakable_by_hand = 3},
2023-03-30 06:16:50 +02:00
sounds = default.node_sound_wood_defaults(),
})
end
-- define the node registration function
2023-04-03 02:48:29 +02:00
function paintings_lib.register3x2(identifier, display_name, texture)
2023-06-03 01:40:11 +02:00
local node_name = ":paintings_lib:3x2_"..identifier:gsub("%s+", "_")
2023-04-03 02:48:29 +02:00
paintings_name[identifier] = paintings_name[identifier] or {}
paintings_name[identifier]["3x2"] = node_name
2023-03-30 06:16:50 +02:00
paintings_texture[node_name] = texture
-- register the node
minetest.register_node(node_name, {
2023-03-31 03:39:48 +02:00
description = display_name.." Painting",
2023-03-30 06:16:50 +02:00
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},
2023-04-03 04:12:03 +02:00
paramtype = "light",
2023-03-31 03:39:48 +02:00
paramtype2 = "facedir",
walkable = false,
sunlight_propagates = true,
2024-01-05 18:45:19 +01:00
groups = {painting = 1, choppy = 3, oddly_breakable_by_hand = 3},
2023-03-30 06:16:50 +02:00
sounds = default.node_sound_wood_defaults(),
})
end
-- define the node registration function
2023-04-03 02:48:29 +02:00
function paintings_lib.register3x3(identifier, display_name, texture)
2023-06-03 01:40:11 +02:00
local node_name = ":paintings_lib:3x3_"..identifier:gsub("%s+", "_")
2023-04-03 02:48:29 +02:00
paintings_name[identifier] = paintings_name[identifier] or {}
paintings_name[identifier]["3x3"] = node_name
2023-03-30 06:16:50 +02:00
paintings_texture[node_name] = texture
-- register the node
minetest.register_node(node_name, {
2023-03-31 03:39:48 +02:00
description = display_name.." Painting",
2023-03-30 06:16:50 +02:00
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},
2023-04-03 04:12:03 +02:00
paramtype = "light",
2023-03-31 03:39:48 +02:00
paramtype2 = "facedir",
walkable = false,
sunlight_propagates = true,
2024-01-05 18:45:19 +01:00
groups = {painting = 1, choppy = 3, oddly_breakable_by_hand = 3},
2023-03-31 03:39:48 +02:00
sounds = default.node_sound_wood_defaults(),
})
end
-- define the node registration function
2023-04-03 02:48:29 +02:00
function paintings_lib.register4x2(identifier, display_name, texture)
2023-06-03 01:40:11 +02:00
local node_name = ":paintings_lib:4x2_"..identifier:gsub("%s+", "_")
2023-04-03 02:48:29 +02:00
paintings_name[identifier] = paintings_name[identifier] or {}
paintings_name[identifier]["4x2"] = node_name
2023-03-31 03:39:48 +02:00
paintings_texture[node_name] = texture
-- register the node
minetest.register_node(node_name, {
description = display_name.." Painting",
drawtype = "mesh",
mesh = "paintings_lib_4x2"..".obj",
selection_box = {type = "fixed", fixed = {-1.5, -1.5, 0.4375, 2.5, 0.5, 0.5}},
collision_box = {type = "fixed", fixed = {-1.5, -1.5, 0.4375, 2.5, 0.5, 0.5}},
tiles = {texture},
2023-04-03 04:12:03 +02:00
paramtype = "light",
2023-03-31 03:39:48 +02:00
paramtype2 = "facedir",
walkable = false,
sunlight_propagates = true,
2024-01-05 18:45:19 +01:00
groups = {painting = 1, choppy = 3, oddly_breakable_by_hand = 3},
2023-03-31 03:39:48 +02:00
sounds = default.node_sound_wood_defaults(),
})
end
-- define the node registration function
2023-04-03 02:48:29 +02:00
function paintings_lib.register4x3(identifier, display_name, texture)
2023-06-03 01:40:11 +02:00
local node_name = ":paintings_lib:4x3_"..identifier:gsub("%s+", "_")
2023-04-03 02:48:29 +02:00
paintings_name[identifier] = paintings_name[identifier] or {}
paintings_name[identifier]["4x3"] = node_name
2023-03-31 03:39:48 +02:00
paintings_texture[node_name] = texture
-- register the node
minetest.register_node(node_name, {
description = display_name.." Painting",
drawtype = "mesh",
mesh = "paintings_lib_4x3"..".obj",
selection_box = {type = "fixed", fixed = {-1.5, -1.5, 0.4375, 2.5, 1.5, 0.5}},
collision_box = {type = "fixed", fixed = {-1.5, -1.5, 0.4375, 2.5, 1.5, 0.5}},
tiles = {texture},
2023-04-03 04:12:03 +02:00
paramtype = "light",
2023-03-31 03:39:48 +02:00
paramtype2 = "facedir",
walkable = false,
sunlight_propagates = true,
2024-01-05 18:45:19 +01:00
groups = {painting = 1, choppy = 3, oddly_breakable_by_hand = 3},
2023-03-31 03:39:48 +02:00
sounds = default.node_sound_wood_defaults(),
})
end
-- define the node registration function
2023-04-03 02:48:29 +02:00
function paintings_lib.register4x4(identifier, display_name, texture)
2023-06-03 01:40:11 +02:00
local node_name = ":paintings_lib:4x4_"..identifier:gsub("%s+", "_")
2023-04-03 02:48:29 +02:00
paintings_name[identifier] = paintings_name[identifier] or {}
paintings_name[identifier]["4x4"] = node_name
2023-03-31 03:39:48 +02:00
paintings_texture[node_name] = texture
-- register the node
minetest.register_node(node_name, {
description = display_name.." Painting",
drawtype = "mesh",
mesh = "paintings_lib_4x4"..".obj",
selection_box = {type = "fixed", fixed = {-1.5, -2.5, 0.4375, 2.5, 1.5, 0.5}},
collision_box = {type = "fixed", fixed = {-1.5, -2.5, 0.4375, 2.5, 1.5, 0.5}},
tiles = {texture},
2023-04-03 04:12:03 +02:00
paramtype = "light",
2023-03-31 03:39:48 +02:00
paramtype2 = "facedir",
walkable = false,
sunlight_propagates = true,
2024-01-05 18:45:19 +01:00
groups = {painting = 1, choppy = 3, oddly_breakable_by_hand = 3},
2023-03-30 06:16:50 +02:00
sounds = default.node_sound_wood_defaults(),
})
end