Random painting on placing

This commit is contained in:
jp 2015-12-03 12:45:35 +01:00
parent 3c83904eb0
commit 6062c3f5e0
7 changed files with 26 additions and 6 deletions

View File

@ -251,7 +251,7 @@ minetest.register_craft({
}) })
minetest.register_craft({ minetest.register_craft({
output = "xdecor:painting", output = "xdecor:painting_1",
recipe = { recipe = {
{"default:sign_wall", "dye:blue"} {"default:sign_wall", "dye:blue"}
} }

View File

@ -483,20 +483,40 @@ for _, f in pairs(flowers) do
}) })
end end
xdecor.register("painting", { xdecor.register("painting_1", {
description = "Painting", description = "Painting",
drawtype = "signlike", drawtype = "signlike",
tiles = {"xdecor_painting.png"}, tiles = {"xdecor_painting_1.png"},
inventory_image = "xdecor_painting.png", inventory_image = "xdecor_painting_1.png",
paramtype2 = "wallmounted", paramtype2 = "wallmounted",
legacy_wallmounted = true, legacy_wallmounted = true,
walkable = false, walkable = false,
on_rotate = screwdriver.rotate_simple, on_rotate = screwdriver.rotate_simple,
wield_image = "xdecor_painting.png", wield_image = "xdecor_painting_1.png",
selection_box = {type="wallmounted"}, 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 for _, b in pairs({{"cactus", "cactus"}, {"moon", "stone"}}) do
xdecor.register(b[1].."brick", { xdecor.register(b[1].."brick", {
drawtype = "normal", drawtype = "normal",

Binary file not shown.

Before

Width:  |  Height:  |  Size: 252 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 246 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 409 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 437 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 409 B