mirror of
https://github.com/joe7575/tubelib2.git
synced 2024-10-04 00:43:14 +02:00
v0.4 - on_update function for secondary nodes introduced
This commit is contained in:
parent
e04f493667
commit
96d43cc69e
31
README.md
31
README.md
@ -22,20 +22,20 @@ Tubelib2 specific 6D directions (1 = North, 2 = East, 3 = South, 4 = West, 5 = D
|
|||||||
|
|
||||||
All 6D dirs are the view from the node to the outer side
|
All 6D dirs are the view from the node to the outer side
|
||||||
Tubes are based on two node types, "angled" and "straight" tubes.
|
Tubes are based on two node types, "angled" and "straight" tubes.
|
||||||
|
|
||||||
|
|
||||||
+-------+
|
+-------+
|
||||||
/ /| +-------+
|
/ /| +-------+
|
||||||
+-------+ | / /|
|
/ / | / /|
|
||||||
| | | / / |
|
/ / + / / |
|
||||||
| | | +-------+ |
|
/ / / +-------+ |
|
||||||
| | | | | |
|
+-------+ / | | |
|
||||||
| | | | |/ |
|
| | / | |/ |
|
||||||
| | + +-------+| +
|
| |/ +-------+| +
|
||||||
| |/ | |/
|
+-------+ | |/
|
||||||
+-------+ +------+
|
+------+
|
||||||
|
|
||||||
|
|
||||||
All other nodes are build by means of axis/rotation variants based on param2
|
All other nodes are build by means of axis/rotation variants based on param2
|
||||||
(paramtype2 == "facedir").
|
(paramtype2 == "facedir").
|
||||||
|
|
||||||
@ -53,7 +53,8 @@ default
|
|||||||
|
|
||||||
# License
|
# License
|
||||||
Copyright (C) 2017-2018 Joachim Stolberg
|
Copyright (C) 2017-2018 Joachim Stolberg
|
||||||
Code: Licensed under the GNU LGPL version 2.1 or later. See LICENSE.txt and http://www.gnu.org/licenses/lgpl-2.1.txt
|
Code: Licensed under the GNU LGPL version 2.1 or later.
|
||||||
|
See LICENSE.txt and http://www.gnu.org/licenses/lgpl-2.1.txt
|
||||||
Textures: CC0
|
Textures: CC0
|
||||||
|
|
||||||
## Dependencies
|
## Dependencies
|
||||||
|
13
design.txt
13
design.txt
@ -18,6 +18,19 @@ View to the north
|
|||||||
V
|
V
|
||||||
5
|
5
|
||||||
|
|
||||||
|
|
||||||
|
+-------+
|
||||||
|
/ /| +-------+
|
||||||
|
/ / | / /|
|
||||||
|
/ / + / / |
|
||||||
|
/ / / +-------+ |
|
||||||
|
+-------+ / | | |
|
||||||
|
| | / | |/ |
|
||||||
|
| |/ +-------+| +
|
||||||
|
+-------+ | |/
|
||||||
|
+------+
|
||||||
|
|
||||||
|
|
||||||
+------+
|
+------+
|
||||||
| |
|
| |
|
||||||
+------+ +---+------+---+ +------+
|
+------+ +---+------+---+ +------+
|
||||||
|
@ -153,7 +153,7 @@ function Tube:update_secondary_node(fpos,fdir, npos,ndir)
|
|||||||
local fpos2, node = self:get_node(fpos, fdir)
|
local fpos2, node = self:get_node(fpos, fdir)
|
||||||
if minetest.registered_nodes[node.name].tubelib2_on_update then
|
if minetest.registered_nodes[node.name].tubelib2_on_update then
|
||||||
local npos2 = self:get_pos(npos, ndir)
|
local npos2 = self:get_pos(npos, ndir)
|
||||||
minetest.registered_nodes[node.name].tubelib2_on_update(fpos2, npos2, ndir)
|
minetest.registered_nodes[node.name].tubelib2_on_update(fpos2, Turn180Deg[fdir], npos2, ndir)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -32,11 +32,6 @@ local Tube = tubelib2.Tube:new({
|
|||||||
"tubelib2:source", "tubelib2:junction", "tubelib2:teleporter"},
|
"tubelib2:source", "tubelib2:junction", "tubelib2:teleporter"},
|
||||||
after_place_tube = function(pos, param2, tube_type, num_tubes, tbl)
|
after_place_tube = function(pos, param2, tube_type, num_tubes, tbl)
|
||||||
minetest.set_node(pos, {name = "tubelib2:tube"..tube_type, param2 = param2})
|
minetest.set_node(pos, {name = "tubelib2:tube"..tube_type, param2 = param2})
|
||||||
-- minetest.sound_play({
|
|
||||||
-- name="default_place_node_glass"},{
|
|
||||||
-- gain=1,
|
|
||||||
-- max_hear_distance=5,
|
|
||||||
-- loop=false})
|
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -187,7 +182,7 @@ minetest.register_node("tubelib2:junction", {
|
|||||||
Tube:after_dig_node(pos)
|
Tube:after_dig_node(pos)
|
||||||
end,
|
end,
|
||||||
|
|
||||||
tubelib2_on_update = function(pos, peer_pos, peer_dir)
|
tubelib2_on_update = function(pos, out_dir, peer_pos, peer_in_dir)
|
||||||
if Tube:secondary_node(peer_pos) then
|
if Tube:secondary_node(peer_pos) then
|
||||||
local sdir = tubelib2.dir_to_string(peer_dir)
|
local sdir = tubelib2.dir_to_string(peer_dir)
|
||||||
local node = minetest.get_node(peer_pos)
|
local node = minetest.get_node(peer_pos)
|
||||||
@ -288,6 +283,11 @@ local function remove_tube(itemstack, placer, pointed_thing)
|
|||||||
else
|
else
|
||||||
Tube:tool_remove_tube(pos, "default_break_glass")
|
Tube:tool_remove_tube(pos, "default_break_glass")
|
||||||
end
|
end
|
||||||
|
else
|
||||||
|
minetest.chat_send_player(placer:get_player_name(),
|
||||||
|
"[Tool Help]\n"..
|
||||||
|
" left: remove node\n"..
|
||||||
|
" right: repair tube line\n")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user