add blank canvas craft item and recipes for paintings

First, craft a blank canvas from four sticks
and some white wool:

- s -
s W s
- s -

Then, combine that canvas with some black and white dyes in the right
pattern to get the painting you want.

Paintings are numbred in-game, from 1 to 20.  Since there are so many
paintings, and so little crafting space, the only way I could think to
do it was to use binary for the recipe.  Convert the number of the
painting you want into binary, then use black dye for each 0 and white for
each 1, and lay them down into the crafting grid in this pattern:

bit2  bit1  bit0
  -   bit4  bit3
  -   Canv.   -

With the blank canvas in the bottom center slot.  For example, if you
want painting number 9, that would be 01001 in binary, so you'd arrange
the crafting grid like so:

Black Black White  --->  Painting #9
  -   Black White
  -   Canv.   -
This commit is contained in:
Vanessa Ezekowitz 2014-07-04 04:45:58 -04:00
parent a985c6f868
commit 67598d3280
3 changed files with 49 additions and 1 deletions

View File

@ -58,6 +58,11 @@ minetest.register_craftitem("homedecor:power_crystal", {
inventory_image = "homedecor_power_crystal.png", inventory_image = "homedecor_power_crystal.png",
}) })
minetest.register_craftitem("homedecor:blank_canvas", {
description = S("Blank Canvas"),
inventory_image = "homedecor_blank_canvas.png"
})
-- alternate craftitem for silicon if mesecons isn't installed. -- alternate craftitem for silicon if mesecons isn't installed.
if ( minetest.get_modpath("mesecons") ) == nil then if ( minetest.get_modpath("mesecons") ) == nil then
@ -1628,6 +1633,47 @@ minetest.register_craft( {
}, },
}) })
-- paintings
minetest.register_craft({
output = "homedecor:blank_canvas",
recipe = {
{ "", "default:stick", "" },
{ "default:stick", "wool:white", "default:stick" },
{ "", "default:stick", "" },
}
})
for b4 = 0,1 do
for b3 = 0,1 do
for b2 = 0,1 do
for b1 = 0,1 do
for b0 = 0,1 do
local i = b0 + b1*2 + b2*4 + b3*8 + b4*16
if i > 0 and i < 21 then
local dyebits = {
[0] = "dye:black",
[1] = "dye:white"
}
minetest.register_craft({
output = "homedecor:painting_"..i,
recipe = {
{ dyebits[b2], dyebits[b1], dyebits[b0] },
{ "", dyebits[b4], dyebits[b3] },
{"", "homedecor:blank_canvas", "" }
}
})
end
end
end
end
end
end
-- more misc stuff here -- more misc stuff here
minetest.register_craft({ minetest.register_craft({
@ -1682,3 +1728,5 @@ minetest.register_craft({
{ "homedecor:drawer_small", "", "default:wood" }, { "homedecor:drawer_small", "", "default:wood" },
}, },
}) })

View File

@ -2,7 +2,7 @@
for i = 1,20 do for i = 1,20 do
minetest.register_node("homedecor:painting_"..i, { minetest.register_node("homedecor:painting_"..i, {
description = "Decorative painting", description = "Decorative painting #"..i,
drawtype = "nodebox", drawtype = "nodebox",
tiles = { tiles = {
"homedecor_painting_edges.png", "homedecor_painting_edges.png",

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB