From 7889c4250ff873b9790e46ffd8fe93e4b224aac8 Mon Sep 17 00:00:00 2001 From: cale Date: Sun, 21 Feb 2016 10:44:23 +0100 Subject: [PATCH] added pipe (WIP) --- mods/default/nodes.lua | 6 +++ .../textures/default_wooden_planks_2.png | Bin 0 -> 223 bytes mods/pipe/LICENSE.txt | 16 ++++++ mods/pipe/depends.txt | 1 + mods/pipe/init.lua | 51 ++++++++++++++++++ mods/pipe/textures/pipe_side.png | Bin 0 -> 234 bytes mods/pipe/textures/pipe_top.png | Bin 0 -> 288 bytes 7 files changed, 74 insertions(+) create mode 100644 mods/default/textures/default_wooden_planks_2.png create mode 100644 mods/pipe/LICENSE.txt create mode 100644 mods/pipe/depends.txt create mode 100644 mods/pipe/init.lua create mode 100644 mods/pipe/textures/pipe_side.png create mode 100644 mods/pipe/textures/pipe_top.png 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 0000000000000000000000000000000000000000..6eb3570a33ecc92c3a93630ad94edc9ff8865796 GIT binary patch literal 223 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE1SJ1Ryj={WI14-?iy0WWg+Z8+Vb&Z8pdfpR zr>`sf113=p6Rt_seEWbxk|nMYCC>S|xv6<249-QVi6yBi3gww484B*6z5(HleBwYw zk)AG&As)w*?-;IbXq?vY^!0anldTP%jg1d4o?gGjKq^T`n3=hGj)l3dPJ_hhBM!+1 zUz$6f8s`cNGIzHq9M7H3qZz-98`8uuDi_U + +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 0000000000000000000000000000000000000000..53ceebd0ce1fdbf473abf8a7ae1087d4b338d04d GIT binary patch literal 234 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE1|*BCs=fdz&H|6fVg?3oVGw3ym^DWND9B#o z>Fdh=fJu~-pZ(&l?>s;u$r9Iy66gHf+|;}h2Ir#G#FEq$h4Rdj37v;jT+e) z1OtU^j1?F2mbdSg_jKCFXP~{TS1k1F8`+4JuW}b{HV*pBGu>)KvCCK47kfWjt1123 a&VKQkFdh=fJu~7NhSFEorypp$r9Iy66gHf+|;}h2Ir#G#FEq$h4Rdj30!#<}j$cj|}5 cCsiM35a?A6$Z5Eq0CXjTr>mdKI;Vst0Oy)xFaQ7m literal 0 HcmV?d00001