mirror of
https://github.com/joe7575/tubelib2.git
synced 2024-08-19 21:14:22 +02:00
bugfixes
This commit is contained in:
parent
92f6d8ce55
commit
ce3a3330bc
12
convert.lua
12
convert.lua
@ -16,6 +16,9 @@
|
|||||||
|
|
||||||
]]--
|
]]--
|
||||||
|
|
||||||
|
-- for lazy programmers
|
||||||
|
local M = minetest.get_meta
|
||||||
|
|
||||||
local Tube = tubelib2.Tube
|
local Tube = tubelib2.Tube
|
||||||
|
|
||||||
function Tube:on_convert_tube(convert_tube_clbk)
|
function Tube:on_convert_tube(convert_tube_clbk)
|
||||||
@ -33,9 +36,8 @@ function Tube:convert_tube_line(pos, dir)
|
|||||||
local npos, node = self:get_next_node(pos, dir)
|
local npos, node = self:get_next_node(pos, dir)
|
||||||
local dir1, dir2, num = self.convert_tube_clbk(npos, node.name, node.param2)
|
local dir1, dir2, num = self.convert_tube_clbk(npos, node.name, node.param2)
|
||||||
if dir1 then
|
if dir1 then
|
||||||
dir2 = dir2 or tubelib2.Turn180Deg[dir1]
|
self.clbk_after_place_tube(self:tube_data_to_table(npos, dir1,
|
||||||
self.clbk_after_place_tube(
|
dir2 or tubelib2.Turn180Deg[dir1], num))
|
||||||
self:tube_data_to_table(npos, dir1, dir2, num), {convert = true})
|
|
||||||
if tubelib2.Turn180Deg[dir] == dir1 then
|
if tubelib2.Turn180Deg[dir] == dir1 then
|
||||||
return npos, dir2
|
return npos, dir2
|
||||||
else
|
else
|
||||||
@ -56,6 +58,10 @@ function Tube:convert_tube_line(pos, dir)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function Tube:set_pairing(pos, peer_pos)
|
function Tube:set_pairing(pos, peer_pos)
|
||||||
|
|
||||||
|
M(pos):set_int("tube_dir", self:get_primary_dir(pos))
|
||||||
|
M(peer_pos):set_int("tube_dir", self:get_primary_dir(peer_pos))
|
||||||
|
|
||||||
local tube_dir1 = self:store_teleport_data(pos, peer_pos)
|
local tube_dir1 = self:store_teleport_data(pos, peer_pos)
|
||||||
local tube_dir2 = self:store_teleport_data(peer_pos, pos)
|
local tube_dir2 = self:store_teleport_data(peer_pos, pos)
|
||||||
|
|
||||||
|
@ -341,6 +341,7 @@ function Tube:add_tube_dir(pos, dir)
|
|||||||
local npos, node = self:get_next_node(pos, dir)
|
local npos, node = self:get_next_node(pos, dir)
|
||||||
if self.primary_node_names[node.name] then
|
if self.primary_node_names[node.name] then
|
||||||
local d1, d2, num = self:decode_param2(node.param2)
|
local d1, d2, num = self:decode_param2(node.param2)
|
||||||
|
if not num then return end
|
||||||
-- not already connected to the new tube?
|
-- not already connected to the new tube?
|
||||||
dir = Turn180Deg[dir]
|
dir = Turn180Deg[dir]
|
||||||
if d1 ~= dir and dir ~= d2 then
|
if d1 ~= dir and dir ~= d2 then
|
||||||
@ -366,6 +367,7 @@ function Tube:del_tube_dir(pos, dir)
|
|||||||
local npos, node = self:get_next_node(pos, dir)
|
local npos, node = self:get_next_node(pos, dir)
|
||||||
if self.primary_node_names[node.name] then
|
if self.primary_node_names[node.name] then
|
||||||
local d1, d2, num = self:decode_param2(node.param2)
|
local d1, d2, num = self:decode_param2(node.param2)
|
||||||
|
if not num then return end
|
||||||
return npos, d1, d2, math.max(num - 1, 0)
|
return npos, d1, d2, math.max(num - 1, 0)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -32,14 +32,11 @@ local Tube = tubelib2.Tube:new({
|
|||||||
"tubelib2:source", "tubelib2:teleporter"},
|
"tubelib2:source", "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({
|
||||||
if not tbl.convert then
|
name="default_place_node_glass"},{
|
||||||
minetest.sound_play({
|
gain=1,
|
||||||
name="default_place_node_glass"},{
|
max_hear_distance=5,
|
||||||
gain=1,
|
loop=false})
|
||||||
max_hear_distance=5,
|
|
||||||
loop=false})
|
|
||||||
end
|
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user