diff --git a/mods/default/nodes.lua b/mods/default/nodes.lua index 284edcf..92bb01e 100644 --- a/mods/default/nodes.lua +++ b/mods/default/nodes.lua @@ -304,6 +304,12 @@ minetest.register_node("default:wooden_planks", { groups = {choppy = 3}, }) +minetest.register_node("default:wooden_planks_2", { + description = "Wooden Planks", + tiles = {"default_wooden_planks_2.png"}, + groups = {choppy = 3}, +}) + -- log minetest.register_node("default:log_1", { diff --git a/mods/default/textures/default_wooden_planks_2.png b/mods/default/textures/default_wooden_planks_2.png new file mode 100644 index 0000000..6eb3570 Binary files /dev/null and b/mods/default/textures/default_wooden_planks_2.png differ diff --git a/mods/pipe/LICENSE.txt b/mods/pipe/LICENSE.txt new file mode 100644 index 0000000..6f6a256 --- /dev/null +++ b/mods/pipe/LICENSE.txt @@ -0,0 +1,16 @@ +License for Code +---------------- + +Copyright (C) 2016 cd2 (cdqwertz) + +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. + +http://www.gnu.org/licenses/lgpl-2.1.html + +License for Media +----------------- + +CC-BY-SA 3.0 UNPORTED. Created by cd2 (cdqwertz) diff --git a/mods/pipe/depends.txt b/mods/pipe/depends.txt new file mode 100644 index 0000000..4ad96d5 --- /dev/null +++ b/mods/pipe/depends.txt @@ -0,0 +1 @@ +default diff --git a/mods/pipe/init.lua b/mods/pipe/init.lua new file mode 100644 index 0000000..b725389 --- /dev/null +++ b/mods/pipe/init.lua @@ -0,0 +1,51 @@ +local pipe_form = "size[8,6]" +local pipe_form = pipe_form..default.gui_colors +local pipe_form = pipe_form..default.gui_bg +local pipe_form = pipe_form.."list[current_name;main;2,0.3;4,1;]" +local pipe_form = pipe_form..default.itemslot_bg(2,0.3,4,1) +local pipe_form = pipe_form.."list[current_player;main;0,1.85;8,1;]" +local pipe_form = pipe_form..default.itemslot_bg(0,1.85,8,1) +local pipe_form = pipe_form.."list[current_player;main;0,3.08;8,3;8]" +local pipe_form = pipe_form..default.itemslot_bg(0,3.08,8,3) + +minetest.register_node("pipe:pipe", { + description = "Pipe", + tiles = {"pipe_top.png", "pipe_side.png"}, + groups = {choppy = 3}, + paramtype = "light", + paramtype2 = "facedir", + drawtype = "nodebox", + node_box = { + type = "fixed", + fixed = { + {-0.1, -0.1, -0.5, 0.1, 0.1, 0.5}, + }, + }, + on_construct = function(pos) + local meta = minetest.get_meta(pos) + meta:set_string("formspec", pipe_form) + meta:set_string("infotext", "Pipe") + local inv = meta:get_inventory() + inv:set_size("main", 4) + end, +}) + +minetest.register_abm({ + nodenames = {"pipe:pipe"}, + neighbors = {"pipe:pipe"}, + interval = 1.0, + chance = 1, + action = function(pos, node, active_object_count, active_object_count_wider) + local meta = minetest.get_meta(pos) + local dir = vector.multiply(minetest.facedir_to_dir(minetest.get_node({x = pos.x, y= pos.y, z=pos.z}).param2), -1) + local next_pos = vector.add(pos, dir) + local inv = meta:get_inventory() + local next_meta = minetest.get_meta(next_pos) + local next_inv = next_meta:get_inventory() + + if next_inv:room_for_item("main", inv:get_list("main")[1]) and not inv:get_list("main")[1]:is_empty() then + next_inv:add_item(inv:get_list("main")[1]) + inv:remove_item("main", 1) + end + end, +}) diff --git a/mods/pipe/textures/pipe_side.png b/mods/pipe/textures/pipe_side.png new file mode 100644 index 0000000..53ceebd Binary files /dev/null and b/mods/pipe/textures/pipe_side.png differ diff --git a/mods/pipe/textures/pipe_top.png b/mods/pipe/textures/pipe_top.png new file mode 100644 index 0000000..7f0f376 Binary files /dev/null and b/mods/pipe/textures/pipe_top.png differ