added pipe (WIP)
This commit is contained in:
parent
7d05be160c
commit
7889c4250f
@ -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", {
|
||||
|
BIN
mods/default/textures/default_wooden_planks_2.png
Normal file
BIN
mods/default/textures/default_wooden_planks_2.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 223 B |
16
mods/pipe/LICENSE.txt
Normal file
16
mods/pipe/LICENSE.txt
Normal file
@ -0,0 +1,16 @@
|
||||
License for Code
|
||||
----------------
|
||||
|
||||
Copyright (C) 2016 cd2 (cdqwertz) <cdqwertz@gmail.com>
|
||||
|
||||
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)
|
1
mods/pipe/depends.txt
Normal file
1
mods/pipe/depends.txt
Normal file
@ -0,0 +1 @@
|
||||
default
|
51
mods/pipe/init.lua
Normal file
51
mods/pipe/init.lua
Normal file
@ -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,
|
||||
})
|
BIN
mods/pipe/textures/pipe_side.png
Normal file
BIN
mods/pipe/textures/pipe_side.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 234 B |
BIN
mods/pipe/textures/pipe_top.png
Normal file
BIN
mods/pipe/textures/pipe_top.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 288 B |
Loading…
x
Reference in New Issue
Block a user