diff --git a/mods/paintings/init.lua b/mods/paintings/init.lua index cb66ae4..ab2de9f 100644 --- a/mods/paintings/init.lua +++ b/mods/paintings/init.lua @@ -3,7 +3,6 @@ --sizes are: 1X1, 1X2 (wide), 2X1 (tall), 2X2 local paintings = { --{"name/texture", "description", "size"} - {"hummingbird", "Hummingbird Painting", "2X2", "D00Med"}, {"dragon", "Dragon Painting", "2X1", "D00Med"}, {"landscape", "Landscape Painting", "1X2", "D00Med"}, {"forest", "Forest Painting", "1X2", "D00Med"}, @@ -14,6 +13,25 @@ local paintings = { {"rose", "Rose Painting", "1X1", "toby109tt"}, } +local painting_crafts = { + {"dye:red", "paintings:possessedwoman", "paintings:rose", "", "", "", "", "", "", "", "", "", ""}, + {"dye:blue", "", "", "", "", "", "", "", "", "", "", "", ""}, + {"dye:yellow", "", "", "", "", "", "", "", "", "", "", "", ""}, + {"dye:orange", "", "", "", "", "", "", "", "", "", "", "", ""}, + {"dye:pink", "", "", "", "", "", "", "", "", "", "", "", ""}, + {"dye:magenta", "paintings:landscape", "", "", "", "", "", "", "", "", "", "", ""}, + {"dye:purple", "paintings:dragon", "", "", "", "", "", "", "", "", "", "", ""}, + {"dye:brown", "", "", "", "", "", "", "", "", "", "", "", ""}, + {"dye:cyan", "paintings:mistiriusgirl", "", "", "", "", "", "", "", "", "", "", ""}, + {"dye:green", "paintings:cthulhu", "", "paintings:waterlilie", "", "", "", "", "", "", "", "", ""}, + {"dye:darkgreen", "", "", "", "", "", "", "", "", "", "", "", ""}, + {"dye:white", "", "", "", "", "", "", "", "", "", "", "", ""}, + {"dye:black", "paintings:forest", "", "", "", "", "", "", "", "", "", "", ""}, + {"dye:grey", "", "", "", "", "", "", "", "", "", "", "", ""}, + {"dye:darkgrey", "", "", "", "", "", "", "", "", "", "", "", ""}, + --{"", "", "", "", "", "", "", "", "", "", "", "", ""}, +} + local small = {-0.5, -0.5, 0.4375, 0.5, 0.5, 0.5} local medium = {-1.5, -0.5, 0.4375, 0.5, 0.5, 0.5} local tall = {-0.5, -0.5, 0.4375, 0.5, 1.5, 0.5} @@ -59,21 +77,97 @@ for _, row in ipairs(paintings) do sounds = default.node_sound_wood_defaults() }) end ---[[ + +local easel_formspec = + "size[8,9]" .. + default.gui_bg .. + default.gui_bg_img .. + default.gui_slots .. + "list[current_name;input;1,1;1,1;]" .. + "list[current_name;output;3,0;4,3;]" .. + "list[current_player;main;0,4.85;8,1;]" .. + "list[current_player;main;0,6.08;8,3;8]" .. + "listring[current_name;input]" .. + "listring[current_name;output]" .. + "listring[current_player;main]" .. + default.get_hotbar_bg(0,4.85) + minetest.register_node("paintings:easel", { description = "Easel", - tiles = {"default_wood.png"}, + drawtype = "mesh", + mesh = "easel.obj", + tiles = {"paintings_easel.png"}, paramtype = "light", paramtype2 = "facedir", groups = {choppy=1}, + selection_box = { + type = "fixed", + fixed = { + {-0.4,-0.5,-0.2,0.4,1.5,0.2}, + } + }, + collision_box = { + type = "fixed", + fixed = { + {-0.2,-0.5,-0.4,0,0.5,0}, + {-0.4,-0.5,0.1,0.4,1.4,0.3}, + } + }, on_construct = function(pos) local meta = minetest.get_meta(pos) meta:set_string("infotext", "Painting Easel") meta:set_string("formspec", easel_formspec) + local inv = meta:get_inventory() + inv:set_size("output", 4 * 3) + inv:set_size("input", 1 * 1) end, - on_righclick = function(pos, node, clicker, itemstack) - + on_metadata_inventory_put = function(pos, listname, index, stack, player) + local meta = minetest.get_meta(pos) + local inv = meta:get_inventory() + local player_inv = player:get_inventory() + if listname == "output" then + player_inv:add_item("main", stack) + inv:set_stack("output", index, "") + end + if listname == "input" then + for _, row in ipairs(painting_crafts) do + local item = row[1] + if inv:contains_item("input", item) then + inv:set_stack("output", 1, row[2]) + inv:set_stack("output", 2, row[3]) + inv:set_stack("output", 3, row[4]) + inv:set_stack("output", 4, row[5]) + inv:set_stack("output", 5, row[6]) + inv:set_stack("output", 6, row[7]) + inv:set_stack("output", 7, row[8]) + inv:set_stack("output", 8, row[9]) + inv:set_stack("output", 9, row[10]) + inv:set_stack("output", 10, row[11]) + inv:set_stack("output", 11, row[12]) + inv:set_stack("output", 12, row[13]) + end + end + end + end, + on_metadata_inventory_take = function(pos, listname, index, stack, player) + local meta = minetest.get_meta(pos) + local inv = meta:get_inventory() + local stack = inv:get_stack("input", 1) + local stack_name = stack:get_name() + inv:remove_item("input", stack_name.." 1") + + inv:set_stack("output", 1, "") + inv:set_stack("output", 2, "") + inv:set_stack("output", 3, "") + inv:set_stack("output", 4, "") + inv:set_stack("output", 5, "") + inv:set_stack("output", 6, "") + inv:set_stack("output", 7, "") + inv:set_stack("output", 8, "") + inv:set_stack("output", 9, "") + inv:set_stack("output", 10, "") + inv:set_stack("output", 11, "") + inv:set_stack("output", 12, "") end, sounds = default.node_sound_wood_defaults() }) -]] diff --git a/mods/paintings/license.txt b/mods/paintings/license.txt new file mode 100644 index 0000000..bd84897 --- /dev/null +++ b/mods/paintings/license.txt @@ -0,0 +1,28 @@ + +License for Code +---------------- + +Copyright (C) 2017 D00Med and toby109tt(aka tobyplowy) + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation; either version 2.1 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU Lesser General Public License for more details. + +You should have received a copy of the GNU Lesser General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +License for Textures, Models and Sounds +--------------------------------------- + +CC BY-SA 3.0 UNPORTED. Created by toby109tt(aka tobyplowy) + +Painting credits: +toby109tt - cthulhu, mistirusgirl, rose, waterlilie +D00Med - possessedwoman, dragon, forest, landscape diff --git a/mods/paintings/models/easel.obj b/mods/paintings/models/easel.obj new file mode 100644 index 0000000..1cc7234 --- /dev/null +++ b/mods/paintings/models/easel.obj @@ -0,0 +1,196 @@ +# Blender v2.72 (sub 0) OBJ File: 'easel.blend' +# www.blender.org +mtllib easel.mtl +o Shape1 +v -0.312500 -0.498960 -0.298887 +v -0.437500 -0.498960 -0.298887 +v -0.437500 1.637156 0.172456 +v -0.312500 1.637156 0.172456 +v -0.437500 -0.512427 -0.237855 +v -0.312500 -0.512427 -0.237855 +v -0.312500 1.623689 0.233488 +v -0.437500 1.623689 0.233488 +v 0.343750 -0.018284 -0.195138 +v -0.343750 -0.018284 -0.195138 +v -0.343750 0.042747 -0.181671 +v 0.343750 0.042747 -0.181671 +v -0.343750 -0.031752 -0.134106 +v 0.343750 -0.031752 -0.134106 +v 0.343750 0.029280 -0.120639 +v -0.343750 0.029280 -0.120639 +v 0.437500 -0.498960 -0.298887 +v 0.312500 -0.498960 -0.298887 +v 0.312500 1.637156 0.172456 +v 0.437500 1.637156 0.172456 +v 0.312500 -0.512427 -0.237855 +v 0.437500 -0.512427 -0.237855 +v 0.437500 1.623689 0.233488 +v 0.312500 1.623689 0.233488 +v 0.062500 -0.010705 -0.191151 +v -0.062500 -0.010705 -0.191151 +v -0.062500 1.942316 0.239791 +v 0.062500 1.942316 0.239791 +v -0.062500 -0.024172 -0.130119 +v 0.062500 -0.024172 -0.130119 +v 0.062500 1.928849 0.300823 +v -0.062500 1.928849 0.300823 +v 0.500000 0.491017 -0.144448 +v -0.500000 0.491017 -0.144448 +v -0.500000 1.467527 0.071023 +v 0.500000 1.467527 0.071023 +v -0.500000 0.477550 -0.083416 +v 0.500000 0.477550 -0.083416 +v 0.500000 1.454060 0.132055 +v -0.500000 1.454060 0.132055 +v 0.062500 -0.520145 0.426975 +v -0.062500 -0.520145 0.426975 +v -0.062500 1.458510 0.135560 +v 0.062500 1.458510 0.135560 +v -0.062500 -0.511038 0.488808 +v 0.062500 -0.511038 0.488808 +v 0.062500 1.467617 0.197393 +v -0.062500 1.467617 0.197393 +v 0.562500 0.436718 -0.188430 +v -0.562500 0.436718 -0.188430 +v -0.562500 0.497750 -0.174963 +v 0.562500 0.497750 -0.174963 +v -0.562500 0.409785 -0.066367 +v 0.562500 0.409785 -0.066367 +v 0.562500 0.470816 -0.052900 +v -0.562500 0.470816 -0.052900 +vt 0.203125 0.437500 +vt 0.234375 0.437500 +vt 0.234375 0.984375 +vt 0.203125 0.984375 +vt 0.250000 0.437500 +vt 0.281250 0.437500 +vt 0.281250 0.984375 +vt 0.250000 0.984375 +vt 0.234375 1.000000 +vt 0.203125 1.000000 +vt 0.265625 0.984375 +vt 0.265625 1.000000 +vt 0.187500 0.437500 +vt 0.187500 0.984375 +vt 0.390625 0.484375 +vt 0.562500 0.484375 +vt 0.562500 0.500000 +vt 0.390625 0.500000 +vt 0.578125 0.484375 +vt 0.750000 0.484375 +vt 0.750000 0.500000 +vt 0.578125 0.500000 +vt 0.562500 0.515625 +vt 0.390625 0.515625 +vt 0.734375 0.500000 +vt 0.734375 0.515625 +vt 0.375000 0.484375 +vt 0.375000 0.500000 +vt 0.015625 0.437500 +vt 0.046875 0.437500 +vt 0.046875 0.984375 +vt 0.015625 0.984375 +vt 0.062500 0.437500 +vt 0.093750 0.437500 +vt 0.093750 0.984375 +vt 0.062500 0.984375 +vt 0.046875 1.000000 +vt 0.015625 1.000000 +vt 0.078125 0.984375 +vt 0.078125 1.000000 +vt 0.000000 0.437500 +vt 0.000000 0.984375 +vt 0.109375 0.484375 +vt 0.140625 0.484375 +vt 0.140625 0.984375 +vt 0.109375 0.984375 +vt 0.156250 0.484375 +vt 0.187500 0.484375 +vt 0.156250 0.984375 +vt 0.140625 1.000000 +vt 0.109375 1.000000 +vt 0.171875 0.984375 +vt 0.171875 1.000000 +vt 0.093750 0.484375 +vt 0.390625 0.734375 +vt 0.640625 0.734375 +vt 0.640625 0.984375 +vt 0.390625 0.984375 +vt 0.656250 0.734375 +vt 0.906250 0.734375 +vt 0.906250 0.984375 +vt 0.656250 0.984375 +vt 0.640625 1.000000 +vt 0.390625 1.000000 +vt 0.890625 0.984375 +vt 0.890625 1.000000 +vt 0.375000 0.734375 +vt 0.375000 0.984375 +vt 0.296875 0.484375 +vt 0.328125 0.484375 +vt 0.328125 0.984375 +vt 0.296875 0.984375 +vt 0.343750 0.484375 +vt 0.343750 0.984375 +vt 0.328125 1.000000 +vt 0.296875 1.000000 +vt 0.359375 0.984375 +vt 0.359375 1.000000 +vt 0.281250 0.484375 +vt 0.312500 0.437500 +vt 0.593750 0.437500 +vt 0.593750 0.453125 +vt 0.312500 0.453125 +vt 0.625000 0.437500 +vt 0.906250 0.437500 +vt 0.906250 0.453125 +vt 0.625000 0.453125 +vt 0.593750 0.484375 +vt 0.312500 0.484375 +vt 0.875000 0.453125 +vt 0.875000 0.484375 +vt 0.281250 0.453125 +usemtl None +s off +f 1/1 2/2 3/3 4/4 +f 5/5 6/6 7/7 8/8 +f 4/4 3/3 8/9 7/10 +f 6/3 5/11 2/12 1/9 +f 6/13 1/1 4/4 7/14 +f 2/2 5/5 8/8 3/3 +f 9/15 10/16 11/17 12/18 +f 13/19 14/20 15/21 16/22 +f 12/18 11/17 16/23 15/24 +f 14/17 13/25 10/26 9/23 +f 14/27 9/15 12/18 15/28 +f 10/16 13/19 16/22 11/17 +f 17/29 18/30 19/31 20/32 +f 21/33 22/34 23/35 24/36 +f 20/32 19/31 24/37 23/38 +f 22/31 21/39 18/40 17/37 +f 22/41 17/29 20/32 23/42 +f 18/30 21/33 24/36 19/31 +f 25/43 26/44 27/45 28/46 +f 29/47 30/48 31/14 32/49 +f 28/46 27/45 32/50 31/51 +f 30/45 29/52 26/53 25/50 +f 30/54 25/43 28/46 31/35 +f 26/44 29/47 32/49 27/45 +f 33/55 34/56 35/57 36/58 +f 37/59 38/60 39/61 40/62 +f 36/58 35/57 40/63 39/64 +f 38/57 37/65 34/66 33/63 +f 38/67 33/55 36/58 39/68 +f 34/56 37/59 40/62 35/57 +f 41/69 42/70 43/71 44/72 +f 45/73 46/27 47/68 48/74 +f 44/72 43/71 48/75 47/76 +f 46/71 45/77 42/78 41/75 +f 46/79 41/69 44/72 47/7 +f 42/70 45/73 48/74 43/71 +f 49/80 50/81 51/82 52/83 +f 53/84 54/85 55/86 56/87 +f 52/83 51/82 56/88 55/89 +f 54/82 53/90 50/91 49/88 +f 54/6 49/80 52/83 55/92 +f 50/81 53/84 56/87 51/82 diff --git a/mods/paintings/textures/paintings_easel.png b/mods/paintings/textures/paintings_easel.png new file mode 100644 index 0000000..67344a3 Binary files /dev/null and b/mods/paintings/textures/paintings_easel.png differ diff --git a/mods/paintings/textures/paintings_hummingbird.png b/mods/paintings/textures/paintings_hummingbird.png deleted file mode 100644 index 2715c3f..0000000 Binary files a/mods/paintings/textures/paintings_hummingbird.png and /dev/null differ