Add 'mypaint' mod @ Git commit c1d4dd5:

https://github.com/DonBatman/mypaint/tree/c1d4dd5
This commit is contained in:
AntumDeluge 2017-06-08 16:24:49 -07:00
parent ec9fd53cad
commit c0c57ca204
18 changed files with 363 additions and 0 deletions

View File

@ -178,6 +178,7 @@ The game includes the mods from the default [minetest_game](https://github.com/m
* [mydoors][] ([CC-BY / CC-BY-SA][lic.mydoors] / [WTFPL][lic.wtfpl] / [DWYWFPL][lic.dwywpl]) -- version: [63aef13 Git][ver.mydoors] *2017-03-31* ([patched][patch.mydoors])
* [myfences][] ([DWYWPL][lic.dwywpl]) -- version: [c6e529a Git][ver.myfences] *2016-04-04*
* [mylights][] ([DWYWPL][lic.dwywpl]) -- version: [437fc0c Git][ver.mylights] *2016-03-23*
* [mypaint][] ([DWYWPL][lic.dwywpl]) -- version: [c1d4dd5 Git][ver.mypaint] *2016-03-25*
* [myroofs][] ([DWYWPL][lic.dwywpl]) -- version: [6da6148 Git][ver.myroofs] *2016-03-23*
* [mysheetmetal][] ([DWYWPL][lic.dwywpl]) -- version: [7c5ab71 Git][ver.mysheetmetal] *2016-04-12* ([patched][patch.mysheetmetal])
* [mywoodslopes][] ([DWYWPL][lic.dwywpl]) -- version: [3a1b531 Git][ver.mywoodslopes] *2016-03-23*
@ -263,6 +264,7 @@ The game includes the mods from the default [minetest_game](https://github.com/m
[mydoors]: https://forum.minetest.net/viewtopic.php?t=10626
[myfences]: https://forum.minetest.net/viewtopic.php?t=14275
[mylights]: https://forum.minetest.net/viewtopic.php?t=13154
[mypaint]: https://forum.minetest.net/viewtopic.php?t=14274
[myroofs]: https://forum.minetest.net/viewtopic.php?t=11416
[mysheetmetal]: https://forum.minetest.net/viewtopic.php?t=11702
[mywoodslopes]: https://forum.minetest.net/viewtopic.php?t=11433
@ -472,6 +474,7 @@ The game includes the mods from the default [minetest_game](https://github.com/m
[ver.mydoors]: https://github.com/minetest-mods/mydoors/tree/63aef13
[ver.myfences]: https://github.com/DonBatman/myfences/tree/c6e529a
[ver.mylights]: https://github.com/minetest-mods/mylights/tree/437fc0c
[ver.mypaint]: https://github.com/DonBatman/mypaint/tree/c1d4dd5
[ver.myroofs]: https://github.com/minetest-mods/myroofs/tree/6da6148
[ver.mysheetmetal]: https://github.com/minetest-mods/mysheetmetal/tree/7c5ab71
[ver.mywoodslopes]: https://github.com/minetest-mods/mywoodslopes/tree/3a1b531

View File

@ -9,6 +9,7 @@
- [mydoors][] (DWYWPL)
- [myfences][] (DWYWPL)
- [mylights][] (DWYWPL)
- [mypaint][] (DWYWPL)
- [myroofs][] (DWYWPL)
- [mysheetmetal][] (DWYWPL)
- [mywoodslopes][] (DWYWPL)
@ -22,6 +23,7 @@
[mydoors]: https://forum.minetest.net/viewtopic.php?t=10626
[myfences]: https://forum.minetest.net/viewtopic.php?t=14275
[mylights]: https://forum.minetest.net/viewtopic.php?t=13154
[mypaint]: https://forum.minetest.net/viewtopic.php?t=14274
[myroofs]: https://forum.minetest.net/viewtopic.php?t=11416
[mysheetmetal]: https://forum.minetest.net/viewtopic.php?t=11702
[mywoodslopes]: https://forum.minetest.net/viewtopic.php?t=11433

View File

@ -0,0 +1,5 @@
# mypaint
Use paint cans and brushes to paint items.
Licence - DWYWPL

View File

@ -0,0 +1 @@
default

View File

@ -0,0 +1 @@
Provides paint brushes and buckets for other mods to use to paint their items.

Binary file not shown.

View File

@ -0,0 +1,31 @@
mypaint = {}
mypaint.colors = {
red = {"Red", "ff0000"},
green = {"Green", "00ff00"},
white = {"White", "ffffff"},
black = {"Black", "000000"},
blue = {"Blue", "0000ff"},
brown = {"Brown", "190B07"},
cyan = {"Cyan", "00ffff"},
darkgreen = {"Dark Green", "005000"},
darkgrey = {"Dark Grey", "1C1C1C"},
grey = {"Grey", "848484"},
magenta = {"Magenta", "ff00ff"},
orange = {"Orange", "ff7700"},
pink = {"Pink", "FE2E9A"},
violet = {"Violet", "7f007f"},
yellow = {"Yellow", "ffff00"},
}
mypaint.paintables = {}
mypaint.register = function(names, colors)
local ctable = {}
for _, color in ipairs(colors) do
ctable[color] = true
end
for _, name in ipairs(names) do
mypaint.paintables[name] = ctable
end
end
dofile(minetest.get_modpath("mypaint").."/paint.lua")

View File

@ -0,0 +1 @@
name = mypaint

View File

@ -0,0 +1,106 @@
# Blender v2.77 (sub 0) OBJ File: ''
# www.blender.org
o Cylinder
v -0.000000 -0.500000 0.250000
v -0.000000 0.000000 0.250000
v -0.125000 -0.500000 0.216506
v -0.125000 0.000000 0.216506
v -0.216506 -0.500000 0.125000
v -0.216506 0.000000 0.125000
v -0.250000 -0.500000 0.000000
v -0.250000 0.000000 0.000000
v -0.216506 -0.500000 -0.125000
v -0.216506 0.000000 -0.125000
v -0.125000 -0.500000 -0.216506
v -0.125000 0.000000 -0.216506
v -0.000000 -0.500000 -0.250000
v -0.000000 0.000000 -0.250000
v 0.125000 -0.500000 -0.216506
v 0.125000 0.000000 -0.216506
v 0.216506 -0.500000 -0.125000
v 0.216506 0.000000 -0.125000
v 0.250000 -0.500000 -0.000000
v 0.250000 0.000000 -0.000000
v 0.216506 -0.500000 0.125000
v 0.216506 0.000000 0.125000
v 0.125000 -0.500000 0.216506
v 0.125000 0.000000 0.216506
vt 0.999881 0.000119
vt 0.999881 0.322018
vt 0.916568 0.322018
vt 0.916567 0.000119
vt 0.833254 0.322018
vt 0.833254 0.000119
vt 0.749941 0.322018
vt 0.749940 0.000119
vt 0.666627 0.322018
vt 0.666627 0.000119
vt 0.583314 0.322018
vt 0.583313 0.000119
vt 0.500000 0.322018
vt 0.500000 0.000119
vt 0.416687 0.322018
vt 0.416686 0.000119
vt 0.333373 0.322018
vt 0.333373 0.000119
vt 0.250060 0.322018
vt 0.250060 0.000119
vt 0.166746 0.322018
vt 0.166746 0.000119
vt 0.114068 0.633186
vt 0.041916 0.591529
vt 0.000260 0.519378
vt 0.000260 0.436064
vt 0.041916 0.363912
vt 0.114068 0.322256
vt 0.197381 0.322256
vt 0.269533 0.363912
vt 0.311190 0.436064
vt 0.311190 0.519377
vt 0.269533 0.591529
vt 0.197381 0.633186
vt 0.083433 0.322018
vt 0.083433 0.000119
vt 0.000119 0.322018
vt 0.000119 0.000119
vt 0.197241 0.322256
vt 0.269392 0.363913
vt 0.311049 0.436064
vt 0.311049 0.519378
vt 0.269392 0.591529
vt 0.197241 0.633186
vt 0.113927 0.633186
vt 0.041776 0.591529
vt 0.000119 0.519377
vt 0.000119 0.436064
vt 0.041776 0.363912
vt 0.113927 0.322256
vn -0.258800 0.000000 0.965900
vn -0.707100 0.000000 0.707100
vn -0.965900 0.000000 0.258800
vn -0.965900 0.000000 -0.258800
vn -0.707100 0.000000 -0.707100
vn -0.258800 0.000000 -0.965900
vn 0.258800 0.000000 -0.965900
vn 0.707100 0.000000 -0.707100
vn 0.965900 0.000000 -0.258800
vn 0.965900 0.000000 0.258800
vn 0.000000 1.000000 0.000000
vn 0.707100 0.000000 0.707100
vn 0.258800 0.000000 0.965900
vn 0.000000 -1.000000 0.000000
s off
f 1/1/1 2/2/1 4/3/1 3/4/1
f 3/4/2 4/3/2 6/5/2 5/6/2
f 5/6/3 6/5/3 8/7/3 7/8/3
f 7/8/4 8/7/4 10/9/4 9/10/4
f 9/10/5 10/9/5 12/11/5 11/12/5
f 11/12/6 12/11/6 14/13/6 13/14/6
f 13/14/7 14/13/7 16/15/7 15/16/7
f 15/16/8 16/15/8 18/17/8 17/18/8
f 17/18/9 18/17/9 20/19/9 19/20/9
f 19/20/10 20/19/10 22/21/10 21/22/10
f 4/23/11 2/24/11 24/25/11 22/26/11 20/27/11 18/28/11 16/29/11 14/30/11 12/31/11 10/32/11 8/33/11 6/34/11
f 21/22/12 22/21/12 24/35/12 23/36/12
f 23/36/13 24/35/13 2/37/13 1/38/13
f 1/39/14 3/40/14 5/41/14 7/42/14 9/43/14 11/44/14 13/45/14 15/46/14 17/47/14 19/48/14 21/49/14 23/50/14

View File

@ -0,0 +1,213 @@
local BRUSH_USES = 3
local CAN_USES = 100
function check_paintcan(pos, node)
local name = node.name
if string.sub(name, 1, 14) ~= "mypaint:paint_" then
return
end
local color = string.sub(name, 15)
local meta = minetest.get_meta(pos)
stack = ItemStack("mypaint:brush_"..color)
if minetest.setting_getbool("creative_mode") then
return stack
end
local uses = meta:get_int("mypaint:uses") - 1
meta:set_int("mypaint:uses", uses)
if uses <= 0 then
minetest.dig_node(pos)
else
local info = meta:get_string("infotext")
info = string.gsub(info, "%(.*%)", "("..uses.." uses)")
meta:set_string("infotext", info)
end
return stack
end
function paint_node(pos, node, col, itemstack)
local s, e
local nname = node.name
s, e = string.find(nname, "_[^_]+$")
local color
if s and e then
color = string.sub(nname, s + 1, e)
if mypaint.colors[color] then
nname = string.sub(nname, 1, s - 1)
if color == col then
return
end
end
end
for name, colors in pairs(mypaint.paintables) do
if (nname == name) then
if not col then
if color then
minetest.set_node(pos, {name = name, param2 = node.param2})
end
return
end
if not colors[col] then
return
end
minetest.set_node(pos, {name = name.."_"..col, param2 = node.param2})
if not minetest.setting_getbool("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
end
end
minetest.register_tool("mypaint:brush", {
description = "Paint Brush",
inventory_image = "mypaint_brush.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)
if string.sub(node.name, 1, 8) ~= "mypaint:" then
return
end
return check_paintcan(pos, node)
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
local desc = entry[1]
local cstring = entry[2]
minetest.register_tool("mypaint:brush_"..color, {
description = "Paint Brush ("..desc.." Paint)",
inventory_image = "mypaint_brush.png^(mypaint_brush_color.png^[colorize:#"..cstring..")",
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)
local ret = check_paintcan(pos, node)
if ret then
return ret
end
return paint_node(pos, node, color, itemstack)
end,
})
minetest.register_node("mypaint:paint_"..color, {
description = desc.." Paint",
drawtype = "mesh",
paramtype = "light",
paramtype2 = "facedir",
mesh = "mypaint_can.obj",
tiles = {"(mypaint_can_color.png^[colorize:#"..cstring..")^mypaint_can_base.png"},
stack_max = 1,
drop = "",
groups = {oddly_breakable_by_hand = 3, dig_immediate = 3, not_in_creative_inventory = 1},
selection_box = {
type = "fixed",
fixed = {
{-0.25, -0.5, -0.25, 0.25, 0., 0.25},
}
},
after_dig_node = function(pos, oldnode, oldmetadata, digger)
if not digger then
return
end
local inv = digger:get_inventory()
if not inv then
return
end
local itemstack = ItemStack("mypaint:paintcan_"..color)
local uses = tonumber(oldmetadata.fields["mypaint:uses"])
if not uses then
uses = 100
end
if uses <= 0 then
return
end
itemstack:set_wear((CAN_USES - uses) * (65535 / CAN_USES))
if inv:room_for_item("main", itemstack) then
inv:add_item("main", itemstack)
else
minetest.add_item(pos, itemstack)
end
end
})
minetest.register_tool("mypaint:paintcan_"..color, {
description = desc.." Paint",
inventory_image = "mypaint_inv_can_base.png^(mypaint_inv_can_color.png^[colorize:#"..cstring..":alpha)",
on_place = function(itemstack, user, pointed_thing)
local pname = "mypaint:paint_"..color
local paint = ItemStack(pname)
paint = minetest.item_place_node(paint, user, pointed_thing)
if not minetest.setting_getbool("creative_mode") then
if not paint or (paint:get_count() > 0) then
return
end
end
local pos = pointed_thing.under
local node = minetest.get_node(pos)
local meta = minetest.get_meta(pos)
if node.name ~= pname or (meta:get_int("mypaint:uses") > 0) then
pos = pointed_thing.above
node = minetest.get_node(pos)
meta = minetest.get_meta(pos)
if node.name ~= pname or (meta:get_int("mypaint:uses") > 0) then
return
end
end
local uses = math.floor(CAN_USES - itemstack:get_wear() / (65535 / CAN_USES))
meta:set_int("mypaint:uses", uses)
meta:set_string("infotext", desc.." Paint ("..uses.." uses)")
itemstack:take_item()
return itemstack
end
})
minetest.register_craft({
output = "mypaint:paintcan_"..color,
recipe = {
{"bucket:bucket_water","dye:"..color}
},
replacements = {{"bucket:bucket_water","bucket:bucket_empty"}},
})
end
minetest.register_craft({
output = 'mypaint:brush',
recipe = {
{'wool:white'},
{'group:stick'},
}
})
minetest.register_craft({
output = 'mypaint:scraper',
recipe = {
{'default:steel_ingot', ''},
{'', 'group:stick'},
}
})

Binary file not shown.

After

Width:  |  Height:  |  Size: 300 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 124 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 338 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 128 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 712 B