mirror of
https://github.com/joe7575/tubelib2.git
synced 2024-10-11 04:13:04 +02:00
WiFi pairing improved
This commit is contained in:
parent
0f2d062238
commit
cc2201beb3
@ -98,9 +98,13 @@ end
|
|||||||
-- pos/dir are the pos of the secondary nodes pointing to the head tube nodes.
|
-- pos/dir are the pos of the secondary nodes pointing to the head tube nodes.
|
||||||
function Tube:update_secondary_node(pos1, dir1, pos2, dir2)
|
function Tube:update_secondary_node(pos1, dir1, pos2, dir2)
|
||||||
local _, node = self:get_node(pos1)
|
local _, node = self:get_node(pos1)
|
||||||
if self.secondary_node_names[node.name] and self.clbk_update_secondary_node then
|
if self.secondary_node_names[node.name] then
|
||||||
|
if minetest.registered_nodes[node.name].tubelib2_on_update then
|
||||||
|
minetest.registered_nodes[node.name].tubelib2_on_update(node, pos1, dir1, pos2, Turn180Deg[dir2])
|
||||||
|
elseif self.clbk_update_secondary_node then
|
||||||
self.clbk_update_secondary_node(node, pos1, dir1, pos2, Turn180Deg[dir2])
|
self.clbk_update_secondary_node(node, pos1, dir1, pos2, Turn180Deg[dir2])
|
||||||
end
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function Tube:infotext(pos1, pos2)
|
function Tube:infotext(pos1, pos2)
|
||||||
@ -123,7 +127,7 @@ function Tube:store_teleport_data(pos, peer_pos)
|
|||||||
meta:set_string("tele_pos", S(peer_pos))
|
meta:set_string("tele_pos", S(peer_pos))
|
||||||
meta:set_string("channel", nil)
|
meta:set_string("channel", nil)
|
||||||
meta:set_string("formspec", nil)
|
meta:set_string("formspec", nil)
|
||||||
meta:set_string("infotext", I("Connected with ")..S(peer_pos))
|
meta:set_string("infotext", I("Paired with ")..S(peer_pos))
|
||||||
return meta:get_int("tube_dir")
|
return meta:get_int("tube_dir")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
BIN
locale/de.mo
BIN
locale/de.mo
Binary file not shown.
23
locale/de.po
23
locale/de.po
@ -7,14 +7,14 @@ msgid ""
|
|||||||
msgstr ""
|
msgstr ""
|
||||||
"Project-Id-Version: \n"
|
"Project-Id-Version: \n"
|
||||||
"Report-Msgid-Bugs-To: \n"
|
"Report-Msgid-Bugs-To: \n"
|
||||||
"POT-Creation-Date: 2018-12-20 16:17+0100\n"
|
"POT-Creation-Date: 2018-12-22 11:16+0100\n"
|
||||||
"PO-Revision-Date: 2018-12-20 16:19+0100\n"
|
"PO-Revision-Date: 2018-12-22 11:19+0100\n"
|
||||||
|
"Last-Translator: \n"
|
||||||
|
"Language-Team: \n"
|
||||||
"Language: de\n"
|
"Language: de\n"
|
||||||
"MIME-Version: 1.0\n"
|
"MIME-Version: 1.0\n"
|
||||||
"Content-Type: text/plain; charset=UTF-8\n"
|
"Content-Type: text/plain; charset=UTF-8\n"
|
||||||
"Content-Transfer-Encoding: 8bit\n"
|
"Content-Transfer-Encoding: 8bit\n"
|
||||||
"Last-Translator: \n"
|
|
||||||
"Language-Team: \n"
|
|
||||||
"X-Generator: Poedit 2.0.6\n"
|
"X-Generator: Poedit 2.0.6\n"
|
||||||
|
|
||||||
#: tube_api.lua
|
#: tube_api.lua
|
||||||
@ -22,8 +22,12 @@ msgid "Maximum length reached!"
|
|||||||
msgstr "Maximale Länge erreicht!"
|
msgstr "Maximale Länge erreicht!"
|
||||||
|
|
||||||
#: tube_api.lua
|
#: tube_api.lua
|
||||||
msgid "Unconnected"
|
msgid "Pairing is missing"
|
||||||
msgstr "Nicht verbunden"
|
msgstr "Das Pairing fehlt noch"
|
||||||
|
|
||||||
|
#: tube_api.lua
|
||||||
|
msgid "Connection to a tube is missing!"
|
||||||
|
msgstr "Eine Verbindung zu einer Röhre fehlt!"
|
||||||
|
|
||||||
#: internal1.lua
|
#: internal1.lua
|
||||||
msgid "Not connected!"
|
msgid "Not connected!"
|
||||||
@ -32,3 +36,10 @@ msgstr "Nicht verbunden!"
|
|||||||
#: internal1.lua internal2.lua
|
#: internal1.lua internal2.lua
|
||||||
msgid "Connected with "
|
msgid "Connected with "
|
||||||
msgstr "Verbunden mit "
|
msgstr "Verbunden mit "
|
||||||
|
|
||||||
|
#: internal1.lua
|
||||||
|
msgid "Paired with "
|
||||||
|
msgstr "Gepaart mit "
|
||||||
|
|
||||||
|
#~ msgid "Unconnected"
|
||||||
|
#~ msgstr "Nicht verbunden"
|
||||||
|
@ -8,7 +8,7 @@ msgid ""
|
|||||||
msgstr ""
|
msgstr ""
|
||||||
"Project-Id-Version: PACKAGE VERSION\n"
|
"Project-Id-Version: PACKAGE VERSION\n"
|
||||||
"Report-Msgid-Bugs-To: \n"
|
"Report-Msgid-Bugs-To: \n"
|
||||||
"POT-Creation-Date: 2018-12-20 16:17+0100\n"
|
"POT-Creation-Date: 2018-12-22 11:16+0100\n"
|
||||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||||
@ -22,7 +22,11 @@ msgid "Maximum length reached!"
|
|||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: tube_api.lua
|
#: tube_api.lua
|
||||||
msgid "Unconnected"
|
msgid "Pairing is missing"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: tube_api.lua
|
||||||
|
msgid "Connection to a tube is missing!"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: internal1.lua
|
#: internal1.lua
|
||||||
@ -32,3 +36,7 @@ msgstr ""
|
|||||||
#: internal1.lua internal2.lua
|
#: internal1.lua internal2.lua
|
||||||
msgid "Connected with "
|
msgid "Connected with "
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
#: internal1.lua
|
||||||
|
msgid "Paired with "
|
||||||
|
msgstr ""
|
||||||
|
12
tube_api.lua
12
tube_api.lua
@ -244,16 +244,18 @@ function Tube:prepare_pairing(pos, tube_dir, sFormspec)
|
|||||||
if meta:get_int("tube_dir") ~= 0 then -- already prepared?
|
if meta:get_int("tube_dir") ~= 0 then -- already prepared?
|
||||||
-- update tube_dir only
|
-- update tube_dir only
|
||||||
meta:set_int("tube_dir", tube_dir)
|
meta:set_int("tube_dir", tube_dir)
|
||||||
else
|
elseif tube_dir then
|
||||||
meta:set_int("tube_dir", tube_dir)
|
meta:set_int("tube_dir", tube_dir)
|
||||||
meta:set_string("channel", nil)
|
meta:set_string("channel", nil)
|
||||||
meta:set_string("infotext", I("Unconnected"))
|
meta:set_string("infotext", I("Pairing is missing"))
|
||||||
meta:set_string("formspec", sFormspec)
|
meta:set_string("formspec", sFormspec)
|
||||||
|
else
|
||||||
|
meta:set_string("infotext", I("Connection to a tube is missing!"))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function Tube:pairing(pos, channel)
|
function Tube:pairing(pos, channel)
|
||||||
if self.pairingList[channel] and pos ~= self.pairingList[channel] then
|
if self.pairingList[channel] and not vector.equals(pos, self.pairingList[channel]) then
|
||||||
-- store peer position on both nodes
|
-- store peer position on both nodes
|
||||||
local peer_pos = self.pairingList[channel]
|
local peer_pos = self.pairingList[channel]
|
||||||
local tube_dir1 = self:store_teleport_data(pos, peer_pos)
|
local tube_dir1 = self:store_teleport_data(pos, peer_pos)
|
||||||
@ -265,7 +267,7 @@ function Tube:pairing(pos, channel)
|
|||||||
self.pairingList[channel] = pos
|
self.pairingList[channel] = pos
|
||||||
local meta = M(pos)
|
local meta = M(pos)
|
||||||
meta:set_string("channel", channel)
|
meta:set_string("channel", channel)
|
||||||
meta:set_string("infotext", I("Unconnected").." ("..channel..")")
|
meta:set_string("infotext", I("Pairing is missing").." ("..channel..")")
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -281,7 +283,7 @@ function Tube:stop_pairing(pos, oldmetadata, sFormspec)
|
|||||||
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", I("Unconnected"))
|
peer_meta:set_string("infotext", I("Pairing is missing"))
|
||||||
end
|
end
|
||||||
elseif oldmetadata.fields.channel then
|
elseif oldmetadata.fields.channel then
|
||||||
self.pairingList[oldmetadata.fields.channel] = nil
|
self.pairingList[oldmetadata.fields.channel] = nil
|
||||||
|
Loading…
Reference in New Issue
Block a user