Skip to content

Commit 751895e

Browse files
committed
Added check if we are connected when clicking on hyperlinks
1 parent bd6972a commit 751895e

File tree

1 file changed

+22
-3
lines changed

1 file changed

+22
-3
lines changed

lua/mapper.lua

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ room info should include:
4646

4747
module (..., package.seeall)
4848

49-
VERSION = 1.1 -- for querying by plugins
49+
VERSION = 1.2 -- for querying by plugins
5050

5151
require "movewindow"
5252
require "copytable"
@@ -201,9 +201,20 @@ local function get_room (uid)
201201
return room
202202
end -- get_room
203203

204+
local function check_connected ()
205+
if not IsConnected() then
206+
mapprint ("You are not connected to", WorldName())
207+
return false
208+
end -- if not connected
209+
return true
210+
end -- check_connected
204211

205212
function start_speedwalk (path)
206213

214+
if not check_connected () then
215+
return
216+
end -- if
217+
207218
if current_speedwalk and #current_speedwalk > 0 then
208219
mapprint ("You are already speedwalking! (Ctrl + LH-click on any room to cancel)")
209220
return
@@ -801,6 +812,11 @@ local function changed_room (uid)
801812
end -- changed_room
802813

803814
function check_we_can_find ()
815+
816+
if not check_connected () then
817+
return
818+
end -- if
819+
804820
if not current_room then
805821
mapprint ("I don't know where you are right now - try: LOOK")
806822
return false
@@ -1294,7 +1310,11 @@ function find (f, show_uid, expected_count, walk)
12941310
end -- map_find_things
12951311

12961312
function do_hyperlink (hash)
1297-
1313+
1314+
if not check_connected () then
1315+
return
1316+
end -- if
1317+
12981318
if not hyperlink_paths or not hyperlink_paths [hash] then
12991319
mapprint ("Hyperlink is no longer valid, as you have moved.")
13001320
return
@@ -1305,6 +1325,5 @@ function do_hyperlink (hash)
13051325
last_hyperlink_uid = path [#path].uid
13061326
end -- if
13071327
start_speedwalk (path)
1308-
13091328

13101329
end -- do_hyperlink

0 commit comments

Comments
 (0)