Compare commits

...

5 Commits

Author SHA1 Message Date
Ilya Zhuravlev 4bcdbf9340 Support default dyes 2012-09-11 22:02:49 +04:00
Ilya Zhuravlev 2ba54495d0 unicolor group sometimes doesn't work, replaced with dye name 2012-09-09 19:56:49 +04:00
Ilya Zhuravlev 8adff6ee99 Fixed painting placing 2012-09-09 00:54:58 +04:00
Ilya Zhuravlev 4684781a44 Removed obsolete palette; fixed some descriptions. 2012-09-09 00:18:07 +04:00
Ilya Zhuravlev b7f5921ea3 Added brushes textures & craft, fixed magenta, make brushes non-infinite. 2012-09-08 23:37:01 +04:00
23 changed files with 81 additions and 23 deletions

View File

@ -14,18 +14,37 @@ minetest.register_craft({
{ 'default:stick','', 'default:stick' },
}})
minetest.register_craft({
--[[minetest.register_craft({
output = 'painting:palette 1',
recipe = {
{ 'group:dye', 'group:dye', 'group:dye' },
{ 'group:dye', '', 'group:dye' },
{ 'group:dye', 'group:dye', 'group:dye' },
{ 'group:dye', 'group:dye', 'group:dye' },
}})]]
minetest.register_craft({
output = 'painting:canvas_16 1',
recipe = {
{ '', '', '' },
{ '', '', '' },
{ 'default:paper', '', '' },
}})
--[[
--other sizes work bad =(
minetest.register_craft({
output = 'painting:canvas_32 1',
recipe = {
{ '', '', '' },
{ 'default:paper', 'default:paper', '' },
{ 'default:paper', 'default:paper', '' },
}})
minetest.register_craft({
output = 'painting:canvas 1',
output = 'painting:canvas_64 1',
recipe = {
{ 'default:paper', 'default:paper', 'default:paper' },
{ 'default:paper', 'default:paper', 'default:paper' },
{ 'default:paper', 'default:paper', 'default:paper' },
}})
]]

View File

@ -17,9 +17,11 @@ textures = {
white = "white.png", yellow = "yellow.png",
orange = "orange.png", red = "red.png",
violet = "violet.png", blue = "blue.png",
green = "green.png", magenta = "pink.png",
cyan = "cyan.png", lightgrey = "lightgrey.png",
darkgrey = "darkgrey.png", black = "black.png"
green = "green.png", magenta = "magenta.png",
cyan = "cyan.png", grey = "grey.png",
darkgrey = "darkgrey.png", black = "black.png",
darkgreen = "darkgreen.png", brown="brown.png",
pink = "pink.png"
}
thickness = 0.1
@ -31,7 +33,7 @@ picbox = {
}
picnode = {
description = "pic",
description = "Picture",
tiles = { "white.png" },
inventory_image = "painted.png",
drawtype = "nodebox",
@ -72,7 +74,6 @@ picent = {
local meta = minetest.env:get_meta(pos)
local data = meta:get_string("painting:picturedata")
data = minetest.deserialize(data)
if not data.grid then return end
self.object:set_properties({textures = { to_imagestring(data.grid, data.res) }})
end
@ -92,7 +93,7 @@ paintent = {
local name = puncher:get_wielded_item():get_name()
name = string.split(name, "_")[2]
if not textures[name] then return end
--get player eye level
local ppos = puncher:getpos()
ppos = { x = ppos.x, y = ppos.y+(1.5 + 1/16), z = ppos.z }
@ -119,6 +120,10 @@ paintent = {
self.grid[x][y]=colors[name]
self.object:set_properties({textures = { to_imagestring(self.grid, self.res) }})
local wielded = puncher:get_wielded_item()
wielded:add_wear(65535/256)
puncher:set_wielded_item(wielded)
end,
on_activate = function(self, staticdata)
@ -137,22 +142,37 @@ paintent = {
end
}
-- just pure magic
local walltoface = {-1, -1, 1, 3, 0, 2}
--paintedcanvas picture inventory item
paintedcanvas = {
description = "Painted Canvas",
inventory_image = "painted.png",
stack_max = 1,
on_place = function(itemstack, placer, pointed_thing)
--place node
local placerpos = placer:getpos()
local pos = pointed_thing.above
local dir = sub(pos, placerpos)
local fd = minetest.dir_to_facedir(dir)
local under = pointed_thing.under
local above = pointed_thing.above
local dir = {
x = under.x - above.x,
y = under.y - above.y,
z = under.z - above.z
}
local wm = minetest.dir_to_wallmounted(dir)
local fd = walltoface[wm + 1]
if fd == -1 then
return itemstack
end
minetest.env:add_node(pos, { name = "painting:pic",
param2 = fd,
paramtype2 = "none" })
--save metadata
local data = itemstack:get_metadata()
local meta = minetest.env:get_meta(pos)
@ -178,6 +198,7 @@ paintedcanvas = {
--canvas inventory item
canvas = {
description = "Canvas",
inventory_image = "default_paper.png",
stack_max = 99,
}
@ -189,7 +210,7 @@ canvasbox = {
}
canvasnode = {
description = "canvas",
description = "Canvas",
tiles = { "white.png" },
inventory_image = "painted.png",
drawtype = "nodebox",
@ -238,7 +259,7 @@ easelbox = {
}
easel = {
description = "easel",
description = "Easel",
tiles = { "default_wood.png" },
drawtype = "nodebox",
sunlight_propagates = true,
@ -250,8 +271,8 @@ easel = {
groups = { snappy = 2, choppy = 2, oddly_breakable_by_hand = 2 },
on_punch = function(pos, node, player)
local wielded = player:get_wielded_item():get_name()
wielded = string.split(wielded, "_")
local wielded_raw = player:get_wielded_item():get_name()
wielded = string.split(wielded_raw, "_")
local name = wielded[1]
local res = tonumber(wielded[2])
@ -267,7 +288,7 @@ easel = {
minetest.env:add_node(pos, { name = "painting:canvasnode",
param2 = fd,
paramtype2 = "none" })
local dir = dirs[fd]
pos = { x = pos.x - 0.01 * dir.x, y = pos.y, z = pos.z - 0.01 * dir.z }
@ -279,7 +300,7 @@ easel = {
p.fd = fd
meta:set_int("has_canvas", 1)
local itemstack = ItemStack("painting:canvas")
local itemstack = ItemStack(wielded_raw)
player:get_inventory():remove_item("main", itemstack)
end,
@ -296,6 +317,14 @@ easel = {
--brushes
local function table_copy(t)
local t2 = {}
for k,v in pairs(t) do
t2[k] = v
end
return t2
end
brush = {
description = "brush",
inventory_image = "default_tool_steelaxe.png",
@ -314,8 +343,8 @@ minetest.register_entity("painting:picent", picent)
minetest.register_node("painting:pic", picnode)
minetest.register_craftitem("painting:canvas_16", canvas)
minetest.register_craftitem("painting:canvas_32", canvas)
minetest.register_craftitem("painting:canvas_64", canvas)
--minetest.register_craftitem("painting:canvas_32", canvas)
--minetest.register_craftitem("painting:canvas_64", canvas)
minetest.register_craftitem("painting:paintedcanvas", paintedcanvas)
minetest.register_entity("painting:paintent", paintent)
@ -328,8 +357,18 @@ revcolors = {}
for color, _ in pairs(textures) do
table.insert(revcolors, color)
minetest.register_tool("painting:brush_"..color, brush)
local brush_new = table_copy(brush)
brush_new.description = color:gsub("^%l", string.upper).." brush"
brush_new.inventory_image = "painting_brush_"..color..".png"
minetest.register_tool("painting:brush_"..color, brush_new)
minetest.register_craft({
output = "painting:brush_"..color,
recipe = {
{"dye:"..color},
{"default:stick"},
{"default:stick"}
}
})
end
for i, color in ipairs(revcolors) do

BIN
textures/brown.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 128 B

BIN
textures/darkgreen.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 128 B

View File

Before

Width:  |  Height:  |  Size: 295 B

After

Width:  |  Height:  |  Size: 295 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 301 B

BIN
textures/magenta.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 128 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 571 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 571 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 570 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 568 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 563 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 567 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 572 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 569 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 569 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 572 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 574 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 569 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 575 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 573 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 571 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 301 B

After

Width:  |  Height:  |  Size: 128 B