From f46ad835261ed6b40456dcede84bb94570f704f6 Mon Sep 17 00:00:00 2001 From: TheOnlyJoeEnderman Date: Fri, 31 Mar 2023 01:39:48 +0000 Subject: [PATCH] 0.0.1 --- register.lua | 153 +++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 111 insertions(+), 42 deletions(-) diff --git a/register.lua b/register.lua index 8d8f07d..1f08f8b 100644 --- a/register.lua +++ b/register.lua @@ -3,138 +3,207 @@ paintings_name = {} paintings_texture = {} -- define the node registration function -function paintings_lib.register_painting1x1(name, texture) - local node_name = "paintings_lib:1x1_"..name +function paintings_lib.register_painting1x1(identifier, display_name, texture) + local node_name = "paintings_lib:1x1_"..display_name:gsub("%s+", "_") paintings_name["1x1"] = paintings_name["1x1"] or {} - paintings_name["1x1"][name] = node_name + paintings_name["1x1"][identifier] = node_name paintings_texture[node_name] = texture -- register the node minetest.register_node(node_name, { - description = name.." Painting", + description = display_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, + 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 +function paintings_lib.register_painting1x2(identifier, display_name, texture) + local node_name = "paintings_lib:1x2_"..display_name:gsub("%s+", "_") paintings_name["1x2"] = paintings_name["1x2"] or {} - paintings_name["1x2"][name] = node_name + paintings_name["1x2"][identifier] = node_name paintings_texture[node_name] = texture -- register the node minetest.register_node(node_name, { - description = name.." Painting", + description = display_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, + 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 +function paintings_lib.register_painting2x1(identifier, display_name, texture) + local node_name = "paintings_lib:2x1_"..display_name:gsub("%s+", "_") paintings_name["2x1"] = paintings_name["2x1"] or {} - paintings_name["2x1"][name] = node_name + paintings_name["2x1"][identifier] = node_name paintings_texture[node_name] = texture -- register the node minetest.register_node(node_name, { - description = name.." Painting", + description = display_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, + 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 +function paintings_lib.register_painting2x2(identifier, display_name, texture) + local node_name = "paintings_lib:2x2_"..display_name:gsub("%s+", "_") paintings_name["2x2"] = paintings_name["2x2"] or {} - paintings_name["2x2"][name] = node_name + paintings_name["2x2"][identifier] = node_name paintings_texture[node_name] = texture -- register the node minetest.register_node(node_name, { - description = name.." Painting", + description = display_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, + 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 +function paintings_lib.register_painting3x2(identifier, display_name, texture) + local node_name = "paintings_lib:3x2_"..display_name:gsub("%s+", "_") paintings_name["3x2"] = paintings_name["3x2"] or {} - paintings_name["3x2"][name] = node_name + paintings_name["3x2"][identifier] = node_name paintings_texture[node_name] = texture -- register the node minetest.register_node(node_name, { - description = name.." Painting", + description = display_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, + 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 +function paintings_lib.register_painting3x3(identifier, display_name, texture) + local node_name = "paintings_lib:3x3_"..display_name:gsub("%s+", "_") paintings_name["3x3"] = paintings_name["3x3"] or {} - paintings_name["3x3"][name] = node_name + paintings_name["3x3"][identifier] = node_name paintings_texture[node_name] = texture -- register the node minetest.register_node(node_name, { - description = name.." Painting", + description = display_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, + 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_painting4x2(identifier, display_name, texture) + local node_name = "paintings_lib:4x2_"..display_name:gsub("%s+", "_") + paintings_name["4x2"] = paintings_name["4x2"] or {} + paintings_name["4x2"][identifier] = node_name + 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}, + 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_painting4x3(identifier, display_name, texture) + local node_name = "paintings_lib:4x3_"..display_name:gsub("%s+", "_") + paintings_name["4x3"] = paintings_name["4x3"] or {} + paintings_name["4x3"][identifier] = node_name + 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}, + 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_painting4x4(identifier, display_name, texture) + local node_name = "paintings_lib:4x4_"..display_name:gsub("%s+", "_") + paintings_name["4x4"] = paintings_name["4x4"] or {} + paintings_name["4x4"][identifier] = node_name + 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}, + paramtype2 = "facedir", + walkable = false, + sunlight_propagates = true, groups = {choppy = 3, oddly_breakable_by_hand = 3}, sounds = default.node_sound_wood_defaults(), })