aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOch Noe <och_noe@forksworld.de>2021-05-18 19:51:46 +0200
committerOch Noe <och_noe@forksworld.de>2021-05-18 19:51:46 +0200
commit42d33d92a7365c58f944bd42100ab775dc1e872a (patch)
treefd6dccef8183a003f0638f0a6f95ff66adbaca29
parent882702878ecc520639e237a8ebbe3c2bb88c619d (diff)
downloadcs_waypoints-42d33d92a7365c58f944bd42100ab775dc1e872a.tar.gz
cs_waypoints-42d33d92a7365c58f944bd42100ab775dc1e872a.tar.bz2
cs_waypoints-42d33d92a7365c58f944bd42100ab775dc1e872a.zip
wp_fgrep added
-rw-r--r--init.lua31
1 files changed, 28 insertions, 3 deletions
diff --git a/init.lua b/init.lua
index 787ce45..51f1021 100644
--- a/init.lua
+++ b/init.lua
@@ -235,7 +235,7 @@ local function position_shift(p)
if distance == 0 then return end
here[d] = here[d] + distance
- here.y = here.y - 1 -- correction
+ -- here.y = here.y - 1 -- correction
minetest.run_server_chatcommand('teleport', tostring_point(here))
@@ -281,7 +281,7 @@ local function position_shift2(p)
here.y = here.y+shift.y
here.z = here.z+shift.z
- here.y = here.y - 1 -- correction
+ -- here.y = here.y - 1 -- correction
minetest.run_server_chatcommand('teleport', tostring_point(here))
@@ -503,7 +503,7 @@ minetest.register_chatcommand('tp', {
-- wp_grep written by erstazi (player at Linux-Forks.de )
minetest.register_chatcommand('wp_grep', {
params = '<name>',
- description = 'lists waypoints',
+ description = 'lists matching waypoints',
func = safe(function(param)
local wpname = param
local count = 0
@@ -522,3 +522,28 @@ minetest.register_chatcommand('wp_grep', {
end),
})
+
+minetest.register_chatcommand('wp_fgrep', {
+ params = '<name>',
+ description = 'lists matching waypoints',
+ func = safe(function(param)
+ local wpname = param
+ local count = 0
+ for name, point in pairsByKeys(waypoints, lc_cmp) do
+ if string.find(name, wpname,1,true) then
+ count = count + 1
+ minetest.display_chat_message(
+ ('%s -> %s'):format(name, tostring_point(point))
+ )
+ end
+ end
+
+ if count == 0 then
+ minetest.display_chat_message(('waypoint "%s" not found.'):format(wpname))
+ end
+ end),
+})
+
+
+
+