mirror of
https://github.com/joe7575/tubelib2.git
synced 2024-08-19 21:14:22 +02:00
pairing bugfix
This commit is contained in:
parent
13612bcd14
commit
fe72e64762
@ -157,7 +157,9 @@ function Tube:tool_remove_tube(pos, sound)
|
|||||||
local oldnode, oldmeta = self:remove_tube(pos, sound)
|
local oldnode, oldmeta = self:remove_tube(pos, sound)
|
||||||
if oldnode then
|
if oldnode then
|
||||||
self:after_dig_tube(pos, oldnode, oldmeta)
|
self:after_dig_tube(pos, oldnode, oldmeta)
|
||||||
|
return true
|
||||||
end
|
end
|
||||||
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
@ -201,16 +203,19 @@ end
|
|||||||
|
|
||||||
function Tube:stop_pairing(pos, oldmetadata, sFormspec)
|
function Tube:stop_pairing(pos, oldmetadata, sFormspec)
|
||||||
-- unpair peer node
|
-- unpair peer node
|
||||||
if oldmetadata and oldmetadata.fields and oldmetadata.fields.tele_pos then
|
if oldmetadata and oldmetadata.fields then
|
||||||
|
if oldmetadata.fields.tele_pos then
|
||||||
local tele_pos = minetest.string_to_pos(oldmetadata.fields.tele_pos)
|
local tele_pos = minetest.string_to_pos(oldmetadata.fields.tele_pos)
|
||||||
local peer_meta = M(tele_pos)
|
local peer_meta = M(tele_pos)
|
||||||
if peer_meta then
|
if peer_meta then
|
||||||
self:after_place_node(tele_pos, {peer_meta:get_int("tube_dir")})
|
self:after_place_node(tele_pos, {peer_meta:get_int("tube_dir")})
|
||||||
|
|
||||||
peer_meta:set_string("channel", nil)
|
peer_meta:set_string("channel", nil)
|
||||||
peer_meta:set_string("tele_pos", nil)
|
peer_meta:set_string("tele_pos", nil)
|
||||||
peer_meta:set_string("formspec", sFormspec)
|
peer_meta:set_string("formspec", sFormspec)
|
||||||
peer_meta:set_string("infotext", "Unconnected")
|
peer_meta:set_string("infotext", "Unconnected")
|
||||||
end
|
end
|
||||||
|
elseif oldmetadata.fields.channel then
|
||||||
|
self.pairingList[oldmetadata.fields.channel] = nil
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user