diff --git a/crafts.lua b/crafts.lua index a540a30..a5e0e9f 100644 --- a/crafts.lua +++ b/crafts.lua @@ -251,7 +251,7 @@ minetest.register_craft({ }) minetest.register_craft({ - output = "xdecor:painting", + output = "xdecor:painting_1", recipe = { {"default:sign_wall", "dye:blue"} } diff --git a/nodes.lua b/nodes.lua index 8cda504..1637e9e 100644 --- a/nodes.lua +++ b/nodes.lua @@ -483,20 +483,40 @@ for _, f in pairs(flowers) do }) end -xdecor.register("painting", { +xdecor.register("painting_1", { description = "Painting", drawtype = "signlike", - tiles = {"xdecor_painting.png"}, - inventory_image = "xdecor_painting.png", + tiles = {"xdecor_painting_1.png"}, + inventory_image = "xdecor_painting_1.png", paramtype2 = "wallmounted", legacy_wallmounted = true, walkable = false, on_rotate = screwdriver.rotate_simple, - wield_image = "xdecor_painting.png", + wield_image = "xdecor_painting_1.png", selection_box = {type="wallmounted"}, - groups = {dig_immediate=3, flammable=3, attached_node=1} + groups = {dig_immediate=3, flammable=3, attached_node=1}, + after_place_node = function(pos, _, _, _) + local node = minetest.get_node(pos) + minetest.set_node(pos, {name = "xdecor:painting_"..math.random(1,4), param2 = node.param2}) + end }) +minetest.register_alias("xdecor:painting", "xdecor:painting_1") + +for i = 2, 4 do + xdecor.register("painting_"..i, { + drawtype = "signlike", + tiles = {"xdecor_painting_"..i..".png"}, + paramtype2 = "wallmounted", + legacy_wallmounted = true, + walkable = false, + on_rotate = screwdriver.rotate_simple, + drop = "xdecor:painting_1", + selection_box = {type="wallmounted"}, + groups = {dig_immediate=3, flammable=3, attached_node=1, not_in_creative_inventory=1} + }) +end + for _, b in pairs({{"cactus", "cactus"}, {"moon", "stone"}}) do xdecor.register(b[1].."brick", { drawtype = "normal", diff --git a/textures/xdecor_painting.png b/textures/xdecor_painting.png deleted file mode 100644 index ebbdc9b..0000000 Binary files a/textures/xdecor_painting.png and /dev/null differ diff --git a/textures/xdecor_painting_1.png b/textures/xdecor_painting_1.png new file mode 100644 index 0000000..424fbd9 Binary files /dev/null and b/textures/xdecor_painting_1.png differ diff --git a/textures/xdecor_painting_2.png b/textures/xdecor_painting_2.png new file mode 100644 index 0000000..0351f52 Binary files /dev/null and b/textures/xdecor_painting_2.png differ diff --git a/textures/xdecor_painting_3.png b/textures/xdecor_painting_3.png new file mode 100644 index 0000000..a21e9a5 Binary files /dev/null and b/textures/xdecor_painting_3.png differ diff --git a/textures/xdecor_painting_4.png b/textures/xdecor_painting_4.png new file mode 100644 index 0000000..855b950 Binary files /dev/null and b/textures/xdecor_painting_4.png differ