wp_fgrep added

master
Och Noe 2021-05-18 19:51:46 +02:00
parent 882702878e
commit 42d33d92a7
1 changed files with 28 additions and 3 deletions

View File

@ -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),
})