diff options
author | Och Noe <och_noe@forksworld.de> | 2020-08-26 17:33:10 +0200 |
---|---|---|
committer | Och Noe <och_noe@forksworld.de> | 2020-08-26 17:33:10 +0200 |
commit | 0d0fb9a49a99051588f1221ba57ec0a70271933d (patch) | |
tree | 72f3e3c55304eb21983b62a1fc74057efbe7f1b0 | |
parent | 717f418ea2ec08b1569e6b0fc76b070040d776b6 (diff) | |
download | cs_waypoints-0d0fb9a49a99051588f1221ba57ec0a70271933d.tar.gz cs_waypoints-0d0fb9a49a99051588f1221ba57ec0a70271933d.tar.bz2 cs_waypoints-0d0fb9a49a99051588f1221ba57ec0a70271933d.zip |
wp_use, tw_use - use the top of the stack but don't remove it
-rw-r--r-- | init.lua | 30 |
1 files changed, 29 insertions, 1 deletions
@@ -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', |