wp_use, tw_use - use the top of the stack but don't remove it
parent
717f418ea2
commit
0d0fb9a49a
30
init.lua
30
init.lua
|
@ -4,11 +4,13 @@
|
|||
|
||||
local mod_name = minetest.get_current_modname()
|
||||
|
||||
local mod_version = "2.5"
|
||||
|
||||
local function log(level, message)
|
||||
minetest.log(level, ('[%s] %s'):format(mod_name, message))
|
||||
end
|
||||
|
||||
log('action', 'CSM cs_waypoints loading...')
|
||||
log('action', 'CSM cs_waypoints '..mod_version..' loading...')
|
||||
|
||||
minetest.display_chat_message("CSM cs_waypoints loading...")
|
||||
|
||||
|
@ -142,6 +144,18 @@ local function stack_pop()
|
|||
return true
|
||||
end
|
||||
|
||||
local function stack_use()
|
||||
wp_stack = load_waypoints_stack()
|
||||
count = 0
|
||||
if nil ~= wp_stack then count = #wp_stack end
|
||||
if count<1 then
|
||||
minetest.display_chat_message('stack empty - no teleporting')
|
||||
return
|
||||
end
|
||||
minetest.run_server_chatcommand('teleport', tostring_point(wp_stack[count]))
|
||||
return true
|
||||
end
|
||||
|
||||
local function stack_show()
|
||||
wp_stack = load_waypoints_stack()
|
||||
count = 0
|
||||
|
@ -379,6 +393,20 @@ minetest.register_chatcommand('wp_pop', {
|
|||
}
|
||||
)
|
||||
|
||||
minetest.register_chatcommand('tw_use', {
|
||||
params = '',
|
||||
description = "use the last saved position but don't remove it",
|
||||
func = stack_use,
|
||||
}
|
||||
)
|
||||
|
||||
minetest.register_chatcommand('wp_use', {
|
||||
params = '',
|
||||
description = "use the last saved position but don't remove it",
|
||||
func = stack_use,
|
||||
}
|
||||
)
|
||||
|
||||
minetest.register_chatcommand('wp_stack', {
|
||||
params = '',
|
||||
description = 'shows the stack content',
|
||||
|
|
Loading…
Reference in New Issue