Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Fedja Beader
CSM
Commits
f9713069
Commit
f9713069
authored
Aug 05, 2021
by
Fedja Beader
Browse files
only translate coordinates if jump was successful.
parent
129328c3
Changes
1
Show whitespace changes
Inline
Side-by-side
library/jumpdrives.lua
View file @
f9713069
...
...
@@ -45,6 +45,26 @@ function translate_position_list(jump, list)
end
end
local
last_jump
=
nil
--"Jump executed in 1227 ms"
local
match_pattern
=
"Jump executed in.*ms"
core
.
register_on_receiving_chat_message
(
function
(
message
)
local
captures
=
string.match
(
message
,
match_pattern
)
if
captures
and
last_jump
then
l
:
info
(
"Message captured: \"" .. message .. "
\
", executing jump watchlist handlers."
)
for
i
=
1
,
#
jd_watchlist
do
jd_watchlist
[
i
](
last_jump
)
end
last_jump
=
nil
return
true
end
return
false
end
)
core
.
register_on_sending_fields
(
function
(
pos
,
formname
,
fields
)
if
formname
==
""
and
fields
.
jump
then
local
x
=
tonumber
(
fields
.
x
)
...
...
@@ -66,9 +86,8 @@ core.register_on_sending_fields(function(pos, formname, fields)
jump
.
radius
=
radius
jump
.
offset
=
offset
for
i
=
1
,
#
jd_watchlist
do
jd_watchlist
[
i
](
jump
)
end
l
:
debug
(
"Waiting for \"
Jump
executed
in
.
*
ms
\
" message indicating jump success..."
)
last_jump
=
jump
-- let's see if it was successful or not
end
end
end
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment