Compare commits
5 Commits
81570147ec
...
9288e8d3be
Author | SHA1 | Date |
---|---|---|
Don | 9288e8d3be | |
Jordan Irwin | 10a5359d02 | |
Samuel Sieb | c1d4dd5f5c | |
DonBatman | 926bd4cec2 | |
DonBatman | cdb022072b |
4
init.lua
4
init.lua
|
@ -7,8 +7,8 @@ mypaint.colors = {
|
||||||
blue = {"Blue", "0000ff"},
|
blue = {"Blue", "0000ff"},
|
||||||
brown = {"Brown", "190B07"},
|
brown = {"Brown", "190B07"},
|
||||||
cyan = {"Cyan", "00ffff"},
|
cyan = {"Cyan", "00ffff"},
|
||||||
darkgreen = {"Dark Green", "005000"},
|
darkgreen = {"Dark Green", "005000"},
|
||||||
darkgrey = {"Dark Grey", "1C1C1C"},
|
darkgrey = {"Dark Grey", "1C1C1C"},
|
||||||
grey = {"Grey", "848484"},
|
grey = {"Grey", "848484"},
|
||||||
magenta = {"Magenta", "ff00ff"},
|
magenta = {"Magenta", "ff00ff"},
|
||||||
orange = {"Orange", "ff7700"},
|
orange = {"Orange", "ff7700"},
|
||||||
|
|
55
paint.lua
55
paint.lua
|
@ -9,7 +9,7 @@ function check_paintcan(pos, node)
|
||||||
local color = string.sub(name, 15)
|
local color = string.sub(name, 15)
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
stack = ItemStack("mypaint:brush_"..color)
|
stack = ItemStack("mypaint:brush_"..color)
|
||||||
if minetest.setting_getbool("creative_mode") then
|
if minetest.settings:get_bool("creative_mode") then
|
||||||
return stack
|
return stack
|
||||||
end
|
end
|
||||||
local uses = meta:get_int("mypaint:uses") - 1
|
local uses = meta:get_int("mypaint:uses") - 1
|
||||||
|
@ -28,8 +28,9 @@ function paint_node(pos, node, col, itemstack)
|
||||||
local s, e
|
local s, e
|
||||||
local nname = node.name
|
local nname = node.name
|
||||||
s, e = string.find(nname, "_[^_]+$")
|
s, e = string.find(nname, "_[^_]+$")
|
||||||
|
local color
|
||||||
if s and e then
|
if s and e then
|
||||||
local color = string.sub(nname, s + 1, e)
|
color = string.sub(nname, s + 1, e)
|
||||||
if mypaint.colors[color] then
|
if mypaint.colors[color] then
|
||||||
nname = string.sub(nname, 1, s - 1)
|
nname = string.sub(nname, 1, s - 1)
|
||||||
if color == col then
|
if color == col then
|
||||||
|
@ -40,18 +41,25 @@ function paint_node(pos, node, col, itemstack)
|
||||||
|
|
||||||
for name, colors in pairs(mypaint.paintables) do
|
for name, colors in pairs(mypaint.paintables) do
|
||||||
if (nname == name) then
|
if (nname == name) then
|
||||||
if colors[col] then
|
if not col then
|
||||||
minetest.set_node(pos,{name = name.."_"..col, param2 = node.param2})
|
if color then
|
||||||
if not minetest.setting_getbool("creative_mode") then
|
minetest.set_node(pos, {name = name, param2 = node.param2})
|
||||||
local wear = itemstack:get_wear() + 65535 / BRUSH_USES
|
|
||||||
if wear < 65535 then
|
|
||||||
itemstack:set_wear(wear)
|
|
||||||
else
|
|
||||||
itemstack = ItemStack("mypaint:brush")
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
return
|
||||||
|
end
|
||||||
|
if not colors[col] then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
minetest.set_node(pos, {name = name.."_"..col, param2 = node.param2})
|
||||||
|
if not minetest.settings:get_bool("creative_mode") then
|
||||||
|
local wear = itemstack:get_wear() + 65535 / BRUSH_USES
|
||||||
|
if wear < 65535 then
|
||||||
|
itemstack:set_wear(wear)
|
||||||
|
else
|
||||||
|
itemstack = ItemStack("mypaint:brush")
|
||||||
|
end
|
||||||
|
return itemstack
|
||||||
end
|
end
|
||||||
return itemstack
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -72,6 +80,19 @@ minetest.register_tool("mypaint:brush", {
|
||||||
end
|
end
|
||||||
})
|
})
|
||||||
|
|
||||||
|
minetest.register_tool("mypaint:scraper", {
|
||||||
|
description = "Paint Scraper",
|
||||||
|
inventory_image = "mypaint_scraper.png",
|
||||||
|
on_use = function(itemstack, user, pointed_thing)
|
||||||
|
if pointed_thing.type ~= "node" then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
local pos = pointed_thing.under
|
||||||
|
local node = minetest.get_node(pos)
|
||||||
|
return paint_node(pos, node, nil, itemstack)
|
||||||
|
end
|
||||||
|
})
|
||||||
|
|
||||||
for color, entry in pairs(mypaint.colors) do
|
for color, entry in pairs(mypaint.colors) do
|
||||||
local desc = entry[1]
|
local desc = entry[1]
|
||||||
local cstring = entry[2]
|
local cstring = entry[2]
|
||||||
|
@ -141,7 +162,7 @@ for color, entry in pairs(mypaint.colors) do
|
||||||
local pname = "mypaint:paint_"..color
|
local pname = "mypaint:paint_"..color
|
||||||
local paint = ItemStack(pname)
|
local paint = ItemStack(pname)
|
||||||
paint = minetest.item_place_node(paint, user, pointed_thing)
|
paint = minetest.item_place_node(paint, user, pointed_thing)
|
||||||
if not minetest.setting_getbool("creative_mode") then
|
if not minetest.settings:get_bool("creative_mode") then
|
||||||
if not paint or (paint:get_count() > 0) then
|
if not paint or (paint:get_count() > 0) then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
@ -182,3 +203,11 @@ minetest.register_craft({
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
minetest.register_craft({
|
||||||
|
output = 'mypaint:scraper',
|
||||||
|
recipe = {
|
||||||
|
{'default:steel_ingot', ''},
|
||||||
|
{'', 'group:stick'},
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
|
Binary file not shown.
After Width: | Height: | Size: 712 B |
Loading…
Reference in New Issue